Sad outcome
Sad outcome
Posted Nov 28, 2024 4:15 UTC (Thu) by neilbrown (subscriber, #359)In reply to: Sad outcome by mezcalero
Parent article: The kernel's command-line commotion
Just find some private directory, create a symlink from my_comm to /proc/self/fd/NN, make sure NN is CLOSE-ON-EXEC,
and
execveat(private-dir-fd, "my_comm", argv, envp, 0);
As close-on-exec is processed after the target file is opened, this gives you all you need.
Having to find a private directory isn't ideal, but shouldn't be too hard. /run/fexec/$UID/$PID/ ??
Cleaning up might be awkward.
Posted Nov 28, 2024 8:32 UTC (Thu)
by mezcalero (subscriber, #45103)
[Link] (1 responses)
I mean, come on.
(Yes, I know it wasn't you who who said copying argv[0] → comm[] was too slow, that was Linus.)
Posted Dec 13, 2024 12:40 UTC (Fri)
by roblucid (guest, #48964)
[Link]
I developed many years, then later ran a lot of server machines distributed over many sites including network centersw and kernel level smoke & mirrors undermines the whole point of switching to the fd based call. Developers have a tendency to pick the easy option and if you're worried about exploits to race conditions, giving them shell access gets your hosts remotely cracked.
Sad outcome
Sad outcome