diff -ruN linux-vanilla/fs/exec.c linux/fs/exec.c --- linux-vanilla/fs/exec.c Wed Jan 9 20:02:17 2002 +++ linux/fs/exec.c Sat Mar 30 18:35:25 2002 @@ -644,6 +644,21 @@ cap_clear(bprm->cap_permitted); cap_clear(bprm->cap_effective); + /* Keeping process capabilities if requested + affections: + uid == 0 && non-secure_noroot, with any capabilities: + not harmed, all file caps will be set + uid != 0, with no capabilities (standard way): + not harmed, since capabilities cannot be raised + uid != 0, with capabilities (current->keep_capabilities is set): + affected: process caps will be set as file caps + */ + if (current->keep_capabilities) { + bprm->cap_inheritable = current->cap_inheritable; + bprm->cap_permitted = current->cap_permitted; + bprm->cap_effective = current->cap_effective; + } + /* To support inheritance of root-permissions and suid-root * executables under compatibility mode, we raise all three * capability sets for the file.