Skip to contentSkip to conversation

seteuid and /proc/<pid>/exe

DISCUSSION Larrosa, Antonio 1 participant 1 message Jan 10, 2013

lore
Share & tools
lore
#0 lore raw

Hello,

I have a user with uid=1000 that runs a process, let's say with pid 42.

If I do a readlink on /proc/42/exe from another process run by that same user, it reads the link correctly.
If root calls readlink on that same link, it works correctly.

The problem is that I have another process that is run by root, and then calls seteuid(1000). When it tries to read that link, it fails with "permission denied". I could just seteuid(0), read the link and seteuid(1000) again
(I checked it and it works) but I wonder if that's really the expected behaviour.

If any of the effective, real and saved uid of the process have permissions to read the link, is it expected that only because they're different, then the permission is denied?

Thanks,

Signature · 1 line
Antonio Larrosa