| .. | .. |
|---|
| 93 | 93 | break; |
|---|
| 94 | 94 | case _LINUX_CAPABILITY_VERSION_2: |
|---|
| 95 | 95 | warn_deprecated_v2(); |
|---|
| 96 | | - /* |
|---|
| 97 | | - * fall through - v3 is otherwise equivalent to v2. |
|---|
| 98 | | - */ |
|---|
| 96 | + fallthrough; /* v3 is otherwise equivalent to v2 */ |
|---|
| 99 | 97 | case _LINUX_CAPABILITY_VERSION_3: |
|---|
| 100 | 98 | *tocopy = _LINUX_CAPABILITY_U32S_3; |
|---|
| 101 | 99 | break; |
|---|
| .. | .. |
|---|
| 418 | 416 | EXPORT_SYMBOL(ns_capable_noaudit); |
|---|
| 419 | 417 | |
|---|
| 420 | 418 | /** |
|---|
| 419 | + * ns_capable_setid - Determine if the current task has a superior capability |
|---|
| 420 | + * in effect, while signalling that this check is being done from within a |
|---|
| 421 | + * setid or setgroups syscall. |
|---|
| 422 | + * @ns: The usernamespace we want the capability in |
|---|
| 423 | + * @cap: The capability to be tested for |
|---|
| 424 | + * |
|---|
| 425 | + * Return true if the current task has the given superior capability currently |
|---|
| 426 | + * available for use, false if not. |
|---|
| 427 | + * |
|---|
| 428 | + * This sets PF_SUPERPRIV on the task if the capability is available on the |
|---|
| 429 | + * assumption that it's about to be used. |
|---|
| 430 | + */ |
|---|
| 431 | +bool ns_capable_setid(struct user_namespace *ns, int cap) |
|---|
| 432 | +{ |
|---|
| 433 | + return ns_capable_common(ns, cap, CAP_OPT_INSETID); |
|---|
| 434 | +} |
|---|
| 435 | +EXPORT_SYMBOL(ns_capable_setid); |
|---|
| 436 | + |
|---|
| 437 | +/** |
|---|
| 421 | 438 | * capable - Determine if the current task has a superior capability in effect |
|---|
| 422 | 439 | * @cap: The capability to be tested for |
|---|
| 423 | 440 | * |
|---|