/* SPDX-License-Identifier: GPL-2.0 */ /* * This is <linux/capability.h> * * Andrew G. Morgan <morgan@kernel.org> * Alexander Kjeldaas <astor@guardian.no> * with help from Aleph1, Roland Buresund and Andrew Main. * * See here for the libcap library ("POSIX draft" compliance): * * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
*/ #ifndef _LINUX_CAPABILITY_H #define _LINUX_CAPABILITY_H
/* same as vfs_ns_cap_data but in cpu endian and always filled completely */ struct cpu_vfs_cap_data {
__u32 magic_etc;
kuid_t rootid;
kernel_cap_t permitted;
kernel_cap_t inheritable;
};
/* * CAP_FS_MASK and CAP_NFSD_MASKS: * * The fs mask is all the privileges that fsuid==0 historically meant. * At one time in the past, that included CAP_MKNOD and CAP_LINUX_IMMUTABLE. * * It has never meant setting security.* and trusted.* xattrs. * * We could also define fsmask as follows: * 1. CAP_FS_MASK is the privilege to bypass all fs-related DAC permissions * 2. The security.* and trusted.* xattrs are fs-related MAC permissions
*/
staticinlinebool cap_isclear(const kernel_cap_t a)
{ return !a.val;
}
staticinlinebool cap_isidentical(const kernel_cap_t a, const kernel_cap_t b)
{ return a.val == b.val;
}
/* * Check if "a" is a subset of "set". * return true if ALL of the capabilities in "a" are also in "set" * cap_issubset(0101, 1111) will return true * return false if ANY of the capabilities in "a" are not in "set" * cap_issubset(1111, 0101) will return false
*/ staticinlinebool cap_issubset(const kernel_cap_t a, const kernel_cap_t set)
{ return !(a.val & ~set.val);
}
/* Used to decide between falling back on the old suser() or fsuser(). */
staticinline kernel_cap_t cap_drop_fs_set(const kernel_cap_t a)
{ return cap_drop(a, CAP_FS_SET);
}
/* audit system wants to get cap info from files as well */ int get_vfs_caps_from_disk(struct mnt_idmap *idmap, conststruct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.