X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=kernel%2Fcapability.c;h=901e0fdc3fffa3b32fca26e0aa4e1985b244bd10;hb=6329d3021bcfa9038621e6e917d98929421d8ec8;hp=cfbe44299488c18187d80acbe06d9e03c5dc8a83;hpb=c907310fb0a5dd69a7fe11c08368abb0d34a35cb;p=linux-2.6 diff --git a/kernel/capability.c b/kernel/capability.c index cfbe442994..901e0fdc3f 100644 --- a/kernel/capability.c +++ b/kernel/capability.c @@ -121,6 +121,27 @@ static int cap_validate_magic(cap_user_header_t header, unsigned *tocopy) * uninteresting and/or not to be changed. */ +/* + * Atomically modify the effective capabilities returning the original + * value. No permission check is performed here - it is assumed that the + * caller is permitted to set the desired effective capabilities. + */ +kernel_cap_t cap_set_effective(const kernel_cap_t pE_new) +{ + kernel_cap_t pE_old; + + spin_lock(&task_capability_lock); + + pE_old = current->cap_effective; + current->cap_effective = pE_new; + + spin_unlock(&task_capability_lock); + + return pE_old; +} + +EXPORT_SYMBOL(cap_set_effective); + /** * sys_capget - get the capabilities of a given process. * @header: pointer to struct that contains capability version and