syscall_set_return_value(9)
β¨ syscall_set_return_value(9) β¨ β Kernel API Manual, bestie edition π
okay so picture this: you're deep in the kernel, lowkey living your best ptrace life, and you just need to edit the outcome of a syscall before user mode ever lays eyes on it. that's this function. that's the whole vibe. it's from the Kernel API Manual and honestly it ate. π
π¦ NAME π¦
syscall_set_return_value β change the return value of a traced system call. that's it, that's the girl. she rewrites history (the syscall's history, specifically). β¨
πΈ SYNOPSIS πΈ
void syscall_set_return_value (struct task_struct *task , struct pt_regs *regs , int error , long val );
like, look at her. four args. no notes. π«Ά
π ARGUMENTS π
taskβ the task of interest, bestie, and it must be blocked. not "probably blocked," not "blocked-ish." blocked. periodt. πregsβtask_pt_regsoftask. the regs, the whole regs, and nothing but the regs. π«Άerrorβ a negative error code, or zero to indicate success. zero = slay, negative = it's giving failure. πvalβ the user return value, but only iferroris zero. iferrorisn't zero, girl, this one's just vibing in the void. π
π₯ DESCRIPTION π₯
so here's the tea β β this changes the results of the system call that user mode will see. literally rewriting the ending of the story before anyone reads it. main character energy fr fr.
- if
erroris zero β user sees a successful system call with a return value ofval. π - if
erroris nonzero β it's a negated errno code, and user sees a failed system call with this errno code. π
β οΈ and now the important bit, don't scroll past: it's only valid to call this whentaskis stopped for tracing on exit from a system call, due toSYSCALL_WORK_SYSCALL_TRACEorSYSCALL_WORK_SYSCALL_AUDIT. call it anywhere else and you're not serving, you're just causing chaos. ngl, respect the rules. π
π SEE ALSO π
- Kernel file
./include/asm-generic/syscall.h syscall_get_nr(9)syscall_set_nr(9)syscall_rollback(9)syscall_get_error(9)syscall_get_return_value(9)syscall_get_arguments(9)syscall_set_arguments(9)syscall_get_arch(9)
the whole friend group, honestly. go say hi. π¦β¨
and that's a wrap, bestie!! π this little icon lives in ./include/asm-generic, dated October 2026, and she's serving syscall_set_return_value(9) realness. go forth and trace responsibly β ily, mwah π«ΆπΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms