[PATCH 0/1] get_nr_restart_syscall() should return __NR_ia32_restart_syscall if __USER32_CS

Oleg Nesterov
2017-03-28T15:05:37Z

Hello,

get_nr_restart_syscall() is still buggy, TS_I386_REGS_POKED can't
really help and should probably die.

The fix just adds the __USER32_CS check, but perhaps we can avoid
these "fundamentally broken" checks altogether?

Is __NR_ia32_restart_syscall/__NR_restart_syscall the part of ABI?
OK, we probaly can't remove them, at least right now. But what if
we simply add the new syscall number,

#define __NR_new_restart_syscall 383
#define __NR_ia32_new_restart_syscall 383

so that it doesn't depends on bitness and we can just do

static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
{
BUILD_BUG_ON(__NR_ia32_new_restart_syscall != __NR_new_restart_syscall);
#ifdef CONFIG_X86_X32_ABI
return __NR_new_restart_syscall | (regs->orig_ax & __X32_SYSCALL_BIT);
#else
return __NR_new_restart_syscall;
#endif
}

?

Oleg.