Skip to content

Commit

Permalink
x86: Introduce restart_block->arch_data to remove TS_COMPAT_RESTART
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Oleg Nesterov authored and Thomas Gleixner committed Mar 16, 2021
1 parent 8c150ba commit b2e9df8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
12 changes: 2 additions & 10 deletions arch/x86/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,10 @@ static inline int arch_within_stack_frames(const void * const stack,
#ifndef __ASSEMBLY__
#ifdef CONFIG_COMPAT
#define TS_I386_REGS_POKED 0x0004 /* regs poked by 32-bit ptracer */
#define TS_COMPAT_RESTART 0x0008

#define arch_set_restart_data arch_set_restart_data
#define arch_set_restart_data(restart) \
do { restart->arch_data = current_thread_info()->status; } while (0)

static inline void arch_set_restart_data(struct restart_block *restart)
{
struct thread_info *ti = current_thread_info();
if (ti->status & TS_COMPAT)
ti->status |= TS_COMPAT_RESTART;
else
ti->status &= ~TS_COMPAT_RESTART;
}
#endif

#ifdef CONFIG_X86_32
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
{
#ifdef CONFIG_IA32_EMULATION
if (current_thread_info()->status & TS_COMPAT_RESTART)
if (current->restart_block.arch_data & TS_COMPAT)
return __NR_ia32_restart_syscall;
#endif
#ifdef CONFIG_X86_X32_ABI
Expand Down
1 change: 1 addition & 0 deletions include/linux/restart_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum timespec_type {
* System call restart block.
*/
struct restart_block {
unsigned long arch_data;
long (*fn)(struct restart_block *);
union {
/* For futex_wait and futex_wait_requeue_pi */
Expand Down

0 comments on commit b2e9df8

Please sign in to comment.