summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-kernel/crash
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-kernel/crash')
-rw-r--r--meta-oe/recipes-kernel/crash/crash-cross-canadian_8.0.6.bb (renamed from meta-oe/recipes-kernel/crash/crash-cross-canadian_8.0.4.bb)6
-rw-r--r--meta-oe/recipes-kernel/crash/crash.inc11
-rw-r--r--meta-oe/recipes-kernel/crash/crash/0001-Use-CC-env-var-to-get-compiler-version.patch48
-rw-r--r--meta-oe/recipes-kernel/crash/crash/0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch89
-rw-r--r--meta-oe/recipes-kernel/crash/crash/0002-arm64-add-pac-mask-to-better-support-gdb-stack-unwin.patch85
-rw-r--r--meta-oe/recipes-kernel/crash/crash/0003-Fix-build-failure-in-readline-lib.patch136
-rw-r--r--meta-oe/recipes-kernel/crash/crash/0004-tools.c-do-not-use-keywords-nullptr-as-a-variable-in.patch60
-rw-r--r--meta-oe/recipes-kernel/crash/crash/0005-Fix-build-failure-on-32bit-machine-i686.patch83
-rw-r--r--meta-oe/recipes-kernel/crash/crash_8.0.6.bb (renamed from meta-oe/recipes-kernel/crash/crash_8.0.4.bb)0
9 files changed, 512 insertions, 6 deletions
diff --git a/meta-oe/recipes-kernel/crash/crash-cross-canadian_8.0.4.bb b/meta-oe/recipes-kernel/crash/crash-cross-canadian_8.0.6.bb
index 54883cef38..bafe56d2c4 100644
--- a/meta-oe/recipes-kernel/crash/crash-cross-canadian_8.0.4.bb
+++ b/meta-oe/recipes-kernel/crash/crash-cross-canadian_8.0.6.bb
@@ -15,9 +15,9 @@ DEPENDS = "\
15 nativesdk-mpfr \ 15 nativesdk-mpfr \
16 nativesdk-readline \ 16 nativesdk-readline \
17 nativesdk-zlib \ 17 nativesdk-zlib \
18 virtual/${HOST_PREFIX}gcc \ 18 virtual/nativesdk-cross-cc \
19 virtual/${HOST_PREFIX}binutils \ 19 virtual/nativesdk-cross-binutils \
20 virtual/nativesdk-${HOST_PREFIX}compilerlibs \ 20 virtual/nativesdk-compilerlibs \
21 virtual/nativesdk-libc" 21 virtual/nativesdk-libc"
22 22
23RDEPENDS:${PN} = "nativesdk-liblzma" 23RDEPENDS:${PN} = "nativesdk-liblzma"
diff --git a/meta-oe/recipes-kernel/crash/crash.inc b/meta-oe/recipes-kernel/crash/crash.inc
index 04318b1505..3c9a99ae4a 100644
--- a/meta-oe/recipes-kernel/crash/crash.inc
+++ b/meta-oe/recipes-kernel/crash/crash.inc
@@ -14,16 +14,21 @@ DEPENDS = "zlib readline coreutils-native ncurses-native"
14 14
15INC_PR = "r1" 15INC_PR = "r1"
16 16
17S = "${WORKDIR}/git"
18SRC_URI = "git://github.com/crash-utility/${BPN}.git;branch=master;protocol=https \ 17SRC_URI = "git://github.com/crash-utility/${BPN}.git;branch=master;protocol=https \
19 ${GNU_MIRROR}/gdb/gdb-10.2.tar.gz;name=gdb;subdir=git \ 18 ${GNU_MIRROR}/gdb/gdb-10.2.tar.gz;name=gdb;subdir=${BB_GIT_DEFAULT_DESTSUFFIX} \
20 file://7001force_define_architecture.patch \ 19 file://7001force_define_architecture.patch \
21 file://7003cross_ranlib.patch \ 20 file://7003cross_ranlib.patch \
22 file://0001-cross_add_configure_option.patch \ 21 file://0001-cross_add_configure_option.patch \
23 file://donnot-extract-gdb-during-do-compile.patch \ 22 file://donnot-extract-gdb-during-do-compile.patch \
24 file://gdb_build_jobs_and_not_write_crash_target.patch \ 23 file://gdb_build_jobs_and_not_write_crash_target.patch \
24 file://0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch \
25 file://0002-arm64-add-pac-mask-to-better-support-gdb-stack-unwin.patch \
26 file://0003-Fix-build-failure-in-readline-lib.patch \
27 file://0004-tools.c-do-not-use-keywords-nullptr-as-a-variable-in.patch \
28 file://0005-Fix-build-failure-on-32bit-machine-i686.patch \
29 file://0001-Use-CC-env-var-to-get-compiler-version.patch \
25 " 30 "
26SRCREV = "a6832f608cb5d473739cf33bbf84ab1df8d98fd5" 31SRCREV = "f13853cef53f5c5463a51021edbc81977e2b1405"
27 32
28SRC_URI[gdb.sha256sum] = "b33ad58d687487a821ec8d878daab0f716be60d0936f2e3ac5cf08419ce70350" 33SRC_URI[gdb.sha256sum] = "b33ad58d687487a821ec8d878daab0f716be60d0936f2e3ac5cf08419ce70350"
29 34
diff --git a/meta-oe/recipes-kernel/crash/crash/0001-Use-CC-env-var-to-get-compiler-version.patch b/meta-oe/recipes-kernel/crash/crash/0001-Use-CC-env-var-to-get-compiler-version.patch
new file mode 100644
index 0000000000..773598def1
--- /dev/null
+++ b/meta-oe/recipes-kernel/crash/crash/0001-Use-CC-env-var-to-get-compiler-version.patch
@@ -0,0 +1,48 @@
1From 6ad5e9302057e157ab701880a8543ca59058df2d Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?K=C3=A9l=C3=A9fa=20San=C3=A9?= <kelefa.sane@smile.fr>
3Date: Fri, 16 May 2025 16:18:28 +0200
4Subject: [PATCH v2] Use CC env var to get compiler version
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9The source file build_data.c generated at compilation time define a
10variable compiler_version which is obtained by calling "gcc --version"
11cmd. This call retrieve the native gcc compiler install on host build
12machine but not necessarily the compiler use to build the project (ex:
13cross compilation).
14
15The CC env variable commonly used in Makefile project define the
16compiler to use at build, so this is the appropriate way to retrieve the
17compiler version, when the CC env var is define.
18
19Upstream-Status: Submitted [https://lists.crash-utility.osci.io/archives/list/devel@lists.crash-utility.osci.io/thread/V3G3QH3YW6WZWD56TVTFQIHYLZ33UIJL/]
20
21Signed-off-by: Kéléfa Sané <kelefa.sane@smile.fr>
22---
23 configure.c | 12 +++++++++++-
24 1 file changed, 11 insertions(+), 1 deletion(-)
25
26diff --git a/configure.c b/configure.c
27index 4668c9a..4b65bd7 100644
28--- a/configure.c
29+++ b/configure.c
30@@ -1362,7 +1362,17 @@ make_build_data(char *target)
31
32 fp1 = popen("date", "r");
33 fp2 = popen("id", "r");
34- fp3 = popen("gcc --version", "r");
35+
36+ const char *cc_env = getenv("CC");
37+ if(NULL == cc_env) {
38+ fp3 = popen("gcc --version", "r");
39+ }
40+ else {
41+ char compiler_version_cmd[512];
42+
43+ snprintf(compiler_version_cmd, sizeof(compiler_version_cmd), "%s --version", cc_env);
44+ fp3 = popen(compiler_version_cmd, "r");
45+ }
46
47 if ((fp4 = fopen("build_data.c", "w")) == NULL) {
48 perror("build_data.c");
diff --git a/meta-oe/recipes-kernel/crash/crash/0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch b/meta-oe/recipes-kernel/crash/crash/0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch
new file mode 100644
index 0000000000..47182f8b6c
--- /dev/null
+++ b/meta-oe/recipes-kernel/crash/crash/0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch
@@ -0,0 +1,89 @@
1From 329bd56da28fc1b5b53a60ca2172643d2090435d Mon Sep 17 00:00:00 2001
2From: Tao Liu <ltao@redhat.com>
3Date: Fri, 13 Dec 2024 08:36:03 +0000
4Subject: [PATCH] symbol: fix -S cannot work with kaslr detection
5
6When kernel enabled the CONFIG_RANDOMIZE_BASE, crash needs to add "kaslr=auto"
7in crash command line to tell crash to decode the random address.
8But when with "-S" in command line, crash would bypass the kaslr option
9that cause symbol from kernel image is mismatch with ram on a live system.
10
11The fix is provided by Tao Liu <ltao@redhat.com> from crash-utility upstream,
12and not merged to crash master yet.
13
14Upstream-Status: Pending
15[https://lists.crash-utility.osci.io/archives/list/devel@lists.crash-utility.osci.io/thread/5OXNYPPU6GLLQKCWH7WBNBJXLNZ4EBZD/]
16
17Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
18---
19 symbols.c | 18 ++++++++++--------
20 1 file changed, 10 insertions(+), 8 deletions(-)
21
22diff --git a/symbols.c b/symbols.c
23index a3cd0f3..6062d21 100644
24--- a/symbols.c
25+++ b/symbols.c
26@@ -25,7 +25,7 @@
27
28 static void store_symbols(bfd *, int, void *, long, unsigned int);
29 static void store_sysmap_symbols(void);
30-static ulong relocate(ulong, char *, int);
31+static ulong relocate(ulong, char *, int *);
32 static int relocate_force(ulong, char *);
33 static void kaslr_init(void);
34 static void strip_module_symbol_end(char *s);
35@@ -230,6 +230,7 @@ symtab_init(void)
36 DEBUGINFO_ERROR_MESSAGE1 :
37 DEBUGINFO_ERROR_MESSAGE2);
38 }
39+ kt->flags |= RELOC_FORCE;
40 store_sysmap_symbols();
41 return;
42 } else if (LKCD_KERNTYPES())
43@@ -817,7 +818,7 @@ store_symbols(bfd *abfd, int dynamic, void *minisyms, long symcount,
44 syminfo.type)) {
45 if (kt->flags & (RELOC_SET|RELOC_FORCE))
46 sp->value = relocate(syminfo.value,
47- (char *)syminfo.name, !(first++));
48+ (char *)syminfo.name, &first);
49 else
50 sp->value = syminfo.value;
51 sp->type = syminfo.type;
52@@ -893,9 +894,9 @@ store_sysmap_symbols(void)
53
54 if (machdep->verify_symbol(name, syment.value,
55 syment.type)) {
56- if (kt->flags & RELOC_SET)
57+ if (kt->flags & (RELOC_SET|RELOC_FORCE))
58 sp->value = relocate(syment.value,
59- syment.name, !(first++));
60+ syment.name, &first);
61 else
62 sp->value = syment.value;
63 sp->type = syment.type;
64@@ -924,7 +925,7 @@ store_sysmap_symbols(void)
65 * are not as loaded into the kernel (not unity-mapped).
66 */
67 static ulong
68-relocate(ulong symval, char *symname, int first_symbol)
69+relocate(ulong symval, char *symname, int *first_symbol)
70 {
71 if (XEN_HYPER_MODE()) {
72 kt->flags &= ~(RELOC_SET|RELOC_FORCE);
73@@ -937,9 +938,10 @@ relocate(ulong symval, char *symname, int first_symbol)
74 break;
75
76 case RELOC_FORCE:
77- if (first_symbol && !relocate_force(symval, symname))
78- kt->flags &= ~RELOC_FORCE;
79- break;
80+ if (!(*first_symbol) && relocate_force(symval, symname)) {
81+ *first_symbol += 1;
82+ }
83+ return symval - kt->relocate;
84 }
85
86 if (machine_type("X86_64")) {
87--
882.35.5
89
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 @@
1From 0f39e33d3504f3a17b83574c3be97640460b7eef Mon Sep 17 00:00:00 2001
2From: "Guanyou.Chen" <chenguanyou@xiaomi.com>
3Date: Wed, 25 Dec 2024 23:50:28 +0800
4Subject: [PATCH] arm64: add pac mask to better support gdb stack unwind
5
6Currently, gdb passthroughs of 'bt', 'frame', 'up', 'down',
7'info, locals' don't work on arm64 machine enabled pauth.
8This is because gdb does not know the lr register actual values
9to unwind the stack frames.
10
11Without 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
17With 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
25Signed-off-by: Guanyou.Chen <chenguanyou@xiaomi.com>
26Signed-off-by: mark.yang <mark.yang@lge.com>
27
28Upstream-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
34diff --git a/gdb-10.2.patch b/gdb-10.2.patch
35index 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)
65diff --git a/gdb_interface.c b/gdb_interface.c
66index 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--
842.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 @@
1From 772fbb1022911410b5fb773fde37910fc8286041 Mon Sep 17 00:00:00 2001
2From: Lianbo Jiang <lijiang@redhat.com>
3Date: Fri, 24 Jan 2025 16:12:40 +0800
4Subject: [PATCH] Fix build failure in readline lib
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9This is a backported patch from gdb upstream, see the commit
10425f843d58c5 ("Import GNU Readline 8.2"), and only backported
11patch related to compilation errors.
12
13Without 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
36Note: the current build failure was observed on gcc (GCC) 15.0.0.
37
38Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
39Signed-off-by: mark.yang <mark.yang@lge.com>
40
41Upstream-Status: Backport [772fbb1 Fix build failure in readline lib]
42---
43 gdb-10.2.patch | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++
44 1 file changed, 82 insertions(+)
45
46diff --git a/gdb-10.2.patch b/gdb-10.2.patch
47index 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 @@
1From 325a9d1b3b4ce76bf4556235c885e619e219622c Mon Sep 17 00:00:00 2001
2From: Lianbo Jiang <lijiang@redhat.com>
3Date: Fri, 24 Jan 2025 15:32:59 +0800
4Subject: [PATCH] tools.c: do not use keywords 'nullptr' as a variable in code
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Without 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
23Note: this was observed on gcc version 15.0.1
24
25Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
26Signed-off-by: mark.yang <mark.yang@lge.com>
27
28Upstream-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
33diff --git a/tools.c b/tools.c
34index 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--
592.34.1
60
diff --git a/meta-oe/recipes-kernel/crash/crash/0005-Fix-build-failure-on-32bit-machine-i686.patch b/meta-oe/recipes-kernel/crash/crash/0005-Fix-build-failure-on-32bit-machine-i686.patch
new file mode 100644
index 0000000000..e4796b9ced
--- /dev/null
+++ b/meta-oe/recipes-kernel/crash/crash/0005-Fix-build-failure-on-32bit-machine-i686.patch
@@ -0,0 +1,83 @@
1From 2724bb1d0260f3886f8a3d533838caf80c7e61e5 Mon Sep 17 00:00:00 2001
2From: Lianbo Jiang <lijiang@redhat.com>
3Date: Fri, 24 Jan 2025 17:56:23 +0800
4Subject: [PATCH 10/10] Fix build failure on 32bit machine(i686)
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9This issue was caused by commit 0f39e33d3504 with the following
10compilation error:
11
12 frame.c: In function ‘CORE_ADDR frame_unwind_pc(frame_info*)’:
13 frame.c:982:35: error: cannot convert ‘CORE_ADDR*’ {aka ‘long long unsigned int*’} to ‘ulong*’ {aka ‘long unsigned int*’}
14 982 | crash_decode_ptrauth_pc(&pc);
15 | ^~~
16 | |
17 | CORE_ADDR* {aka long long unsigned int*}
18 frame.c:948:48: note: initializing argument 1 of ‘void crash_decode_ptrauth_pc(ulong*)’
19 948 | extern "C" void crash_decode_ptrauth_pc(ulong* pc);
20 | ~~~~~~~^~
21
22Upstream-Status: Backport [https://github.com/crash-utility/crash/commit/2724bb1d0260f3886f8a3d533838caf80c7e61e5]
23Fixes: 0f39e33d3504 ("arm64: add pac mask to better support gdb stack unwind")
24Reported-by: Guanyou.Chen <chenguanyou@xiaomi.com>
25Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
26---
27 gdb-10.2.patch | 6 +++---
28 gdb_interface.c | 4 ++--
29 2 files changed, 5 insertions(+), 5 deletions(-)
30
31diff --git a/gdb-10.2.patch b/gdb-10.2.patch
32index 8f5d7db22840..d22f2d6d75bc 100644
33--- a/gdb-10.2.patch
34+++ b/gdb-10.2.patch
35@@ -55,7 +55,7 @@ exit 0
36 # your system doesn't have fcntl.h in /usr/include (which is where it
37 # should be according to Posix).
38 -DEFS = @DEFS@
39-+DEFS = -DCRASH_MERGE @DEFS@
40++DEFS = -DCRASH_MERGE -D${CRASH_TARGET} @DEFS@
41 GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config \
42 -DLOCALEDIR="\"$(localedir)\"" $(DEFS)
43
44@@ -16222,7 +16222,7 @@ exit 0
45 return NULL;
46 }
47
48-+#ifdef CRASH_MERGE
49++#if defined(CRASH_MERGE) && defined(ARM64)
50 +extern "C" void crash_decode_ptrauth_pc(ulong* pc);
51 +#endif
52 +
53@@ -16233,7 +16233,7 @@ exit 0
54 try
55 {
56 pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
57-+#ifdef CRASH_MERGE
58++#if defined(CRASH_MERGE) && defined(ARM64)
59 + crash_decode_ptrauth_pc(&pc);
60 +#endif
61 pc_p = true;
62diff --git a/gdb_interface.c b/gdb_interface.c
63index e108d097ee5f..c2e99f5c156a 100644
64--- a/gdb_interface.c
65+++ b/gdb_interface.c
66@@ -1084,12 +1084,12 @@ int crash_get_current_task_reg (int regno, const char *regname,
67 }
68
69 /* arm64 kernel lr maybe has patuh */
70+#ifdef ARM64
71 void crash_decode_ptrauth_pc(ulong *pc);
72 void crash_decode_ptrauth_pc(ulong *pc)
73 {
74-#ifdef ARM64
75 struct machine_specific *ms = machdep->machspec;
76 if (is_kernel_text(*pc | ms->CONFIG_ARM64_KERNELPACMASK))
77 *pc |= ms->CONFIG_ARM64_KERNELPACMASK;
78-#endif /* !ARM64 */
79 }
80+#endif /* !ARM64 */
81--
822.47.1
83
diff --git a/meta-oe/recipes-kernel/crash/crash_8.0.4.bb b/meta-oe/recipes-kernel/crash/crash_8.0.6.bb
index 1af90978e0..1af90978e0 100644
--- a/meta-oe/recipes-kernel/crash/crash_8.0.4.bb
+++ b/meta-oe/recipes-kernel/crash/crash_8.0.6.bb