<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/linux/entry-common.h, branch v7.3-rc1</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.3-rc1</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.3-rc1'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-07-20T18:38:40+00:00</updated>
<entry>
<title>entry, treewide: Make syscall_enter_from_user_mode[_work]() indicate syscall execution</title>
<updated>2026-07-20T18:38:40+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@kernel.org</email>
</author>
<published>2026-07-12T21:25:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=05c033db7e9ad3c34f6968ec568cb6ee01051c57'/>
<id>urn:sha1:05c033db7e9ad3c34f6968ec568cb6ee01051c57</id>
<content type='text'>
The return values of syscall_enter_from_user_mode[_work]() are
non-intuitive. Both functions return the syscall number which should be
invoked by the architecture specific syscall entry code. The returned
number can be:

  - the unmodified syscall number which was handed in by the caller

  - a modified syscall number (ptrace, seccomp, trace/probe/bpf)

That has an additional twist. If the return value is -1L then the caller is
not allowed to modify the return value as that indicates that the modifying
entity requests to abort the syscall and set the return value already. That
can obviously not be differentiated from a syscall which handed in -1 as
syscall number.

The most trivial way to deal with that is:

    set_return_value(regs, -ENOSYS);
    nr = syscall_enter_from_user_mode(regs, nr);
    if (valid(nr))
    	handle_syscall(regs, nr);

That's what LOONGARCH, RISCV, and X86 do. But PowerPC and S390 do not
preset the return value, so when user space hands in -1 and there is
nothing setting the return value in the entry work code, then the syscall
is skipped but the return value is whatever random data has been in the
return value register.

Change the return values of syscall_enter_from_user_mode[_work]() to
boolean and return false, when either ptrace or seccomp request to skip the
syscall. If they return true, update the syscall number as it might have
been changed.

That results in slightly different behaviour of the architectures versus
tracing.

If the syscall tracepoint has probe/BPF attached, those might set the
syscall number to -1 and also set the return value. PowerPC and S390 will
then overwrite that value with -ENOSYS. The other architectures will just
ignore it like any other invalid syscall and use the modified one.

Originally-by: Michal Suchánek &lt;msuchanek@suse.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Tested-by: Michal Suchánek &lt;msuchanek@suse.de&gt;
Link: https://patch.msgid.link/20260712141346.772209074@kernel.org
</content>
</entry>
<entry>
<title>entry: Make return type of syscall_trace_enter() bool</title>
<updated>2026-07-20T18:38:40+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@kernel.org</email>
</author>
<published>2026-07-12T21:25:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=71ff30013f19ca46c2c72c25731c32b6cc7b5620'/>
<id>urn:sha1:71ff30013f19ca46c2c72c25731c32b6cc7b5620</id>
<content type='text'>
This prepares for changing the return types of
syscall_enter_from_user_mode[_work]() to bool, which in turn separates the
decision of invoking the syscall from the syscall number, which might have
been changed in the call by ptrace, seccomp, tracing.

Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Tested-by: Michal Suchánek &lt;msuchanek@suse.de&gt;
Reviewed-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Link: https://patch.msgid.link/20260712141346.699072205@kernel.org
</content>
</entry>
<entry>
<title>entry: Rework trace_syscall_enter()</title>
<updated>2026-07-20T18:38:40+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@kernel.org</email>
</author>
<published>2026-07-12T21:25:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dfc98c7a46424683326c8d8ffc70e81548c59fdb'/>
<id>urn:sha1:dfc98c7a46424683326c8d8ffc70e81548c59fdb</id>
<content type='text'>
Reread the syscall number from pt_regs and stop returning the eventually
modified syscall number.

That moves the reread to the end of syscall_trace_enter() and prepares for
moving it to the call site.

