tools/testing/selftests/mseal_system_mappings/sysmap_is_sealed.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/mseal_system_mappings/sysmap_is_sealed.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/mseal_system_mappings/sysmap_is_sealed.c- Extension
.c- Size
- 1947 bytes
- Lines
- 120
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
stdio.herrno.hunistd.hstring.hstdbool.hkselftest.hkselftest_harness.h
Detected Declarations
function has_mappingfunction mapping_is_sealed
Annotated Snippet
if (!strncmp(line, VMFLAGS, strlen(VMFLAGS))) {
if (strstr(line, MSEAL_FLAGS))
return true;
return false;
}
}
return false;
}
FIXTURE(basic) {
FILE *maps;
};
FIXTURE_SETUP(basic)
{
self->maps = fopen("/proc/self/smaps", "r");
if (!self->maps)
SKIP(return, "Could not open /proc/self/smap, errno=%d",
errno);
};
FIXTURE_TEARDOWN(basic)
{
if (self->maps)
fclose(self->maps);
};
FIXTURE_VARIANT(basic)
{
char *name;
bool sealed;
};
FIXTURE_VARIANT_ADD(basic, vdso) {
.name = "[vdso]",
.sealed = true,
};
FIXTURE_VARIANT_ADD(basic, vvar) {
.name = "[vvar]",
.sealed = true,
};
FIXTURE_VARIANT_ADD(basic, vvar_vclock) {
.name = "[vvar_vclock]",
.sealed = true,
};
FIXTURE_VARIANT_ADD(basic, sigpage) {
.name = "[sigpage]",
.sealed = true,
};
FIXTURE_VARIANT_ADD(basic, vectors) {
.name = "[vectors]",
.sealed = true,
};
FIXTURE_VARIANT_ADD(basic, uprobes) {
.name = "[uprobes]",
.sealed = true,
};
FIXTURE_VARIANT_ADD(basic, stack) {
.name = "[stack]",
.sealed = false,
};
TEST_F(basic, check_sealed)
{
if (!has_mapping(variant->name, self->maps)) {
SKIP(return, "could not find the mapping, %s",
variant->name);
}
EXPECT_EQ(variant->sealed,
mapping_is_sealed(variant->name, self->maps));
};
TEST_HARNESS_MAIN
Annotation
- Immediate include surface: `stdio.h`, `errno.h`, `unistd.h`, `string.h`, `stdbool.h`, `kselftest.h`, `kselftest_harness.h`.
- Detected declarations: `function has_mapping`, `function mapping_is_sealed`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.