mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
signals/sigaltstack: Prepare to add new SS_xxx flags
This patch adds SS_FLAG_BITS - the mask that splits sigaltstack mode values and bit-flags. Since there is no bit-flags yet, the mask is defined to 0. The flags are added by subsequent patches. With every new flag, the mask should have the appropriate bit cleared. This makes sure if some flag is tried on a kernel that doesn't support it, the -EINVAL error will be returned, because such a flag will be treated as an invalid mode rather than the bit-flag. That way the existence of the particular features can be probed at run-time. This change was suggested by Andy Lutomirski: https://lkml.org/lkml/2016/3/6/158 Signed-off-by: Stas Sergeev <[email protected]> Cc: Al Viro <[email protected]> Cc: Amanieu d'Antras <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Pavel Emelyanov <[email protected]> Cc: Peter Zijlstra (Intel) <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Sasha Levin <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vladimir Davydov <[email protected]> Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
0b4521e8cf
commit
407bc16ad1
2 changed files with 9 additions and 10 deletions
|
|
@ -3104,7 +3104,8 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
|
|||
if (uss) {
|
||||
void __user *ss_sp;
|
||||
size_t ss_size;
|
||||
int ss_flags;
|
||||
unsigned ss_flags;
|
||||
int ss_mode;
|
||||
|
||||
error = -EFAULT;
|
||||
if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
|
||||
|
|
@ -3119,18 +3120,13 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
|
|||
if (on_sig_stack(sp))
|
||||
goto out;
|
||||
|
||||
ss_mode = ss_flags & ~SS_FLAG_BITS;
|
||||
error = -EINVAL;
|
||||
/*
|
||||
* Note - this code used to test ss_flags incorrectly:
|
||||
* old code may have been written using ss_flags==0
|
||||
* to mean ss_flags==SS_ONSTACK (as this was the only
|
||||
* way that worked) - this fix preserves that older
|
||||
* mechanism.
|
||||
*/
|
||||
if (ss_flags != SS_DISABLE && ss_flags != SS_ONSTACK && ss_flags != 0)
|
||||
if (ss_mode != SS_DISABLE && ss_mode != SS_ONSTACK &&
|
||||
ss_mode != 0)
|
||||
goto out;
|
||||
|
||||
if (ss_flags == SS_DISABLE) {
|
||||
if (ss_mode == SS_DISABLE) {
|
||||
ss_size = 0;
|
||||
ss_sp = NULL;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue