sigaltstack: support SS_AUTODISARM for CONFIG_COMPAT
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Stas Sergeev
Currently
SS_AUTODISARMis not supported in compatibility mode, but does not return-EINVALeither. This makes dosemu built with -m32 onx86_64to crash. Also the kernel's sigaltstack selftest fails if compiled with -m32.This patch adds the needed support. It also improves the selftest output a little (%i changed to %x for bitmasks).
Signed-off-by Stas Sergeev <[email protected]>
Spurious newline. Also, should this be cc:stable?
Quoted 25 lines
CC Shuah Khan <[email protected]>CC Andrew Morton <[email protected]>CC Jiri Kosina <[email protected]>CC Al Viro <[email protected]>CC Stephen Bates <[email protected]>CC Milosz Tanski <[email protected]>CC Andy Lutomirski <[email protected]>CC Ingo Molnar <[email protected]>CC "Peter Zijlstra (Intel)" <[email protected]>CC Helge Deller <[email protected]>CC Wang Xiaoqiang <[email protected]>CC Dave Hansen <[email protected]>CC Sasha Levin <[email protected]>--- include/linux/compat.h | 4 +++- kernel/signal.c | 11 +++++++++-- tools/testing/selftests/sigaltstack/sas.c | 7 ++++--- 3 files changed, 16 insertions(+), 6 deletions(-)include/linux/compat.h +0
-0
include/linux/compat.h int __compat_save_altstack(compat_stack_t __user *, unsigned long); · line 714
Quoted 5 lines
include/linux/compat.h +1
-1@@ -711,8 +711,10 @@ int __compat_save_altstack(compat_stack_t __user *, unsigned long); compat_stack_t __user *__uss = uss; \struct task_struct *t = current; \ put_user_ex(ptr_to_compat((void __user *)t->sas_ss_sp), &__uss->ss_sp); \ -put_user_ex (sas_ss_flags (sp), &__uss->ss_flags); \ +put_user_ex (t->sas_ss_flags, &__uss->ss_flags); \
Should the sas_ss_flags() helper be deleted, perhaps? This code seems a bit odd -- it no longer does the on_sig_stack(sp) check.. (It matches the non-compat code.)
04.02.2017 20:32, Andy Lutomirski пишет:
Quoted 6 lines · Stas Sergeev
Quoted 5 lines
Currently
SS_AUTODISARMis not supported in compatibility mode, but does not return-EINVALeither. This makes dosemu built with -m32 onx86_64to crash. Also the kernel's sigaltstack selftest fails if compiled with -m32.
Quoted 6 lines
Quoted 5 lines
This patch adds the needed support. It also improves the selftest output a little (%i changed to %x for bitmasks).
Signed-off-by Stas Sergeev <[email protected]>Spurious newline.
Is this a problem? :)
Quoted 1 line
Also, should this be cc:stable?
It doesn't match the stable submission criteries AFAICS. Can we declare it "obviously correct" and the problem it fixes "critical"? If so, I'll need to strip the %i -> %x change from it as it doesn't pass the stable submission guidelines.
Quoted 5 lines
Quoted 5 lines
include/linux/compat.h +0
-0@@ -711,8 +711,10 @@ int __compat_save_altstack(compat_stack_t __user *, unsigned long);
Quoted 8 lines
include/linux/compat.h int __compat_save_altstack(compat_stack_t __user *, unsigned long); · line 714
Quoted 5 lines
include/linux/compat.h +1
-1compat_stack_t __user *__uss = uss; \struct task_struct *t = current; \ put_user_ex(ptr_to_compat((void __user *)t->sas_ss_sp), &__uss->ss_sp); \ -put_user_ex (sas_ss_flags (sp), &__uss->ss_flags); \ +put_user_ex (t->sas_ss_flags, &__uss->ss_flags); \Should the
sas_ss_flags()helper be deleted, perhaps? This code seems a bit odd -- it no longer does theon_sig_stack(sp)check.. (It matches the non-compat code.)
sas_ss_flags() is still used in sigaltstack() code and in signal delivery code, so why do you think it should be removed? It is needed to return the correct status via sigaltstack() and for deciding whether to switch stacks. But saving and restoring to/from uc_stack must be done with raw flags. I don't think we need to check on_sig_stack() when saving to uc_stack, or do we?