[all-commits] [llvm/llvm-project] 8bbfac: [BOLT][NFC] Fix UB due to unaligned load in DebugS...

Job Noorman via All-commits all-commits at lists.llvm.org
Thu Apr 13 07:39:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8bbfac7be1b1be94a7a95aaf602cc224f6e504e7
      https://github.com/llvm/llvm-project/commit/8bbfac7be1b1be94a7a95aaf602cc224f6e504e7
  Author: Job Noorman <jnoorman at igalia.com>
  Date:   2023-04-13 (Thu, 13 Apr 2023)

  Changed paths:
    M bolt/lib/Core/DebugData.cpp

  Log Message:
  -----------
  [BOLT][NFC] Fix UB due to unaligned load in DebugStrOffsetsWriter

The following tests fail when enabling UBSan due to an unaligned memory
load:

> runtime error: load of misaligned address 0x620000000643 for type
> 'const uint32_t' (aka 'const unsigned int'), which requires 4 byte
> alignment

  BOLT :: AArch64/asm-func-debug.test
  BOLT :: AArch64/update-debug-reloc.test
  BOLT :: X86/asm-func-debug.test
  BOLT :: X86/dwarf5-df-dualcu.test
  BOLT :: X86/dwarf5-df-mono-dualcu.test
  BOLT :: X86/dwarf5-ftypes-dwp-input-dwo-output.test
  BOLT :: X86/dwarf5-locaddrx.test
  BOLT :: X86/dwarf5-split-dwarf4-monolithic.test
  BOLT :: X86/inlined-function-mixed.test
  BOLT :: non-empty-debug-line.test

This patch fixes this by using read32le for the load.

Reviewed By: ayermolo

Differential Revision: https://reviews.llvm.org/D148217




More information about the All-commits mailing list