From: Vitaly Mayatskikh <vmayatsk@redhat.com> Date: Tue, 10 Feb 2009 13:59:32 +0100 Subject: [x86-64] fix int $0x80 -ENOSYS return Message-id: m3ocxav45n.wl%vmayatsk@redhat.com O-Subject: [RHEL-5.4 patch] bz481682 x86-64: fix int $0x80 -ENOSYS return Bugzilla: 481682 RH-Acked-by: Prarit Bhargava <prarit@redhat.com> RH-Acked-by: Roland McGrath <roland@redhat.com> Description: ============ Utrace update for RHEL-5.2 contains patch backported from upstream commit 48ee679a02406c65ced67c3951ad19744eb21083. This commit has a regression: if int 0x80 receives invalid syscall number (> NR_syscalls) and it's not traced and auditd was disabled across reboot, int 0x80 returns syscall number instead of -ENOSYS. Upstream status: ================ commit c09249f8d1b84344eca882547afdbffee8c09d14 Test status: ============ Tested ok with reproducer. diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S index 7a4b2bc..8321e2a 100644 --- a/arch/x86_64/ia32/ia32entry.S +++ b/arch/x86_64/ia32/ia32entry.S @@ -328,9 +328,9 @@ ENTRY(ia32_syscall) orl $TS_COMPAT,threadinfo_status(%r10) testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) jnz ia32_tracesys -ia32_do_syscall: cmpl $(IA32_NR_syscalls-1),%eax - ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */ + ja ia32_badsys +ia32_do_call: IA32_ARG_FIXUP call *ia32_sys_call_table(,%rax,8) # xxx: rip relative ia32_sysret: @@ -344,7 +344,9 @@ ia32_tracesys: call syscall_trace_enter LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ RESTORE_REST - jmp ia32_do_syscall + cmpl $(IA32_NR_syscalls-1),%eax + ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */ + jmp ia32_do_call END(ia32_syscall) ia32_badsys: