diff options
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 1828f8d10844..ce17760d9c51 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -1548,24 +1548,37 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, | |||
1548 | if (arg4 | arg5) | 1548 | if (arg4 | arg5) |
1549 | return -EINVAL; | 1549 | return -EINVAL; |
1550 | switch (arg2) { | 1550 | switch (arg2) { |
1551 | case 0: | 1551 | case PR_MCE_KILL_CLEAR: |
1552 | if (arg3 != 0) | 1552 | if (arg3 != 0) |
1553 | return -EINVAL; | 1553 | return -EINVAL; |
1554 | current->flags &= ~PF_MCE_PROCESS; | 1554 | current->flags &= ~PF_MCE_PROCESS; |
1555 | break; | 1555 | break; |
1556 | case 1: | 1556 | case PR_MCE_KILL_SET: |
1557 | current->flags |= PF_MCE_PROCESS; | 1557 | current->flags |= PF_MCE_PROCESS; |
1558 | if (arg3 != 0) | 1558 | if (arg3 == PR_MCE_KILL_EARLY) |
1559 | current->flags |= PF_MCE_EARLY; | 1559 | current->flags |= PF_MCE_EARLY; |
1560 | else | 1560 | else if (arg3 == PR_MCE_KILL_LATE) |
1561 | current->flags &= ~PF_MCE_EARLY; | 1561 | current->flags &= ~PF_MCE_EARLY; |
1562 | else if (arg3 == PR_MCE_KILL_DEFAULT) | ||
1563 | current->flags &= | ||
1564 | ~(PF_MCE_EARLY|PF_MCE_PROCESS); | ||
1565 | else | ||
1566 | return -EINVAL; | ||
1562 | break; | 1567 | break; |
1563 | default: | 1568 | default: |
1564 | return -EINVAL; | 1569 | return -EINVAL; |
1565 | } | 1570 | } |
1566 | error = 0; | 1571 | error = 0; |
1567 | break; | 1572 | break; |
1568 | 1573 | case PR_MCE_KILL_GET: | |
1574 | if (arg2 | arg3 | arg4 | arg5) | ||
1575 | return -EINVAL; | ||
1576 | if (current->flags & PF_MCE_PROCESS) | ||
1577 | error = (current->flags & PF_MCE_EARLY) ? | ||
1578 | PR_MCE_KILL_EARLY : PR_MCE_KILL_LATE; | ||
1579 | else | ||
1580 | error = PR_MCE_KILL_DEFAULT; | ||
1581 | break; | ||
1569 | default: | 1582 | default: |
1570 | error = -EINVAL; | 1583 | error = -EINVAL; |
1571 | break; | 1584 | break; |