1 /* Copyright (C) 2001-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/>. */
18 #include <sigaltstack-offsets.h>
20 .section .rodata.str1.1,"aMS",@progbits,1
21 .type longjmp_msg,@object
23 .string "longjmp causes uninitialized stack frame"
24 .size longjmp_msg, .-longjmp_msg
27 # define LOAD_MSG lea longjmp_msg(%rip), %RDI_LP
29 # define LOAD_MSG mov $longjmp_msg, %RDI_LP
32 #define CHECK_INVALID_LONGJMP \
33 cmp %R8_LP, %RSP_LP; \
35 /* Save function parameters. */ \
37 cfi_register (%rdi, %r10); \
39 cfi_register (%rsi, %rbx); \
41 lea -sizeSS(%rsp), %RSI_LP; \
42 movl $__NR_sigaltstack, %eax; \
44 /* Without working sigaltstack we cannot perform the test. */ \
47 testl $1, (-sizeSS + oSS_FLAGS)(%rsp); \
49 mov (-sizeSS + oSS_SP)(%rsp), %RAX_LP; \
50 add (-sizeSS + oSS_SIZE)(%rsp), %RAX_LP; \
51 sub %R8_LP, %RAX_LP; \
52 cmp (-sizeSS + oSS_SIZE)(%rsp), %RAX_LP; \
57 cfi_def_cfa_offset(16); \
59 call HIDDEN_JUMPTARGET(__fortify_fail); \
69 #define __longjmp ____longjmp_chk
70 #include <__longjmp.S>