1
2
3
4
5
6
7
8
9
10#include <signal.h>
11#include <ucontext.h>
12
13#include "test_signals_utils.h"
14#include "testcases.h"
15
16struct fake_sigframe sf;
17
18static int fake_sigreturn_duplicated_fpsimd_run(struct tdescr *td,
19 siginfo_t *si, ucontext_t *uc)
20{
21 struct _aarch64_ctx *shead = GET_SF_RESV_HEAD(sf), *head;
22
23
24 if (!get_current_context(td, &sf.uc))
25 return 1;
26
27 head = get_starting_head(shead, sizeof(struct fpsimd_context) + HDR_SZ,
28 GET_SF_RESV_SIZE(sf), NULL);
29 if (!head)
30 return 0;
31
32
33 head->magic = FPSIMD_MAGIC;
34 head->size = sizeof(struct fpsimd_context);
35
36 write_terminator_record(GET_RESV_NEXT_HEAD(head));
37
38 ASSERT_BAD_CONTEXT(&sf.uc);
39 fake_sigreturn(&sf, sizeof(sf), 0);
40
41 return 1;
42}
43
44struct tdescr tde = {
45 .name = "FAKE_SIGRETURN_DUPLICATED_FPSIMD",
46 .descr = "Triggers a sigreturn including two fpsimd_context",
47 .sig_ok = SIGSEGV,
48 .timeout = 3,
49 .run = fake_sigreturn_duplicated_fpsimd_run,
50};
51