include/linux/entry-common.h
Source file repositories/reference/linux-study-clean/include/linux/entry-common.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/entry-common.h- Extension
.h- Size
- 10241 bytes
- Lines
- 324
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/audit.hlinux/irq-entry-common.hlinux/livepatch.hlinux/ptrace.hlinux/resume_user_mode.hlinux/seccomp.hlinux/sched.hasm/entry-common.hasm/syscall.h
Detected Declarations
function arch_ptrace_report_syscall_entryfunction syscall_enter_auditfunction syscall_trace_enterfunction enter_from_user_modefunction enter_from_user_modefunction setfunction arch_ptrace_report_syscall_exitfunction syscall_exit_workfunction syscall_trace_enterfunction syscall_exit_to_user_modefunction arch_exit_to_user_mode_work
Annotated Snippet
if (unlikely(current->syscall_dispatch.on_dispatch)) {
current->syscall_dispatch.on_dispatch = false;
return;
}
}
audit_syscall_exit(regs);
if (work & SYSCALL_WORK_SYSCALL_TRACEPOINT)
trace_syscall_exit(regs, syscall_get_return_value(current, regs));
step = report_single_step(work);
if (step || work & SYSCALL_WORK_SYSCALL_TRACE)
arch_ptrace_report_syscall_exit(regs, step);
}
/**
* syscall_exit_to_user_mode_work - Handle one time work before returning to user mode
* @regs: Pointer to currents pt_regs
*
* Step 1 of syscall_exit_to_user_mode() with the same calling convention.
*
* The caller must invoke steps 2-3 of syscall_exit_to_user_mode() afterwards.
*/
static __always_inline void syscall_exit_to_user_mode_work(struct pt_regs *regs)
{
unsigned long work = READ_ONCE(current_thread_info()->syscall_work);
unsigned long nr = syscall_get_nr(current, regs);
CT_WARN_ON(ct_state() != CT_STATE_KERNEL);
if (IS_ENABLED(CONFIG_PROVE_LOCKING)) {
if (WARN(irqs_disabled(), "syscall %lu left IRQs disabled", nr))
local_irq_enable();
}
rseq_debug_syscall_return(regs);
/*
* Do one-time syscall specific work. If these work items are
* enabled, we want to run them exactly once per syscall exit with
* interrupts enabled.
*/
if (unlikely(work & SYSCALL_WORK_EXIT))
syscall_exit_work(regs, work);
}
/**
* syscall_exit_to_user_mode - Handle work before returning to user mode
* @regs: Pointer to currents pt_regs
*
* Invoked with interrupts enabled and fully valid @regs. Returns with all
* work handled, interrupts disabled such that the caller can immediately
* switch to user mode. Called from architecture specific syscall and ret
* from fork code.
*
* The call order is:
* 1) One-time syscall exit work:
* - rseq syscall exit
* - audit
* - syscall tracing
* - ptrace (single stepping)
*
* 2) Preparatory work
* - Disable interrupts
* - Exit to user mode loop (common TIF handling). Invokes
* arch_exit_to_user_mode_work() for architecture specific TIF work
* - Architecture specific one time work arch_exit_to_user_mode_prepare()
* - Address limit and lockdep checks
*
* 3) Final transition (lockdep, tracing, context tracking, RCU), i.e. the
* functionality in exit_to_user_mode().
*
* This is a combination of syscall_exit_to_user_mode_work() (1), disabling
* interrupts followed by syscall_exit_to_user_mode_prepare() (2) and
* exit_to_user_mode() (3). This function is preferred unless there is a
* compelling architectural reason to invoke the functions separately.
*/
static __always_inline void syscall_exit_to_user_mode(struct pt_regs *regs)
{
instrumentation_begin();
syscall_exit_to_user_mode_work(regs);
local_irq_disable();
syscall_exit_to_user_mode_prepare(regs);
instrumentation_end();
exit_to_user_mode();
}
#endif
Annotation
- Immediate include surface: `linux/audit.h`, `linux/irq-entry-common.h`, `linux/livepatch.h`, `linux/ptrace.h`, `linux/resume_user_mode.h`, `linux/seccomp.h`, `linux/sched.h`, `asm/entry-common.h`.
- Detected declarations: `function arch_ptrace_report_syscall_entry`, `function syscall_enter_audit`, `function syscall_trace_enter`, `function enter_from_user_mode`, `function enter_from_user_mode`, `function set`, `function arch_ptrace_report_syscall_exit`, `function syscall_exit_work`, `function syscall_trace_enter`, `function syscall_exit_to_user_mode`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.