1 /* Copyright (C) 2009-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
19 #include <pointer_guard.h>
21 #include <sigaltstack-offsets.h>
23 .section .rodata.str1.1,"aMS",@progbits,1
24 .type longjmp_msg,@object
26 .string "longjmp causes uninitialized stack frame"
27 .size longjmp_msg, .-longjmp_msg
30 #define __longjmp ____longjmp_chk
38 cfi_adjust_cfa_offset (4); \
39 cfi_rel_offset (r12, 0); \
44 cfi_adjust_cfa_offset (4); \
45 cfi_rel_offset (pr, 0); \
52 .long _GLOBAL_OFFSET_TABLE_; \
54 .long longjmp_msg@GOTOFF; \
56 .long HIDDEN_JUMPTARGET(__fortify_fail)@PLT-(.Lfail0-.); \
64 cfi_adjust_cfa_offset (4); \
65 cfi_rel_offset (pr, 0); \
73 .long HIDDEN_JUMPTARGET(__fortify_fail); \
77 #define CHECK_SP(reg) \
78 /* Jumping to a higher-address frame is always allowed. */ \
82 mov.l r0, @-r15; /* The return value is already in here. */ \
83 cfi_adjust_cfa_offset (4); \
84 mov.l r1, @-r15; /* PTR_DEMANGLE helper. */ \
85 cfi_adjust_cfa_offset (4); \
86 mov.l r2, @-r15; /* The new SP value is already in here. */ \
87 cfi_adjust_cfa_offset (4); \
88 mov.l r4, @-r15; /* We'll still need this one. */ \
89 cfi_adjust_cfa_offset (4); \
91 cfi_adjust_cfa_offset (sizeSS); \
94 DO_CALL (sigaltstack, 2); \
95 /* Without working sigaltstack we cannot perform the test. */ \
98 mov.l @(oSS_FLAGS, r15), r0; \
99 tst #SS_ONSTACK, r0; \
101 mov.l @(oSS_SIZE, r15), r2; \
102 mov.l @(oSS_SP, r15), r1; \
112 cfi_adjust_cfa_offset (-sizeSS); \
114 cfi_adjust_cfa_offset (-4); \
116 cfi_adjust_cfa_offset (-4); \
118 cfi_adjust_cfa_offset (-4); \
120 cfi_adjust_cfa_offset (-4); \
123 #include <__longjmp.S>