Created attachment 7286 [details] [PATCH] * ld/pe-dll.c: clear memory after allocating it but before using it. I work for The Tor Project and in the process of working on deterministic builds of win64 we discovered that there were phantom bytes we couldn't account for. After researching for a few days, one of our developers found the cause and I'm attaching a patch for ld in binutils. This patch is a few days old but should still apply cleanly to master. The text to explain the bug better: Currently, in pe-dll.c , extern_rt_rel_d is allocated but not cleared before using it. This leads (apparently) to uninitialized heap contents leaking into the generated files, which is a problem for reproducible builds. It appears that elsewhere in pe-dll.c, the pattern is to clear memory like this after allocating it but before using it. That's the approach that this patch takes. Patch written by bobnomnom. The fix has been tested in both win64 and win32 in our Gitian infrastructure and successfully creates reproducible, identical binaries.
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gdb and binutils". The branch, master has been updated via 8d5c4b7bfdfa5f2b40fa056132823c8e9497dc72 (commit) from 630b051036e446754f13d1f07cfd6de0612a90de (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8d5c4b7bfdfa5f2b40fa056132823c8e9497dc72 commit 8d5c4b7bfdfa5f2b40fa056132823c8e9497dc72 Author: Nick Clifton <nickc@redhat.com> Date: Thu Nov 21 13:29:47 2013 +0000 PR ld/16192 * pe-dll.c (pe_create_runtime_relocator_reference): Zero the newly allocated idata5 block. ----------------------------------------------------------------------- Summary of changes: ld/ChangeLog | 6 ++++++ ld/pe-dll.c | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-)
Hi Erinn, I think that a simpler solution would be to just call xcalloc() to allocate the data structure, rather than using memset afterwards. So that is what I have done. Please try out the latest linker sources and let me know if you are happy with the result. Cheers Nick
Hi Nick, I've verified that this fix works. Thanks.
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gdb and binutils". The annotated tag, hjl/linux/release/2.24.51.0.2 has been created at bc64dc5b95aa848d7274e4648d667b9b1065d88c (tag) tagging bbd7f545f1639be4573ba06ed688b8db670d4597 (commit) replaces hjl/linux/release/2.24.51.0.1 tagged by H.J. Lu on Fri Dec 13 08:44:03 2013 -0800 - Log ----------------------------------------------------------------- Linux binutils 2.24.51.0.2 Alan Modra (47): daily update daily update daily update daily update daily update Correct elf64-ppc.c handling of protected symbols PowerPC64 ELFv2, allocate dynreloc space for ifunc daily update daily update daily update daily update PowerPC64 ELFv2 trampoline match Fixes to powerpc64 gold ELFv2 support Add missing ChangeLog for 88b8e63904fda25c029deaf25d7b4e489b351470 daily update daily update daily update daily update daily update daily update daily update Import config.sub and config.guess from upstream. daily update daily update daily update daily update daily update daily update daily update daily update daily update daily update daily update PowerPC64 linking of --just-symbols objects (klibc) More PowerPC64 ELFv2 --just-symbols fixes daily update daily update daily update daily update daily update Fix --as-needed undefined symbol references from dynamic libraries. correct file reference daily update daily update daily update daily update daily update Alexey Makhalov (1): PR gas/16109 Andreas Arnez (3): S390: Fix TDB regset recognition Fix GDB crash with upstream GCC due to qsort(NULL, ...) Fix GDB crash with upstream GCC due to memcpy(NULL, ...) Andrew Burgess (6): Mark entirely optimized out value as non-lazy. Tighten regexp in gdb.base/setshow.exp Make "set debug frame 1" use the standard print routine for optimized out values. Print entirely unavailable struct/union values as a single <unavailable>. Add support for DW_OP_bit_piece and DW_OP_plus_uconst to DWARF assembler. Add call to get_compiler_info to gdb_compile_shlib. Andrew Pinski (2): ld/ChangeLog: ld/ChangeLog: Anthony Green (1): Add software single step support to moxie port Cary Coutant (6): Fix assert failure with --emit-relocs and .eh_frame sections. Fix race condition while building EH frame header. Add --verify-only option to DWP. Revert "Fix race condition while building EH frame header." Use in-tree assembler for exception_x86_64_bnd_test. Add check for which library is needed for dlopen. Catherine Moore (4): 2013-11-11 Catherine Moore <clm@codesourcery.com> Fix ChangeLog entries from earlier commit. 2013-11-19 Catherine Moore <clm@codesourcery.com> 2013-11-19 Catherine Moore <clm@codesourcery.com> Chung-Lin Tang (1): Separate emulations for nios2-elf and nios2-linux. Conrad Hoffmann (1): * gprof.c (inline_file_names): New variable. Cory Fields (1): * windres.c (define_resource): Use zero for timestamp, making Doug Evans (42): * gdb.python/py-arch.exp: Tweak test name for bad memory access test. Add pretty-printing of .debug_gnu_pubnames, .debug_gnu_pubtypes. PR 11786 Fix email address in earlier entry. Change "set debug symtab-create" to take a verbosity level. Change "set debug dwarf2-read" to take a verbosity level. * gdb.arch/arm-bl-branch-dest.exp: Use gdb_test_file_name instead Work around gold/15646. * gdb.base/fileio.exp: Make $dir2 writable after the test is done * breakpoint.c (bpstat_check_breakpoint_conditions): Assert fix email address in earlier commit * breakpoint.c (breakpoint_cond_eval): Fix and enhance comment. * breakpoint.c (bpstat_check_breakpoint_conditions): For thread * gdb.python/py-breakpoint.exp: Split up into several functions, * gdb.python/py-breakpoint.exp: Reformat for 80 columns. * gdb.python/py-breakpoint.exp: Make tests have unique names. * linux-low.c (resume_status_pending_p): Tweak comment. * linux-low.c (linux_set_resume_request): Fix comment. Move types_deeply_equal from py-type.c to gdbtypes.c. cli/cli-script.c (multi_line_command_p): New function. * python/py-frame.c (frapy_block): Fix error message text. * python/py-frame.c (gdbpy_initialize_frames): Remove FIRST_ERROR, * gdb.python/python.exp: Don't call skip_python_tests, we still want Fix long line in earlier entry. * gdb.python/py-symbol.exp: Fix whitespace. * gdb.python/py-symbol.exp: Add some comments. Make all test names unique. * gdb.python/py-type.exp (test_enums): Fix typo. Test name tweaks for py-value.exp. * gdb.base/ena-dis-br.exp: Add missing quote to "step after continue * configure.ac: Add comments delineating libpython and libmcheck. fix spelling in previous entry Rename breakpoint_object to gdbpy_breakpoint_object. Remove trailing whitespace. * python/py-auto-load.c (source_section_scripts): Move comment to Move .debug_gdb_script processing to auto-load.c. * auto-load.c (load_auto_scripts_for_objfile): Add some comments. fix date in previous entry * gdb.base/break.exp: Fix setting of $baz. Delete interp_exec_p. PR 16286 add missing PR# to previous entry * dwarf2read.c (lookup_dwo_cutu): Include name of dwp file in Edjunior Barbosa Machado (1): Fix argument type on gdbsim_detach prototype. Eli Zaretskii (2): doc/gdb.texinfo (i386): Fix yesterday's commit. Fix the manual more thoroughly. H.J. Lu (45): Add binutils-sharable.patch Add binutils-lto-mixed.patch Add binutils-pr12639.patch Add binutils-secondary.patch Mention hjl.tools@gmail.com in bug URL Set BFD version to 2.24.51.0.1 Remove strayed entry Remove CpuNop from CPU_K6_2_FLAGS Merge remote-tracking branch 'origin/master' into hjl/linux/master Update bfd version to 2.24.51.0.2 Merge remote-tracking branch 'origin/master' into hjl/linux/master Merge remote-tracking branch 'origin/master' into hjl/linux/master Make room for PLT0 directly Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND Merge remote-tracking branch 'origin/master' into hjl/linux/master Add R_X86_64_PC32_BND/R_X86_64_PLT32_BND suppor to gold Add a dummy "int bnd_prefix" argument Update x86 gas tests for mingw Re-indent elf_x86_64_section_from_shdr Add mpx1static, mpx2 and mpx2static tests Add bnd-branch-1 test Merge remote-tracking branch 'origin/master' into hjl/linux/master Add HOSTING_SLIBS and use it for -pie Merge remote-tracking branch 'origin/master' into hjl/linux/master Fix a typo Merge remote-tracking branch 'origin/master' into hjl/linux/master Merge remote-tracking branch 'origin/master' into hjl/linux/master Add the missing ChangeLog entry Add -ffat-lto-objects to STAGE[23]_CFLAGS Add -ldl to POSTSTAGE1_LDFLAGS Add -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ Remove -lpthread -ldl and add -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ Merge remote-tracking branch 'origin/master' into hjl/linux/master Add a test for --as-needed with symbol versioning Remove shared object from -Ttext-segment Set ET_EXEC for -pie -Ttext-segment= Add "#..." Remove bfd_elf32_bfd_set_private_bfd_flags Also copy EI_OSABI field Merge remote-tracking branch 'origin/master' into hjl/linux/master Apply fixes for PRs 16317/16322 Merge remote-tracking branch 'origin/hjl/linux/master' into hjl/linux/applied Apply binutils-pr16317.patch Apply binutils-pr16322.patch Update release note for 2.24.51.0.2 Jan Kratochvil (2): gdb/NEWS: Fix typo Record objfile->original_name as an absolute path Jan-Benedict Glaw (1): 2013-11-08 Jan-Benedict Glaw <jbglaw@lug-owl.de Joel Brobecker (42): Minor reformatting in remote-sim.c (gdbsim_detach declaration). Dandling memory pointers in Ada catchpoints with GDB/MI. Add command to list Ada exceptions Implement GDB/MI equivalent of "info exceptions" CLI command. Document "info exceptions" and "-info-ada-exception" new commands. Add missing ChangeLog entry for a7e332c24b77168bc61d4ee776bf29c831fbbc88 Small fix (first word of sentence to start with capital letter) crash while re-reading symbols from objfile on ppc-aix. Replace "info-ada-exceptions" by "ada-exceptions" in -list-features language.h: Add "symtab.h" #include New function cli-utils.c:extract_arg_const GDB/MI: Add new "--language LANG" command option. Fix DW_OP_GNU_regval_type with FP registers Start inferior before running test listing Ada exceptions. gdb.ada/info_exc.exp,mi_exc_info.exp: handle runtimes with full debug info. gdb.ada/info_exc.exp,mi_exc_info.exp: Use more unique exception name. Rename "read_reg" into "read_addr_from_reg" in struct dwarf_expr_context_funcs Add "language-option" to -list-features mi-language.exp: Check "langauge-option" in -list-features output. gdb_ari.sh: Remove entries for dirent.h and stat.h. Fix int() builtin with range type gdb.Value objects. get rid of py-value.c:is_intlike (use is_integral_type instead) Makefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_string.h". Remove last traces of gdb_stat.h. Makefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_dirent.h". Fix filestuff.c build error if RLIMIT_NOFILE not defined. New GDB/MI command "-info-gdb-mi-command" Add "undefined-command" error code at end of ^error result... Remove all trailing spaces in mi/mi-main.c. Remove "ada-exceptions" from -list-features output. NEWS: Extend documentation of the new GDB/MI --language option. crash evaluating bogus exception condition expression (sparc-solaris) Ada: Reserved word "all" should not need to be spelled in lowercase. Minor coding-style fixes in ada-lex.l:find_dot_all. Allow Windows UNWIND_INFO version 2. Uninitialized variable "this_id" in frame.c:get_prev_frame_1. Document the GDB 7.6.2 release in gdb/ChangeLog Fix gdb/ChangeLog date in last entry. nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missing GDB/MI: Document support for -exec-run --start in -list-features Set language for Ada minimal symbols. Add @cindex for section documenting the -list-features GDB/MI command. Jose E. Marchesi (4): 2013-11-07 Jose E. Marchesi <jose.marchesi@oracle.com> sparc: support single-stepping over longjmp calls. testsuite: handle SIGLOST/SIGPWR conflict in sparc64-*-linux-gnu targets. Fixed typo in date in testsuite/ChangeLog entry Keith Seitz (4): Fix regressions caused by const-ify linespec patch: PR c++/7539 Fix PR # dyslexia in ChangeLog for previous commit. It should have PR c++/14819: Explicit class:: inside class scope does not work Keven Boell (1): testsuite: introduce index in varobj child eval. Kyrylo Tkachov (1): [ld/testsuite/] Luis Machado (2): * lib/mi-support.exp (mi_gdb_test): Expect different formats * gdb.base/callfuncs.c (main): Assign malloc's return value Maciej W. Rozycki (1): MIPS/opcodes: Add MFCR and MTCR data dependencies Michael Zolotukhin (1): Reorder invalid default mask check Mike Frysinger (3): gdb: testsuite: fix ksh shebang to use sh strip off +x bits on non-executable/script files sim: bfin: tests: make run-tests.sh executable Nick Clifton (8): * rescoff.c (write_coff_file): Use 64-bit alignment for resource PR ld/16082 PR ld/16017 * config/tc-aarch64.c (parse_sys_reg): Do not issue error messages * scripttempl/elf32msp430.sc (.data): Set the based on the next PR ld/16192 * peXXigen.c (pe_print_resource_entries): New function: Displays * s390-mkopc.c (dumpTable): Provide a format string to printf so Omair Javaid (1): testsuite/gdb.dwarf2: dw2-case-insensitive.exp: p fuNC_lang fails on arm Pedro Alves (36): infrun.c:handle_inferior_event: Don't fall through in TARGET_WAITKIND_LOADED handling. infrun.c:handle_inferior_event: Move comment. infrun.c: Don't set ecs->random_signal for "catchpoint" events (eliminate ecs->random_signal). infrun.c:handle_inferior_event: Rework random signal checks. Eliminate enum bpstat_signal_value, simplify random signal checks further. infrun.c: Split handle_inferior_event further. infrun.c:handle_signal_stop: Move initial connection/attachment handling code earlier. Simplify dwarf2-frame.c:read_addr_from_reg. Make the maint.exp:'maint print objfiles' test less fragile. Add missing ChangeLog entry. Don't let two frames with the same id end up in the frame chain. Make use of the frame stash to detect wider stack cycles. Eliminate dwarf2_frame_cache recursion, don't unwind from the dwarf2 sniffer (move dwarf2_tailcall_sniffer_first elsewhere). Revert "Eliminate dwarf2_frame_cache recursion, don't unwind from the dwarf2 sniffer (move dwarf2_tailcall_sniffer_first elsewhere)." Revert "Make use of the frame stash to detect wider stack cycles." Revert "Don't let two frames with the same id end up in the frame chain." Eliminate dwarf2_frame_cache recursion, don't unwind from the dwarf2 sniffer (move dwarf2_tailcall_sniffer_first elsewhere). Don't let two frames with the same id end up in the frame chain. Make use of the frame stash to detect wider stack cycles. Rename gdb.dwarf2/dw2-bad-cfi.* to gdb.dwarf2/dw2-unspecified-ret-addr.*. Make "set debug frame 1" output print <not saved> instead of <optimized out>. Fix type of not saved registers. Fix PR 16152's ChangeLog entry. register: "optimized out" -> "not saved". get_prev_frame, UNWIND_NULL_ID -> UNWIND_OUTERMOST get_prev_frame, outer_frame_id and unwind->stop_reason checks are redundant. get_prev_frame, stop_reason != UNWIND_NO_REASON, add frame debug output. Plug target side conditions and commands leaks. UNWIND_NULL_ID is no longer used anywhere. Update comments. Handle 'k' packet TARGET_CLOSE_ERROR gracefully. gnulib's sys/stat.h always defines S_IRGRP, S_IXGRP, S_IXOTH. Add new target_read_raw_memory function, and consolidate comments. New OPTIMIZED_OUT_ERROR error code. Fix "info frame" in the outermost frame. Eliminate UNSUPPORTED_ERROR. breakpoint.c:insert_bp_location: Constify local. Phil Muldoon (4): 2013-11-07 Phil Muldoon <pmuldoon@redhat.com> 2013-11-07 Phil Muldoon <pmuldoon@redhat.com> 2013-11-07 Phil Muldoon <pmuldoon@redhat.com> 2013-11-11 Phil Muldoon <pmuldoon@redhat.com> Pierre Muller (1): Fix completion for pascal language. Richard Sandiford (1): binutils/testsuite/ Roland McGrath (4): Set CPU type in BFD backend for x86_64-nacl* and i?86-nacl* targets Fix references to __ehdr_start when it cannot be defined Fix *-nacl* target objcopy/strip of binary made with custom linker script Use $(INSTALL_PROGRAM_ENV) consistently. Samuel Bronson (2): MAINTAINERS (Write After Approval): Add myself to the list. Resurrect gdb-add-index as a contrib script Sanimir Agovic (1): test: test eval routines with EVAL_AVOID_SIDE_EFFECTS flag set Senthil Kumar Selvaraj (1): * scripttempl/avr.sc: Set .data section's LMA to next available Sergio Durigan Junior (2): Remove gdb_string.h from gdbarch.sh Sanitize access to gdbarch on the SDT probe API (and fix ARM bug) Siva Chandra (1): 2013-12-12 Siva Chandra Reddy <sivachandra@google.com> Steffen Sledz (1): gdb: fix cygwin check in configure script Sterling Augustine (2): 2013-11-22 Sterling Augustine <saugustine@google.com> 2013-11-22 Sterling Augustine <saugustine@google.com> Steve Ellcey (1): 2013-11-25 Steve Ellcey <sellcey@mips.com> Tom Tromey (42): constify to_detach introduce common.m4 remove link.h checks use gdb_string.h in m32c-tdep.c gdb configure updates fix a comment in configure.ac remove unused gdbserver configury fix "tkill" check fix multi-arch-exec for parallel mode off-by-one fix for py-linetable.c fix grammar oddity in the manual print summary from "make check" fix PR c++/16117 link gdbreplay against gnulib change how list of modules is computed import strstr and strerror modules remove gdb_string.h don't check for string.h or strings.h import gnulib dirent module remove gdb_dirent.h don't check for stddef.h stdlib.h is universal too don't check for unistd.h sys/types.h cleanup import gnulib sys/stat.h module remove gdb_stat.h remove strerror module Detect infinite loop in value_fetch_lazy's lval_register handling. handle an unspecified return address column update comment in dw2-bad-cfi.S. revert patch from 2013-11-22 add "dir" menu item for gdbserver add @kindex for catchpoints remove some sym_probe_fns methods make symtab::filename const make symtab::dirname const put the psymtab filename in the filename bcache fix a couple of FIXMEs pack partial_symtab for space remove unnecessary declaration remove objfile_to_front update free_objfile comment Tristan Gingold (5): Fix version.dll binutils test on non native platforms Improve dump of xdata/pdata on x86_64. Fix crash on intelbad. Clear allocated target data. Add epilog unwind for x86_64 pe/coff Walfred Tedeschi (9): Fix conditions in creating a bitfield. Add MPX registers XML files. Add MPX support for i386 MPX for amd64 Add MPX support to gdbserver. Add pretty-printer for MPX bnd registers. Add MPX registers tests. Fix PR16193 - gdbserver aborts. Documentation for MPX. Will Newton (8): sim/arm: Prevent NULL pointer dereference in sim_create_inferior. sim/arm: Prevent crash when running sim with no binary. sim/ChangeLog: Correct bug number in previous commit. ld/ARM: Fix script-type testsuite failure. gdb/arm-tdep.c: Remove "Infinite loop detected" error message. bfd/elfnn-aarch64.c: Fix miscalculation of GOTPLT offset for ifunc syms. bfd/elfnn-aarch64.c: Handle static links with ifunc correctly. ld/testsuite/ld-aarch64: Fixup IFUNC tests to work on all targets Yao Qi (36): Constify 'la_name' in struct language_defn New field 'la_natural_name' in struct language_defn Remove varobj_language_string, languages and varobj_languages Fix typo Remove 'whatever' in lib/mi-support.exp Fix format issues in lib/mi-support.exp Remove unnecessary '\'. Move changelog entry to the right ChangeLog Remove last_cache Don't update target_dcache if it is not initialized Move target-dcache out of target.c Don't stress 'remote' in "Data Caching" in doc Add REGISTRY for struct address_space. Associate target_dcache to address_space. set_address_space_data if dcache is NULL. s/see @pxref/@pxref in doc Doc 'dynamic' for command -var-list-children Use mi_create_floating_varobj Check has_more in mi_create_dynamic_varobj Update doc on displayhint in command -var-list-children Write "ON" and "OFF" in lower case in GDB doc. GDB perf test on single step Renaming in target-dcache.c set/show code-cache Use target_read_code in disassemble. GDB perf test on backtrace GDB perf test on disassemble Delegate to target_ops->beneath for TARGET_OBJECT_RAW_MEMORY Fix typo "checksm" Fix PR remote/15974 Avoid "may be used uninitialized" warning Use gdb_produce_source Invalidate target cache before starting to handle event. Use target_read_code in skip_prologue (i386) Use target_read_code in skip_prologue (amd64) Fix a bug in matching notifications. Yufeng Zhang (8): * elfxx-aarch64.c (_bfd_aarch64_elf_grok_prstatus): Fix hard-coded bfd/ gas/ Revert "Add support for AArch64 trace unit registers." gas/ Add support for armv7ve to gas. Revert "Do not issue error messages when parsing a PSTATE register". gas/testsuite/ bviyer (2): Added Cilk runtime library (libcilkrts) into GCC. Disable libcilkrts when C++ is not used. ccoutant (1): Fix demangler to handle conversion operators correctly. gary (1): libiberty/ 2013-10-25 Gary Benson <gbenson@redhat.com> gerald (3): Fix up ChangeLog entries (name, e-mail, formatting, otherwise). * testsuite/test-expandargv.c: Include unistd.h. * testsuite/test-demangle.c: Include unistd.h. glisse (1): 2013-10-29 Marc Glisse <marc.glisse@inria.fr> jason (1): / * Makefile.tpl (STAGE1_CONFIGURE_FLAGS): Pass --disable-build-format-warnings. gcc/ * configure.ac (loose_warn): Add -Wno-format if --disable-build-format-warnings. law (1): * Makefile.def (target_modules): Remove libmudflap (languages): Remove check-target-libmudflap). * Makefile.in: Rebuilt. * Makefile.tpl (check-target-libmudflap-c++): Remove. * configure.ac (target_libraries): Remove target-libmudflap. Remove checks which disabled libmudflap on some systems. * configure: Rebuilt. * libmudflap: Directory removed. rsandifo (1): include/ * longlong.h: New file. schwab (1): config/ * picflag.m4 (m68k-*-*): Use default PIC flag. sterling (1): 2013-10-22 Sterling Augustine <saugustine@google.com> tschwinge (2): * Makefile.tpl: Fix typo. * Makefile.in: Regenerate. * Makefile.in: Regenerate. uros (1): * cp-demangle.c (d_copy_templates): Cast result of malloc to (struct d_print_template *). (d_print_comp): Cast result of realloc to (struct d_saved scope *). -----------------------------------------------------------------------