security/smack/smack.h
Source file repositories/reference/linux-study-clean/security/smack/smack.h
File Facts
- System
- Linux kernel
- Corpus path
security/smack/smack.h- Extension
.h- Size
- 14474 bytes
- Lines
- 542
- Domain
- Core OS
- Bucket
- Security And Isolation
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/capability.hlinux/spinlock.hlinux/lsm_hooks.hlinux/in.hlinux/in6.hnet/netlabel.hlinux/list.hlinux/rculist.hlinux/lsm_audit.hlinux/msg.h
Detected Declarations
struct smack_knownstruct superblock_smackstruct socket_smackstruct inode_smackstruct task_smackstruct smack_rulestruct smk_net4addrstruct smk_net6addrstruct smk_port_labelstruct smack_known_list_elemstruct smack_audit_datastruct smk_audit_infofunction smack_nf_ip_initfunction smk_inode_transmutablefunction smk_ad_initfunction smk_ad_init_netfunction smk_ad_setfield_u_tskfunction smk_ad_setfield_u_fs_path_dentryfunction smk_ad_setfield_u_fs_inodefunction smk_ad_setfield_u_fs_pathfunction smk_ad_setfield_u_net_skfunction smk_ad_init
Annotated Snippet
struct smack_known {
struct list_head list;
struct hlist_node smk_hashed;
char *smk_known;
u32 smk_secid;
struct netlbl_lsm_secattr smk_netlabel; /* on wire labels */
struct list_head smk_rules; /* access rules */
struct mutex smk_rules_lock; /* lock for rules */
};
/*
* Maximum number of bytes for the levels in a CIPSO IP option.
* Why 23? CIPSO is constrained to 30, so a 32 byte buffer is
* bigger than can be used, and 24 is the next lower multiple
* of 8, and there are too many issues if there isn't space set
* aside for the terminating null byte.
*/
#define SMK_CIPSOLEN 24
struct superblock_smack {
struct smack_known *smk_root;
struct smack_known *smk_floor;
struct smack_known *smk_hat;
struct smack_known *smk_default;
int smk_flags;
};
/*
* Superblock flags
*/
#define SMK_SB_INITIALIZED 0x01
#define SMK_SB_UNTRUSTED 0x02
struct socket_smack {
struct smack_known *smk_out; /* outbound label */
struct smack_known *smk_in; /* inbound label */
struct smack_known *smk_packet; /* TCP peer label */
int smk_state; /* netlabel socket states */
};
#define SMK_NETLBL_UNSET 0
#define SMK_NETLBL_UNLABELED 1
#define SMK_NETLBL_LABELED 2
#define SMK_NETLBL_REQSKB 3
/*
* Inode smack data
*/
struct inode_smack {
struct smack_known *smk_inode; /* label of the fso */
struct smack_known *smk_task; /* label of the task */
struct smack_known *smk_mmap; /* label of the mmap domain */
int smk_flags; /* smack inode flags */
};
struct task_smack {
struct smack_known *smk_task; /* label for access control */
struct smack_known *smk_forked; /* label when forked */
struct smack_known *smk_transmuted;/* label when transmuted */
struct list_head smk_rules; /* per task access rules */
struct mutex smk_rules_lock; /* lock for the rules */
struct list_head smk_relabel; /* transit allowed labels */
};
#define SMK_INODE_INSTANT 0x01 /* inode is instantiated */
#define SMK_INODE_TRANSMUTE 0x02 /* directory is transmuting */
#define SMK_INODE_CHANGED 0x04 /* smack was transmuted (unused) */
#define SMK_INODE_IMPURE 0x08 /* involved in an impure transaction */
/*
* A label access rule.
*/
struct smack_rule {
struct list_head list;
struct smack_known *smk_subject;
struct smack_known *smk_object;
int smk_access;
};
/*
* An entry in the table identifying IPv4 hosts.
*/
struct smk_net4addr {
struct list_head list;
struct in_addr smk_host; /* network address */
struct in_addr smk_mask; /* network mask */
int smk_masks; /* mask size */
struct smack_known *smk_label; /* label */
};
#if IS_ENABLED(CONFIG_IPV6)
Annotation
- Immediate include surface: `linux/capability.h`, `linux/spinlock.h`, `linux/lsm_hooks.h`, `linux/in.h`, `linux/in6.h`, `net/netlabel.h`, `linux/list.h`, `linux/rculist.h`.
- Detected declarations: `struct smack_known`, `struct superblock_smack`, `struct socket_smack`, `struct inode_smack`, `struct task_smack`, `struct smack_rule`, `struct smk_net4addr`, `struct smk_net6addr`, `struct smk_port_label`, `struct smack_known_list_elem`.
- Atlas domain: Core OS / Security And Isolation.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.