syscall_set_return_value(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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_regs of task. 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 if error is zero. if error isn'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 error is zero β†’ user sees a successful system call with a return value of val. πŸŽ€
  • if error is 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 when task is stopped for tracing on exit from a system call, due to SYSCALL_WORK_SYSCALL_TRACE or SYSCALL_WORK_SYSCALL_AUDIT. call it anywhere else and you're not serving, you're just causing chaos. ngl, respect the rules. πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘

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