From: Ting-Han Hou <ue081723@gmail.com>
To: Danish Khateeb <danishkhateeb03@gmail.com>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, Andy Lutomirski <luto@kernel.org>,
"H . Peter Anvin" <hpa@zytor.com>,
Jinjie Ruan <ruanjinjie@huawei.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/entry: Fail invalid syscall numbers other than -1 with -ENOSYS again
Date: Sun, 11 Oct 2026 21:15:16 +0800 [thread overview]
Message-ID: <20261011131516.104193-1-ue081723@gmail.com> (raw)
In-Reply-To: <20260929173345.257226-1-danishkhateeb03@gmail.com>
On Tue, Sep 29, 2026 at 12:33:45PM -0500, Danish Khateeb wrote:
> x86/entry: Fail invalid syscall numbers other than -1 with -ENOSYS again
I tested this on top of current mainline a5ebb76233b7
(v7.3-rc6-386-ga5ebb76233b7): x86_64 defconfig + kvm_guest.config,
booted in QEMU/KVM (-cpu host), with the x86 selftests built from the
same tree.
selftests/x86/syscall_numbering_64:
without the patch:
[FAIL] A total of 37800 system calls had incorrect behavior
(12600 each in the "modifying the default return", "clobbering the
top 32 bits" and "sign-extending the syscall number" ptrace passes,
e.g. "x32 syscall 0:-64 returned -9999, but it should have returned
-ENOSYS")
with the patch:
[OK] All system calls succeeded or failed as expected
It also passes with CONFIG_X86_X32_ABI=y ("x32 is supported").
The selftest does not cover the syscall_32.c hunk, so I also used a
small tracer that sets the return register to -9999 at the
syscall-entry stop of int $0x80, from both a 32-bit and a 64-bit
process. Without the patch, numbers 1000, 0x7fffffff, -2 and -1000 all
return -9999. With the patch they return -ENOSYS. -1 returns -9999 in
both cases, as expected.
ptrace_syscall_{32,64}, syscall_nt_{32,64}, syscall_arg_fault_{32,64},
single_step_syscall_{32,64}, check_initial_reg_state_{32,64},
sysret_rip_64, sigreturn_64 and test_syscall_vdso_32 pass with and
without the patch. No warnings in dmesg on the patched kernels. I did
not test a native 32-bit kernel.
The kernel test robot report for this is
https://lore.kernel.org/all/202609210251.4f7bf339-lkp@intel.com/ ,
which asked for:
Reported-by: kernel test robot <yi1.lai@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202609210251.4f7bf339-lkp@intel.com
I used an AI assistant (Claude Code) to help build and run these tests
and to read through the change; I checked the results myself.
Tested-by: Ting-Han Hou <ue081723@gmail.com>
Reviewed-by: Ting-Han Hou <ue081723@gmail.com>
prev parent reply other threads:[~2026-10-11 13:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 17:33 Danish Khateeb
2026-10-11 13:15 ` Ting-Han Hou [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261011131516.104193-1-ue081723@gmail.com \
--to=ue081723@gmail.com \
--cc=bp@alien8.de \
--cc=danishkhateeb03@gmail.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=ruanjinjie@huawei.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®