mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
Fix array overflow in backtrace on PowerPC (bug 25423)
When unwinding through a signal frame the backtrace function on PowerPC didn't check array bounds when storing the frame address. Fixes commitd400dcac5e
("PowerPC: fix backtrace to handle signal trampolines"). (cherry picked from commitd937694059
)
This commit is contained in:
parent
0df8ecff9e
commit
34ce87638c
1
NEWS
1
NEWS
@ -154,6 +154,7 @@ The following bugs are resolved with this release:
|
||||
[25203] libio: Disable vtable validation for pre-2.1 interposed handles
|
||||
[25204] Ignore LD_PREFER_MAP_32BIT_EXEC for SUID programs
|
||||
[25232] No const correctness for strchr et al. for Clang++
|
||||
[25423] Array overflow in backtrace on powerpc
|
||||
|
||||
|
||||
Version 2.27
|
||||
|
@ -88,6 +88,18 @@ handle_signal (int signum)
|
||||
}
|
||||
/* Symbol names are not available for static functions, so we do not
|
||||
check do_test. */
|
||||
|
||||
/* Check that backtrace does not return more than what fits in the array
|
||||
(bug 25423). */
|
||||
for (int j = 0; j < NUM_FUNCTIONS; j++)
|
||||
{
|
||||
n = backtrace (addresses, j);
|
||||
if (n > j)
|
||||
{
|
||||
FAIL ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NO_INLINE int
|
||||
|
@ -114,6 +114,8 @@ __backtrace (void **array, int size)
|
||||
}
|
||||
if (gregset)
|
||||
{
|
||||
if (count + 1 == size)
|
||||
break;
|
||||
array[++count] = (void*)((*gregset)[PT_NIP]);
|
||||
current = (void*)((*gregset)[PT_R1]);
|
||||
}
|
||||
|
@ -87,6 +87,8 @@ __backtrace (void **array, int size)
|
||||
if (is_sigtramp_address (current->return_address))
|
||||
{
|
||||
struct signal_frame_64 *sigframe = (struct signal_frame_64*) current;
|
||||
if (count + 1 == size)
|
||||
break;
|
||||
array[++count] = (void*) sigframe->uc.uc_mcontext.gp_regs[PT_NIP];
|
||||
current = (void*) sigframe->uc.uc_mcontext.gp_regs[PT_R1];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user