tools/testing/selftests/arm64/signal/testcases/gcs_exception_fault.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/arm64/signal/testcases/gcs_exception_fault.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/arm64/signal/testcases/gcs_exception_fault.c- Extension
.c- Size
- 1169 bytes
- Lines
- 63
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
errno.hsignal.hunistd.hsys/mman.hsys/prctl.htest_signals_utils.htestcases.h
Detected Declarations
function Copyrightfunction gcs_op_fault_triggerfunction gcs_op_fault_signal
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2023 ARM Limited
*/
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/prctl.h>
#include "test_signals_utils.h"
#include "testcases.h"
/*
* We should get this from asm/siginfo.h but the testsuite is being
* clever with redefining siginfo_t.
*/
#ifndef SEGV_CPERR
#define SEGV_CPERR 10
#endif
static inline void gcsss1(uint64_t Xt)
{
asm volatile (
"sys #3, C7, C7, #2, %0\n"
:
: "rZ" (Xt)
: "memory");
}
static int gcs_op_fault_trigger(struct tdescr *td)
{
/*
* The slot below our current GCS should be in a valid GCS but
* must not have a valid cap in it.
*/
gcsss1(get_gcspr_el0() - 8);
return 0;
}
static int gcs_op_fault_signal(struct tdescr *td, siginfo_t *si,
ucontext_t *uc)
{
ASSERT_GOOD_CONTEXT(uc);
return 1;
}
struct tdescr tde = {
.name = "Invalid GCS operation",
.descr = "An invalid GCS operation generates the expected signal",
.feats_required = FEAT_GCS,
.timeout = 3,
.sig_ok = SIGSEGV,
.sig_ok_code = SEGV_CPERR,
.sanity_disabled = true,
.trigger = gcs_op_fault_trigger,
.run = gcs_op_fault_signal,
};
Annotation
- Immediate include surface: `errno.h`, `signal.h`, `unistd.h`, `sys/mman.h`, `sys/prctl.h`, `test_signals_utils.h`, `testcases.h`.
- Detected declarations: `function Copyright`, `function gcs_op_fault_trigger`, `function gcs_op_fault_signal`.
- 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.