1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2019 ARM Limited
5 * Place a fake sigframe on the stack including an additional FPSIMD
6 * record: on sigreturn Kernel must spot this attempt and the test
7 * case is expected to be terminated via SEGV.
13 #include "test_signals_utils.h"
14 #include "testcases.h"
16 struct fake_sigframe sf;
18 static int fake_sigreturn_duplicated_fpsimd_run(struct tdescr *td,
19 siginfo_t *si, ucontext_t *uc)
21 struct _aarch64_ctx *shead = GET_SF_RESV_HEAD(sf), *head;
23 /* just to fill the ucontext_t with something real */
24 if (!get_current_context(td, &sf.uc))
27 head = get_starting_head(shead, sizeof(struct fpsimd_context) + HDR_SZ,
28 GET_SF_RESV_SIZE(sf), NULL);
32 /* Add a spurious fpsimd_context */
33 head->magic = FPSIMD_MAGIC;
34 head->size = sizeof(struct fpsimd_context);
36 write_terminator_record(GET_RESV_NEXT_HEAD(head));
38 ASSERT_BAD_CONTEXT(&sf.uc);
39 fake_sigreturn(&sf, sizeof(sf), 0);
45 .name = "FAKE_SIGRETURN_DUPLICATED_FPSIMD",
46 .descr = "Triggers a sigreturn including two fpsimd_context",
49 .run = fake_sigreturn_duplicated_fpsimd_run,