Unless I am worse at C than I thought, the implemented way to determine the application binary path is to read the /proc/[pid]/exe symlink.
This is sadly not a reliable way. The symlink is always given in the applications mount namespace, not the compositors mount namespace.
With unprivileged user namespaces (which afaik most distributions have available for lxc/docker/etc.) any user application can abuse this to gain any path.
I think this can be (paritally) mitigated by checking /proc/[pid]/ns/nmt and compare it with /proc/self/ns/mnt.
As secondary problem, applications that use interpreters (such as python) will show up as the interpreter. And sadly /proc/[pid]/cmdline is not reliable either to determine which file is interpreted.
Unless I am worse at C than I thought, the implemented way to determine the application binary path is to read the
/proc/[pid]/exesymlink.This is sadly not a reliable way. The symlink is always given in the applications mount namespace, not the compositors mount namespace.
With unprivileged user namespaces (which afaik most distributions have available for lxc/docker/etc.) any user application can abuse this to gain any path.
I think this can be (paritally) mitigated by checking
/proc/[pid]/ns/nmtand compare it with/proc/self/ns/mnt.As secondary problem, applications that use interpreters (such as python) will show up as the interpreter. And sadly
/proc/[pid]/cmdlineis not reliable either to determine which file is interpreted.