diff options
| author | Khem Raj <raj.khem@gmail.com> | 2021-05-01 10:46:55 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-29 11:17:20 +0100 |
| commit | b202d5e92e1db80727785933b3a6c4a7ddcec963 (patch) | |
| tree | 5b27437674ec23be6aa19d4cb3460f593d45dbf4 /meta/recipes-devtools | |
| parent | 9c6fe7ae1e88a9a2c6b53f7ef746332f47b1847d (diff) | |
| download | poky-b202d5e92e1db80727785933b3a6c4a7ddcec963.tar.gz | |
m4: Do not use SIGSTKSZ
Fixes
../../m4-1.4.18/lib/c-stack.c:55:26: error: missing binary operator before token "("
55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
| ^~~~~~~~
(From OE-Core rev: 4d350d458fa4ec75bf6f40da9c3a7c43403f3dbd)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 44ca8edd622782733d507e20a3d5ee9e44eb8be4)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
| -rw-r--r-- | meta/recipes-devtools/m4/m4-1.4.18.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/m4/m4/0001-c-stack-stop-using-SIGSTKSZ.patch | 84 |
2 files changed, 85 insertions, 0 deletions
diff --git a/meta/recipes-devtools/m4/m4-1.4.18.inc b/meta/recipes-devtools/m4/m4-1.4.18.inc index a9b63c1bf6..6475b02f8b 100644 --- a/meta/recipes-devtools/m4/m4-1.4.18.inc +++ b/meta/recipes-devtools/m4/m4-1.4.18.inc | |||
| @@ -9,6 +9,7 @@ inherit autotools texinfo ptest | |||
| 9 | SRC_URI = "${GNU_MIRROR}/m4/m4-${PV}.tar.gz \ | 9 | SRC_URI = "${GNU_MIRROR}/m4/m4-${PV}.tar.gz \ |
| 10 | file://ac_config_links.patch \ | 10 | file://ac_config_links.patch \ |
| 11 | file://m4-1.4.18-glibc-change-work-around.patch \ | 11 | file://m4-1.4.18-glibc-change-work-around.patch \ |
| 12 | file://0001-c-stack-stop-using-SIGSTKSZ.patch \ | ||
| 12 | " | 13 | " |
| 13 | SRC_URI_append_class-target = " file://0001-Unset-need_charset_alias-when-building-for-musl.patch \ | 14 | SRC_URI_append_class-target = " file://0001-Unset-need_charset_alias-when-building-for-musl.patch \ |
| 14 | file://run-ptest \ | 15 | file://run-ptest \ |
diff --git a/meta/recipes-devtools/m4/m4/0001-c-stack-stop-using-SIGSTKSZ.patch b/meta/recipes-devtools/m4/m4/0001-c-stack-stop-using-SIGSTKSZ.patch new file mode 100644 index 0000000000..883b8a2075 --- /dev/null +++ b/meta/recipes-devtools/m4/m4/0001-c-stack-stop-using-SIGSTKSZ.patch | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | From 69238f15129f35eb4756ad8e2004e0d7907cb175 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Fri, 30 Apr 2021 17:40:36 -0700 | ||
| 4 | Subject: [PATCH] c-stack: stop using SIGSTKSZ | ||
| 5 | |||
| 6 | This patch is required with glibc 2.34+ | ||
| 7 | based on gnulib [1] | ||
| 8 | |||
| 9 | [1] https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=f9e2b20a12a230efa30f1d479563ae07d276a94b | ||
| 10 | |||
| 11 | Upstream-Status: Pending | ||
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 13 | --- | ||
| 14 | lib/c-stack.c | 22 +++++++++++++--------- | ||
| 15 | 1 file changed, 13 insertions(+), 9 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/lib/c-stack.c b/lib/c-stack.c | ||
| 18 | index 5353c08..863f764 100644 | ||
| 19 | --- a/lib/c-stack.c | ||
| 20 | +++ b/lib/c-stack.c | ||
| 21 | @@ -51,13 +51,14 @@ | ||
| 22 | typedef struct sigaltstack stack_t; | ||
| 23 | #endif | ||
| 24 | #ifndef SIGSTKSZ | ||
| 25 | -# define SIGSTKSZ 16384 | ||
| 26 | -#elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384 | ||
| 27 | +#define get_sigstksz() (16384) | ||
| 28 | +#elif HAVE_LIBSIGSEGV | ||
| 29 | /* libsigsegv 2.6 through 2.8 have a bug where some architectures use | ||
| 30 | more than the Linux default of an 8k alternate stack when deciding | ||
| 31 | if a fault was caused by stack overflow. */ | ||
| 32 | -# undef SIGSTKSZ | ||
| 33 | -# define SIGSTKSZ 16384 | ||
| 34 | +#define get_sigstksz() ((SIGSTKSZ) < 16384 ? 16384 : (SIGSTKSZ)) | ||
| 35 | +#else | ||
| 36 | +#define get_sigstksz() ((SIGSTKSZ)) | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #include <stdlib.h> | ||
| 40 | @@ -131,7 +132,8 @@ die (int signo) | ||
| 41 | /* Storage for the alternate signal stack. */ | ||
| 42 | static union | ||
| 43 | { | ||
| 44 | - char buffer[SIGSTKSZ]; | ||
| 45 | + /* allocate buffer with size from get_sigstksz() */ | ||
| 46 | + char *buffer; | ||
| 47 | |||
| 48 | /* These other members are for proper alignment. There's no | ||
| 49 | standard way to guarantee stack alignment, but this seems enough | ||
| 50 | @@ -203,10 +205,11 @@ c_stack_action (void (*action) (int)) | ||
| 51 | program_error_message = _("program error"); | ||
| 52 | stack_overflow_message = _("stack overflow"); | ||
| 53 | |||
| 54 | + alternate_signal_stack.buffer = malloc(get_sigstksz()); | ||
| 55 | /* Always install the overflow handler. */ | ||
| 56 | if (stackoverflow_install_handler (overflow_handler, | ||
| 57 | alternate_signal_stack.buffer, | ||
| 58 | - sizeof alternate_signal_stack.buffer)) | ||
| 59 | + get_sigstksz())) | ||
| 60 | { | ||
| 61 | errno = ENOTSUP; | ||
| 62 | return -1; | ||
| 63 | @@ -279,14 +282,15 @@ c_stack_action (void (*action) (int)) | ||
| 64 | stack_t st; | ||
| 65 | struct sigaction act; | ||
| 66 | st.ss_flags = 0; | ||
| 67 | + alternate_signal_stack.buffer = malloc(get_sigstksz()); | ||
| 68 | # if SIGALTSTACK_SS_REVERSED | ||
| 69 | /* Irix mistakenly treats ss_sp as the upper bound, rather than | ||
| 70 | lower bound, of the alternate stack. */ | ||
| 71 | - st.ss_sp = alternate_signal_stack.buffer + SIGSTKSZ - sizeof (void *); | ||
| 72 | - st.ss_size = sizeof alternate_signal_stack.buffer - sizeof (void *); | ||
| 73 | + st.ss_sp = alternate_signal_stack.buffer + get_sigstksz() - sizeof (void *); | ||
| 74 | + st.ss_size = get_sigstksz() - sizeof (void *); | ||
| 75 | # else | ||
| 76 | st.ss_sp = alternate_signal_stack.buffer; | ||
| 77 | - st.ss_size = sizeof alternate_signal_stack.buffer; | ||
| 78 | + st.ss_size = get_sigstksz(); | ||
| 79 | # endif | ||
| 80 | r = sigaltstack (&st, NULL); | ||
| 81 | if (r != 0) | ||
| 82 | -- | ||
| 83 | 2.31.1 | ||
| 84 | |||
