Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/valgrind: fix MIPS compile issues
@ 2024-08-08 13:39 Waldemar Brodkorb
  2024-08-08 16:56 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Waldemar Brodkorb @ 2024-08-08 13:39 UTC (permalink / raw)
  To: buildroot

Add two patches from upstream to fix MIPS compile issues.

Fixes:
 - http://autobuild.buildroot.net/results/4cb/4cb021207d341b412ef6921c3368da3b644d7eb0
 - http://autobuild.buildroot.net/results/d0e/d0ef7145960695bbbec23909b1ca24a5336f3c23

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 ...ninitialized-err-in-handle_extension.patch | 47 +++++++++++++++++++
 ...st_IP_AT_SYSCALL-in-handle_extension.patch | 33 +++++++++++++
 2 files changed, 80 insertions(+)
 create mode 100644 package/valgrind/0003-Fix-uninitialized-err-in-handle_extension.patch
 create mode 100644 package/valgrind/0004-Avoid-use-of-guest_IP_AT_SYSCALL-in-handle_extension.patch

diff --git a/package/valgrind/0003-Fix-uninitialized-err-in-handle_extension.patch b/package/valgrind/0003-Fix-uninitialized-err-in-handle_extension.patch
new file mode 100644
index 0000000000..c6a6b3dce3
--- /dev/null
+++ b/package/valgrind/0003-Fix-uninitialized-err-in-handle_extension.patch
@@ -0,0 +1,47 @@
+From 94c2e5c6be23c6323f24deacdad5f98fb9f0b1c2 Mon Sep 17 00:00:00 2001
+From: Andreas Arnez <arnez@linux.ibm.com>
+Date: Wed, 15 May 2024 14:32:42 +0200
+Subject: [PATCH] Fix uninitialized `err' in handle_extension()
+
+In handle_extension(), in the case of a second return from SCHEDSETJMP the
+variable `err' would be used uninitialized.  Fix this by avoiding any
+access to `err' in this case.
+
+Signed-off-by: Andreas Arnez <arnez@linux.ibm.com>
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+Upstream: https://sourceware.org/git/?p=valgrind.git;a=commit;h=94c2e5c6be23c6323f24deacdad5f98fb9f0b1c2
+---
+ coregrind/m_scheduler/scheduler.c | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
+index fc8cf7c9c..29751bb28 100644
+--- a/coregrind/m_scheduler/scheduler.c
++++ b/coregrind/m_scheduler/scheduler.c
+@@ -1233,7 +1233,10 @@ static void handle_extension(ThreadId tid)
+    SCHEDSETJMP(tid, jumped, err = VG_(client_extension)(tid));
+    vg_assert(VG_(is_running_thread)(tid));
+ 
+-   if (err != ExtErr_OK) {
++   if (jumped != (UWord)0) {
++      block_signals();
++      VG_(poll_signals)(tid);
++   } else if (err != ExtErr_OK) {
+       ThreadState* tst = VG_(get_ThreadState)(tid);
+       Addr addr = tst->arch.vex.guest_IP_AT_SYSCALL;
+       switch (err) {
+@@ -1244,11 +1247,6 @@ static void handle_extension(ThreadId tid)
+          VG_(core_panic)("scheduler: bad return code from extension");
+       }
+    }
+-
+-   if (jumped != (UWord)0) {
+-      block_signals();
+-      VG_(poll_signals)(tid);
+-   }
+ }
+ 
+ /* tid just requested a jump to the noredir version of its current
+-- 
+2.39.2
+
diff --git a/package/valgrind/0004-Avoid-use-of-guest_IP_AT_SYSCALL-in-handle_extension.patch b/package/valgrind/0004-Avoid-use-of-guest_IP_AT_SYSCALL-in-handle_extension.patch
new file mode 100644
index 0000000000..006e24096e
--- /dev/null
+++ b/package/valgrind/0004-Avoid-use-of-guest_IP_AT_SYSCALL-in-handle_extension.patch
@@ -0,0 +1,33 @@
+From 16249b21456d681b5d98400287b8dbd926050c75 Mon Sep 17 00:00:00 2001
+From: Andreas Arnez <arnez@linux.ibm.com>
+Date: Wed, 15 May 2024 14:32:42 +0200
+Subject: [PATCH] Avoid use of guest_IP_AT_SYSCALL in handle_extension()
+
+The guest state field guest_IP_AT_SYSCALL is referenced in
+handle_extension(), even though it may not be defined by all
+architectures.  Avoid its use altogether.
+
+Signed-off-by: Andreas Arnez <arnez@linux.ibm.com>
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+Upstream: https://sourceware.org/git/?p=valgrind.git;a=commit;h=16249b21456d681b5d98400287b8dbd926050c75
+---
+ coregrind/m_scheduler/scheduler.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
+index 29751bb28..cc8d070b7 100644
+--- a/coregrind/m_scheduler/scheduler.c
++++ b/coregrind/m_scheduler/scheduler.c
+@@ -1237,8 +1237,7 @@ static void handle_extension(ThreadId tid)
+       block_signals();
+       VG_(poll_signals)(tid);
+    } else if (err != ExtErr_OK) {
+-      ThreadState* tst = VG_(get_ThreadState)(tid);
+-      Addr addr = tst->arch.vex.guest_IP_AT_SYSCALL;
++      Addr addr = VG_(get_IP)(tid);
+       switch (err) {
+       case ExtErr_Illop:
+          VG_(synth_sigill)(tid, addr);
+-- 
+2.39.2
+
-- 
2.39.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-08 16:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08 13:39 [Buildroot] [PATCH] package/valgrind: fix MIPS compile issues Waldemar Brodkorb
2024-08-08 16:56 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox