File Index
Files and directories
Sign in
FILE

test_signals.c

File preview with syntax highlighting.

linux-6.19.14/tools/testing/selftests/arm64/signal/test_signals.c C
 1// SPDX-License-Identifier: GPL-2.0
 2/*
 3 * Copyright (C) 2019 ARM Limited
 4 *
 5 * Generic test wrapper for arm64 signal tests.
 6 *
 7 * Each test provides its own tde struct tdescr descriptor to link with
 8 * this wrapper. Framework provides common helpers.
 9 */
10
11#include <sys/auxv.h>
12#include <sys/prctl.h>
13
14#include <kselftest.h>
15
16#include "test_signals.h"
17#include "test_signals_utils.h"
18
19struct tdescr *current = &tde;
20
21int main(int argc, char *argv[])
22{
23	/*
24	 * Ensure GCS is at least enabled throughout the tests if
25	 * supported, otherwise the inability to return from the
26	 * function that enabled GCS makes it very inconvenient to set
27	 * up test cases.  The prctl() may fail if GCS was locked by
28	 * libc setup code.
29	 */
30	if (getauxval(AT_HWCAP) & HWCAP_GCS)
31		gcs_set_state(PR_SHADOW_STACK_ENABLE);
32
33	ksft_print_msg("%s :: %s\n", current->name, current->descr);
34	if (test_setup(current) && test_init(current)) {
35		test_run(current);
36		test_cleanup(current);
37	}
38	test_result(current);
39
40	/* Do not return in case GCS was enabled */
41	exit(current->result);
42}
~/ Read-only file preview.