Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std: Backport a libbacktrace soundness fix #33729

Merged
merged 1 commit into from
May 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/libbacktrace/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
2016-05-18 Uros Bizjak <[email protected]>

PR target/71161
* elf.c (phdr_callback) [__i386__]: Add
__attribute__((__force_align_arg_pointer__)).

2016-03-02 Maxim Ostapenko <[email protected]>

* elf.c (backtrace_initialize): Properly initialize elf_fileline_fn to
avoid possible crash.
(elf_add): Don't set *fileline_fn to elf_nodebug value in case of
missing debug info anymore.

2016-02-06 John David Anglin <[email protected]>

* mmap.c (MAP_FAILED): Define if not defined.

2016-01-04 Jakub Jelinek <[email protected]>

Update copyright years.

2015-12-18 Andris Pavenis <[email protected]>

* configure.ac: Specify that DJGPP do not have mmap even when sys/mman.h exists
* configure.ac: Specify that DJGPP do not have mmap
even when sys/mman.h exists.
* configure: Regenerate

2015-12-09 John David Anglin <[email protected]>

PR 68115/libfortran
PR libgfortran/68115
* configure.ac: Set libbacktrace_cv_sys_sync to no on hppa*-*-hpux*.
* configure: Regenerate.
* elf.c (backtrace_initialize): Cast __sync_bool_compare_and_swap call
Expand Down
6 changes: 4 additions & 2 deletions src/libbacktrace/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,6 @@ elf_add (struct backtrace_state *state, int descriptor, uintptr_t base_address,
{
if (!backtrace_close (descriptor, error_callback, data))
goto fail;
*fileline_fn = elf_nodebug;
return 1;
}

Expand Down Expand Up @@ -867,6 +866,9 @@ struct phdr_data
libraries. */

static int
#ifdef __i386__
__attribute__ ((__force_align_arg_pointer__))
#endif
phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
void *pdata)
{
Expand Down Expand Up @@ -925,7 +927,7 @@ backtrace_initialize (struct backtrace_state *state, int descriptor,
int ret;
int found_sym;
int found_dwarf;
fileline elf_fileline_fn;
fileline elf_fileline_fn = elf_nodebug;
struct phdr_data pd;

ret = elf_add (state, descriptor, 0, error_callback, data, &elf_fileline_fn,
Expand Down
4 changes: 4 additions & 0 deletions src/libbacktrace/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ POSSIBILITY OF SUCH DAMAGE. */
#define MAP_ANONYMOUS MAP_ANON
#endif

#ifndef MAP_FAILED
#define MAP_FAILED ((void *)-1)
#endif

/* A list of free memory blocks. */

struct backtrace_freelist_struct
Expand Down
3 changes: 3 additions & 0 deletions src/libbacktrace/pecoff.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ coff_add (struct backtrace_state *state, int descriptor,
const b_coff_section_header *sects;
struct backtrace_view str_view;
int str_view_valid;
// NOTE: upstream this is a `size_t` but this was fixed in Rust commit
// 55e2b7e1b, see #33729 for more info. If you see this in a diff
// against the upstream libbacktrace, that's what's going on.
uint32_t str_size;
off_t str_off;
struct backtrace_view syms_view;
Expand Down