October 2018
Beginner
794 pages
19h 23m
English
In the previous section, we've just seen how the useful seteuid(getuid()) semantic can be used to switch a setuid privileged process to a regular unprivileged state (that's good design and safer). But what if we have this requirement:
Time t0: initialization code: must run as rootTime t1: func1(): must *not* run as rootTime t2: func2(): must run as rootTime t3: func3(): must *not* run as root[...]
To achieve the must-run-as-root semantic initially, we can of course create the program to be a setuid-root program. Then, at time t1, we issue the setuid(getuid()) giving up root privileges.
But how do we regain root privileges at time t2? Ah, that's where the saved-setuid feature becomes precious. What's more, it's ...
Read now
Unlock full access