]>
Commit | Line | Data |
---|---|---|
688903eb | 1 | /* Copyright (C) 2009-2018 Free Software Foundation, Inc. |
6a9f82ac JM |
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 Lesser General Public | |
ab84e3ff PE |
15 | License along with the GNU C Library. If not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
6a9f82ac | 17 | |
c67273d5 | 18 | #include <signal.h> |
6a9f82ac JM |
19 | #include <stdio.h> |
20 | #define __longjmp ____longjmp_chk | |
c67273d5 JM |
21 | #define CHECK_SP(saved_sp, cur_sp, sp_type) \ |
22 | do { \ | |
23 | sp_type sp_saved = (sp_type) (saved_sp); \ | |
24 | if (sp_saved < (cur_sp)) \ | |
25 | { \ | |
26 | struct __jmp_buf_internal_tag *env_save = env_arg; \ | |
27 | int val_save = val_arg; \ | |
28 | stack_t ss; \ | |
29 | int ret = __sigaltstack (NULL, &ss); \ | |
30 | if (ret == 0 \ | |
31 | && (!(ss.ss_flags & SS_ONSTACK) \ | |
aa099ade | 32 | || ((unsigned sp_type) ((sp_type) (long) ss.ss_sp \ |
c67273d5 JM |
33 | + (sp_type) ss.ss_size \ |
34 | - sp_saved) \ | |
35 | < ss.ss_size))) \ | |
36 | __fortify_fail ("longjmp causes uninitialized stack frame"); \ | |
37 | asm volatile ("move %0, %1" : "=r" (env) : "r" (env_save)); \ | |
38 | asm volatile ("move %0, %1" : "=r" (val) : "r" (val_save)); \ | |
39 | } \ | |
40 | } while (0) | |
6a9f82ac | 41 | #include <__longjmp.c> |