0003-Fix-uninitialized-err-in-handle_extension.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From 94c2e5c6be23c6323f24deacdad5f98fb9f0b1c2 Mon Sep 17 00:00:00 2001
  2. From: Andreas Arnez <arnez@linux.ibm.com>
  3. Date: Wed, 15 May 2024 14:32:42 +0200
  4. Subject: [PATCH] Fix uninitialized `err' in handle_extension()
  5. In handle_extension(), in the case of a second return from SCHEDSETJMP the
  6. variable `err' would be used uninitialized. Fix this by avoiding any
  7. access to `err' in this case.
  8. Signed-off-by: Andreas Arnez <arnez@linux.ibm.com>
  9. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
  10. Upstream: https://sourceware.org/git/?p=valgrind.git;a=commit;h=94c2e5c6be23c6323f24deacdad5f98fb9f0b1c2
  11. ---
  12. coregrind/m_scheduler/scheduler.c | 10 ++++------
  13. 1 file changed, 4 insertions(+), 6 deletions(-)
  14. diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
  15. index fc8cf7c9c..29751bb28 100644
  16. --- a/coregrind/m_scheduler/scheduler.c
  17. +++ b/coregrind/m_scheduler/scheduler.c
  18. @@ -1233,7 +1233,10 @@ static void handle_extension(ThreadId tid)
  19. SCHEDSETJMP(tid, jumped, err = VG_(client_extension)(tid));
  20. vg_assert(VG_(is_running_thread)(tid));
  21. - if (err != ExtErr_OK) {
  22. + if (jumped != (UWord)0) {
  23. + block_signals();
  24. + VG_(poll_signals)(tid);
  25. + } else if (err != ExtErr_OK) {
  26. ThreadState* tst = VG_(get_ThreadState)(tid);
  27. Addr addr = tst->arch.vex.guest_IP_AT_SYSCALL;
  28. switch (err) {
  29. @@ -1244,11 +1247,6 @@ static void handle_extension(ThreadId tid)
  30. VG_(core_panic)("scheduler: bad return code from extension");
  31. }
  32. }
  33. -
  34. - if (jumped != (UWord)0) {
  35. - block_signals();
  36. - VG_(poll_signals)(tid);
  37. - }
  38. }
  39. /* tid just requested a jump to the noredir version of its current
  40. --
  41. 2.39.2