[PATCH 4/4] x86: turn TS_COMPAT_RESTART into restart_block->arch_d=

From: Oleg Nesterov
Date: Fri Nov 29 2019 - 12:05:04 EST


---
arch/x86/include/asm/thread_info.h | 12 ++----------
arch/x86/kernel/signal.c | 2 +-
include/linux/restart_block.h | 1 +
3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thre=
ad_info.h
index a4de7aa..75c4a0a 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -233,18 +233,10 @@ static inline int arch_within_stack_frames(const void=
* const stack,
#ifndef __ASSEMBLY__
#ifdef CONFIG_COMPAT
#define TS_I386_REGS_POKED=090x0004=09/* regs poked by 32-bit ptracer */
-#define TS_COMPAT_RESTART=090x0008
=20
-#define arch_set_restart_data=09arch_set_restart_data
+#define arch_set_restart_data(restart)=09\
+=09do { restart->arch_data =3D current_thread_info()->status; } while (0)
=20
-static inline void arch_set_restart_data(struct restart_block *restart)
-{
-=09struct thread_info *ti =3D current_thread_info();
-=09if (ti->status & TS_COMPAT)
-=09=09ti->status |=3D TS_COMPAT_RESTART;
-=09else
-=09=09ti->status &=3D ~TS_COMPAT_RESTART;
-}
#endif
=20
#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 2fdbf5e..2e52767 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -771,7 +771,7 @@ handle_signal(struct ksignal *ksig, struct pt_regs *reg=
s)
static inline unsigned long get_nr_restart_syscall(const struct pt_regs *r=
egs)
{
#ifdef CONFIG_IA32_EMULATION
-=09if (current_thread_info()->status & TS_COMPAT_RESTART)
+=09if (current->restart_block.arch_data & TS_COMPAT)
=09=09return __NR_ia32_restart_syscall;
#endif
#ifdef CONFIG_X86_X32_ABI
diff --git a/include/linux/restart_block.h b/include/linux/restart_block.h
index bba2920..980a655 100644
--- a/include/linux/restart_block.h
+++ b/include/linux/restart_block.h
@@ -23,6 +23,7 @@ enum timespec_type {
* System call restart block.
*/
struct restart_block {
+=09unsigned long arch_data;
=09long (*fn)(struct restart_block *);
=09union {
=09=09/* For futex_wait and futex_wait_requeue_pi */
--=20
2.5.0