| 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 |
| |