Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_SECUREBITS_H |
| 2 | #define _LINUX_SECUREBITS_H 1 |
| 3 | |
| 4 | #define SECUREBITS_DEFAULT 0x00000000 |
| 5 | |
| 6 | extern unsigned securebits; |
| 7 | |
| 8 | /* When set UID 0 has no special privileges. When unset, we support |
| 9 | inheritance of root-permissions and suid-root executable under |
| 10 | compatibility mode. We raise the effective and inheritable bitmasks |
| 11 | *of the executable file* if the effective uid of the new process is |
| 12 | 0. If the real uid is 0, we raise the inheritable bitmask of the |
| 13 | executable file. */ |
| 14 | #define SECURE_NOROOT 0 |
| 15 | |
| 16 | /* When set, setuid to/from uid 0 does not trigger capability-"fixes" |
| 17 | to be compatible with old programs relying on set*uid to loose |
| 18 | privileges. When unset, setuid doesn't change privileges. */ |
| 19 | #define SECURE_NO_SETUID_FIXUP 2 |
| 20 | |
| 21 | /* Each securesetting is implemented using two bits. One bit specify |
| 22 | whether the setting is on or off. The other bit specify whether the |
| 23 | setting is fixed or not. A setting which is fixed cannot be changed |
| 24 | from user-level. */ |
| 25 | |
| 26 | #define issecure(X) ( (1 << (X+1)) & SECUREBITS_DEFAULT ? \ |
| 27 | (1 << (X)) & SECUREBITS_DEFAULT : \ |
| 28 | (1 << (X)) & securebits ) |
| 29 | |
| 30 | #endif /* !_LINUX_SECUREBITS_H */ |