security/integrity/iint.c
Source file repositories/reference/linux-study-clean/security/integrity/iint.c
File Facts
- System
- Linux kernel
- Corpus path
security/integrity/iint.c- Extension
.c- Size
- 1533 bytes
- Lines
- 72
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/security.hintegrity.h
Detected Declarations
function kernel_readfunction integrity_load_keysfunction integrity_fs_initfunction integrity_fs_fini
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2008 IBM Corporation
*
* Authors:
* Mimi Zohar <zohar@us.ibm.com>
*
* File: integrity_iint.c
* - initialize the integrity directory in securityfs
* - load IMA and EVM keys
*/
#include <linux/security.h>
#include "integrity.h"
struct dentry *integrity_dir;
/*
* integrity_kernel_read - read data from the file
*
* This is a function for reading file content instead of kernel_read().
* It does not perform locking checks to ensure it cannot be blocked.
* It does not perform security checks because it is irrelevant for IMA.
*
*/
int integrity_kernel_read(struct file *file, loff_t offset,
void *addr, unsigned long count)
{
return __kernel_read(file, addr, count, &offset);
}
/*
* integrity_load_keys - load integrity keys hook
*
* Hooks is called from init/main.c:kernel_init_freeable()
* when rootfs is ready
*/
void __init integrity_load_keys(void)
{
ima_load_x509();
if (!IS_ENABLED(CONFIG_IMA_LOAD_X509))
evm_load_x509();
}
int __init integrity_fs_init(void)
{
if (integrity_dir)
return 0;
integrity_dir = securityfs_create_dir("integrity", NULL);
if (IS_ERR(integrity_dir)) {
int ret = PTR_ERR(integrity_dir);
if (ret != -ENODEV)
pr_err("Unable to create integrity sysfs dir: %d\n",
ret);
integrity_dir = NULL;
return ret;
}
return 0;
}
void __init integrity_fs_fini(void)
{
if (!integrity_dir || !simple_empty(integrity_dir))
return;
securityfs_remove(integrity_dir);
integrity_dir = NULL;
}
Annotation
- Immediate include surface: `linux/security.h`, `integrity.h`.
- Detected declarations: `function kernel_read`, `function integrity_load_keys`, `function integrity_fs_init`, `function integrity_fs_fini`.
- Atlas domain: Core OS / Security And Isolation.
- Implementation status: source implementation candidate.
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.