fn fake_proc_cmdline(
ctx: &Ctx,
rest: &[u8],
text: &[u8],
) -> Result<Option<i32>, i32>Expand description
Serves /proc/<pid>/cmdline as the process was started, without the
loader the exec was retargeted at.
The kernel’s file names the dynamic loader’s alias, --argv0, the name
and the program before the real arguments, or the shim loader’s alias,
the program and its AT_EXECFN before the whole argv; ps, pgrep -f
and programs reading their own command line expect the argv the tracee
passed. A process in
the no-ptrace trampoline, or one that rewrote its own argv, is left as is.
In the guest-stub restricted mode no loader is exec’d, so the kernel’s
file is the vector the program was exec’d with, which is right but for a
#! script: there the interpreter, its argument and the script recorded
at the exec take the place of argv[0], as the kernel would show them.
§Arguments
ctx- Shared supervisor state.rest- The<pid>or<pid>/task/<tid>of the path.text- The file as the kernel gives it.
§Returns
A descriptor on the rewritten copy, or None when the file carries no
loader prefix.
§Errors
An errno when the copy cannot be made.