Skip to content

Commit a421153

Browse files
committed
std: Update libbacktrace for a soundness fix
This updates the vendor'd libbacktrace source to tpick up gcc-mirror/gcc@047a1c2f which is a soundness fix for when a backtrace is generated on executables that do not have debug information.
1 parent 9a14045 commit a421153

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

src/libbacktrace/ChangeLog

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
1+
2016-05-18 Uros Bizjak <ubizjak@gmail.com>
2+
3+
PR target/71161
4+
* elf.c (phdr_callback) [__i386__]: Add
5+
__attribute__((__force_align_arg_pointer__)).
6+
7+
2016-03-02 Maxim Ostapenko <m.ostapenko@partner.samsung.com>
8+
9+
* elf.c (backtrace_initialize): Properly initialize elf_fileline_fn to
10+
avoid possible crash.
11+
(elf_add): Don't set *fileline_fn to elf_nodebug value in case of
12+
missing debug info anymore.
13+
14+
2016-02-06 John David Anglin <danglin@gcc.gnu.org>
15+
16+
* mmap.c (MAP_FAILED): Define if not defined.
17+
118
2016-01-04 Jakub Jelinek <jakub@redhat.com>
219

320
Update copyright years.
421

522
2015-12-18 Andris Pavenis <andris.pavenis@iki.fi>
623

7-
* configure.ac: Specify that DJGPP do not have mmap even when sys/mman.h exists
24+
* configure.ac: Specify that DJGPP do not have mmap
25+
even when sys/mman.h exists.
826
* configure: Regenerate
927

1028
2015-12-09 John David Anglin <danglin@gcc.gnu.org>
1129

12-
PR 68115/libfortran
30+
PR libgfortran/68115
1331
* configure.ac: Set libbacktrace_cv_sys_sync to no on hppa*-*-hpux*.
1432
* configure: Regenerate.
1533
* elf.c (backtrace_initialize): Cast __sync_bool_compare_and_swap call

src/libbacktrace/elf.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,6 @@ elf_add (struct backtrace_state *state, int descriptor, uintptr_t base_address,
791791
{
792792
if (!backtrace_close (descriptor, error_callback, data))
793793
goto fail;
794-
*fileline_fn = elf_nodebug;
795794
return 1;
796795
}
797796

@@ -867,6 +866,9 @@ struct phdr_data
867866
libraries. */
868867

869868
static int
869+
#ifdef __i386__
870+
__attribute__ ((__force_align_arg_pointer__))
871+
#endif
870872
phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
871873
void *pdata)
872874
{
@@ -925,7 +927,7 @@ backtrace_initialize (struct backtrace_state *state, int descriptor,
925927
int ret;
926928
int found_sym;
927929
int found_dwarf;
928-
fileline elf_fileline_fn;
930+
fileline elf_fileline_fn = elf_nodebug;
929931
struct phdr_data pd;
930932

931933
ret = elf_add (state, descriptor, 0, error_callback, data, &elf_fileline_fn,

src/libbacktrace/mmap.c

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ POSSIBILITY OF SUCH DAMAGE. */
5050
#define MAP_ANONYMOUS MAP_ANON
5151
#endif
5252

53+
#ifndef MAP_FAILED
54+
#define MAP_FAILED ((void *)-1)
55+
#endif
56+
5357
/* A list of free memory blocks. */
5458

5559
struct backtrace_freelist_struct

src/libbacktrace/pecoff.c

+3
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,9 @@ coff_add (struct backtrace_state *state, int descriptor,
602602
const b_coff_section_header *sects;
603603
struct backtrace_view str_view;
604604
int str_view_valid;
605+
// NOTE: upstream this is a `size_t` but this was fixed in Rust commit
606+
// 55e2b7e1b, see #33729 for more info. If you see this in a diff
607+
// against the upstream libbacktrace, that's what's going on.
605608
uint32_t str_size;
606609
off_t str_off;
607610
struct backtrace_view syms_view;

0 commit comments

Comments
 (0)