core: fix set keep caps for ambient capabilities
authorTobias Kaufmann <Tobias.KA.Kaufmann@bmw.de>
Fri, 31 Jul 2020 08:57:39 +0000 (10:57 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 11 Sep 2020 18:06:20 +0000 (20:06 +0200)
commit6f65eaf9c2643e0d9e22357f41f0b3d29e18075a
tree9cbeca76029f1c5a75a9fc5bc322df40e3607e11
parent08338a234e381223416d536867199b2f9a2ed30a
core: fix set keep caps for ambient capabilities

The securebit keep-caps retains the capabilities in the permitted set
over an UID change (ambient capabilities are cleared though).

Setting the keep-caps securebit after the uid change and before execve
doesn't make sense as it is cleared during execve and there is no
additional user ID change after this point.

Altough the documentation (man 7 capabilities) is ambigious, keep-caps
is reset during execve although keep-caps-locked is set. After execve
only keep-caps-locked is set and keep-caps is cleared.

(cherry picked from commit 198dc1784514b800c3e69153839084a55ebf2e84)
src/core/execute.c