No functional change.

Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Tested-by: Michal Suchánek &lt;msuchanek@suse.de&gt;
Reviewed-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Link: https://patch.msgid.link/20260712141346.639115923@kernel.org
</content>
</entry>
<entry>
<title>entry: Rework syscall_audit_enter()</title>
<updated>2026-07-20T18:38:40+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@kernel.org</email>
</author>
<published>2026-07-12T21:25:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6f25517010ddd3f8080d7e06b9b1cb1b64b73772'/>
<id>urn:sha1:6f25517010ddd3f8080d7e06b9b1cb1b64b73772</id>
<content type='text'>
Move it out of line and let it reread the syscall number on it's own. That
makes the low level entry code denser and allows to move the reread to the
call site of syscall_trace_enter() once the tracer is fixed up.

To prevent the compiler from putting audit_context() out of line and
thereby breaking dead code elimination, mark audit_context()
__always_inline.

Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Tested-by: Michal Suchánek &lt;msuchanek@suse.de&gt;
Reviewed-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Link: https://patch.msgid.link/20260712141346.576865340@kernel.org
</content>
</entry>
<entry>
<title>entry: Fix seccomp bypass after ptrace with TSYNC</title>
<updated>2026-07-14T14:34:07+00:00</updated>
<author>
<name>Jinjie Ruan</name>
<email>ruanjinjie@huawei.com</email>
</author>
<published>2026-07-13T02:57:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4a3591287fb7f808e209b4974ed337f609a2006b'/>
<id>urn:sha1:4a3591287fb7f808e209b4974ed337f609a2006b</id>
<content type='text'>
Sashiko review pointed out the following issue.

If a thread is stopped in syscall_trace_enter() for ptrace, another
thread can install a seccomp filter with SECCOMP_FILTER_FLAG_TSYNC
(e.g., via seccomp_attach_filter()). This will successfully set
SYSCALL_WORK_SECCOMP on the stopped thread, but syscall_trace_enter()
evaluates a cached 'work' variable sampled on entry. Consequently,
the subsequent check for SYSCALL_WORK_SECCOMP misses the newly
assigned flag, and the filter is silently bypassed.

This race condition could allow an unprivileged process to execute
a prohibited system call (e.g., execve) that the newly installed filter
was intended to block, especially since the tracer might have modified
the system call number during the ptrace stop.

Fix this by re-reading the syscall_work flags after ptrace handling,
so that any new SYSCALL_WORK_SECCOMP flag set by another thread via
TSYNC during the ptrace stop is observed before the subsequent
seccomp check.

Fixes: 142781e108b1 ("entry: Provide generic syscall entry functionality")
Signed-off-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20260629132914.1135C1F000E9@smtp.kernel.org/
Link: https://patch.msgid.link/20260713025712.416366-1-ruanjinjie@huawei.com
</content>
</entry>
<entry>
<title>ptrace, treewide: Rename ptrace_report_syscall_entry() to ptrace_report_syscall_permit_entry()</title>
<updated>2026-07-12T10:38:02+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@kernel.org</email>
</author>
<published>2026-07-07T19:06:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=622f04e97415e62bd2ab61f7a27e7a296e8467b7'/>
<id>urn:sha1:622f04e97415e62bd2ab61f7a27e7a296e8467b7</id>
<content type='text'>
The return value of that function is boolean and tells the caller whether
to permit the syscall processing or not.

Rename the function so the purpose is clear and make the return type bool.

Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Tested-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Reviewed-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Reviewed-by: Radu Rendec &lt;radu@rendec.net&gt;
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Acked-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Acked-by: Magnus Lindholm &lt;linmag7@gmail.com&gt;
Link: https://patch.msgid.link/20260707190254.280015701@kernel.org
</content>
</entry>
<entry>
<title>seccomp, treewide: Rename and convert __secure_computing() to return boolean</title>
<updated>2026-07-12T10:38:02+00:00</updated>
<author>
<name>Jinjie Ruan</name>
<email>ruanjinjie@huawei.com</email>
</author>
<published>2026-07-07T19:06:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7ba2ba74713c83408cc942b60dd869ab2c34c84f'/>
<id>urn:sha1:7ba2ba74713c83408cc942b60dd869ab2c34c84f</id>
<content type='text'>
The return value of __secure_computing() currently uses 0 to indicate
that a system call should be allowed, and -1 to indicate that it should
be blocked/killed. This 0/-1 pattern is non-intuitive for a security
check function and makes the control flow at the call sites less readable.

