tools/testing/selftests/powerpc/signal/sigreturn_unaligned.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/signal/sigreturn_unaligned.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/powerpc/signal/sigreturn_unaligned.c- Extension
.c- Size
- 824 bytes
- Lines
- 44
- 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
signal.hstdio.hstdlib.hstring.hucontext.hunistd.hutils.h
Detected Declarations
function sigusr1_handlerfunction test_sigreturn_unalignedfunction main
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Test sigreturn to an unaligned address, ie. low 2 bits set.
* Nothing bad should happen.
* This was able to trigger warnings with CONFIG_PPC_RFI_SRR_DEBUG=y.
*/
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ucontext.h>
#include <unistd.h>
#include "utils.h"
static void sigusr1_handler(int signo, siginfo_t *info, void *ptr)
{
ucontext_t *uc = ptr;
UCONTEXT_NIA(uc) |= 3;
}
static int test_sigreturn_unaligned(void)
{
struct sigaction action;
memset(&action, 0, sizeof(action));
action.sa_sigaction = sigusr1_handler;
action.sa_flags = SA_SIGINFO;
FAIL_IF(sigaction(SIGUSR1, &action, NULL) == -1);
raise(SIGUSR1);
return 0;
}
int main(void)
{
return test_harness(test_sigreturn_unaligned, "sigreturn_unaligned");
}
Annotation
- Immediate include surface: `signal.h`, `stdio.h`, `stdlib.h`, `string.h`, `ucontext.h`, `unistd.h`, `utils.h`.
- Detected declarations: `function sigusr1_handler`, `function test_sigreturn_unaligned`, `function main`.
- 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.