<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/Documentation/core-api/entry.rst, branch v7.3-rc2</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<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.tavy.me/linux.git/commit/?id=05c033db7e9ad3c34f6968ec568cb6ee01051c57'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</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.tavy.me/linux.git/commit/?id=bad2a27ba8c4a6bd2c47e598898d9dbd0f98511f'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>Documentation: core-api: entry: Replace deprecated KVM entry/exit functions</title>
<updated>2025-07-24T14:32:59+00:00</updated>
<author>
<name>Andrew Donnellan</name>
<email>ajd@linux.ibm.com</email>
</author>
<published>2025-07-23T07:51:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=3597405effbb17f3dc15b714be04398a91c87a62'/>
<id>3597405effbb17f3dc15b714be04398a91c87a62</id>
<content type='text'>
The x86-specific functions kvm_guest_{enter,exit}_irqoff() were removed
and replaced by the generic guest_state_{enter,exit}_irqoff() in commit
ef9989afda73 ("kvm: add guest_state_{enter,exit}_irqoff()") and commit
b2d2af7e5df3 ("kvm/x86: rework guest entry logic").

Update the references in the entry/exit handling documentation.

Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Nicolas Saenz Julienne &lt;nsaenz@amazon.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Andrew Donnellan &lt;ajd@linux.ibm.com&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Link: https://lore.kernel.org/r/20250723075134.105132-1-ajd@linux.ibm.com
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The x86-specific functions kvm_guest_{enter,exit}_irqoff() were removed
and replaced by the generic guest_state_{enter,exit}_irqoff() in commit
ef9989afda73 ("kvm: add guest_state_{enter,exit}_irqoff()") and commit
b2d2af7e5df3 ("kvm/x86: rework guest entry logic").

Update the references in the entry/exit handling documentation.

Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Nicolas Saenz Julienne &lt;nsaenz@amazon.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Andrew Donnellan &lt;ajd@linux.ibm.com&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Link: https://lore.kernel.org/r/20250723075134.105132-1-ajd@linux.ibm.com
</pre>
</div>
</content>
</entry>
<entry>
<title>Documentation: core-api: entry: Fix typo "systcalls" -&gt; "syscalls"</title>
<updated>2025-07-15T19:28:50+00:00</updated>
<author>
<name>Andrew Donnellan</name>
<email>ajd@linux.ibm.com</email>
</author>
<published>2025-07-15T06:15:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2abdc8818c2aad2764c1b014283c126ef43b2364'/>
<id>2abdc8818c2aad2764c1b014283c126ef43b2364</id>
<content type='text'>
Fix a typo: "systcalls" should be "syscalls".

Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
Signed-off-by: Andrew Donnellan &lt;ajd@linux.ibm.com&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Link: https://lore.kernel.org/r/20250715061529.56268-1-ajd@linux.ibm.com
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix a typo: "systcalls" should be "syscalls".

Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
Signed-off-by: Andrew Donnellan &lt;ajd@linux.ibm.com&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Link: https://lore.kernel.org/r/20250715061529.56268-1-ajd@linux.ibm.com
</pre>
</div>
</content>
</entry>
<entry>
<title>Docs: typos/spelling</title>
<updated>2024-05-02T16:02:29+00:00</updated>
<author>
<name>Remington Brasga</name>
<email>rbrasga@uci.edu</email>
</author>
<published>2024-04-29T22:55:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=da51bbcdbace8f43adf6066934c3926b656376e5'/>
<id>da51bbcdbace8f43adf6066934c3926b656376e5</id>
<content type='text'>
Fix spelling and grammar in Docs descriptions

Signed-off-by: Remington Brasga &lt;rbrasga@uci.edu&gt;
Reviewed-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Link: https://lore.kernel.org/r/20240429225527.2329-1-rbrasga@uci.edu
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix spelling and grammar in Docs descriptions

Signed-off-by: Remington Brasga &lt;rbrasga@uci.edu&gt;
Reviewed-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Link: https://lore.kernel.org/r/20240429225527.2329-1-rbrasga@uci.edu
</pre>
</div>
</content>
</entry>
<entry>
<title>Documentation: core-api: entry: Add comments about nesting</title>
<updated>2022-01-27T18:32:40+00:00</updated>
<author>
<name>Nicolas Saenz Julienne</name>
<email>nsaenzju@redhat.com</email>
</author>
<published>2022-01-10T10:50:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=e3aa43e936d854373d9a75372aefcefebfca208f'/>
<id>e3aa43e936d854373d9a75372aefcefebfca208f</id>
<content type='text'>
The topic of nesting and reentrancy in the context of early entry code
hasn't been addressed so far. So do it.

Signed-off-by: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
Reviewed-by: Frederic Weisbecker &lt;frederic@kernel.org&gt;
Reviewed-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Link: https://lore.kernel.org/r/20220110105044.94423-2-nsaenzju@redhat.com
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The topic of nesting and reentrancy in the context of early entry code
hasn't been addressed so far. So do it.

Signed-off-by: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
Reviewed-by: Frederic Weisbecker &lt;frederic@kernel.org&gt;
Reviewed-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Link: https://lore.kernel.org/r/20220110105044.94423-2-nsaenzju@redhat.com
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Documentation: Fill the gaps about entry/noinstr constraints</title>
<updated>2022-01-27T18:32:40+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2022-01-10T10:50:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bf026e2e316ba57135b70e8ce591276239c7b2cf'/>
<id>bf026e2e316ba57135b70e8ce591276239c7b2cf</id>
<content type='text'>
The entry/exit handling for exceptions, interrupts, syscalls and KVM is
not really documented except for some comments.

Fill the gaps.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de
Co-developed-by: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
Signed-off-by: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
Reviewed-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Reviewed-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;

----

Changes since v3:
 - s/nointr/noinstr/

Changes since v2:
 - No big content changes, just style corrections, so it should be
   pretty clean at this stage. In the light of this, I kept Mark's
   Reviewed-by.
 - Paul's style and paragraph re-writes
 - Randy's style comments
 - Add links to transition type sections

Documentation/core-api/entry.rst | 261 +++++++++++++++++++++++++++++++
 Documentation/core-api/index.rst |   8 +
 2 files changed, 269 insertions(+)
 create mode 100644 Documentation/core-api/entry.rst

Reviewed-by: Frederic Weisbecker &lt;frederic@kernel.org&gt;
Link: https://lore.kernel.org/r/20220110105044.94423-1-nsaenzju@redhat.com
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The entry/exit handling for exceptions, interrupts, syscalls and KVM is
not really documented except for some comments.

Fill the gaps.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de
Co-developed-by: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
Signed-off-by: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
Reviewed-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Reviewed-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;

----

Changes since v3:
 - s/nointr/noinstr/

Changes since v2:
 - No big content changes, just style corrections, so it should be
   pretty clean at this stage. In the light of this, I kept Mark's
   Reviewed-by.
 - Paul's style and paragraph re-writes
 - Randy's style comments
 - Add links to transition type sections

Documentation/core-api/entry.rst | 261 +++++++++++++++++++++++++++++++
 Documentation/core-api/index.rst |   8 +
 2 files changed, 269 insertions(+)
 create mode 100644 Documentation/core-api/entry.rst

Reviewed-by: Frederic Weisbecker &lt;frederic@kernel.org&gt;
Link: https://lore.kernel.org/r/20220110105044.94423-1-nsaenzju@redhat.com
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