Furthermore, any potential future changes to these return values would
require a high-risk, error-prone audit of all its users across different
architectures.

Sanitize this logic by converting the return type of __secure_computing()
to a proper boolean, where 'true' explicitly means 'allow' and 'false'
means 'fail/deny'.

Update all the two dozen or so call sites across the tree to align with
this new boolean semantic. No functional changes are intended, as the
callers still return -1 to the lower-level assembly entry code upon
seccomp denial.

Rename the function to __seccomp_permit_syscall() so that the purpose is
entirely clear.

[ tglx: Rename the function ]

Suggested-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Suggested-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Tested-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Acked-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Link: https://patch.msgid.link/20260707190254.230735780@kernel.org
</content>
</entry>
<entry>
<title>entry: Use syscall number instead of rereading it</title>
<updated>2026-07-12T10:38:01+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@kernel.org</email>
</author>
<published>2026-07-07T19:06:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8af25d0a2e465f3cb73c47c605fddd1664ee79b2'/>
<id>urn:sha1:8af25d0a2e465f3cb73c47c605fddd1664ee79b2</id>
<content type='text'>
rseq_syscall_enter_work() is invoked before the syscall number can be
modified. So there is no point in rereading it from pt_regs.

Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Tested-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Reviewed-by: Radu Rendec &lt;radu@rendec.net&gt;
Reviewed-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Reviewed-by: Philippe Mathieu-Daudé &lt;philmd@oss.qualcomm.com&gt;
Link: https://patch.msgid.link/20260707190254.181086755@kernel.org
</content>
</entry>
<entry>
<title>entry: Remove syscall_enter_from_user_mode()</title>
<updated>2026-07-12T10:38:01+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@kernel.org</email>
</author>
<published>2026-07-07T19:06:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bad2a27ba8c4a6bd2c47e598898d9dbd0f98511f'/>
<id>urn:sha1:bad2a27ba8c4a6bd2c47e598898d9dbd0f98511f</id>
<content type='text'>
All architecture use either:

    nr = syscall_enter_from_user_mode_randomize_stack(regs, nr);

or

    enter_from_user_mode_randomize_stack(regs);
    nr = syscall_enter_from_user_mode_work(regs, nr);

Remove the now unused function.

Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Tested-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Reviewed-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Link: https://patch.msgid.link/20260707190254.132654198@kernel.org
</content>
</entry>
<entry>
<title>entry: Provide [syscall_]enter_from_user_mode_randomize_stack()</title>
<updated>2026-07-12T10:38:01+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@kernel.org</email>
</author>
<published>2026-07-07T19:06:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=855c103f86275a55eba115cabb86eb84f8236933'/>
<id>urn:sha1:855c103f86275a55eba115cabb86eb84f8236933</id>
<content type='text'>
Randomizing the syscall stack can only happen after state is established
via enter_from_user_mode() or syscall_enter_from_user_mode(). The earlier
it happens the better.

Provide two new macros to consolidate that:

  - enter_from_user_mode_randomize_stack()
	enter_from_user_mode();
	add_random_kstack_offset_irqsoff();

  - syscall_enter_from_user_mode_randomize_stack()
	enter_from_user_mode_randomize_stack();
	syscall_enter_from_user_mode_work();

to reduce boiler plate code.

Those are macros and not inline functions as the latter would limit the
stack randomization scope to the inline function itself.

Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Tested-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Reviewed-by: Radu Rendec &lt;radu@rendec.net&gt;
Reviewed-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Reviewed-by: Philippe Mathieu-Daudé &lt;philmd@oss.qualcomm.com&gt;
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Link: https://patch.msgid.link/20260707190253.816918647@kernel.org
</content>
</entry>
</feed>
