diff options
author | mark.yang <mark.yang@lge.com> | 2025-03-26 20:43:18 +0900 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2025-03-26 07:37:51 -0700 |
commit | 604eb7dcde41e8af7d1b43aa80f08dbac11f0865 (patch) | |
tree | f1b36e8e795da669a2576d8ca38bfe568b0baa72 /meta-oe/recipes-kernel | |
parent | afaa5f4737d4363b2e6a0adbb345ee6233f645f6 (diff) | |
download | meta-openembedded-604eb7dcde41e8af7d1b43aa80f08dbac11f0865.tar.gz |
crash: fix build with gcc-15
* to fix: following erros occured in gcc-15.0.1 environment.
signals.c: In function '_rl_signal_handler':
signals.c:62:36: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
62 | # define SIGHANDLER_RETURN return (0)
| ^
signals.c:160:3: note: in expansion of macro 'SIGHANDLER_RETURN'
160 | SIGHANDLER_RETURN;
| ^~~~~~~~~~~~~~~~~
signals.c:141:1: note: declared here
141 | _rl_signal_handler (int sig)
| ^~~~~~~~~~~~~~~~~~
signals.c: In function 'rl_set_sighandler':
signals.c:343:18: error: assignment to '__sighandler_t' {aka 'void (*)(int)'} from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types]
343 | act.sa_handler = handler;
| ^
In file included from signals.c:30:
recipe-sysroot/usr/include/signal.h:72:16: note: '__sighandler_t' declared here
72 | typedef void (*__sighandler_t) (int);
| ^~~~~~~~~~~~~~
Signed-off-by: mark.yang <mark.yang@lge.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-kernel')
4 files changed, 284 insertions, 0 deletions
diff --git a/meta-oe/recipes-kernel/crash/crash.inc b/meta-oe/recipes-kernel/crash/crash.inc index 3d712592df..6425c4ba7a 100644 --- a/meta-oe/recipes-kernel/crash/crash.inc +++ b/meta-oe/recipes-kernel/crash/crash.inc | |||
@@ -23,6 +23,9 @@ SRC_URI = "git://github.com/crash-utility/${BPN}.git;branch=master;protocol=http | |||
23 | file://donnot-extract-gdb-during-do-compile.patch \ | 23 | file://donnot-extract-gdb-during-do-compile.patch \ |
24 | file://gdb_build_jobs_and_not_write_crash_target.patch \ | 24 | file://gdb_build_jobs_and_not_write_crash_target.patch \ |
25 | file://0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch \ | 25 | file://0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch \ |
26 | file://0002-arm64-add-pac-mask-to-better-support-gdb-stack-unwin.patch \ | ||
27 | file://0003-Fix-build-failure-in-readline-lib.patch \ | ||
28 | file://0004-tools.c-do-not-use-keywords-nullptr-as-a-variable-in.patch \ | ||
26 | " | 29 | " |
27 | SRCREV = "f13853cef53f5c5463a51021edbc81977e2b1405" | 30 | SRCREV = "f13853cef53f5c5463a51021edbc81977e2b1405" |
28 | 31 | ||
diff --git a/meta-oe/recipes-kernel/crash/crash/0002-arm64-add-pac-mask-to-better-support-gdb-stack-unwin.patch b/meta-oe/recipes-kernel/crash/crash/0002-arm64-add-pac-mask-to-better-support-gdb-stack-unwin.patch new file mode 100644 index 0000000000..42a585d366 --- /dev/null +++ b/meta-oe/recipes-kernel/crash/crash/0002-arm64-add-pac-mask-to-better-support-gdb-stack-unwin.patch | |||
@@ -0,0 +1,85 @@ | |||
1 | From 0f39e33d3504f3a17b83574c3be97640460b7eef Mon Sep 17 00:00:00 2001 | ||
2 | From: "Guanyou.Chen" <chenguanyou@xiaomi.com> | ||
3 | Date: Wed, 25 Dec 2024 23:50:28 +0800 | ||
4 | Subject: [PATCH] arm64: add pac mask to better support gdb stack unwind | ||
5 | |||
6 | Currently, gdb passthroughs of 'bt', 'frame', 'up', 'down', | ||
7 | 'info, locals' don't work on arm64 machine enabled pauth. | ||
8 | This is because gdb does not know the lr register actual values | ||
9 | to unwind the stack frames. | ||
10 | |||
11 | Without the patch: | ||
12 | crash> gdb bt | ||
13 | #0 __switch_to (prev=0xffffff8001af92c0, next=0xffffff889da7a580) at /proc/self/cwd/common/arch/arm64/kernel/process.c:569 | ||
14 | #1 0x9fc5c5d3602132c0 in ?? () | ||
15 | Backtrace stopped: previous frame identical to this frame (corrupt stack?) | ||
16 | |||
17 | With the patch: | ||
18 | crash> gdb bt | ||
19 | #0 __switch_to (prev=prev@entry=0xffffff8001af92c0, next=next@entry=0xffffff889da7a580) at /proc/self/cwd/common/arch/arm64/kernel/process.c:569 | ||
20 | #1 0xffffffd3602132c0 in context_switch (rq=0xffffff8a7295a080, prev=0xffffff8001af92c0, next=0xffffff889da7a580, rf=<optimized out>) at /proc/self/cwd/common/kernel/sched/core.c:5515 | ||
21 | #2 __schedule (sched_mode=<optimized out>, sched_mode@entry=2147859424) at /proc/self/cwd/common/kernel/sched/core.c:6843 | ||
22 | #3 0xffffffd3602136d8 in schedule () at /proc/self/cwd/common/kernel/sched/core.c:6917 | ||
23 | ... | ||
24 | |||
25 | Signed-off-by: Guanyou.Chen <chenguanyou@xiaomi.com> | ||
26 | Signed-off-by: mark.yang <mark.yang@lge.com> | ||
27 | |||
28 | Upstream-Status: Backport [0f39e33 arm64: add pac mask to better support gdb stack unwind] | ||
29 | --- | ||
30 | gdb-10.2.patch | 23 +++++++++++++++++++++++ | ||
31 | gdb_interface.c | 10 ++++++++++ | ||
32 | 2 files changed, 33 insertions(+) | ||
33 | |||
34 | diff --git a/gdb-10.2.patch b/gdb-10.2.patch | ||
35 | index c867660..fd6fadb 100644 | ||
36 | --- a/gdb-10.2.patch | ||
37 | +++ b/gdb-10.2.patch | ||
38 | @@ -16216,3 +16216,26 @@ exit 0 | ||
39 | printf_filtered (_("Backtrace stopped: %s\n"), | ||
40 | frame_stop_reason_string (trailing)); | ||
41 | } | ||
42 | +--- gdb-10.2/gdb/frame.c.orig | ||
43 | ++++ gdb-10.2/gdb/frame.c | ||
44 | +@@ -944,6 +944,10 @@ frame_find_by_id (struct frame_id id) | ||
45 | + return NULL; | ||
46 | + } | ||
47 | + | ||
48 | ++#ifdef CRASH_MERGE | ||
49 | ++extern "C" void crash_decode_ptrauth_pc(ulong* pc); | ||
50 | ++#endif | ||
51 | ++ | ||
52 | + static CORE_ADDR | ||
53 | + frame_unwind_pc (struct frame_info *this_frame) | ||
54 | + { | ||
55 | +@@ -974,6 +978,9 @@ frame_unwind_pc (struct frame_info *this_frame) | ||
56 | + try | ||
57 | + { | ||
58 | + pc = gdbarch_unwind_pc (prev_gdbarch, this_frame); | ||
59 | ++#ifdef CRASH_MERGE | ||
60 | ++ crash_decode_ptrauth_pc(&pc); | ||
61 | ++#endif | ||
62 | + pc_p = true; | ||
63 | + } | ||
64 | + catch (const gdb_exception_error &ex) | ||
65 | diff --git a/gdb_interface.c b/gdb_interface.c | ||
66 | index 315711e..e108d09 100644 | ||
67 | --- a/gdb_interface.c | ||
68 | +++ b/gdb_interface.c | ||
69 | @@ -1083,3 +1083,13 @@ int crash_get_current_task_reg (int regno, const char *regname, | ||
70 | return machdep->get_current_task_reg(regno, regname, regsize, value); | ||
71 | } | ||
72 | |||
73 | +/* arm64 kernel lr maybe has patuh */ | ||
74 | +void crash_decode_ptrauth_pc(ulong *pc); | ||
75 | +void crash_decode_ptrauth_pc(ulong *pc) | ||
76 | +{ | ||
77 | +#ifdef ARM64 | ||
78 | + struct machine_specific *ms = machdep->machspec; | ||
79 | + if (is_kernel_text(*pc | ms->CONFIG_ARM64_KERNELPACMASK)) | ||
80 | + *pc |= ms->CONFIG_ARM64_KERNELPACMASK; | ||
81 | +#endif /* !ARM64 */ | ||
82 | +} | ||
83 | -- | ||
84 | 2.34.1 | ||
85 | |||
diff --git a/meta-oe/recipes-kernel/crash/crash/0003-Fix-build-failure-in-readline-lib.patch b/meta-oe/recipes-kernel/crash/crash/0003-Fix-build-failure-in-readline-lib.patch new file mode 100644 index 0000000000..f3318b3a6a --- /dev/null +++ b/meta-oe/recipes-kernel/crash/crash/0003-Fix-build-failure-in-readline-lib.patch | |||
@@ -0,0 +1,136 @@ | |||
1 | From 772fbb1022911410b5fb773fde37910fc8286041 Mon Sep 17 00:00:00 2001 | ||
2 | From: Lianbo Jiang <lijiang@redhat.com> | ||
3 | Date: Fri, 24 Jan 2025 16:12:40 +0800 | ||
4 | Subject: [PATCH] Fix build failure in readline lib | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | This is a backported patch from gdb upstream, see the commit | ||
10 | 425f843d58c5 ("Import GNU Readline 8.2"), and only backported | ||
11 | patch related to compilation errors. | ||
12 | |||
13 | Without the patch: | ||
14 | |||
15 | signals.c: In function ‘_rl_handle_signal’: | ||
16 | signals.c:62:36: error: ‘return’ with a value, in function returning void [-Wreturn-mismatch] | ||
17 | 62 | # define SIGHANDLER_RETURN return (0) | ||
18 | | ^ | ||
19 | signals.c:290:3: note: in expansion of macro ‘SIGHANDLER_RETURN’ | ||
20 | 290 | SIGHANDLER_RETURN; | ||
21 | | ^~~~~~~~~~~~~~~~~ | ||
22 | signals.c:178:1: note: declared here | ||
23 | 178 | _rl_handle_signal (int sig) | ||
24 | | ^~~~~~~~~~~~~~~~~ | ||
25 | signals.c: In function ‘rl_sigwinch_handler’: | ||
26 | signals.c:306:32: error: passing argument 2 of ‘rl_set_sighandler’ from incompatible pointer type [-Wincompatible-pointer-types] | ||
27 | 306 | rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch); | ||
28 | | ^~~~~~~~~~~~~~~~~~~ | ||
29 | | | | ||
30 | | void (*)(int) | ||
31 | In file included from rldefs.h:31, | ||
32 | from signals.c:37: | ||
33 | signals.c:81:51: note: expected ‘void (*)(void)’ but argument is of type ‘void (*)(int)’ | ||
34 | 81 | static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); | ||
35 | |||
36 | Note: the current build failure was observed on gcc (GCC) 15.0.0. | ||
37 | |||
38 | Signed-off-by: Lianbo Jiang <lijiang@redhat.com> | ||
39 | Signed-off-by: mark.yang <mark.yang@lge.com> | ||
40 | |||
41 | Upstream-Status: Backport [772fbb1 Fix build failure in readline lib] | ||
42 | --- | ||
43 | gdb-10.2.patch | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
44 | 1 file changed, 82 insertions(+) | ||
45 | |||
46 | diff --git a/gdb-10.2.patch b/gdb-10.2.patch | ||
47 | index fd6fadb..8f5d7db 100644 | ||
48 | --- a/gdb-10.2.patch | ||
49 | +++ b/gdb-10.2.patch | ||
50 | @@ -16239,3 +16239,85 @@ exit 0 | ||
51 | pc_p = true; | ||
52 | } | ||
53 | catch (const gdb_exception_error &ex) | ||
54 | +--- gdb-10.2/readline/readline/signals.c.orig | ||
55 | ++++ gdb-10.2/readline/readline/signals.c | ||
56 | +@@ -48,23 +48,11 @@ | ||
57 | + | ||
58 | + #if defined (HANDLE_SIGNALS) | ||
59 | + | ||
60 | +-#if !defined (RETSIGTYPE) | ||
61 | +-# if defined (VOID_SIGHANDLER) | ||
62 | +-# define RETSIGTYPE void | ||
63 | +-# else | ||
64 | +-# define RETSIGTYPE int | ||
65 | +-# endif /* !VOID_SIGHANDLER */ | ||
66 | +-#endif /* !RETSIGTYPE */ | ||
67 | +- | ||
68 | +-#if defined (VOID_SIGHANDLER) | ||
69 | +-# define SIGHANDLER_RETURN return | ||
70 | +-#else | ||
71 | +-# define SIGHANDLER_RETURN return (0) | ||
72 | +-#endif | ||
73 | ++#define SIGHANDLER_RETURN return | ||
74 | + | ||
75 | + /* This typedef is equivalent to the one for Function; it allows us | ||
76 | + to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */ | ||
77 | +-typedef RETSIGTYPE SigHandler (); | ||
78 | ++typedef void SigHandler (int); | ||
79 | + | ||
80 | + #if defined (HAVE_POSIX_SIGNALS) | ||
81 | + typedef struct sigaction sighandler_cxt; | ||
82 | +@@ -78,12 +66,12 @@ typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt | ||
83 | + # define SA_RESTART 0 | ||
84 | + #endif | ||
85 | + | ||
86 | +-static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); | ||
87 | +-static void rl_maybe_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); | ||
88 | +-static void rl_maybe_restore_sighandler PARAMS((int, sighandler_cxt *)); | ||
89 | ++static SigHandler *rl_set_sighandler (int, SigHandler *, sighandler_cxt *); | ||
90 | ++static void rl_maybe_set_sighandler (int, SigHandler *, sighandler_cxt *); | ||
91 | ++static void rl_maybe_restore_sighandler (int, sighandler_cxt *); | ||
92 | + | ||
93 | +-static RETSIGTYPE rl_signal_handler PARAMS((int)); | ||
94 | +-static RETSIGTYPE _rl_handle_signal PARAMS((int)); | ||
95 | ++static void rl_signal_handler (int); | ||
96 | ++static void _rl_handle_signal (int); | ||
97 | + | ||
98 | + /* Exported variables for use by applications. */ | ||
99 | + | ||
100 | +@@ -137,7 +125,7 @@ void *_rl_sigcleanarg; | ||
101 | + /* Readline signal handler functions. */ | ||
102 | + | ||
103 | + /* Called from RL_CHECK_SIGNALS() macro */ | ||
104 | +-RETSIGTYPE | ||
105 | ++void | ||
106 | + _rl_signal_handler (int sig) | ||
107 | + { | ||
108 | + _rl_caught_signal = 0; /* XXX */ | ||
109 | +@@ -160,7 +148,7 @@ _rl_signal_handler (int sig) | ||
110 | + SIGHANDLER_RETURN; | ||
111 | + } | ||
112 | + | ||
113 | +-static RETSIGTYPE | ||
114 | ++static void | ||
115 | + rl_signal_handler (int sig) | ||
116 | + { | ||
117 | + if (_rl_interrupt_immediately) | ||
118 | +@@ -174,7 +162,7 @@ rl_signal_handler (int sig) | ||
119 | + SIGHANDLER_RETURN; | ||
120 | + } | ||
121 | + | ||
122 | +-static RETSIGTYPE | ||
123 | ++static void | ||
124 | + _rl_handle_signal (int sig) | ||
125 | + { | ||
126 | + #if defined (HAVE_POSIX_SIGNALS) | ||
127 | +@@ -291,7 +279,7 @@ _rl_handle_signal (int sig) | ||
128 | + } | ||
129 | + | ||
130 | + #if defined (SIGWINCH) | ||
131 | +-static RETSIGTYPE | ||
132 | ++static void | ||
133 | + rl_sigwinch_handler (int sig) | ||
134 | + { | ||
135 | + SigHandler *oh; | ||
136 | |||
diff --git a/meta-oe/recipes-kernel/crash/crash/0004-tools.c-do-not-use-keywords-nullptr-as-a-variable-in.patch b/meta-oe/recipes-kernel/crash/crash/0004-tools.c-do-not-use-keywords-nullptr-as-a-variable-in.patch new file mode 100644 index 0000000000..e4bd4cd3a9 --- /dev/null +++ b/meta-oe/recipes-kernel/crash/crash/0004-tools.c-do-not-use-keywords-nullptr-as-a-variable-in.patch | |||
@@ -0,0 +1,60 @@ | |||
1 | From 325a9d1b3b4ce76bf4556235c885e619e219622c Mon Sep 17 00:00:00 2001 | ||
2 | From: Lianbo Jiang <lijiang@redhat.com> | ||
3 | Date: Fri, 24 Jan 2025 15:32:59 +0800 | ||
4 | Subject: [PATCH] tools.c: do not use keywords 'nullptr' as a variable in code | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Without the patch: | ||
10 | |||
11 | tools.c: In function ‘drop_core’: | ||
12 | tools.c:6251:23: error: expected identifier or ‘(’ before ‘nullptr’ | ||
13 | 6251 | volatile int *nullptr; | ||
14 | | ^~~~~~~ | ||
15 | tools.c:6259:17: error: lvalue required as left operand of assignment | ||
16 | 6259 | nullptr = NULL; | ||
17 | | ^ | ||
18 | tools.c:6261:21: error: invalid type argument of unary ‘*’ (have ‘typeof (nullptr)’) | ||
19 | 6261 | i = *nullptr; | ||
20 | | ^~~~~~~~ | ||
21 | make[6]: *** [Makefile:345: tools.o] Error 1 | ||
22 | |||
23 | Note: this was observed on gcc version 15.0.1 | ||
24 | |||
25 | Signed-off-by: Lianbo Jiang <lijiang@redhat.com> | ||
26 | Signed-off-by: mark.yang <mark.yang@lge.com> | ||
27 | |||
28 | Upstream-Status: Backport [325a9d1 tools.c: do not use keywords 'nullptr' as a variable in code] | ||
29 | --- | ||
30 | tools.c | 6 +++--- | ||
31 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
32 | |||
33 | diff --git a/tools.c b/tools.c | ||
34 | index 85d8b6f..c9305be 100644 | ||
35 | --- a/tools.c | ||
36 | +++ b/tools.c | ||
37 | @@ -6248,7 +6248,7 @@ lowest_bit_long(ulong val) | ||
38 | void | ||
39 | drop_core(char *s) | ||
40 | { | ||
41 | - volatile int *nullptr; | ||
42 | + volatile int *ptr; | ||
43 | int i ATTRIBUTE_UNUSED; | ||
44 | |||
45 | if (s && ascii_string(s)) | ||
46 | @@ -6256,9 +6256,9 @@ drop_core(char *s) | ||
47 | |||
48 | kill((pid_t)pc->program_pid, 3); | ||
49 | |||
50 | - nullptr = NULL; | ||
51 | + ptr = NULL; | ||
52 | while (TRUE) | ||
53 | - i = *nullptr; | ||
54 | + i = *ptr; | ||
55 | } | ||
56 | |||
57 | |||
58 | -- | ||
59 | 2.34.1 | ||
60 | |||