Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86: Introduce restart_block->arch_data to remove TS_COMPAT_RESTART

Save the current_thread_info()->status of X86 in the new
restart_block->arch_data field so TS_COMPAT_RESTART can be removed again.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210201174716.GA17898@redhat.com

authored by

Oleg Nesterov and committed by
Thomas Gleixner
b2e9df85 8c150ba2

+4 -11
+2 -10
arch/x86/include/asm/thread_info.h
··· 217 217 #ifndef __ASSEMBLY__ 218 218 #ifdef CONFIG_COMPAT 219 219 #define TS_I386_REGS_POKED 0x0004 /* regs poked by 32-bit ptracer */ 220 - #define TS_COMPAT_RESTART 0x0008 221 220 222 - #define arch_set_restart_data arch_set_restart_data 221 + #define arch_set_restart_data(restart) \ 222 + do { restart->arch_data = current_thread_info()->status; } while (0) 223 223 224 - static inline void arch_set_restart_data(struct restart_block *restart) 225 - { 226 - struct thread_info *ti = current_thread_info(); 227 - if (ti->status & TS_COMPAT) 228 - ti->status |= TS_COMPAT_RESTART; 229 - else 230 - ti->status &= ~TS_COMPAT_RESTART; 231 - } 232 224 #endif 233 225 234 226 #ifdef CONFIG_X86_32
+1 -1
arch/x86/kernel/signal.c
··· 767 767 static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs) 768 768 { 769 769 #ifdef CONFIG_IA32_EMULATION 770 - if (current_thread_info()->status & TS_COMPAT_RESTART) 770 + if (current->restart_block.arch_data & TS_COMPAT) 771 771 return __NR_ia32_restart_syscall; 772 772 #endif 773 773 #ifdef CONFIG_X86_X32_ABI
+1
include/linux/restart_block.h
··· 23 23 * System call restart block. 24 24 */ 25 25 struct restart_block { 26 + unsigned long arch_data; 26 27 long (*fn)(struct restart_block *); 27 28 union { 28 29 /* For futex_wait and futex_wait_requeue_pi */