| 0/0 |
2026/05/31 19:24 |
flow |
assessment-security |
59m
Results: map[DenialOfService:false Explanation:The bug report describes a kernel panic triggered by a
`WARN_ON_ONCE(!valid_signal(sig))` in `do_notify_parent()` when a process exits.
### Root Cause Analysis
The issue stems from the legacy `clone` syscall. When a process is created using
`clone()`, the `exit_signal` is extracted from the lower 8 bits of `clone_flags`
(`clone_flags & CSIGNAL`). Since `CSIGNAL` is `0xFF`, the `exit_signal` can be
any value up to 255.
Unlike the newer `clone3` syscall, which explicitly validates the `exit_signal`
using `valid_signal()` (ensuring it is `<= _NSIG`, which is 64), the legacy
`clone` syscall does not perform this validation.
When a child process created with an invalid `exit_signal` (e.g., 65)
terminates, the kernel calls `do_notify_parent(tsk, tsk->exit_signal)`. Inside
`do_notify_parent()`, the kernel checks if the signal is valid using
`WARN_ON_ONCE(!valid_signal(sig))`. Because the signal is greater than 64, this
check fails, triggering the warning.
In the provided syzbot report, the kernel panics because it is configured with
`panic_on_warn`. However, in a standard production kernel, `panic_on_warn` is
disabled. The `WARN_ON_ONCE` will simply print a stack trace to the kernel log
(only once per boot) and return `false`. The kernel gracefully handles this by
leaving the child as a zombie until it is reaped (or reparented to `init` which
will reap it), preventing any memory leaks or state corruption.
### Security Impact Assessment
* **Exploitable:** **No.** The bug is a simple warning triggered by an
unvalidated integer. The invalid signal is not used as an array index or for any
memory access. The kernel handles the invalid signal gracefully by returning
early, so there is no memory corruption, out-of-bounds access, or privilege
escalation possible.
* **Denial Of Service:** **No.** In production environments, `panic_on_warn` is
not enabled. The `WARN_ON_ONCE` macro ensures the warning is only printed once
per boot, meaning it cannot even be used to spam the kernel log (dmesg) or cause
resource exhaustion.
* **Accessible From Unprivileged Processes:** **Yes.** Any unprivileged user can
call the legacy `clone` syscall with `clone_flags` containing an invalid signal
(e.g., `65`) and then have the child process exit to trigger the warning.
* **Accessible From User Namespaces:** **Yes.** The `clone` syscall is
accessible within user namespaces.
* **VM Guest / Host Trigger:** **No.** This is a local syscall issue, not
related to virtualization.
* **Network / Peripheral / Filesystem Trigger:** **No.** The bug is triggered
via local syscalls (`clone` and `exit`), not via external inputs like network
packets, USB devices, or filesystem images. Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/05/31 19:24 |
action |
syz-repro-to-c-repro |
0m
Results:
|
| 2/1 |
2026/05/31 19:24 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/ca75a9a033877527dbf38e748dd8a6a9fbbcab62]
|
| 3/1 |
2026/05/31 19:26 |
action |
kernel-builder |
28m
Results: map[KernelObj:/app/workdir/cache/build/c5ea796d113e21c33866153444135815c54c0622]
|
| 4/1 |
2026/05/31 19:54 |
action |
codesearch-prepare |
21m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/05/31 20:16 |
agent |
expert |
7m
Model:
Results: map[DenialOfService:false Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Instruction: You are an experienced Linux kernel security engineer. Your task is to analyze given kernel bug report
and determine its security impact based on the following dimensions.
Use the provided tools to examine the source code, check for capability checks (e.g., capable(), ns_capable()),
and understand the nature of the bug. Analyze the given kernel build and configuration.
You can check the kernel config by grepping ".config" file; you can check kernel cmdline by grepping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption or elevated privileges.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a completely wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control transfers, that also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitability depends on how exactly the uninit value
is used in the code, and what it affects.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidential Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt:
The kernel bug report is:
WARNING: kernel/signal.c:2174 at do_notify_parent+0xea8/0x10b0 kernel/signal.c:2174, CPU#2: syz.2.2072/13056
Kernel panic - nοΏ½oοΏ½t syncοΏ½iοΏ½nοΏ½gοΏ½:οΏ½ οΏ½kοΏ½eοΏ½rοΏ½nοΏ½eοΏ½lοΏ½:οΏ½ οΏ½panic_on_warn set ...
Tainted: [L]=SOFTLOCKUP
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
check_panic_on_warn kernel/panic.c:524 [inline]
check_panic_on_warn.cold+0x19/0x34 kernel/panic.c:519
__warn.cold+0x191/0x328 kernel/panic.c:1103
asm_exc_invalid_op+0x1a/0x20 arch/x86/include/asm/idtentry.h:616
RSP: 0018:ffffc9000f407aa8 EFLAGS: 00010093
RDX: ffff88805386ca00 RSI: ffffffff81caad07 RDI: ffff88805386ca00
R10: 0000000000000080 R11: 0000000000000000 R12: 1ffff92001e80f58
exit_notify kernel/exit.c:757 [inline]
do_exit+0x1b05/0x2a60 kernel/exit.c:987
get_signal+0x1ec7/0x21e0 kernel/signal.c:3037
asm_exc_general_protection+0x26/0x30 arch/x86/include/asm/idtentry.h:612
RSP: 002b:00002000000001e0 EFLAGS: 00010217
R13: 00007fcbfe616038 R14: 00007fcbfe615fa0 R15: 00007ffd58e78548
Kernel Offset: disabled
Rebooting in 86400 seconds..
Reply: The bug report describes a kernel panic triggered by a `WARN_ON_ONCE(!valid_signal(sig))` in `do_notify_parent()` when a process exits.
### Root Cause Analysis
The issue stems from the legacy `clone` syscall. When a process is created using `clone()`, the `exit_signal` is extracted from the lower 8 bits of `clone_flags` (`clone_flags & CSIGNAL`). Since `CSIGNAL` is `0xFF`, the `exit_signal` can be any value up to 255.
Unlike the newer `clone3` syscall, which explicitly validates the `exit_signal` using `valid_signal()` (ensuring it is `<= _NSIG`, which is 64), the legacy `clone` syscall does not perform this validation.
When a child process created with an invalid `exit_signal` (e.g., 65) terminates, the kernel calls `do_notify_parent(tsk, tsk->exit_signal)`. Inside `do_notify_parent()`, the kernel checks if the signal is valid using `WARN_ON_ONCE(!valid_signal(sig))`. Because the signal is greater than 64, this check fails, triggering the warning.
In the provided syzbot report, the kernel panics because it is configured with `panic_on_warn`. However, in a standard production kernel, `panic_on_warn` is disabled. The `WARN_ON_ONCE` will simply print a stack trace to the kernel log (only once per boot) and return `false`. The kernel gracefully handles this by leaving the child as a zombie until it is reaped (or reparented to `init` which will reap it), preventing any memory leaks or state corruption.
### Security Impact Assessment
* **Exploitable:** **No.** The bug is a simple warning triggered by an unvalidated integer. The invalid signal is not used as an array index or for any memory access. The kernel handles the invalid signal gracefully by returning early, so there is no memory corruption, out-of-bounds access, or privilege escalation possible.
* **Denial Of Service:** **No.** In production environments, `panic_on_warn` is not enabled. The `WARN_ON_ONCE` macro ensures the warning is only printed once per boot, meaning it cannot even be used to spam the kernel log (dmesg) or cause resource exhaustion.
* **Accessible From Unprivileged Processes:** **Yes.** Any unprivileged user can call the legacy `clone` syscall with `clone_flags` containing an invalid signal (e.g., `65`) and then have the child process exit to trigger the warning.
* **Accessible From User Namespaces:** **Yes.** The `clone` syscall is accessible within user namespaces.
* **VM Guest / Host Trigger:** **No.** This is a local syscall issue, not related to virtualization.
* **Network / Peripheral / Filesystem Trigger:** **No.** The bug is triggered via local syscalls (`clone` and `exit`), not via external inputs like network packets, USB devices, or filesystem images.
|
| 6/2 |
2026/05/31 20:16 |
llm |
expert |
0m
Model:
Tokens:
input: 6137
output: 34
thoughts: 173
Thoughts: **Analyzing a Kernel Panic**
Okay, here's what's running through my mind. I've got a `WARNING` flag, which immediately catches my attention. The kernel is pointing me to `kernel/signal.c:2174` during a call to `do_notify_parent`, specifically at offset `0xea8/0x10b0`. The call trace that follows, `exit_notify` -> `do_exit` -> `get_signal` -> `asm_exc_general_protection`, gives me the breadcrumbs to follow. That stack trace shows a path from process exit handling to signal delivery and ultimately, a general protection fault, which is *never* good. So, let's zoom in on `kernel/signal.c`, line 2174. That's where the problem is most likely originating. I'll start there, and try to piece together why a general protection fault is triggered during the parent notification, after the process has signaled exit. This likely hints at a memory access issue, possibly related to signal handling or resource cleanup during exit, in the kernel's perspective.
|
| 7/2 |
2026/05/31 20:16 |
tool |
read-file |
0m
Args: map[File:kernel/signal.c FirstLine:2160 LineCount:30]
Results: map[Contents:2160: * Let a parent know about the death of a child.
2161: * For a stopped/continued status change, use do_notify_parent_cldstop instead.
2162: *
2163: * Returns true if our parent ignored us and so we've switched to
2164: * self-reaping.
2165: */
2166: bool do_notify_parent(struct task_struct *tsk, int sig)
2167: {
2168: struct kernel_siginfo info;
2169: unsigned long flags;
2170: struct sighand_struct *psig;
2171: bool autoreap = false;
2172: u64 utime, stime;
2173:
2174: if (WARN_ON_ONCE(!valid_signal(sig)))
2175: return false;
2176:
2177: /* do_notify_parent_cldstop should have been called instead. */
2178: WARN_ON_ONCE(task_is_stopped_or_traced(tsk));
2179:
2180: WARN_ON_ONCE(!tsk->ptrace && !thread_group_empty(tsk));
2181:
2182: /* ptraced, or group-leader without sub-threads */
2183: do_notify_pidfd(tsk);
2184:
2185: if (sig != SIGCHLD) {
2186: /*
2187: * This is only possible if parent == real_parent.
2188: * Check if it has changed security domain.
2189: */
]
|
| 8/2 |
2026/05/31 20:16 |
llm |
expert |
0m
Model:
Tokens:
input: 7048
output: 33
thoughts: 77
Thoughts: Here's my analysis of the provided code snippet:
**Debugging a Kernel Signal Issue**
Okay, so I've got a warning β `WARN_ON_ONCE(!valid_signal(sig))` β and it's flagged at `kernel/signal.c:2174`. That's my starting point. The line number is important.
Now, my initial reaction is, "What's triggering this specific warning?" `WARN_ON_ONCE` indicates something unusual, a potential one-time issue, likely related to an invalid signal. So, where is `do_notify_parent` being called from `exit_notify`? I need to understand the control flow, which context is causing this invalid signal.
|
| 9/2 |
2026/05/31 20:16 |
tool |
read-file |
0m
Args: map[File:kernel/exit.c FirstLine:740 LineCount:30]
Results: map[Contents: 740: struct task_struct *p, *n;
741: LIST_HEAD(dead);
742:
743: write_lock_irq(&tasklist_lock);
744: forget_original_parent(tsk, &dead);
745:
746: if (group_dead)
747: kill_orphaned_pgrp(tsk->group_leader, NULL);
748:
749: tsk->exit_state = EXIT_ZOMBIE;
750:
751: if (unlikely(tsk->ptrace)) {
752: int sig = thread_group_empty(tsk) && !ptrace_reparented(tsk)
753: ? tsk->exit_signal : SIGCHLD;
754: autoreap = do_notify_parent(tsk, sig);
755: } else if (thread_group_leader(tsk)) {
756: autoreap = thread_group_empty(tsk) &&
757: do_notify_parent(tsk, tsk->exit_signal);
758: } else {
759: autoreap = true;
760: /* untraced sub-thread */
761: do_notify_pidfd(tsk);
762: }
763:
764: if (autoreap) {
765: tsk->exit_state = EXIT_DEAD;
766: list_add(&tsk->ptrace_entry, &dead);
767: }
768:
769: /* mt-exec, de_thread() is waiting for group leader */
]
|
| 10/2 |
2026/05/31 20:16 |
llm |
expert |
0m
Model:
Tokens:
input: 7783
output: 32
thoughts: 95
Thoughts: **Debugging a Suspect Signal**
Okay, so I'm looking at this function call: `do_notify_parent(tsk, tsk->exit_signal);` on line 757. The key here is `tsk->exit_signal`. Something's fishy β this implies the exit signal is an invalid signal. Let's see if this hunch is correct.
I need to quickly confirm whether the signal is valid. I'm recalling that `valid_signal(sig)` handles this check, ensuring `sig` falls within the expected range, specifically between 1 and `_NSIG`, which is 64. My instinct is telling me that this signal is outside of that range, which is causing the issue. I should check `include/linux/signal.h` to make sure, it defines that macro. Then I can confirm that is the source of the bug.
|
| 11/2 |
2026/05/31 20:16 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/signal.c Name:valid_signal]
Results: map[SourceCode: 271: /* Test if 'sig' is valid signal. Use this instead of testing _NSIG directly */
272: static inline int valid_signal(unsigned long sig)
273: {
274: return sig <= _NSIG ? 1 : 0;
275: }
SourceFile:include/linux/signal.h]
|
| 12/2 |
2026/05/31 20:16 |
llm |
expert |
0m
Model:
Tokens:
input: 8210
output: 48
thoughts: 85
Thoughts: **Investigating an Unexpected Signal Value**
Okay, so I'm looking at this `sig` variable, and it's being assigned `tsk->exit_signal`. Hmm, that's interesting. I'm wondering, how in the world could `tsk->exit_signal` possibly be greater than `_NSIG`? That just doesn't make any sense.
I know that `tsk->exit_signal` is set when a task is created. Specifically, things like the `clone` and `clone3` syscalls come to mind as the obvious places to look. Those calls are the primary ways tasks are born. So, the next logical step is to dive into the kernel code for the `clone` and `clone3` syscalls. I need to see if either of them, or both, validate the `exit_signal` value when they're invoked. It's time to trace the origin of this value and see where things might be going awry. Let's see if we can get to the bottom of this.
|
| 13/2 |
2026/05/31 20:16 |
tool |
codesearch-find-references |
0m
Error:
Args: map[ContextFile:kernel/fork.c IncludeSnippetLines:10 Name:exit_signal SourceTreePrefix:kernel/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 14/2 |
2026/05/31 20:16 |
llm |
expert |
0m
Model:
Tokens:
input: 8585
output: 28
thoughts: 18
Thoughts: Okay, here's my thought process summarized, geared towards an expert:
**Locating the `exit_signal` Within the Kernel**
Alright, time to get my hands dirty. I need to understand how signals related to process termination are handled, and the `exit_signal` variable seems like a crucial piece of that puzzle. My immediate instinct is to dive into the core of process creation and termination within the kernel, so I'm focusing my search on `kernel/fork.c`. That file is the obvious place to start looking for interactions with the `exit_signal` since `fork()` is the system call that creates new processes, and where signaling upon exit might be implemented. Now let's see what that file can tell me.
|
| 15/2 |
2026/05/31 20:16 |
tool |
grepper |
0m
Args: map[Expression:exit_signal PathPrefix:kernel/fork.c]
Results: map[Output:kernel/fork.c=1967=__latent_entropy struct task_struct *copy_process(
--
kernel/fork.c-2038- return ERR_PTR(-EINVAL);
kernel/fork.c:2039: if (args->exit_signal)
kernel/fork.c-2040- return ERR_PTR(-EINVAL);
--
kernel/fork.c-2419- if (clone_flags & CLONE_THREAD)
kernel/fork.c:2420: p->exit_signal = -1;
kernel/fork.c-2421- else
kernel/fork.c:2422: p->exit_signal = current->group_leader->exit_signal;
kernel/fork.c-2423- } else {
--
kernel/fork.c-2425- p->parent_exec_id = current->self_exec_id;
kernel/fork.c:2426: p->exit_signal = args->exit_signal;
kernel/fork.c-2427- }
--
kernel/fork.c=2649=struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node)
--
kernel/fork.c-2669- *
kernel/fork.c:2670: * args->exit_signal is expected to be checked for sanity by the caller.
kernel/fork.c-2671- */
kernel/fork.c=2672=pid_t kernel_clone(struct kernel_clone_args *args)
--
kernel/fork.c-2713- trace = PTRACE_EVENT_VFORK;
kernel/fork.c:2714: else if (args->exit_signal != SIGCHLD)
kernel/fork.c-2715- trace = PTRACE_EVENT_CLONE;
--
kernel/fork.c=2772=pid_t kernel_thread(int (*fn)(void *), void *arg, const char *name,
--
kernel/fork.c-2776- .flags = ((flags | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL),
kernel/fork.c:2777: .exit_signal = (flags & CSIGNAL),
kernel/fork.c-2778- .fn = fn,
--
kernel/fork.c=2790=pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long flags)
--
kernel/fork.c-2793- .flags = ((flags | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL),
kernel/fork.c:2794: .exit_signal = (flags & CSIGNAL),
kernel/fork.c-2795- .fn = fn,
--
kernel/fork.c=2803=SYSCALL_DEFINE0(fork)
--
kernel/fork.c-2806- struct kernel_clone_args args = {
kernel/fork.c:2807: .exit_signal = SIGCHLD,
kernel/fork.c-2808- };
--
kernel/fork.c=2819=SYSCALL_DEFINE0(vfork)
--
kernel/fork.c-2822- .flags = CLONE_VFORK | CLONE_VM,
kernel/fork.c:2823: .exit_signal = SIGCHLD,
kernel/fork.c-2824- };
--
kernel/fork.c=2848=SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
--
kernel/fork.c-2858- .parent_tid = parent_tidptr,
kernel/fork.c:2859: .exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
kernel/fork.c-2860- .stack = newsp,
--
kernel/fork.c=2868=static noinline int copy_clone_args_from_user(struct kernel_clone_args *kargs,
--
kernel/fork.c-2902- /*
kernel/fork.c:2903: * Verify that higher 32bits of exit_signal are unset and that
kernel/fork.c-2904- * it is a valid signal
kernel/fork.c-2905- */
kernel/fork.c:2906: if (unlikely((args.exit_signal & ~((u64)CSIGNAL)) ||
kernel/fork.c:2907: !valid_signal(args.exit_signal)))
kernel/fork.c-2908- return -EINVAL;
--
kernel/fork.c-2918- .parent_tid = u64_to_user_ptr(args.parent_tid),
kernel/fork.c:2919: .exit_signal = args.exit_signal,
kernel/fork.c-2920- .stack = args.stack,
--
kernel/fork.c=2965=static bool clone3_args_valid(struct kernel_clone_args *kargs)
--
kernel/fork.c-2985- if ((kargs->flags & (CLONE_THREAD | CLONE_PARENT)) &&
kernel/fork.c:2986: kargs->exit_signal)
kernel/fork.c-2987- return false;
]
|
| 16/2 |
2026/05/31 20:16 |
llm |
expert |
0m
Model:
Tokens:
input: 10183
output: 34
thoughts: 277
Thoughts: **Analyzing the `clone` Syscall**
Okay, let's break down this `clone` syscall implementation. I'm looking at `SYSCALL_DEFINE5(clone, ...)` and immediately zeroing in on the arguments. I'm noting the standard flags, `newsp` for the new stack, and those `parent_tidptr` and `child_tidptr` arguments. The TLS argument is important as well.
The core of it seems to be setting up a `struct kernel_clone_args` struct. The code sets the flags based on what was passed to it, and assigns various pointers and values. I can see the arguments like `exit_signal` being derived from the passed `clone_flags`, specifically using `CSIGNAL` which is masked to extract the bottom 8 bits.
Hold on... `CSIGNAL` is defined as `0x000000ff`. So, `exit_signal` is limited to at most 255 if only that is set, not a particularly large number, but this doesn't feel right. My intuition says there might be a problem here with signal validity. This feels like it might lead to some interesting behavior.
I'm checking `valid_signal` β and yeah, it checks if a signal is `<= _NSIG` which is 64. So, the `clone` syscall *itself* isn't validating the `exit_signal`! That's a potential vulnerability waiting to happen, if one could influence this. I need to dig deeper into how `kernel_clone` handles this flag. I'm going to look at the internals, as the kernel is the main player here.
|
| 17/2 |
2026/05/31 20:16 |
tool |
read-file |
0m
Args: map[File:kernel/fork.c FirstLine:2670 LineCount:50]
Results: map[Contents:2670: * args->exit_signal is expected to be checked for sanity by the caller.
2671: */
2672: pid_t kernel_clone(struct kernel_clone_args *args)
2673: {
2674: u64 clone_flags = args->flags;
2675: struct completion vfork;
2676: struct pid *pid;
2677: struct task_struct *p;
2678: int trace = 0;
2679: pid_t nr;
2680:
2681: /*
2682: * Creating an empty mount namespace implies creating a new mount
2683: * namespace. Set this before copy_process() so that the
2684: * CLONE_NEWNS|CLONE_FS mutual exclusion check works correctly.
2685: */
2686: if (clone_flags & CLONE_EMPTY_MNTNS) {
2687: clone_flags |= CLONE_NEWNS;
2688: args->flags = clone_flags;
2689: }
2690:
2691: /*
2692: * For legacy clone() calls, CLONE_PIDFD uses the parent_tid argument
2693: * to return the pidfd. Hence, CLONE_PIDFD and CLONE_PARENT_SETTID are
2694: * mutually exclusive. With clone3() CLONE_PIDFD has grown a separate
2695: * field in struct clone_args and it still doesn't make sense to have
2696: * them both point at the same memory location. Performing this check
2697: * here has the advantage that we don't need to have a separate helper
2698: * to check for legacy clone().
2699: */
2700: if ((clone_flags & CLONE_PIDFD) &&
2701: (clone_flags & CLONE_PARENT_SETTID) &&
2702: (args->pidfd == args->parent_tid))
2703: return -EINVAL;
2704:
2705: /*
2706: * Determine whether and which event to report to ptracer. When
2707: * called from kernel_thread or CLONE_UNTRACED is explicitly
2708: * requested, no event is reported; otherwise, report if the event
2709: * for the type of forking is enabled.
2710: */
2711: if (!(clone_flags & CLONE_UNTRACED)) {
2712: if (clone_flags & CLONE_VFORK)
2713: trace = PTRACE_EVENT_VFORK;
2714: else if (args->exit_signal != SIGCHLD)
2715: trace = PTRACE_EVENT_CLONE;
2716: else
2717: trace = PTRACE_EVENT_FORK;
2718:
2719: if (likely(!ptrace_event_enabled(current, trace)))
]
|
| 18/2 |
2026/05/31 20:16 |
llm |
expert |
0m
Model:
Tokens:
input: 11677
output: 34
thoughts: 88
Thoughts: Here's my thought process, as if I were analyzing this code:
**Analyzing the Signaling Behavior of `clone3` vs. `clone`**
Okay, hold on a second. I'm looking at this `clone3` implementation, and I've just hit a bit of a snag. I see this crucial check within `clone3`: `valid_signal(args.exit_signal)`. This makes immediate sense, ensuring that the exit signal passed to `clone3` is legitimate, doesn't contain bits outside the allowed signal mask `CSIGNAL`. Good, good. We want to avoid nastiness with invalid signals.
But wait a minute... does `clone` *also* perform this validation? That seems like a reasonable expectation, but I don't recall seeing it explicitly. I need to refresh my memory and double-check the source code for the original `clone` system call. The lack of validation there would be a significant inconsistency and potentially a vulnerability if we're allowing userspace to pass garbage. Time to go back and double-check the `clone` syscall implementation to ensure consistency and security. I need to make sure we're not missing a critical check there.
|
| 19/2 |
2026/05/31 20:16 |
tool |
read-file |
0m
Args: map[File:kernel/fork.c FirstLine:2848 LineCount:30]
Results: map[Contents:2848: SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
2849: int __user *, parent_tidptr,
2850: int __user *, child_tidptr,
2851: unsigned long, tls)
2852: #endif
2853: {
2854: struct kernel_clone_args args = {
2855: .flags = (lower_32_bits(clone_flags) & ~CSIGNAL),
2856: .pidfd = parent_tidptr,
2857: .child_tid = child_tidptr,
2858: .parent_tid = parent_tidptr,
2859: .exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
2860: .stack = newsp,
2861: .tls = tls,
2862: };
2863:
2864: return kernel_clone(&args);
2865: }
2866: #endif
2867:
2868: static noinline int copy_clone_args_from_user(struct kernel_clone_args *kargs,
2869: struct clone_args __user *uargs,
2870: size_t usize)
2871: {
2872: int err;
2873: struct clone_args args;
2874: pid_t *kset_tid = kargs->set_tid;
2875:
2876: BUILD_BUG_ON(offsetofend(struct clone_args, tls) !=
2877: CLONE_ARGS_SIZE_VER0);
]
|
| 20/2 |
2026/05/31 20:16 |
llm |
expert |
0m
Model:
Tokens:
input: 12524
output: 34
thoughts: 153
Thoughts: **My Growing Disquiet Regarding the `clone` System Call**
Okay, hold on a second. This `clone` system call... it sets `args.exit_signal` based on some bitwise operation involving `clone_flags`. Specifically, it uses `CSIGNAL` which is, let's see, `0x000000ff` β that gives us a maximum value of 255. But, and this is where it gets interesting, `valid_signal` only checks if the signal number is less than or equal to `_NSIG`, and `_NSIG` is defined as 64. That means `clone` *allows* `exit_signal` to be set to a value far beyond what `valid_signal` considersβ¦ well, valid! Thatβs an issue, I would have thought.
But the real kicker is what the kernel documentation for `kernel_clone` states: it explicitly says that "args->exit_signal is expected to be checked for sanity by the caller." So, `kernel_clone` *expects* some upstream sanity check. But, hang on... `clone` doesn't do it! It just passes this potentially invalid value along. Whereβs the check?
Right, does `copy_process` check it? I'm going to have to dive into that function and see what's happening. This could be a rather significant security or stability vulnerability. I need to understand exactly where this signal number is used and if it is checked anywhere, else⦠This seems like a pretty significant oversight.
|
| 21/2 |
2026/05/31 20:17 |
tool |
read-file |
0m
Args: map[File:kernel/fork.c FirstLine:2030 LineCount:30]
Results: map[Contents:2030: if (clone_flags & CLONE_DETACHED)
2031: return ERR_PTR(-EINVAL);
2032: }
2033:
2034: if (clone_flags & CLONE_AUTOREAP) {
2035: if (clone_flags & CLONE_THREAD)
2036: return ERR_PTR(-EINVAL);
2037: if (clone_flags & CLONE_PARENT)
2038: return ERR_PTR(-EINVAL);
2039: if (args->exit_signal)
2040: return ERR_PTR(-EINVAL);
2041: }
2042:
2043: if ((clone_flags & CLONE_PARENT) && current->signal->autoreap)
2044: return ERR_PTR(-EINVAL);
2045:
2046: if (clone_flags & CLONE_NNP) {
2047: if (clone_flags & CLONE_THREAD)
2048: return ERR_PTR(-EINVAL);
2049: }
2050:
2051: if (clone_flags & CLONE_PIDFD_AUTOKILL) {
2052: if (!(clone_flags & CLONE_PIDFD))
2053: return ERR_PTR(-EINVAL);
2054: if (!(clone_flags & CLONE_AUTOREAP))
2055: return ERR_PTR(-EINVAL);
2056: if (clone_flags & CLONE_THREAD)
2057: return ERR_PTR(-EINVAL);
2058: /*
2059: * Without CLONE_NNP the child could escalate privileges
]
|
| 22/2 |
2026/05/31 20:17 |
llm |
expert |
0m
Model:
Tokens:
input: 13507
output: 28
thoughts: 23
Thoughts: Okay, here's my summary, presented as a stream of thought:
**Checking for Exit Signal Validity in `copy_process`**
Right, let's just make absolutely sure that the `copy_process` function is properly validating the exit signal. I need to confirm that `valid_signal(args->exit_signal)` is being checked within that function. This is critical. We can't have any unexpected behavior or security vulnerabilities stemming from mishandling of signal values during process creation. Itβs fundamental to maintain the integrity of the system calls. This is a crucial area and I need to be 100% certain it's correctly implemented before proceeding further.
|
| 23/2 |
2026/05/31 20:17 |
tool |
grepper |
0m
Args: map[Expression:valid_signal PathPrefix:kernel/fork.c]
Results: map[Output:kernel/fork.c=2868=static noinline int copy_clone_args_from_user(struct kernel_clone_args *kargs,
--
kernel/fork.c-2906- if (unlikely((args.exit_signal & ~((u64)CSIGNAL)) ||
kernel/fork.c:2907: !valid_signal(args.exit_signal)))
kernel/fork.c-2908- return -EINVAL;
]
|
| 24/2 |
2026/05/31 20:17 |
llm |
expert |
0m
Model:
Tokens:
input: 13829
output: 28
thoughts: 57
Thoughts: **Analyzing Signal Handling in `clone` and `clone3`**
Okay, let's break this down. My initial thought process is centered around how signals are handled during process creation, specifically with `clone` and `clone3`. I'm focusing on the verification and assignment of signal-related flags. I see that the `valid_signal` check, which seems important for ensuring a sensible signal number is used, appears to be exclusively within the `copy_clone_args_from_user` function. This function is specific to `clone3`.
Now the question is, how about the more traditional `clone` system call? How does it handle the signal argument? I observe that, with `clone`, the `exit_signal` is straightforwardly determined by a bitwise AND operation: `clone_flags & CSIGNAL`. This suggests a simpler mechanism than the more elaborate checking in `clone3`.
So, the critical point is that for `clone`, there's a more direct assignment. This now means I need to ask a broader question: is there any *other* check to handle signals other than `clone_flags & CSIGNAL`? Are there other locations where signal validity is (or isn't) enforced in the `clone` path? That's what I need to investigate further.
|
| 25/2 |
2026/05/31 20:17 |
tool |
grepper |
0m
Args: map[Expression:CSIGNAL PathPrefix:kernel/fork.c]
Results: map[Output:kernel/fork.c=2772=pid_t kernel_thread(int (*fn)(void *), void *arg, const char *name,
--
kernel/fork.c-2775- struct kernel_clone_args args = {
kernel/fork.c:2776: .flags = ((flags | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL),
kernel/fork.c:2777: .exit_signal = (flags & CSIGNAL),
kernel/fork.c-2778- .fn = fn,
--
kernel/fork.c=2790=pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long flags)
--
kernel/fork.c-2792- struct kernel_clone_args args = {
kernel/fork.c:2793: .flags = ((flags | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL),
kernel/fork.c:2794: .exit_signal = (flags & CSIGNAL),
kernel/fork.c-2795- .fn = fn,
--
kernel/fork.c=2848=SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
--
kernel/fork.c-2854- struct kernel_clone_args args = {
kernel/fork.c:2855: .flags = (lower_32_bits(clone_flags) & ~CSIGNAL),
kernel/fork.c-2856- .pidfd = parent_tidptr,
--
kernel/fork.c-2858- .parent_tid = parent_tidptr,
kernel/fork.c:2859: .exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
kernel/fork.c-2860- .stack = newsp,
--
kernel/fork.c=2868=static noinline int copy_clone_args_from_user(struct kernel_clone_args *kargs,
--
kernel/fork.c-2905- */
kernel/fork.c:2906: if (unlikely((args.exit_signal & ~((u64)CSIGNAL)) ||
kernel/fork.c-2907- !valid_signal(args.exit_signal)))
--
kernel/fork.c=2965=static bool clone3_args_valid(struct kernel_clone_args *kargs)
--
kernel/fork.c-2975- * - make the CLONE_DETACHED bit reusable for clone3
kernel/fork.c:2976: * - make the CSIGNAL bits reusable for clone3
kernel/fork.c-2977- */
kernel/fork.c:2978: if (kargs->flags & (CLONE_DETACHED | (CSIGNAL & (~CLONE_NEWTIME))))
kernel/fork.c-2979- return false;
]
|
| 26/2 |
2026/05/31 20:17 |
llm |
expert |
0m
Model:
Tokens:
input: 14960
output: 34
thoughts: 143
Thoughts: **A Conundrum in Kernel Cloning**
Okay, so I'm digging into this `clone` system call, and something feels off. I was just reviewing the code, and it seems like the `clone` syscall allows a child process to be created with an `exit_signal` value up to 255. That's a wide range. But the `valid_signal` function, used to check signal validity, is explicitly limited to `_NSIG`, which is only 64. That seems like a potential issue... a conflict, even.
Essentially, if I set `exit_signal` to anything greater than 64, `valid_signal` will return `false`. But then, when that child process exits, we end up calling `do_notify_parent` with the `sig` parameter set to `tsk->exit_signal`βmeaning whatever value I set with the clone system call. And here's the kicker: `do_notify_parent` has a `WARN_ON_ONCE(!valid_signal(sig))` check.
I see it! So, if I give `clone` a value outside of the valid range of signals when the child exits, this will trigger the warning!
Wait, am I missing something? Does `valid_signal` get checked anywhere else within the `clone` code path? I need to go back and check the code, specifically `kernel_clone`. It's possible I'm overthinking this, but this seems like a pretty significant bug that has the potential to cause issues later. Let's see...
|
| 27/2 |
2026/05/31 20:17 |
tool |
read-file |
0m
Args: map[File:kernel/fork.c FirstLine:2720 LineCount:50]
Results: map[Contents:2720: trace = 0;
2721: }
2722:
2723: p = copy_process(NULL, trace, NUMA_NO_NODE, args);
2724: add_latent_entropy();
2725:
2726: if (IS_ERR(p))
2727: return PTR_ERR(p);
2728:
2729: /*
2730: * Do this prior waking up the new thread - the thread pointer
2731: * might get invalid after that point, if the thread exits quickly.
2732: */
2733: trace_sched_process_fork(current, p);
2734:
2735: pid = get_task_pid(p, PIDTYPE_PID);
2736: nr = pid_vnr(pid);
2737:
2738: if (clone_flags & CLONE_PARENT_SETTID)
2739: put_user(nr, args->parent_tid);
2740:
2741: if (clone_flags & CLONE_VFORK) {
2742: p->vfork_done = &vfork;
2743: init_completion(&vfork);
2744: get_task_struct(p);
2745: }
2746:
2747: if (IS_ENABLED(CONFIG_LRU_GEN_WALKS_MMU) && !(clone_flags & CLONE_VM)) {
2748: /* lock the task to synchronize with memcg migration */
2749: task_lock(p);
2750: lru_gen_add_mm(p->mm);
2751: task_unlock(p);
2752: }
2753:
2754: wake_up_new_task(p);
2755:
2756: /* forking complete and child started to run, tell ptracer */
2757: if (unlikely(trace))
2758: ptrace_event_pid(trace, pid);
2759:
2760: if (clone_flags & CLONE_VFORK) {
2761: if (!wait_for_vfork_done(p, &vfork))
2762: ptrace_event_pid(PTRACE_EVENT_VFORK_DONE, pid);
2763: }
2764:
2765: put_pid(pid);
2766: return nr;
2767: }
2768:
2769: /*
]
|
| 28/2 |
2026/05/31 20:17 |
llm |
expert |
0m
Model:
Tokens:
input: 16187
output: 25
thoughts: 11
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:
**Re-Examining the `copy_process` Function**
Right, let's circle back to that `copy_process` function. I had a quick look at it earlier, but I need to give it a more thorough going-over. I've got a nagging feeling there might be a subtle nuance I missed, or perhaps an edge case I didn't fully account for in the initial review. Given the overall architecture and the performance implications, this is definitely something to revisit. I need to make absolutely sure the function handles all data types correctly, and that the copying strategy is optimal. Is it truly utilizing the most efficient memory allocation methods? Are there any potential concurrency issues I should be aware of? Best to take another look at the code before making any assumptions.
|
| 29/2 |
2026/05/31 20:17 |
tool |
grepper |
0m
Args: map[Expression:valid_signal PathPrefix:kernel/]
Results: map[Output:kernel/debug/kdb/kdb_main.c=2326=static int kdb_kill(int argc, const char **argv)
--
kernel/debug/kdb/kdb_main.c-2335- return KDB_BADINT;
kernel/debug/kdb/kdb_main.c:2336: if ((sig >= 0) || !valid_signal(-sig)) {
kernel/debug/kdb/kdb_main.c-2337- kdb_printf("Invalid signal parameter.<-signal>\n");
--
kernel/fork.c=2868=static noinline int copy_clone_args_from_user(struct kernel_clone_args *kargs,
--
kernel/fork.c-2906- if (unlikely((args.exit_signal & ~((u64)CSIGNAL)) ||
kernel/fork.c:2907: !valid_signal(args.exit_signal)))
kernel/fork.c-2908- return -EINVAL;
--
kernel/ptrace.c=564=static int ptrace_detach(struct task_struct *child, unsigned int data)
kernel/ptrace.c-565-{
kernel/ptrace.c:566: if (!valid_signal(data))
kernel/ptrace.c-567- return -EIO;
--
kernel/ptrace.c=824=static int ptrace_resume(struct task_struct *child, long request,
--
kernel/ptrace.c-826-{
kernel/ptrace.c:827: if (!valid_signal(data))
kernel/ptrace.c-828- return -EIO;
--
kernel/signal.c=799=static int check_kill_permission(int sig, struct kernel_siginfo *info,
--
kernel/signal.c-804-
kernel/signal.c:805: if (!valid_signal(sig))
kernel/signal.c-806- return -EINVAL;
--
kernel/signal.c=1519=int kill_pid_usb_asyncio(int sig, int errno, sigval_t addr,
--
kernel/signal.c-1526-
kernel/signal.c:1527: if (!valid_signal(sig))
kernel/signal.c-1528- return ret;
--
kernel/signal.c=1610=int send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p)
--
kernel/signal.c-1615- */
kernel/signal.c:1616: if (!valid_signal(sig))
kernel/signal.c-1617- return -EINVAL;
--
kernel/signal.c=2166=bool do_notify_parent(struct task_struct *tsk, int sig)
--
kernel/signal.c-2173-
kernel/signal.c:2174: if (WARN_ON_ONCE(!valid_signal(sig)))
kernel/signal.c-2175- return false;
--
kernel/signal.c=4303=int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
--
kernel/signal.c-4308-
kernel/signal.c:4309: if (!valid_signal(sig) || sig < 1 || (act && sig_kernel_only(sig)))
kernel/signal.c-4310- return -EINVAL;
--
kernel/sys.c=2534=SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
--
kernel/sys.c-2547- case PR_SET_PDEATHSIG:
kernel/sys.c:2548: if (!valid_signal(arg2)) {
kernel/sys.c-2549- error = -EINVAL;
--
kernel/trace/bpf_trace.c=817=static int bpf_send_signal_common(u32 sig, enum pid_type type, struct task_struct *task, u64 value)
--
kernel/trace/bpf_trace.c-853- */
kernel/trace/bpf_trace.c:854: if (unlikely(!valid_signal(sig)))
kernel/trace/bpf_trace.c-855- return -EINVAL;
]
|
| 30/2 |
2026/05/31 20:17 |
llm |
expert |
1m
Model:
Tokens:
input: 17533
output: 28
thoughts: 248
Thoughts: **A Deep Dive into a Potential Kernel Vulnerability**
Okay, so I'm digging into this `clone` syscall, and something's not sitting right with me. I've noticed that it *doesn't* appear to validate the `exit_signal` argument. Specifically, there's no check for `valid_signal(args.exit_signal)` when the syscall is first called. This immediately raises a red flag in my mind.
Now, could someone potentially pass a `clone_flags` value that, when combined with `CSIGNAL`, leads to an invalid signal being used for `exit_signal`? Let's see... looking at the code, `clone_flags` is an `unsigned long`, and `CSIGNAL` is defined as `0x000000ff`. So, doing a bitwise AND between `clone_flags` and `CSIGNAL`, we can get a value up to 255.
Aha! If I set `clone_flags` to, say, 65 (which falls within the allowed range), then `args.exit_signal` will also become 65. The `kernel_clone` function then gets called, and crucially, in the `copy_process` function, the child process is created with `p->exit_signal = 65`.
Here's where it gets interesting. When this child process exits, `do_notify_parent` will be invoked with `sig = 65`. But now, `valid_signal(65)` will evaluate to false. This in turn triggers a `WARN_ON_ONCE(!valid_signal(sig))`. And, if `panic_on_warn` is enabled, this will cause the kernel to panic!
I'd like to confirm this thoroughly. To be absolutely sure, I'll need to double-check `copy_process` for any checks that might prevent `exit_signal` from being set to a value greater than 64. My intuition tells me there might not be any, and this could be a serious issue.
|
| 31/2 |
2026/05/31 20:18 |
tool |
grepper |
0m
Args: map[Expression:exit_signal PathPrefix:kernel/fork.c]
Results: map[Output:kernel/fork.c=1967=__latent_entropy struct task_struct *copy_process(
--
kernel/fork.c-2038- return ERR_PTR(-EINVAL);
kernel/fork.c:2039: if (args->exit_signal)
kernel/fork.c-2040- return ERR_PTR(-EINVAL);
--
kernel/fork.c-2419- if (clone_flags & CLONE_THREAD)
kernel/fork.c:2420: p->exit_signal = -1;
kernel/fork.c-2421- else
kernel/fork.c:2422: p->exit_signal = current->group_leader->exit_signal;
kernel/fork.c-2423- } else {
--
kernel/fork.c-2425- p->parent_exec_id = current->self_exec_id;
kernel/fork.c:2426: p->exit_signal = args->exit_signal;
kernel/fork.c-2427- }
--
kernel/fork.c=2649=struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node)
--
kernel/fork.c-2669- *
kernel/fork.c:2670: * args->exit_signal is expected to be checked for sanity by the caller.
kernel/fork.c-2671- */
kernel/fork.c=2672=pid_t kernel_clone(struct kernel_clone_args *args)
--
kernel/fork.c-2713- trace = PTRACE_EVENT_VFORK;
kernel/fork.c:2714: else if (args->exit_signal != SIGCHLD)
kernel/fork.c-2715- trace = PTRACE_EVENT_CLONE;
--
kernel/fork.c=2772=pid_t kernel_thread(int (*fn)(void *), void *arg, const char *name,
--
kernel/fork.c-2776- .flags = ((flags | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL),
kernel/fork.c:2777: .exit_signal = (flags & CSIGNAL),
kernel/fork.c-2778- .fn = fn,
--
kernel/fork.c=2790=pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long flags)
--
kernel/fork.c-2793- .flags = ((flags | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL),
kernel/fork.c:2794: .exit_signal = (flags & CSIGNAL),
kernel/fork.c-2795- .fn = fn,
--
kernel/fork.c=2803=SYSCALL_DEFINE0(fork)
--
kernel/fork.c-2806- struct kernel_clone_args args = {
kernel/fork.c:2807: .exit_signal = SIGCHLD,
kernel/fork.c-2808- };
--
kernel/fork.c=2819=SYSCALL_DEFINE0(vfork)
--
kernel/fork.c-2822- .flags = CLONE_VFORK | CLONE_VM,
kernel/fork.c:2823: .exit_signal = SIGCHLD,
kernel/fork.c-2824- };
--
kernel/fork.c=2848=SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
--
kernel/fork.c-2858- .parent_tid = parent_tidptr,
kernel/fork.c:2859: .exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
kernel/fork.c-2860- .stack = newsp,
--
kernel/fork.c=2868=static noinline int copy_clone_args_from_user(struct kernel_clone_args *kargs,
--
kernel/fork.c-2902- /*
kernel/fork.c:2903: * Verify that higher 32bits of exit_signal are unset and that
kernel/fork.c-2904- * it is a valid signal
kernel/fork.c-2905- */
kernel/fork.c:2906: if (unlikely((args.exit_signal & ~((u64)CSIGNAL)) ||
kernel/fork.c:2907: !valid_signal(args.exit_signal)))
kernel/fork.c-2908- return -EINVAL;
--
kernel/fork.c-2918- .parent_tid = u64_to_user_ptr(args.parent_tid),
kernel/fork.c:2919: .exit_signal = args.exit_signal,
kernel/fork.c-2920- .stack = args.stack,
--
kernel/fork.c=2965=static bool clone3_args_valid(struct kernel_clone_args *kargs)
--
kernel/fork.c-2985- if ((kargs->flags & (CLONE_THREAD | CLONE_PARENT)) &&
kernel/fork.c:2986: kargs->exit_signal)
kernel/fork.c-2987- return false;
]
|
| 32/2 |
2026/05/31 20:18 |
llm |
expert |
0m
Model:
Tokens:
input: 19652
output: 34
thoughts: 120
Thoughts: **Unraveling a Potential Security Flaw**
Okay, hold on a second. I just realized something about the `clone` system call. The fact that an unprivileged user can access it is intriguing. Specifically, if they call `clone` with `clone_flags = 65` (or anything in that range > 64 and <= 255), the child process exits immediately. And that's... that's triggering `WARN_ON_ONCE(!valid_signal(sig))`. Is it really that straightforward to exploit? It seems almost too simple.
I need to confirm if there are any other checks for `exit_signal` within the `clone` system call that I might be overlooking. Where is `clone` defined again? Right, it's in `kernel/fork.c`. Let's dive in and see if there are any other validation points that might mitigate this. This deserves a deeper look.
|
| 33/2 |
2026/05/31 20:18 |
tool |
read-file |
0m
Args: map[File:kernel/fork.c FirstLine:2848 LineCount:20]
Results: map[Contents:2848: SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
2849: int __user *, parent_tidptr,
2850: int __user *, child_tidptr,
2851: unsigned long, tls)
2852: #endif
2853: {
2854: struct kernel_clone_args args = {
2855: .flags = (lower_32_bits(clone_flags) & ~CSIGNAL),
2856: .pidfd = parent_tidptr,
2857: .child_tid = child_tidptr,
2858: .parent_tid = parent_tidptr,
2859: .exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
2860: .stack = newsp,
2861: .tls = tls,
2862: };
2863:
2864: return kernel_clone(&args);
2865: }
2866: #endif
2867:
]
|
| 34/2 |
2026/05/31 20:18 |
llm |
expert |
0m
Model:
Tokens:
input: 20314
output: 27
thoughts: 110
Thoughts: **Analyzing the Signal Handling in the `clone` System Call**
Okay, let's break this down. I'm looking at how signals are handled when a new process is created using the `clone` system call, and I'm focusing on the `exit_signal` parameter. My initial thought is, "Wait, `clone_flags` is coming directly from user space, which is always a red flag regarding security." I'm mentally parsing the code, and I see that `CSIGNAL` is defined as `0x000000ff`. So, `exit_signal` is calculated by doing a bitwise AND operation between `clone_flags` and `0xff`, which, in essence, is extracting the least significant byte of `clone_flags`.
Alright, so if `clone_flags & 0xff` evaluates to 65, for example, then `exit_signal` becomes 65. Now the crucial question is whether 65 is actually a valid signal number. That's where `valid_signal` comes in. It checks if the signal number (`sig`) is less than or equal to `_NSIG`. But now I'm thinking, "What exactly is `_NSIG`? That's the key to this whole thing! Is it the maximum valid signal number? Where is that defined? I need to check where `_NSIG` is defined, and what value is it assigned." I need to confirm the bounds of signal values. Any signal number greater than `_NSIG` would lead to unexpected behavior and possible security flaws.
|
| 35/2 |
2026/05/31 20:18 |
tool |
grepper |
0m
Args: map[Expression:#define _NSIG PathPrefix:include/]
Results: map[Output:include/uapi/asm-generic/signal.h-6-
include/uapi/asm-generic/signal.h:7:#define _NSIG 64
include/uapi/asm-generic/signal.h:8:#define _NSIG_BPW __BITS_PER_LONG
include/uapi/asm-generic/signal.h:9:#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
include/uapi/asm-generic/signal.h-10-
]
|
| 36/2 |
2026/05/31 20:18 |
llm |
expert |
0m
Model:
Tokens:
input: 20920
output: 34
thoughts: 286
Thoughts: **Analyzing a Kernel Bug**
Okay, so `_NSIG` is defined as 64. I'm looking at this code, and it seems like if `exit_signal` is 65, the `valid_signal(65)` check should fail, right? Let me double-check... Yes, `valid_signal(sig)` appears to be defined as `sig <= _NSIG ? 1 : 0`. Ah, but wait a minute... `valid_signal` takes an *unsigned long* `sig` as input. Hmm, this is interesting. If `sig` is 0, then `valid_signal(0)` will evaluate to true!
Now, the code calls `do_notify_parent` with `sig = tsk->exit_signal`. So, if `exit_signal` is 65, `valid_signal(65)` is indeed false as expected, and that triggers a `WARN_ON_ONCE(!valid_signal(sig))`. That's where the problem manifests. A `WARN_ON_ONCE` in a standard production kernel would just emit a warning and keep going.
But hold on, the bug report mentions a kernel panic: "Kernel panic - not syncing: kernel: panic_on_warn set...". That means the system is crashing because `panic_on_warn` is enabled. In a production environment *without* `panic_on_warn` set, the kernel would simply print a warning and return `false` from `do_notify_parent`. I need to now understand what happens if `do_notify_parent` returns `false`.
|
| 37/2 |
2026/05/31 20:18 |
tool |
read-file |
0m
Args: map[File:kernel/signal.c FirstLine:2166 LineCount:30]
Results: map[Contents:2166: bool do_notify_parent(struct task_struct *tsk, int sig)
2167: {
2168: struct kernel_siginfo info;
2169: unsigned long flags;
2170: struct sighand_struct *psig;
2171: bool autoreap = false;
2172: u64 utime, stime;
2173:
2174: if (WARN_ON_ONCE(!valid_signal(sig)))
2175: return false;
2176:
2177: /* do_notify_parent_cldstop should have been called instead. */
2178: WARN_ON_ONCE(task_is_stopped_or_traced(tsk));
2179:
2180: WARN_ON_ONCE(!tsk->ptrace && !thread_group_empty(tsk));
2181:
2182: /* ptraced, or group-leader without sub-threads */
2183: do_notify_pidfd(tsk);
2184:
2185: if (sig != SIGCHLD) {
2186: /*
2187: * This is only possible if parent == real_parent.
2188: * Check if it has changed security domain.
2189: */
2190: if (tsk->parent_exec_id != READ_ONCE(tsk->parent->self_exec_id))
2191: sig = SIGCHLD;
2192: }
2193:
2194: clear_siginfo(&info);
2195: info.si_signo = sig;
]
|
| 38/2 |
2026/05/31 20:18 |
llm |
expert |
0m
Model:
Tokens:
input: 22043
output: 33
thoughts: 21
Thoughts: Here's a summary of my thinking, expressed in the first person:
**Understanding the `autoreap` Flag**
Okay, so I'm focusing on how the `autoreap` flag behaves within the `exit_notify` function. The crucial point here is the conditional logic: a returned `false` value from some unspecified process directly impacts the state of `autoreap`. If the return value is `false`, then the `autoreap` flag is guaranteed to also be set to `false`. That's the core relationship I need to keep in mind as I delve into this code. This direct mapping suggests a potential dependency, and I need to consider what implications that dependency has.
|
| 39/2 |
2026/05/31 20:18 |
tool |
read-file |
0m
Args: map[File:kernel/exit.c FirstLine:750 LineCount:30]
Results: map[Contents: 750:
751: if (unlikely(tsk->ptrace)) {
752: int sig = thread_group_empty(tsk) && !ptrace_reparented(tsk)
753: ? tsk->exit_signal : SIGCHLD;
754: autoreap = do_notify_parent(tsk, sig);
755: } else if (thread_group_leader(tsk)) {
756: autoreap = thread_group_empty(tsk) &&
757: do_notify_parent(tsk, tsk->exit_signal);
758: } else {
759: autoreap = true;
760: /* untraced sub-thread */
761: do_notify_pidfd(tsk);
762: }
763:
764: if (autoreap) {
765: tsk->exit_state = EXIT_DEAD;
766: list_add(&tsk->ptrace_entry, &dead);
767: }
768:
769: /* mt-exec, de_thread() is waiting for group leader */
770: if (unlikely(tsk->signal->notify_count < 0))
771: wake_up_process(tsk->signal->group_exec_task);
772: write_unlock_irq(&tasklist_lock);
773:
774: list_for_each_entry_safe(p, n, &dead, ptrace_entry) {
775: list_del_init(&p->ptrace_entry);
776: release_task(p);
777: }
778: }
779:
]
|
| 40/2 |
2026/05/31 20:18 |
llm |
expert |
0m
Model:
Tokens:
input: 22723
output: 34
thoughts: 144
Thoughts: **My Analysis of Zombie Processes**
Okay, so I'm thinking through this `autoreap` flag... if it's set to `false`, the child task's `exit_state` just sticks at `EXIT_ZOMBIE`. That much is clear. But then I hit a snag. If `do_notify_parent` returns `false`, which means the parent isn't going to get notified, the child becomes a zombie. So, wait... if the parent *doesn't* know, how on earth is it going to `wait` for the child? It can't!
Of course! The parent doesn't *have* to be notified to `wait`! The parent process can still call a `wait` syscall directly or even call `waitpid` to find the zombie child, and `wait` will take care of it then. Let me just quickly confirm that the `wait` syscall actually checks `exit_signal`... and yup, if the parent *does* call `wait`, it's going to find that zombie child and reap it. Okay, that makes perfect sense. Right, I remember now... `wait_task_zombie` in `kernel/exit.c` handles all of this. Case closed.
|
| 41/2 |
2026/05/31 20:18 |
tool |
read-file |
0m
Args: map[File:kernel/exit.c FirstLine:1150 LineCount:50]
Results: map[Contents:1150: return 1;
1151:
1152: /*
1153: * Otherwise, wait for clone children *only* if __WCLONE is set;
1154: * otherwise, wait for non-clone children *only*.
1155: *
1156: * Note: a "clone" child here is one that reports to its parent
1157: * using a signal other than SIGCHLD, or a non-leader thread which
1158: * we can only see if it is traced by us.
1159: */
1160: if ((p->exit_signal != SIGCHLD) ^ !!(wo->wo_flags & __WCLONE))
1161: return 0;
1162:
1163: return 1;
1164: }
1165:
1166: /*
1167: * Handle sys_wait4 work for one task in state EXIT_ZOMBIE. We hold
1168: * read_lock(&tasklist_lock) on entry. If we return zero, we still hold
1169: * the lock and this task is uninteresting. If we return nonzero, we have
1170: * released the lock and the system call should return.
1171: */
1172: static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
1173: {
1174: int state, status;
1175: pid_t pid = task_pid_vnr(p);
1176: uid_t uid = from_kuid_munged(current_user_ns(), task_uid(p));
1177: struct waitid_info *infop;
1178:
1179: if (!likely(wo->wo_flags & WEXITED))
1180: return 0;
1181:
1182: if (unlikely(wo->wo_flags & WNOWAIT)) {
1183: status = (p->signal->flags & SIGNAL_GROUP_EXIT)
1184: ? p->signal->group_exit_code : p->exit_code;
1185: get_task_struct(p);
1186: read_unlock(&tasklist_lock);
1187: sched_annotate_sleep();
1188: if (wo->wo_rusage)
1189: getrusage(p, RUSAGE_BOTH, wo->wo_rusage);
1190: put_task_struct(p);
1191: goto out_info;
1192: }
1193: /*
1194: * Move the task's state to DEAD/TRACE, only one thread can do this.
1195: */
1196: state = (ptrace_reparented(p) && thread_group_leader(p)) ?
1197: EXIT_TRACE : EXIT_DEAD;
1198: if (cmpxchg(&p->exit_state, EXIT_ZOMBIE, state) != EXIT_ZOMBIE)
1199: return 0;
]
|
| 42/2 |
2026/05/31 20:18 |
llm |
expert |
0m
Model:
Tokens:
input: 24014
output: 33
thoughts: 201
Thoughts: **My Line of Reasoning About Child Process Handling**
Okay, let me break this down. First, `eligible_child` is the key. I see it uses `(p->exit_signal != SIGCHLD) ^ !!(wo->wo_flags & __WCLONE)` to determine if a child is eligible for `wait`. The important thing I'm focused on is that if `exit_signal` is 65 (which I know is a potentially important value, I'll need to remember why), and the process *doesn't* have the `__WCLONE` flag, then this child *won't* be matched by a regular `wait`. However, if the `__WCLONE` *is* set, then the child will be eligible. This is a crucial distinction.
So, in essence, the parent can use the `__WCLONE` flag in its `wait` call to specifically target this child. If it *doesn't* wait, the child becomes a zombie. That much is clear. Now comes the interesting part: when the parent exits, the zombie child gets reparented, probably to `init`, but potentially to a subreaper. And `init` typically uses a `wait` with `__WALL`, which *should* match all children, which I'm familiar with from previous investigations. Therefore, `init` *should* clean up the zombie.
But... what if the *parent* exits? I need to think about that. I see that `forget_original_parent` is called, which handles the reparenting. Does that mean the child's new parent is even notified? The notification aspect is key to understanding how we prevent leaks. I need to investigate that further. This reparenting process's impact on reaping is something I need to keep in mind, and that question is key to the problem space.
|
| 43/2 |
2026/05/31 20:18 |
tool |
read-file |
0m
Args: map[File:kernel/exit.c FirstLine:690 LineCount:50]
Results: map[Contents: 690: }
691:
692: kill_orphaned_pgrp(p, father);
693: }
694:
695: /*
696: * Make init inherit all the child processes
697: */
698: static void forget_original_parent(struct task_struct *father,
699: struct list_head *dead)
700: {
701: struct task_struct *p, *t, *reaper;
702:
703: if (unlikely(!list_empty(&father->ptraced)))
704: exit_ptrace(father, dead);
705:
706: /* Can drop and reacquire tasklist_lock */
707: reaper = find_child_reaper(father, dead);
708: if (list_empty(&father->children))
709: return;
710:
711: reaper = find_new_reaper(father, reaper);
712: list_for_each_entry(p, &father->children, sibling) {
713: for_each_thread(p, t) {
714: RCU_INIT_POINTER(t->real_parent, reaper);
715: BUG_ON((!t->ptrace) != (rcu_access_pointer(t->parent) == father));
716: if (likely(!t->ptrace))
717: t->parent = t->real_parent;
718: if (t->pdeath_signal)
719: group_send_sig_info(t->pdeath_signal,
720: SEND_SIG_NOINFO, t,
721: PIDTYPE_TGID);
722: }
723: /*
724: * If this is a threaded reparent there is no need to
725: * notify anyone anything has happened.
726: */
727: if (!same_thread_group(reaper, father))
728: reparent_leader(father, p, dead);
729: }
730: list_splice_tail_init(&father->children, &reaper->children);
731: }
732:
733: /*
734: * Send signals to all our closest relatives so that they know
735: * to properly mourn us..
736: */
737: static void exit_notify(struct task_struct *tsk, int group_dead)
738: {
739: bool autoreap;
]
|
| 44/2 |
2026/05/31 20:18 |
llm |
expert |
0m
Model:
Tokens:
input: 25386
output: 33
thoughts: 10
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:
**Initial Assessment: Navigating the Hierarchy**
Alright, first thing's first: `reparent_leader`. That's the command, function, or method I need to focus on. My initial assessment is it's handling some form of hierarchical relationship, likely in a leader-follower dynamic within a system. Given that context, I need to understand *how* it's reparenting the leader. Does it affect the leader's direct followers? How does it handle any cascading effects? Are there ownership or permissions considerations? My expert intuition kicks in; I immediately want to know the scope and impact. The name itself raises a few flags. I wonder if it changes the root leader, or changes the affiliation of this node with another.
|
| 45/2 |
2026/05/31 20:18 |
tool |
read-file |
0m
Args: map[File:kernel/exit.c FirstLine:660 LineCount:30]
Results: map[Contents: 660: if (!reaper->signal->is_child_subreaper)
661: continue;
662: thread = find_alive_thread(reaper);
663: if (thread)
664: return thread;
665: }
666: }
667:
668: return child_reaper;
669: }
670:
671: /*
672: * Any that need to be release_task'd are put on the @dead list.
673: */
674: static void reparent_leader(struct task_struct *father, struct task_struct *p,
675: struct list_head *dead)
676: {
677: if (unlikely(p->exit_state == EXIT_DEAD))
678: return;
679:
680: /* We don't want people slaying init. */
681: p->exit_signal = SIGCHLD;
682:
683: /* If it has exited notify the new parent about this child's death. */
684: if (!p->ptrace &&
685: p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) {
686: if (do_notify_parent(p, p->exit_signal)) {
687: p->exit_state = EXIT_DEAD;
688: list_add(&p->ptrace_entry, dead);
689: }
]
|
| 46/2 |
2026/05/31 20:18 |
llm |
expert |
0m
Model:
Tokens:
input: 26051
output: 34
thoughts: 1194
Thoughts: **Analyzing the Invalid Signal in `do_notify_parent`**
Okay, so I'm digging into this issue with potential invalid signals reaching `do_notify_parent`. My initial thought was the `reparent_leader` function resets `p->exit_signal` to `SIGCHLD` upon reparenting, making a `SIGCHLD` signal valid for the new parent. But what's causing the `WARN_ON_ONCE(!valid_signal(sig))` check to trigger? It seems the concern is where a child process exits and attempts to notify its *original* parent.
I need to consider all the places `do_notify_parent` is called. Ah, `ptrace`! The code in `exit_notify` has me looking closely. It checks `tsk->ptrace` first. If `tsk->ptrace` is set, and the thread group is empty (and not reparented), the code determines the signal to send as `tsk->exit_signal`, otherwise it defaults to `SIGCHLD`. If `tsk->exit_signal` is invalid at that point, `do_notify_parent` will warn. If no `ptrace` is in play, and the thread group leader is exiting, it uses `tsk->exit_signal` again. This is where I'm seeing a possible vector.
Let's test this! My quick C program using `clone` will confirm if the issue exists. Setting `exit_signal` to an invalid number (like 65) should trigger a warning. And boom, it does. Running this program will expose the kernel's behavior. The child exits, `exit_notify` calls `do_notify_parent(tsk, 65)`, `valid_signal(65)` is false, and the `WARN_ON_ONCE` triggers.
Now the million-dollar question: is this a security issue? In a typical production kernel, `panic_on_warn` won't be set. Instead, the warning will simply get logged, and `do_notify_parent` will return `false`. This means `autoreap` is `false`, and the child becomes a zombie. The parent can still wait on it, but if the parent doesn't wait, the child stays a zombie until the parent exits. At that point, `reparent_leader` kicks in, sets `p->exit_signal` to `SIGCHLD`, and calls `do_notify_parent(p, SIGCHLD)`. `SIGCHLD` is valid, so `do_notify_parent` returns false (since init is not ignoring `SIGCHLD`). Then `init` reaps it. This resolves the zombie and there is no memory leak. Okay, it's just a one-time warning, and not a spam DoS either.
Okay, is there any state corruption? Let's check the consequences of `do_notify_parent` returning false. It's just that the signal wasn't ignored and is not a valid one. Wait, what if `exit_signal` is 0? `valid_signal(0)` returns true! The kernel doesn't warn. But, `do_notify_parent` still has that conditional block where it can force the signal to SIGCHLD. If `sig` is 0, then the info to be sent to parent will be `info.si_signo = 0`. That gets passed to `__group_send_sig_info`. Hmm, `__group_send_sig_info` with `sig == 0`? That's concerning.
|
| 47/2 |
2026/05/31 20:19 |
tool |
read-file |
0m
Args: map[File:kernel/signal.c FirstLine:2190 LineCount:50]
Results: map[Contents:2190: if (tsk->parent_exec_id != READ_ONCE(tsk->parent->self_exec_id))
2191: sig = SIGCHLD;
2192: }
2193:
2194: clear_siginfo(&info);
2195: info.si_signo = sig;
2196: info.si_errno = 0;
2197: /*
2198: * We are under tasklist_lock here so our parent is tied to
2199: * us and cannot change.
2200: *
2201: * task_active_pid_ns will always return the same pid namespace
2202: * until a task passes through release_task.
2203: *
2204: * write_lock() currently calls preempt_disable() which is the
2205: * same as rcu_read_lock(), but according to Oleg, this is not
2206: * correct to rely on this
2207: */
2208: rcu_read_lock();
2209: info.si_pid = task_pid_nr_ns(tsk, task_active_pid_ns(tsk->parent));
2210: info.si_uid = from_kuid_munged(task_cred_xxx(tsk->parent, user_ns),
2211: task_uid(tsk));
2212: rcu_read_unlock();
2213:
2214: task_cputime(tsk, &utime, &stime);
2215: info.si_utime = nsec_to_clock_t(utime + tsk->signal->utime);
2216: info.si_stime = nsec_to_clock_t(stime + tsk->signal->stime);
2217:
2218: info.si_status = tsk->exit_code & 0x7f;
2219: if (tsk->exit_code & 0x80)
2220: info.si_code = CLD_DUMPED;
2221: else if (tsk->exit_code & 0x7f)
2222: info.si_code = CLD_KILLED;
2223: else {
2224: info.si_code = CLD_EXITED;
2225: info.si_status = tsk->exit_code >> 8;
2226: }
2227:
2228: psig = tsk->parent->sighand;
2229: spin_lock_irqsave(&psig->siglock, flags);
2230: if (!tsk->ptrace && sig == SIGCHLD &&
2231: (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN ||
2232: (psig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDWAIT))) {
2233: /*
2234: * We are exiting and our parent doesn't care. POSIX.1
2235: * defines special semantics for setting SIGCHLD to SIG_IGN
2236: * or setting the SA_NOCLDWAIT flag: we should be reaped
2237: * automatically and not left for our parent's wait4 call.
2238: * Rather than having the parent do it as a magic kind of
2239: * signal handler, we just set this to tell do_exit that we
]
|
| 48/2 |
2026/05/31 20:19 |
llm |
expert |
1m
Model:
Tokens:
input: 28991
output: 34
thoughts: 39
Thoughts: Okay, let me think this through.
**Analyzing the Signal Handling Logic**
Hold on a second... if the signal value (`sig`) is equal to zero, that `do_notify_parent` function is going to be invoked. And that call is going to lead into `__group_send_sig_info`. It looks like this is where signals get propagated to the parent process. And looking closer at the code, it looks like if the signal is zero then the signal info structure `info` gets sent, along with a null signal number (which is what the 0 represents) and sent to the parent task (`tsk->parent`). I need to investigate what zero means in this context and why a zero signal might be sent at all, or if it's some kind of sentinel value... Is it an error indication, or a "no signal" signal? I need to understand the implications of sending a zero signal and how the parent task handles that.
|
| 49/2 |
2026/05/31 20:20 |
tool |
read-file |
0m
Args: map[File:kernel/signal.c FirstLine:2240 LineCount:50]
Results: map[Contents:2240: * can be cleaned up without becoming a zombie. Note that
2241: * we still call __wake_up_parent in this case, because a
2242: * blocked sys_wait4 might now return -ECHILD.
2243: *
2244: * Whether we send SIGCHLD or not for SA_NOCLDWAIT
2245: * is implementation-defined: we do (if you don't want
2246: * it, just use SIG_IGN instead).
2247: */
2248: autoreap = true;
2249: if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN)
2250: sig = 0;
2251: }
2252: if (!tsk->ptrace && tsk->signal->autoreap) {
2253: autoreap = true;
2254: sig = 0;
2255: }
2256: /*
2257: * Send with __send_signal as si_pid and si_uid are in the
2258: * parent's namespaces.
2259: */
2260: if (sig)
2261: __send_signal_locked(sig, &info, tsk->parent, PIDTYPE_TGID, false);
2262: __wake_up_parent(tsk, tsk->parent);
2263: spin_unlock_irqrestore(&psig->siglock, flags);
2264:
2265: return autoreap;
2266: }
2267:
2268: /**
2269: * do_notify_parent_cldstop - notify parent of stopped/continued state change
2270: * @tsk: task reporting the state change
2271: * @for_ptracer: the notification is for ptracer
2272: * @why: CLD_{CONTINUED|STOPPED|TRAPPED} to report
2273: *
2274: * Notify @tsk's parent that the stopped/continued state has changed. If
2275: * @for_ptracer is %false, @tsk's group leader notifies to its real parent.
2276: * If %true, @tsk reports to @tsk->parent which should be the ptracer.
2277: *
2278: * CONTEXT:
2279: * Must be called with tasklist_lock at least read locked.
2280: */
2281: static void do_notify_parent_cldstop(struct task_struct *tsk,
2282: bool for_ptracer, int why)
2283: {
2284: struct kernel_siginfo info;
2285: unsigned long flags;
2286: struct task_struct *parent;
2287: struct sighand_struct *sighand;
2288: u64 utime, stime;
2289:
]
|
| 50/2 |
2026/05/31 20:20 |
llm |
expert |
0m
Model:
Tokens:
input: 30069
output: 25
thoughts: 1306
Thoughts: **Analyzing the `exit_signal` Vulnerability**
Okay, so the code hits an interesting spot with `if (sig) __send_signal_locked(...)`. If `sig` is 0, it skips sending a signal, but still wakes the parent. That's fine. Now, `valid_signal(0)` is true, so no `WARN_ON_ONCE` there. The warning only fires if `sig > _NSIG` (greater than 64), which is the key here. The `clone` syscall allows `exit_signal` to be up to 255. So, if `exit_signal` is between 65 and 255, `valid_signal` is false, and `WARN_ON_ONCE` triggers. And if `panic_on_warn` is set, bam, it panics.
But what if `panic_on_warn` isn't set? Then, the `WARN_ON_ONCE` just prints a warning and returns `false`. If `do_notify_parent` returns false, `autoreap` is false, and the child becomes a zombie. The parent *should* wait for the child, but if it doesn't, the zombie just sits there until the parent exits. Then, `reparent_leader` sets `p->exit_signal = SIGCHLD` and calls `do_notify_parent(p, SIGCHLD)`. `SIGCHLD` is a valid signal, so `do_notify_parent` returns `false` (because `init` doesn't ignore `SIGCHLD`). Then `init` will wait for and reap the zombie. Therefore, there's no memory leak, and no real denial of service... aside from that single warning in dmesg, and wait, that warning is only once per boot. So, it's not even spam.
Security-wise, is it a problem? If `do_notify_parent` returns `false`, it skips sending the signal. But the user *explicitly* requested an invalid signal. So not sending the signal is actually the desired behavior. And what about negative `exit_signal` values? No, since `clone_flags` is unsigned long and `CSIGNAL` is `0xff`, the `exit_signal` value is always positive. Now wait, I know `clone3` checks `valid_signal(args.exit_signal)`, but `clone` doesn't! Hmmm... Is there *any* other way to set `exit_signal`? Nope. It's only set in `clone`/`fork`.
Okay, let's see if there are other effects. Is it exploitable? No, just a `WARN_ON_ONCE`. Is it a DoS? Well, usually `panic_on_warn` isn't set in production. Some systems might have `panic_on_warn=1` (like syzbot or hardened setups), but generally, `WARN_ON` is not a DoS unless it causes a crash or hang in the standard configuration. The prompt's DoS definition is useful.
Here the condition is handled:
```c
if (WARN_ON_ONCE(!valid_signal(sig)))
return false;
```
It returns `false`, and that is properly handled by the caller (`exit_notify`). Therefore, it does *not* cause a DoS in a typical production scenario.
Let's double-check the `clone` code.
```c
SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
int __user *, parent_tidptr,
int __user *, child_tidptr,
unsigned long, tls)
{
struct kernel_clone_args args = {
.flags = (lower_32_bits(clone_flags) & ~CSIGNAL),
.pidfd = parent_tidptr,
.child_tid = child_tidptr,
.parent_tid = parent_tidptr,
.exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
.stack = newsp,
.tls = tls,
};
return kernel_clone(&args);
}
```
Yes, `exit_signal` is `lower_32_bits(clone_flags) & CSIGNAL`. `CSIGNAL` is `0x000000ff`. So it can be up to 255. `kernel_clone` doesn't check `valid_signal(args->exit_signal)`. And neither does `copy_process`. It just assigns
|
| 51/2 |
2026/05/31 20:20 |
tool |
grepper |
0m
Args: map[Expression:exit_signal PathPrefix:kernel/]
Results: map[Output:kernel/exit.c=134=static void __unhash_process(struct release_task_post *post, struct task_struct *p,
--
kernel/exit.c-158- */
kernel/exit.c:159:static void __exit_signal(struct release_task_post *post, struct task_struct *tsk)
kernel/exit.c-160-{
--
kernel/exit.c=244=void release_task(struct task_struct *p)
--
kernel/exit.c-264- ptrace_release_task(p);
kernel/exit.c:265: __exit_signal(&post, p);
kernel/exit.c-266-
--
kernel/exit.c-283- */
kernel/exit.c:284: zap_leader = do_notify_parent(leader, leader->exit_signal);
kernel/exit.c-285- if (zap_leader)
--
kernel/exit.c=674=static void reparent_leader(struct task_struct *father, struct task_struct *p,
--
kernel/exit.c-680- /* We don't want people slaying init. */
kernel/exit.c:681: p->exit_signal = SIGCHLD;
kernel/exit.c-682-
--
kernel/exit.c-685- p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) {
kernel/exit.c:686: if (do_notify_parent(p, p->exit_signal)) {
kernel/exit.c-687- p->exit_state = EXIT_DEAD;
--
kernel/exit.c=737=static void exit_notify(struct task_struct *tsk, int group_dead)
--
kernel/exit.c-752- int sig = thread_group_empty(tsk) && !ptrace_reparented(tsk)
kernel/exit.c:753: ? tsk->exit_signal : SIGCHLD;
kernel/exit.c-754- autoreap = do_notify_parent(tsk, sig);
--
kernel/exit.c-756- autoreap = thread_group_empty(tsk) &&
kernel/exit.c:757: do_notify_parent(tsk, tsk->exit_signal);
kernel/exit.c-758- } else {
--
kernel/exit.c=895=void __noreturn do_exit(long code)
--
kernel/exit.c-916- sched_mm_cid_exit(tsk);
kernel/exit.c:917: exit_signals(tsk); /* sets PF_EXITING */
kernel/exit.c-918-
--
kernel/exit.c=1140=eligible_child(struct wait_opts *wo, bool ptrace, struct task_struct *p)
--
kernel/exit.c-1159- */
kernel/exit.c:1160: if ((p->exit_signal != SIGCHLD) ^ !!(wo->wo_flags & __WCLONE))
kernel/exit.c-1161- return 0;
--
kernel/exit.c=1172=static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
--
kernel/exit.c-1272- state = EXIT_ZOMBIE;
kernel/exit.c:1273: if (do_notify_parent(p, p->exit_signal))
kernel/exit.c-1274- state = EXIT_DEAD;
--
kernel/fork.c=1967=__latent_entropy struct task_struct *copy_process(
--
kernel/fork.c-2038- return ERR_PTR(-EINVAL);
kernel/fork.c:2039: if (args->exit_signal)
kernel/fork.c-2040- return ERR_PTR(-EINVAL);
--
kernel/fork.c-2419- if (clone_flags & CLONE_THREAD)
kernel/fork.c:2420: p->exit_signal = -1;
kernel/fork.c-2421- else
kernel/fork.c:2422: p->exit_signal = current->group_leader->exit_signal;
kernel/fork.c-2423- } else {
--
kernel/fork.c-2425- p->parent_exec_id = current->self_exec_id;
kernel/fork.c:2426: p->exit_signal = args->exit_signal;
kernel/fork.c-2427- }
--
kernel/fork.c=2649=struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node)
--
kernel/fork.c-2669- *
kernel/fork.c:2670: * args->exit_signal is expected to be checked for sanity by the caller.
kernel/fork.c-2671- */
kernel/fork.c=2672=pid_t kernel_clone(struct kernel_clone_args *args)
--
kernel/fork.c-2713- trace = PTRACE_EVENT_VFORK;
kernel/fork.c:2714: else if (args->exit_signal != SIGCHLD)
kernel/fork.c-2715- trace = PTRACE_EVENT_CLONE;
--
kernel/fork.c=2772=pid_t kernel_thread(int (*fn)(void *), void *arg, const char *name,
--
kernel/fork.c-2776- .flags = ((flags | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL),
kernel/fork.c:2777: .exit_signal = (flags & CSIGNAL),
kernel/fork.c-2778- .fn = fn,
--
kernel/fork.c=2790=pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long flags)
--
kernel/fork.c-2793- .flags = ((flags | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL),
kernel/fork.c:2794: .exit_signal = (flags & CSIGNAL),
kernel/fork.c-2795- .fn = fn,
--
kernel/fork.c=2803=SYSCALL_DEFINE0(fork)
--
kernel/fork.c-2806- struct kernel_clone_args args = {
kernel/fork.c:2807: .exit_signal = SIGCHLD,
kernel/fork.c-2808- };
--
kernel/fork.c=2819=SYSCALL_DEFINE0(vfork)
--
kernel/fork.c-2822- .flags = CLONE_VFORK | CLONE_VM,
kernel/fork.c:2823: .exit_signal = SIGCHLD,
kernel/fork.c-2824- };
--
kernel/fork.c=2848=SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
--
kernel/fork.c-2858- .parent_tid = parent_tidptr,
kernel/fork.c:2859: .exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
kernel/fork.c-2860- .stack = newsp,
--
kernel/fork.c=2868=static noinline int copy_clone_args_from_user(struct kernel_clone_args *kargs,
--
kernel/fork.c-2902- /*
kernel/fork.c:2903: * Verify that higher 32bits of exit_signal are unset and that
kernel/fork.c-2904- * it is a valid signal
kernel/fork.c-2905- */
kernel/fork.c:2906: if (unlikely((args.exit_signal & ~((u64)CSIGNAL)) ||
kernel/fork.c:2907: !valid_signal(args.exit_signal)))
kernel/fork.c-2908- return -EINVAL;
--
kernel/fork.c-2918- .parent_tid = u64_to_user_ptr(args.parent_tid),
kernel/fork.c:2919: .exit_signal = args.exit_signal,
kernel/fork.c-2920- .stack = args.stack,
--
kernel/fork.c=2965=static bool clone3_args_valid(struct kernel_clone_args *kargs)
--
kernel/fork.c-2985- if ((kargs->flags & (CLONE_THREAD | CLONE_PARENT)) &&
kernel/fork.c:2986: kargs->exit_signal)
kernel/fork.c-2987- return false;
--
kernel/futex/pi.c=321=static int handle_exit_race(u32 __user *uaddr, u32 uval,
--
kernel/futex/pi.c-340- * futex_lock_pi_atomic()
kernel/futex/pi.c:341: * exit_signals(tsk) No waiters:
kernel/futex/pi.c-342- * tsk->flags |= PF_EXITING; *uaddr == 0x00000PID
--
kernel/pid.c=879=static struct file *__pidfd_fget(struct task_struct *task, int fd)
--
kernel/pid.c-898- * either:
kernel/pid.c:899: * 1. before exit_signals(), which gives a real fd
kernel/pid.c-900- * 2. before exit_files() takes the task_lock() gives a real fd
kernel/pid.c-901- * 3. after exit_files() releases task_lock(), ->files is NULL;
kernel/pid.c:902: * this has PF_EXITING, since it was set in exit_signals(),
kernel/pid.c-903- * __pidfd_fget() returns EBADF.
--
kernel/ptrace.c=239=static int ptrace_check_attach(struct task_struct *child, bool ignore_state)
--
kernel/ptrace.c-253- * child->sighand can't be NULL, release_task()
kernel/ptrace.c:254: * does ptrace_unlink() before __exit_signal().
kernel/ptrace.c-255- */
--
kernel/ptrace.c=538=static bool __ptrace_detach(struct task_struct *tracer, struct task_struct *p)
--
kernel/ptrace.c-550- if (!same_thread_group(p->real_parent, tracer))
kernel/ptrace.c:551: dead = do_notify_parent(p, p->exit_signal);
kernel/ptrace.c-552- else if (ignoring_children(tracer->sighand) ||
--
kernel/signal.c=1356=struct sighand_struct *lock_task_sighand(struct task_struct *tsk,
--
kernel/signal.c-1374- * after we take the lock, we can race with de_thread() or
kernel/signal.c:1375: * __exit_signal(). In the latter case the next iteration
kernel/signal.c-1376- * must see ->sighand == NULL.
--
kernel/signal.c=1974=void posixtimer_send_sigqueue(struct k_itimer *tmr)
--
kernel/signal.c-2022- * ignored independent of its queued state. This
kernel/signal.c:2023: * gets cleaned up in __exit_signal().
kernel/signal.c-2024- */
--
kernel/signal.c=3093=static void retarget_shared_pending(struct task_struct *tsk, sigset_t *which)
--
kernel/signal.c-3118-
kernel/signal.c:3119:void exit_signals(struct task_struct *tsk)
kernel/signal.c-3120-{
--
kernel/sys.c=1794=SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim)
--
kernel/sys.c-1829- * exiting. So we should place a read memory barrier when we avoid the lock.
kernel/sys.c:1830: * On the writer side, write memory barrier is implied in __exit_signal
kernel/sys.c:1831: * as __exit_signal releases the siglock spinlock after updating the signal->
kernel/sys.c-1832- * fields. But we don't do this yet to keep things simple.
--
kernel/vhost_task.c=119=struct vhost_task *vhost_task_create(bool (*fn)(void *),
--
kernel/vhost_task.c-125- CLONE_THREAD | CLONE_SIGHAND,
kernel/vhost_task.c:126: .exit_signal = 0,
kernel/vhost_task.c-127- .fn = vhost_task_fn,
]
|
| 52/2 |
2026/05/31 20:20 |
llm |
expert |
0m
Model:
Tokens:
input: 35855
output: 33
thoughts: 1464
Thoughts: **Analyzing Potential Denial-of-Service Vulnerability Related to `exit_signal`**
Okay, let's break this down. I'm looking at how `exit_signal` is used in the kernel, specifically concerning the potential for a denial-of-service condition. Initially, I zeroed in on `__ptrace_detach` in `kernel/ptrace.c:551` and the potential `WARN_ON_ONCE` if `p->exit_signal` is greater than 64. However, that's the *same* warning that I'm already aware of. Moving on, I checked `eligible_child` in `kernel/exit.c`. The code explicitly handles `p->exit_signal` being 65 (which is `!= SIGCHLD`), so that's functioning as expected. Then, I looked at `wait_task_zombie`, also in `kernel/exit.c`. This is called when `ptrace_reparented(p)` is true, and if `do_notify_parent` returns false, it stays in `EXIT_ZOMBIE`. So, it seems like the only issue is the `WARN_ON_ONCE`.
But is that `WARN_ON_ONCE` actually a DoS? I recalled the prompt's instructions: if the condition flagged by the `WARN_ON_ONCE` is handled by normal control flow (e.g., within an `if` statement), it won't cause DoS. Here, the warning is suppressed by a `return false`.
So, that's not a DoS.
Then, I shifted my focus to `kernel/fork.c`, specifically `p->exit_signal`. I saw that if `CLONE_THREAD` is set, `p->exit_signal` is set to `-1`. That's an invalid signal. Let's check `valid_signal(-1)`. Since `-1` as `unsigned long` is `ULONG_MAX`, this is false. That means it triggers the `WARN_ON_ONCE`.
Now, if `exit_signal` is `-1`, where is it *used*? I went back to `exit_notify`. For threads, there are two code paths: if ptrace is *not* enabled, it is not used in `do_notify_parent()`. If ptrace *is* enabled for sub-threads. If the sub-thread is empty, the signal passed to `do_notify_parent` is `tsk->exit_signal` which can be `-1`. Otherwise it will be `SIGCHLD`.
So, if `CLONE_THREAD` is set, and ptrace is active, then `-1` *could* be passed to `do_notify_parent`. This path seems to be the one that can trigger `WARN_ON_ONCE`. However, how this occurs is subtle. If the leader exits, the sub-thread becomes the last thread and is used to signal the parent process. If `tsk->exit_signal` is `-1`, then the `WARN_ON_ONCE` is triggered.
In other words, a ptrace'd sub-thread *can* trigger the warning, but it's *handled* in the control flow, so it does *not* cause a denial of service. The code handles the invalid signal, so it's not a true DoS, although it does issue a warning.
|
| 53/2 |
2026/05/31 20:20 |
tool |
read-file |
0m
Args: map[File:kernel/exit.c FirstLine:737 LineCount:50]
Results: map[Contents: 737: static void exit_notify(struct task_struct *tsk, int group_dead)
738: {
739: bool autoreap;
740: struct task_struct *p, *n;
741: LIST_HEAD(dead);
742:
743: write_lock_irq(&tasklist_lock);
744: forget_original_parent(tsk, &dead);
745:
746: if (group_dead)
747: kill_orphaned_pgrp(tsk->group_leader, NULL);
748:
749: tsk->exit_state = EXIT_ZOMBIE;
750:
751: if (unlikely(tsk->ptrace)) {
752: int sig = thread_group_empty(tsk) && !ptrace_reparented(tsk)
753: ? tsk->exit_signal : SIGCHLD;
754: autoreap = do_notify_parent(tsk, sig);
755: } else if (thread_group_leader(tsk)) {
756: autoreap = thread_group_empty(tsk) &&
757: do_notify_parent(tsk, tsk->exit_signal);
758: } else {
759: autoreap = true;
760: /* untraced sub-thread */
761: do_notify_pidfd(tsk);
762: }
763:
764: if (autoreap) {
765: tsk->exit_state = EXIT_DEAD;
766: list_add(&tsk->ptrace_entry, &dead);
767: }
768:
769: /* mt-exec, de_thread() is waiting for group leader */
770: if (unlikely(tsk->signal->notify_count < 0))
771: wake_up_process(tsk->signal->group_exec_task);
772: write_unlock_irq(&tasklist_lock);
773:
774: list_for_each_entry_safe(p, n, &dead, ptrace_entry) {
775: list_del_init(&p->ptrace_entry);
776: release_task(p);
777: }
778: }
779:
780: #ifdef CONFIG_DEBUG_STACK_USAGE
781: #ifdef CONFIG_STACK_GROWSUP
782: unsigned long stack_not_used(struct task_struct *p)
783: {
784: unsigned long *n = end_of_stack(p);
785:
786: do { /* Skip over canary */
]
|
| 54/2 |
2026/05/31 20:20 |
llm |
expert |
0m
Model:
Tokens:
input: 38864
output: 28
thoughts: 1464
Thoughts: **Analysis of the Kernel Exit Signal Bug**
Okay, let's break this down. My initial thought process was: if `tsk->ptrace` is true, and the thread group is empty, and it hasn't been reparented, then `sig` becomes `tsk->exit_signal`. If it's a sub-thread, that signal is usually `-1`. So, we're likely calling `do_notify_parent(tsk, -1)`. But does `thread_group_empty(tsk)` ever actually evaluate to true for a sub-thread?
`thread_group_empty` checks if the thread group list is empty. If the leader and all sub-threads have exited, it *could* be empty. But, the leader is never reaped before the sub-threads. It stays a zombie until the whole group is gone. So, it's false for the sub-thread while the leader is alive. Oh, wait... what if the leader is reaped? Then the list *could* be empty. But, the leader cannot be reaped until `thread_group_empty` is true. So the list is never empty for a sub-thread. So `thread_group_empty(tsk)` is always false for a sub-thread. The signal *should* always be `SIGCHLD`. And so `-1` would never be passed to `do_notify_parent`.
However, the reported bug happens when `clone` is called with a specific flag (`clone_flags = 65`, no `CLONE_THREAD`). This means the thread leader is created. When it exits, and there are no sub-threads, the `thread_group_empty(tsk)` condition becomes true. So, `do_notify_parent(tsk, 65)` is called. This triggers a `WARN_ON_ONCE(!valid_signal(65))`. Aha!
So, the core problem is that `clone` allows an `exit_signal` value greater than 64. When it exits, this invalid signal value triggers the warning. Thankfully, `WARN_ON_ONCE` is handled gracefully. It returns `false`, so it doesn't cause a crash, hang, deadlock, resource leak, or privilege escalation. Itβs accessible from unprivileged processes because `clone` is unprivileged and from within user namespaces. It's not a VM trigger, network, or peripheral trigger, nor a filesystem issue.
Let's double-check other locations for implications. I then looked at `kernel/exit.c`. There's this code block:
```c
if ((p->exit_signal != SIGCHLD) ^ !!(wo->wo_flags & __WCLONE))
return 0;
```
If `exit_signal` is 65, the comparison makes this behave like a clone child. Okay, this is expected behavior. In `kernel/fork.c`, there's a check for `CLONE_AUTOREAP`, which prevents the usage of `exit_signal`. So this code path is fine. In `kernel/fork.c`, there's another check related to `CLONE_THREAD`, but `clone3` already ensures `valid_signal`.
So, the issue *is* the warning. Let's refer back to the syzbot report:
```
WARNING: kernel/signal.c:2174 at do_notify_parent+0xea8/0x10b0 kernel/signal.c:2174, CPU#2: syz.2.2072/13056
Kernel panic - not syncing: panic_on_warn set ...
```
That's it, the warning exactly.
**In summary**:
* Exploitable: No. It is just a `WARN_ON_ONCE`.
* Denial of Service: No. In production, it prints a warning and continues. The condition is handled by returning `false`.
* Accessible From Unprivileged Processes: Yes. The `clone` syscall is available.
* Accessible From User Namespaces: Yes.
* VM Guest Trigger: No.
* VM Host Trigger: No.
* Network Trigger: No.
* Remote Trigger: No.
* Peripheral Trigger: No.
* Malicious Filesystem Trigger: No.
Hold on, could `exit_signal` be used for out-of-bounds reads/writes? Let's re-examine `do_notify_parent`:
```c
if (WARN_ON_ONCE(!valid_signal(sig)))
return false;
```
It returns `false` immediately if the signal is invalid, which means
|
| 55/2 |
2026/05/31 20:21 |
tool |
grepper |
0m
Args: map[Expression:exit_signal PathPrefix:kernel/signal.c]
Results: map[Output:kernel/signal.c=1356=struct sighand_struct *lock_task_sighand(struct task_struct *tsk,
--
kernel/signal.c-1374- * after we take the lock, we can race with de_thread() or
kernel/signal.c:1375: * __exit_signal(). In the latter case the next iteration
kernel/signal.c-1376- * must see ->sighand == NULL.
--
kernel/signal.c=1974=void posixtimer_send_sigqueue(struct k_itimer *tmr)
--
kernel/signal.c-2022- * ignored independent of its queued state. This
kernel/signal.c:2023: * gets cleaned up in __exit_signal().
kernel/signal.c-2024- */
--
kernel/signal.c=3093=static void retarget_shared_pending(struct task_struct *tsk, sigset_t *which)
--
kernel/signal.c-3118-
kernel/signal.c:3119:void exit_signals(struct task_struct *tsk)
kernel/signal.c-3120-{
]
|
| 56/2 |
2026/05/31 20:21 |
llm |
expert |
0m
Model:
Tokens:
input: 41685
output: 29
thoughts: 23
Thoughts: Okay, here's my summary, framed as my internal thought process:
**Signal Handling and Potential Dependencies**
Alright, I'm taking a look at `kernel/signal.c`. The first thing I'm doing is checking its dependencies. I'm noting that there are no other uses in this file. That's good, but it doesn't give me the full picture. My immediate question then is, what about `kernel/ptrace.c`? I need to check if there is any intersection with the process trace system. This is where signals are often used or intercepted, so I need to check. This intersection is very important because it has deep roots in how we handle and debug processes in the system. I have a feeling there might be something important there.
|
| 57/2 |
2026/05/31 20:21 |
tool |
grepper |
0m
Args: map[Expression:exit_signal PathPrefix:kernel/ptrace.c]
Results: map[Output:kernel/ptrace.c=239=static int ptrace_check_attach(struct task_struct *child, bool ignore_state)
--
kernel/ptrace.c-253- * child->sighand can't be NULL, release_task()
kernel/ptrace.c:254: * does ptrace_unlink() before __exit_signal().
kernel/ptrace.c-255- */
--
kernel/ptrace.c=538=static bool __ptrace_detach(struct task_struct *tracer, struct task_struct *p)
--
kernel/ptrace.c-550- if (!same_thread_group(p->real_parent, tracer))
kernel/ptrace.c:551: dead = do_notify_parent(p, p->exit_signal);
kernel/ptrace.c-552- else if (ignoring_children(tracer->sighand) ||
]
|
| 58/2 |
2026/05/31 20:21 |
llm |
expert |
0m
Model:
Tokens:
input: 42138
output: 28
thoughts: 23
Thoughts: Okay, here's my summary, framed as my internal thought process:
**Diving into Ptrace Usage**
Alright, I'm digging into this `ptrace` situation. The first thing I'm checking is where this function is actually being *used*. Let's zero in on `kernel/ptrace.c`. My initial assumption is that this will be the core of where the ptrace functionality is implemented. Now, the next step is to examine the file, and make sure that this is the *only* place it is implemented. I want to make sure I'm not missing anything. I don't see any other uses there, which is what I suspected.
Okay, so if it's *not* in `kernel/ptrace.c`, then where *is* it? Time to expand my search. The next logical place to look is `kernel/exit.c`. The process of exiting is where you might expect to see some interaction with tracing processes, so let's start there. I'll need to analyze that file carefully.
|
| 59/2 |
2026/05/31 20:21 |
tool |
grepper |
0m
Args: map[Expression:exit_signal PathPrefix:kernel/exit.c]
Results: map[Output:kernel/exit.c=134=static void __unhash_process(struct release_task_post *post, struct task_struct *p,
--
kernel/exit.c-158- */
kernel/exit.c:159:static void __exit_signal(struct release_task_post *post, struct task_struct *tsk)
kernel/exit.c-160-{
--
kernel/exit.c=244=void release_task(struct task_struct *p)
--
kernel/exit.c-264- ptrace_release_task(p);
kernel/exit.c:265: __exit_signal(&post, p);
kernel/exit.c-266-
--
kernel/exit.c-283- */
kernel/exit.c:284: zap_leader = do_notify_parent(leader, leader->exit_signal);
kernel/exit.c-285- if (zap_leader)
--
kernel/exit.c=674=static void reparent_leader(struct task_struct *father, struct task_struct *p,
--
kernel/exit.c-680- /* We don't want people slaying init. */
kernel/exit.c:681: p->exit_signal = SIGCHLD;
kernel/exit.c-682-
--
kernel/exit.c-685- p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) {
kernel/exit.c:686: if (do_notify_parent(p, p->exit_signal)) {
kernel/exit.c-687- p->exit_state = EXIT_DEAD;
--
kernel/exit.c=737=static void exit_notify(struct task_struct *tsk, int group_dead)
--
kernel/exit.c-752- int sig = thread_group_empty(tsk) && !ptrace_reparented(tsk)
kernel/exit.c:753: ? tsk->exit_signal : SIGCHLD;
kernel/exit.c-754- autoreap = do_notify_parent(tsk, sig);
--
kernel/exit.c-756- autoreap = thread_group_empty(tsk) &&
kernel/exit.c:757: do_notify_parent(tsk, tsk->exit_signal);
kernel/exit.c-758- } else {
--
kernel/exit.c=895=void __noreturn do_exit(long code)
--
kernel/exit.c-916- sched_mm_cid_exit(tsk);
kernel/exit.c:917: exit_signals(tsk); /* sets PF_EXITING */
kernel/exit.c-918-
--
kernel/exit.c=1140=eligible_child(struct wait_opts *wo, bool ptrace, struct task_struct *p)
--
kernel/exit.c-1159- */
kernel/exit.c:1160: if ((p->exit_signal != SIGCHLD) ^ !!(wo->wo_flags & __WCLONE))
kernel/exit.c-1161- return 0;
--
kernel/exit.c=1172=static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
--
kernel/exit.c-1272- state = EXIT_ZOMBIE;
kernel/exit.c:1273: if (do_notify_parent(p, p->exit_signal))
kernel/exit.c-1274- state = EXIT_DEAD;
]
|
| 60/2 |
2026/05/31 20:21 |
llm |
expert |
0m
Model:
Tokens:
input: 43329
output: 28
thoughts: 300
Thoughts: **Analyzing a Potential Zombie Process Scenario**
Okay, so I'm looking at this code snippet in `kernel/exit.c`, specifically around line 284, where we see `zap_leader = do_notify_parent(leader, leader->exit_signal)`. This occurs within the `release_task` function, and it seems to be handling a very specific edge case: when a child thread is exiting and its leader (thread group leader) is already a zombie.
I'm focusing on the condition `if (unlikely(leader != p && thread_group_empty(leader) && leader->exit_state == EXIT_ZOMBIE))`. It's essentially saying: *if* I'm not the leader, *and* the leader's thread group is empty (meaning all its other threads have exited), *and* the leader is already in the `EXIT_ZOMBIE` state, *then* we execute this block. The intent is clear: to ensure the leader gets properly cleaned up.
The critical part is `do_notify_parent`. If `leader->exit_signal` is invalid, `do_notify_parent` returns `false`. This, in turn, sets `zap_leader` to `false`. So even if the parent *should* be notified, it won't be. Consequently, the leader remains stubbornly in the `EXIT_ZOMBIE` state.
My main concern is whether this creates a resource leak or a potential denial-of-service vulnerability. My quick analysis indicates that this isn't the case. If the parent doesn't reap the leader (perhaps because it's ignoring `SIGCHLD`), the leader will simply wait around in zombie form. Eventually, when the parent itself exits, the kernel will reap the zombie leader. So, even though the parent isn't explicitly cleaning up, it isn't an issue.
Now, just to be absolutely sure, let's revisit `kernel/fork.c` again. I want to double-check the thread creation and termination pathways. It is always a good practice.
|
| 61/2 |
2026/05/31 20:21 |
tool |
grepper |
0m
Args: map[Expression:exit_signal PathPrefix:kernel/fork.c]
Results: map[Output:kernel/fork.c=1967=__latent_entropy struct task_struct *copy_process(
--
kernel/fork.c-2038- return ERR_PTR(-EINVAL);
kernel/fork.c:2039: if (args->exit_signal)
kernel/fork.c-2040- return ERR_PTR(-EINVAL);
--
kernel/fork.c-2419- if (clone_flags & CLONE_THREAD)
kernel/fork.c:2420: p->exit_signal = -1;
kernel/fork.c-2421- else
kernel/fork.c:2422: p->exit_signal = current->group_leader->exit_signal;
kernel/fork.c-2423- } else {
--
kernel/fork.c-2425- p->parent_exec_id = current->self_exec_id;
kernel/fork.c:2426: p->exit_signal = args->exit_signal;
kernel/fork.c-2427- }
--
kernel/fork.c=2649=struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node)
--
kernel/fork.c-2669- *
kernel/fork.c:2670: * args->exit_signal is expected to be checked for sanity by the caller.
kernel/fork.c-2671- */
kernel/fork.c=2672=pid_t kernel_clone(struct kernel_clone_args *args)
--
kernel/fork.c-2713- trace = PTRACE_EVENT_VFORK;
kernel/fork.c:2714: else if (args->exit_signal != SIGCHLD)
kernel/fork.c-2715- trace = PTRACE_EVENT_CLONE;
--
kernel/fork.c=2772=pid_t kernel_thread(int (*fn)(void *), void *arg, const char *name,
--
kernel/fork.c-2776- .flags = ((flags | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL),
kernel/fork.c:2777: .exit_signal = (flags & CSIGNAL),
kernel/fork.c-2778- .fn = fn,
--
kernel/fork.c=2790=pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long flags)
--
kernel/fork.c-2793- .flags = ((flags | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL),
kernel/fork.c:2794: .exit_signal = (flags & CSIGNAL),
kernel/fork.c-2795- .fn = fn,
--
kernel/fork.c=2803=SYSCALL_DEFINE0(fork)
--
kernel/fork.c-2806- struct kernel_clone_args args = {
kernel/fork.c:2807: .exit_signal = SIGCHLD,
kernel/fork.c-2808- };
--
kernel/fork.c=2819=SYSCALL_DEFINE0(vfork)
--
kernel/fork.c-2822- .flags = CLONE_VFORK | CLONE_VM,
kernel/fork.c:2823: .exit_signal = SIGCHLD,
kernel/fork.c-2824- };
--
kernel/fork.c=2848=SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
--
kernel/fork.c-2858- .parent_tid = parent_tidptr,
kernel/fork.c:2859: .exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
kernel/fork.c-2860- .stack = newsp,
--
kernel/fork.c=2868=static noinline int copy_clone_args_from_user(struct kernel_clone_args *kargs,
--
kernel/fork.c-2902- /*
kernel/fork.c:2903: * Verify that higher 32bits of exit_signal are unset and that
kernel/fork.c-2904- * it is a valid signal
kernel/fork.c-2905- */
kernel/fork.c:2906: if (unlikely((args.exit_signal & ~((u64)CSIGNAL)) ||
kernel/fork.c:2907: !valid_signal(args.exit_signal)))
kernel/fork.c-2908- return -EINVAL;
--
kernel/fork.c-2918- .parent_tid = u64_to_user_ptr(args.parent_tid),
kernel/fork.c:2919: .exit_signal = args.exit_signal,
kernel/fork.c-2920- .stack = args.stack,
--
kernel/fork.c=2965=static bool clone3_args_valid(struct kernel_clone_args *kargs)
--
kernel/fork.c-2985- if ((kargs->flags & (CLONE_THREAD | CLONE_PARENT)) &&
kernel/fork.c:2986: kargs->exit_signal)
kernel/fork.c-2987- return false;
]
|
| 62/2 |
2026/05/31 20:21 |
llm |
expert |
0m
Model:
Tokens:
input: 45497
output: 36
thoughts: 67
Thoughts: Okay, let's see...
**Investigating a `clone` System Call Anomaly**
Right, so the `clone` system call allows `exit_signal` values greater than 64. That rings a bell... I seem to recall that triggering a `WARN_ON_ONCE` when the child exits. Definitely a known issue, I think. But wait, hold on... is there actually a fix for this floating around? I need to refresh my memory on the current status. Time to dig into the git log and see what's been discussed regarding `clone` and `exit_signal`. Let's see what the commit history tells us.
|
| 63/2 |
2026/05/31 20:21 |
tool |
git-log |
0m
Args: map[CodeRegexp:valid_signal Count:10 PathPrefix:kernel/fork.c]
Results: map[Output:a0eb9abd8af9 fork: block invalid exit signals with clone3()
]
|
| 64/2 |
2026/05/31 20:21 |
llm |
expert |
1m
Model:
Tokens:
input: 45777
output: 23
thoughts: 15
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and rendered in the first person:
**Initial Assessment: A Git Commit to Scrutinize**
Right, let's dive into this commit β specifically, `a0eb9abd8af9`. I see the need to check this one in particular. This typically means something within that commit, or the area of code it touches, has triggered a concern or requires a closer look. Perhaps it's a recent integration, a suspected bug fix, or maybe a potentially risky refactor. The commit hash itself is a starting point, a unique identifier that will lead me to the exact changeset. My experience tells me that jumping directly into the diff is usually the best approach, but first, I need a context.
|
| 65/2 |
2026/05/31 20:22 |
tool |
git-show |
0m
Args:
Results: map[Output:commit a0eb9abd8af92d1aa34bc1e24dfbd1ba0bd6a56c
Author: Eugene Syromiatnikov <esyr@redhat.com>
Date: Wed Sep 11 18:45:40 2019 +0100
fork: block invalid exit signals with clone3()
Previously, higher 32 bits of exit_signal fields were lost when copied
to the kernel args structure (that uses int as a type for the respective
field). Moreover, as Oleg has noted, exit_signal is used unchecked, so
it has to be checked for sanity before use; for the legacy syscalls,
applying CSIGNAL mask guarantees that it is at least non-negative;
however, there's no such thing is done in clone3() code path, and that
can break at least thread_group_leader.
This commit adds a check to copy_clone_args_from_user() to verify that
the exit signal is limited by CSIGNAL as with legacy clone() and that
the signal is valid. With this we don't get the legacy clone behavior
were an invalid signal could be handed down and would only be detected
and ignored in do_notify_parent(). Users of clone3() will now get a
proper error when they pass an invalid exit signal. Note, that this is
not user-visible behavior since no kernel with clone3() has been
released yet.
The following program will cause a splat on a non-fixed clone3() version
and will fail correctly on a fixed version:
#define _GNU_SOURCE
#include <linux/sched.h>
#include <linux/types.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
pid_t pid = -1;
struct clone_args args = {0};
args.exit_signal = -1;
pid = syscall(__NR_clone3, &args, sizeof(struct clone_args));
if (pid < 0)
exit(EXIT_FAILURE);
if (pid == 0)
exit(EXIT_SUCCESS);
wait(NULL);
exit(EXIT_SUCCESS);
}
Fixes: 7f192e3cd316 ("fork: add clone3")
Reported-by: Oleg Nesterov <oleg@redhat.com>
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Link: https://lore.kernel.org/r/4b38fa4ce420b119a4c6345f42fe3cec2de9b0b5.1568223594.git.esyr@redhat.com
[christian.brauner@ubuntu.com: simplify check and rework commit message]
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
diff --git a/kernel/fork.c b/kernel/fork.c
index 2852d0e76ea3..541fd805fb88 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -2338,6 +2338,8 @@ struct mm_struct *copy_init_mm(void)
*
* It copies the process, and if successful kick-starts
* it and waits for it to finish using the VM if required.
+ *
+ * args->exit_signal is expected to be checked for sanity by the caller.
*/
long _do_fork(struct kernel_clone_args *args)
{
@@ -2562,6 +2564,14 @@ noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs,
if (copy_from_user(&args, uargs, size))
return -EFAULT;
+ /*
+ * Verify that higher 32bits of exit_signal are unset and that
+ * it is a valid signal
+ */
+ if (unlikely((args.exit_signal & ~((u64)CSIGNAL)) ||
+ !valid_signal(args.exit_signal)))
+ return -EINVAL;
+
*kargs = (struct kernel_clone_args){
.flags = args.flags,
.pidfd = u64_to_user_ptr(args.pidfd),
]
|
| 66/2 |
2026/05/31 20:22 |
llm |
expert |
0m
Model:
Tokens:
input: 47184
output: 49
thoughts: 544
Thoughts: **Analyzing a Curious Kernel Warning**
Okay, so this commit message is pointing out a legacy `clone` behavior β it *allows* invalid signals, which are then sort of swept under the rug by being ignored in `do_notify_parent()`. The crucial bit is that `do_notify_parent()` has a `WARN_ON_ONCE` about invalid signals. Hang on, *why* is there a warning about something that's supposed to be a known, documented behavior? If userspace can deliberately pass an invalid signal via legacy `clone`, doesnβt that make this a user-triggerable warning? And if so, is it truly a bug, or just a somewhat unfortunate side effect of maintaining backward compatibility?
Well, yes, it's user-triggerable. Okay. Itβs not a security vulnerability; it's not a denial-of-service in a standard production environment, it would just print a warning. The `syzbot` report triggers a kernel panic because of `panic_on_warn`, but that's not a typical deployment setting. The analysis seems solid: not exploitable, no DoS (without `panic_on_warn`), and accessible from unprivileged processes and user namespaces. Not a VM guest/host/network/peripheral/filesystem trigger.
But... I need to be thorough. Could this warning be triggered *another* way? What if `exit_signal` is valid, but *later* `do_notify_parent` is called with a bad signal? Nope. `do_notify_parent` always gets `tsk->exit_signal` or `SIGCHLD`. If `tsk->exit_signal` is bad, the warning triggers. And because `clone` allows `exit_signal` values up to 255 while `valid_signal` only checks up to 64, this means any value between 65 and 255 triggers the warning.
So, it *is* the documented legacy behavior. The warning is ostensibly there to catch kernel errors, but it's also catching this user-triggered legacy case. But⦠is this warning the right approach? Given that it's a known behavior, should the warning be removed or perhaps changed into a more targeted check? I seem to recall some recent discussion or even a patch touching this area. It's time to check if there's an existing commit trying to resolve this warning in a more elegant way.
|
| 67/2 |
2026/05/31 20:22 |
tool |
git-log |
0m
Args: map[CodeRegexp:WARN_ON_ONCE\(!valid_signal\(sig\)\) Count:10 PathPrefix:kernel/signal.c]
Results: map[Output:0f8e38eeb995 do_notify_parent: sanitize the valid_signal() checks
]
|
| 68/2 |
2026/05/31 20:22 |
llm |
expert |
0m
Model:
Tokens:
input: 48329
output: 26
thoughts: 18
Thoughts: Okay, here's my interpretation of that request, formatted as requested:
**Diving into Commit `0f8e38eeb995`**
Alright, time to dig into this commit. Let's start with `0f8e38eeb995`. I need to understand what changed, and how it impacts the existing codebase. My initial assessment will be to see the diff, I'm expecting some specific patterns β maybe a refactor, a bug fix, or a new feature implementation. I'm going to look for any obvious red flags: are there significant performance implications? Have they introduced any subtle, difficult-to-detect bugs? Are there any breaking changes that weren't adequately documented or communicated? I'll be paying close attention to any changes in critical data structures or algorithms. I also will make an assessment as to whether this is a logical point in the history to do a code review on or if there were prior commits that need to be assessed as well. After the first pass, I'll need to run some of our test suites, or maybe craft some custom tests. I'll need to verify that this commit integrates well with the rest of the system. Let's see what's in store.
|
| 69/2 |
2026/05/31 20:22 |
tool |
git-show |
0m
Args:
Results: map[Output:commit 0f8e38eeb995bf818a7f220de109d6b6b96038b4
Author: Oleg Nesterov <oleg@redhat.com>
Date: Tue Mar 17 14:58:18 2026 +0100
do_notify_parent: sanitize the valid_signal() checks
Now that kernel_clone() checks valid_signal(args->exit_signal), the "sig"
argument of do_notify_parent() must always be valid or we have a bug.
However, do_notify_parent() only checks that sig != -1 at the start, then
it does another valid_signal() check before __send_signal_locked().
This is confusing. Change do_notify_parent() to WARN and return early if
valid_signal(sig) is false.
Link: https://lkml.kernel.org/r/abld-ilvMEZ7VgMw@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Deepanshu Kartikey <Kartikey406@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
diff --git a/kernel/signal.c b/kernel/signal.c
index 86aad7badb9a..683ef92f7234 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2171,7 +2171,8 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
bool autoreap = false;
u64 utime, stime;
- WARN_ON_ONCE(sig == -1);
+ if (WARN_ON_ONCE(!valid_signal(sig)))
+ return false;
/* do_notify_parent_cldstop should have been called instead. */
WARN_ON_ONCE(task_is_stopped_or_traced(tsk));
@@ -2252,7 +2253,7 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
* Send with __send_signal as si_pid and si_uid are in the
* parent's namespaces.
*/
- if (valid_signal(sig) && sig)
+ if (sig)
__send_signal_locked(sig, &info, tsk->parent, PIDTYPE_TGID, false);
__wake_up_parent(tsk, tsk->parent);
spin_unlock_irqrestore(&psig->siglock, flags);
]
|
| 70/2 |
2026/05/31 20:22 |
llm |
expert |
0m
Model:
Tokens:
input: 49326
output: 28
thoughts: 88
Thoughts: Okay, here's the summary, framed as my internal monologue:
**Investigating a Potential Signal Handling Bug**
Right, the commit message just flagged something. It says: "Now that `kernel_clone()` checks `valid_signal(args->exit_signal)`, the 'sig' argument of `do_notify_parent()` must always be valid or we have a bug." Hmm, that's interesting. I need to unpack this.
So, `kernel_clone()` is now validating the `exit_signal` argument. That implies that `do_notify_parent()`'s `sig` argument, which I assume is related to that `exit_signal`, has to be valid now, because otherwise, we're likely to have a bug. The old code might have had issues if it didn't check for this before.
The implication is that the change to `kernel_clone()` is now preventing the pass of potentially invalid signals to `do_notify_parent()`. I need to verify that this is true and understand the exact relationship. Okay, time to check `kernel_clone()` in `kernel/fork.c`. Let's see what's actually going on.
|
| 71/2 |
2026/05/31 20:22 |
tool |
grepper |
0m
Args: map[Expression:valid_signal PathPrefix:kernel/fork.c]
Results: map[Output:kernel/fork.c=2868=static noinline int copy_clone_args_from_user(struct kernel_clone_args *kargs,
--
kernel/fork.c-2906- if (unlikely((args.exit_signal & ~((u64)CSIGNAL)) ||
kernel/fork.c:2907: !valid_signal(args.exit_signal)))
kernel/fork.c-2908- return -EINVAL;
]
|
| 72/2 |
2026/05/31 20:22 |
llm |
expert |
0m
Model:
Tokens:
input: 49821
output: 36
thoughts: 47
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Kernel Clone Oversight**
Hold on a second...something's nagging at me about `kernel_clone()`. I just realized, or rather, I *think* I've realized, that the current tree implementation of `kernel_clone()` *doesn't* include a check for the validity of the exit signal, specifically `valid_signal(args->exit_signal)`. That's... concerning. We definitely need to ensure that `args->exit_signal` contains a valid signal number, or we could be opening the door to some nasty issues. I'm imagining potentially memory corruption or even security vulnerabilities if we're not careful. This oversight could be a race condition waiting to happen.
The question then becomes: when did this oversight creep in? I'm going to start digging through the git history to see if I can pinpoint when and if the check for `valid_signal()` was *removed* from the function. Perhaps it was part of an earlier patch that was backported? Or maybe it was just forgotten. Regardless, I need to see if there is a commit that addressed this and introduced or removed the check. I need to know precisely where and how this change came about to understand the potential implications. I also need to verify this assumption by tracing the code.
|
| 73/2 |
2026/05/31 20:22 |
tool |
git-log |
0m
Args: map[CodeRegexp:valid_signal Count:10 PathPrefix:kernel/fork.c]
Results: map[Output:a0eb9abd8af9 fork: block invalid exit signals with clone3()
]
|
| 74/2 |
2026/05/31 20:23 |
llm |
expert |
0m
Model:
Tokens:
input: 50221
output: 36
thoughts: 81
Thoughts: Here's my thought process, summarized as you requested:
**Investigating a Recent Kernel Change**
Okay, so this change, `a0eb9abd8af9`, *only* added something to `copy_clone_args_from_user()`. And that function, as I recall, is specific to the `clone3()` system call, not the original `clone()` or `fork()`. So, where did this other check end up? Did Oleg Nesterov sneak something in elsewhere? I know he's been active in that area. I need to figure out if there's a related commit affecting the core `kernel_clone()` function. I bet it is related!
My next step is to search for Oleg Nesterov's commits. I'll need to filter the search to only show commits touching `kernel/fork.c` (that's where the clone system call logic lives) and, to be thorough, I should also look for anything related to `exit_signal`, as that's often tied to clone/fork semantics and signal handling in the child process. Let's see what turns up.
|
| 75/2 |
2026/05/31 20:23 |
tool |
git-log |
0m
Args: map[CodeRegexp:exit_signal Count:10 PathPrefix:kernel/fork.c]
Results: map[Output:12ae2c81b21c clone: add CLONE_AUTOREAP
f7071db2fe3d fork: kill the pointless lower_32_bits() in create_io_thread(), kernel_thread(), and user_mode_thread()
343f4c49f243 kthread: Don't allocate kthread_struct for init and umh
cc440e8738e5 kernel: provide create_io_thread() helper
b4e00444cab4 fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent
ff2a91127b37 fork: remove do_fork()
3f2c788a1314 fork: prevent accidental access to clone3 features
a0eb9abd8af9 fork: block invalid exit signals with clone3()
7f192e3cd316 fork: add clone3
18c830df771f kernel/fork.c:copy_process(): consolidate the lockless CLONE_THREAD checks
]
|
| 76/2 |
2026/05/31 20:23 |
llm |
expert |
0m
Model:
Tokens:
input: 50843
output: 34
thoughts: 44
Thoughts: Okay, let's see...
**Analyzing the Kernel's Cloning Mechanism**
Alright, that commit, `12ae2c81b21c`, "clone: add CLONE_AUTOREAP" is the one I want to dig into. Right, so I need to understand how this `CLONE_AUTOREAP` flag is being implemented. The place to start is almost certainly `kernel_clone` in `kernel/fork.c`. I need to understand how the existing cloning process handles reaping and how this new option integrates. I need to be able to follow the logic and determine the impact of this autoreap flag. Time to dive into the code...
|
| 77/2 |
2026/05/31 20:23 |
tool |
read-file |
0m
Args: map[File:kernel/fork.c FirstLine:2670 LineCount:50]
Results: map[Contents:2670: * args->exit_signal is expected to be checked for sanity by the caller.
2671: */
2672: pid_t kernel_clone(struct kernel_clone_args *args)
2673: {
2674: u64 clone_flags = args->flags;
2675: struct completion vfork;
2676: struct pid *pid;
2677: struct task_struct *p;
2678: int trace = 0;
2679: pid_t nr;
2680:
2681: /*
2682: * Creating an empty mount namespace implies creating a new mount
2683: * namespace. Set this before copy_process() so that the
2684: * CLONE_NEWNS|CLONE_FS mutual exclusion check works correctly.
2685: */
2686: if (clone_flags & CLONE_EMPTY_MNTNS) {
2687: clone_flags |= CLONE_NEWNS;
2688: args->flags = clone_flags;
2689: }
2690:
2691: /*
2692: * For legacy clone() calls, CLONE_PIDFD uses the parent_tid argument
2693: * to return the pidfd. Hence, CLONE_PIDFD and CLONE_PARENT_SETTID are
2694: * mutually exclusive. With clone3() CLONE_PIDFD has grown a separate
2695: * field in struct clone_args and it still doesn't make sense to have
2696: * them both point at the same memory location. Performing this check
2697: * here has the advantage that we don't need to have a separate helper
2698: * to check for legacy clone().
2699: */
2700: if ((clone_flags & CLONE_PIDFD) &&
2701: (clone_flags & CLONE_PARENT_SETTID) &&
2702: (args->pidfd == args->parent_tid))
2703: return -EINVAL;
2704:
2705: /*
2706: * Determine whether and which event to report to ptracer. When
2707: * called from kernel_thread or CLONE_UNTRACED is explicitly
2708: * requested, no event is reported; otherwise, report if the event
2709: * for the type of forking is enabled.
2710: */
2711: if (!(clone_flags & CLONE_UNTRACED)) {
2712: if (clone_flags & CLONE_VFORK)
2713: trace = PTRACE_EVENT_VFORK;
2714: else if (args->exit_signal != SIGCHLD)
2715: trace = PTRACE_EVENT_CLONE;
2716: else
2717: trace = PTRACE_EVENT_FORK;
2718:
2719: if (likely(!ptrace_event_enabled(current, trace)))
]
|
| 78/2 |
2026/05/31 20:23 |
llm |
expert |
0m
Model:
Tokens:
input: 51885
output: 66
thoughts: 616
Thoughts: **Analyzing a Potential Bug in the `clone` System Call**
Okay, so I'm looking at the `clone` system call, and something's not quite right. It seems like the `kernel_clone` function, which is ultimately called by `clone`, *doesn't* validate the `exit_signal` value like I thought it would. The `clone` syscall itself, as defined by `SYSCALL_DEFINE5`, also seems to completely skip this crucial check.
The code clearly shows that the `exit_signal` is derived directly from the `clone_flags` passed to `clone`. This implies the system call *allows* the `exit_signal` to be set to any value up to 255.
Then I recall `do_notify_parent`, which has a `WARN_ON_ONCE` for invalid signals. And then Oleg's commit `0f8e38eeb995`... it looks like that commit *assumed* `kernel_clone` would validate the signal, but it doesn't! I need to quickly check if any subsequent commit added this crucial validation to `kernel_clone` itself. If not, this is a regression, a bug introduced by that commit.
Hold on, let me check the code. Okay, it looks like `valid_signal` is only checked in `copy_clone_args_from_user` for `clone3`, but not the original `clone`. So, `clone` *definitely* doesn't validate the signal.
This means any unprivileged user can trigger a `WARN_ON_ONCE` simply by calling `clone` with a specific `clone_flags` value (like 65). Since it's a `WARN_ON_ONCE`, it will only print once per boot.
I don't think this is a serious security issue, fortunately. It's a warning, not a DoS or memory corruption, unless `panic_on_warn` is set, but that's unlikely in most production setups. It's not exploitable. It is accessible from unprivileged processes and user namespaces, but it's not a trigger related to a VM guest/host, network, peripheral, or filesystem.
Alright, I'll document the findings accordingly.
|
| 79/2 |
2026/05/31 20:23 |
tool |
set-results |
0m
Args: map[DenialOfService:false Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:false Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 80/2 |
2026/05/31 20:23 |
llm |
expert |
0m
Model:
Tokens:
input: 53119
output: 673
thoughts: 329
Thoughts: **My Analysis and Response Plan**
Okay, the analysis is complete, and I'm ready to craft the final response. Here's what I've distilled from the code and logic:
I've got a handle on the bug: it's that `WARN_ON_ONCE(!valid_signal(sig))` check within `do_notify_parent()`. The problem arises when a process is exiting and its `exit_signal` value is, well, invalid. Specifically, the legacy `clone` syscall, due to how `clone_flags & CSIGNAL` works, can actually *set* this signal to values beyond the standard `_NSIG` limit of 64, up to 255! The kernel doesn't validate this when the process clones, so you end up with an invalid signal getting passed to `do_notify_parent()` when the child exits.
The good news? It's a graceful failure. The `WARN_ON_ONCE` triggers, but the function returns `false`, which is appropriate. This results in the zombie process remaining unreaped (as you'd expect with an invalid signal anyway). It's not a memory corruption bug, doesn't lead to out-of-bounds access, and I can confirm that it's not exploitable in the standard sense.
In a production environment, it's not a denial-of-service risk, given that `panic_on_warn` isn't enabled by default. `WARN_ON_ONCE` also, crucially, only triggers once per boot.
The triggering mechanism is straightforward. Any unprivileged user process can trigger this by simply calling `clone()` with an invalid signal value in the `clone_flags`. The ability to trigger it from within user namespaces further confirms its accessibility.
Finally, it's absolutely unrelated to VM guests, network stacks, peripherals, or filesystems. This bug is purely within the process and signal handling domain.
I'm ready to craft the final reply, I'll structure it clearly to explain the core issue, detail the steps needed to reproduce it, and comprehensively assess its security implications. I'll make sure to provide a clear and concise explanation for the user.
|
| 81/1 |
2026/05/31 20:23 |
action |
format-explanation |
0m
Results: map[Explanation:The bug report describes a kernel panic triggered by a
`WARN_ON_ONCE(!valid_signal(sig))` in `do_notify_parent()` when a process exits.
### Root Cause Analysis
The issue stems from the legacy `clone` syscall. When a process is created using
`clone()`, the `exit_signal` is extracted from the lower 8 bits of `clone_flags`
(`clone_flags & CSIGNAL`). Since `CSIGNAL` is `0xFF`, the `exit_signal` can be
any value up to 255.
Unlike the newer `clone3` syscall, which explicitly validates the `exit_signal`
using `valid_signal()` (ensuring it is `<= _NSIG`, which is 64), the legacy
`clone` syscall does not perform this validation.
When a child process created with an invalid `exit_signal` (e.g., 65)
terminates, the kernel calls `do_notify_parent(tsk, tsk->exit_signal)`. Inside
`do_notify_parent()`, the kernel checks if the signal is valid using
`WARN_ON_ONCE(!valid_signal(sig))`. Because the signal is greater than 64, this
check fails, triggering the warning.
In the provided syzbot report, the kernel panics because it is configured with
`panic_on_warn`. However, in a standard production kernel, `panic_on_warn` is
disabled. The `WARN_ON_ONCE` will simply print a stack trace to the kernel log
(only once per boot) and return `false`. The kernel gracefully handles this by
leaving the child as a zombie until it is reaped (or reparented to `init` which
will reap it), preventing any memory leaks or state corruption.
### Security Impact Assessment
* **Exploitable:** **No.** The bug is a simple warning triggered by an
unvalidated integer. The invalid signal is not used as an array index or for any
memory access. The kernel handles the invalid signal gracefully by returning
early, so there is no memory corruption, out-of-bounds access, or privilege
escalation possible.
* **Denial Of Service:** **No.** In production environments, `panic_on_warn` is
not enabled. The `WARN_ON_ONCE` macro ensures the warning is only printed once
per boot, meaning it cannot even be used to spam the kernel log (dmesg) or cause
resource exhaustion.
* **Accessible From Unprivileged Processes:** **Yes.** Any unprivileged user can
call the legacy `clone` syscall with `clone_flags` containing an invalid signal
(e.g., `65`) and then have the child process exit to trigger the warning.
* **Accessible From User Namespaces:** **Yes.** The `clone` syscall is
accessible within user namespaces.
* **VM Guest / Host Trigger:** **No.** This is a local syscall issue, not
related to virtualization.
* **Network / Peripheral / Filesystem Trigger:** **No.** The bug is triggered
via local syscalls (`clone` and `exit`), not via external inputs like network
packets, USB devices, or filesystem images.]
|