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)
committerTobias Kaufmann <Tobias.KA.Kaufmann@bmw.de>
Wed, 9 Sep 2020 09:17:42 +0000 (11:17 +0200)
commit198dc1784514b800c3e69153839084a55ebf2e84
tree61898a75bb532914d5ef7ee783507ee6c1cfb15e
parent16fcb1918a0e4514b1d0d78259d4ffd646b5da59
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.
src/core/execute.c