Simple solution
Simple solution
Posted Nov 28, 2024 8:04 UTC (Thu) by rrolls (subscriber, #151126)Parent article: The kernel's command-line commotion
Programs wishing to use this instead of execve, when the original path is a symlink, can get the basename of the original path themselves, do whatever opening and checking they like of the contents of the file, then pass that basename to be stored in `comm`.
Everyone wins.
Posted Nov 28, 2024 11:27 UTC (Thu)
by lkundrak (subscriber, #43452)
[Link] (1 responses)
Posted Nov 29, 2024 14:04 UTC (Fri)
by vbabka (subscriber, #91706)
[Link]
Posted Nov 28, 2024 20:22 UTC (Thu)
by rweikusat2 (subscriber, #117920)
[Link]
1. The (first 16 characters of the) file which was actually executed by the kernel.
This means that it's not under control of the code which executed the exec system call. In contrast to this, *argv is the first string of the argument vector. By convention, this is also the filename of the executed file but that's really just a convention. It can be any string the executing process desired to use as first argument and it may even not exist at all, ie *argv may be NULL.
Copying *argv (or, for that matter, any other string the executing process can either chose freely or omit at all) thus doesn't solve the problem that, for programs executed via file descriptor, the correct comm value is useless for determining information about the actually running program.
There's no correct solution for setting comm to the value it would have had had execve with a filename been used instead of execveat/ fexecve because the name which was used to open the file descriptor may no longer refer to the same file by the time it's executed. Using the name from the dentry is probably the best approximation as that's at least a name referring to the file which is being executed.
Simple solution
Simple solution
Simple solution
2. A string the program which was executed passed as argument to PR_SET_NAME.
