Skip to contentSkip to conversation

Patch "sigaltstack: support SS_AUTODISARM for CONFIG_COMPAT" has been added to the 4.10-stable tree

PATCH [email protected] 1 participant 1 message Mar 8, 2017 Stable branch

lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

sigaltstack: support SS_AUTODISARM for CONFIG_COMPAT

to the 4.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
sigaltstack-support-ss_autodisarm-for-config_compat.patch
and it can be found in the queue-4.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 441398d378f29a5ad6d0fcda07918e54e4961800 Mon Sep 17 00:00:00 2001

From: Stas Sergeev <[email protected]>
Date: Mon, 27 Feb 2017 14:27:25 -0800
Subject: sigaltstack: support SS_AUTODISARM for CONFIG_COMPAT

From: Stas Sergeev <[email protected]>

commit 441398d378f29a5ad6d0fcda07918e54e4961800 upstream.

Currently SS_AUTODISARM is not supported in compatibility mode, but does not return -EINVAL either. This makes dosemu built with -m32 on x86_64 to crash. Also the kernel's sigaltstack selftest fails if compiled with -m32.

This patch adds the needed support.

Cc Milosz Tanski <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Al Viro <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Oleg Nesterov <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Waiman Long <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Dmitry Safonov <[email protected]>
Cc Wang Xiaoqiang <[email protected]>
Cc Oleg Nesterov <[email protected]>
---
 include/linux/compat.h |    4 +++-
 kernel/signal.c        |   11 +++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)
include/linux/compat.h +3 -1
@@ -711,8 +711,10 @@ int __compat_save_altstack(compat_stack_
 	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); \
 	put_user_ex(t->sas_ss_size, &__uss->ss_size); \
+	if (t->sas_ss_flags & SS_AUTODISARM) \
+		sas_ss_reset(t); \
 } while (0);
 
 asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
kernel/signal.c +9 -2
@@ -3239,10 +3239,17 @@ int compat_restore_altstack(const compat
 
 int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
 {
+	int err;
 	struct task_struct *t = current;
-	return  __put_user(ptr_to_compat((void __user *)t->sas_ss_sp), &uss->ss_sp) |
-		__put_user(sas_ss_flags(sp), &uss->ss_flags) |
+	err = __put_user(ptr_to_compat((void __user *)t->sas_ss_sp),
+			 &uss->ss_sp) |
+		__put_user(t->sas_ss_flags, &uss->ss_flags) |
 		__put_user(t->sas_ss_size, &uss->ss_size);
+	if (err)
+		return err;
+	if (t->sas_ss_flags & SS_AUTODISARM)
+		sas_ss_reset(t);
+	return 0;
 }
 #endif
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.10/sigaltstack-support-ss_autodisarm-for-config_compat.patch