1/* Copyright (C) 2009-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
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.
8
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.
13
14 You should have received a copy of the GNU General Public License
15 along with GCC; see the file COPYING. If not, write to the Free
16 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA. */
18
19#include <stdio.h>
20#include <signal.h>
21#include <sysdep.h>
22#define __longjmp ____longjmp_chk
23#define CHECK_SP(sp) \
24 do { \
25 register unsigned long this_sp asm ("r30"); \
26 /* The stack grows up, therefore frames that were created and then \
27 destroyed must all have stack values higher than ours. */ \
28 if ((unsigned long) (sp) > this_sp) \
29 { \
30 stack_t oss; \
31 int result = INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &oss);\
32 /* If we aren't using an alternate stack then we have already \
33 shown that we are jumping to a frame that doesn't exist so \
34 error out. If we are using an alternate stack we must prove \
35 that we are jumping *out* of the alternate stack. Note that \
36 the check for that is the same as that for _STACK_GROWS_UP \
37 as for _STACK_GROWS_DOWN. */ \
38 if (!INTERNAL_SYSCALL_ERROR_P (result) \
39 && ((oss.ss_flags & SS_ONSTACK) == 0 \
40 || ((unsigned long) oss.ss_sp + oss.ss_size \
41 - (unsigned long) (sp)) < oss.ss_size)) \
42 __fortify_fail ("longjmp causes uninitialized stack frame"); \
43 } \
44 } while (0)
45
46#include <__longjmp.c>
47

source code of glibc/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c