[all-commits] [llvm/llvm-project] 118445: [WebAssembly] Protect memory.fill and memory.copy ...

Dan Gohman via All-commits all-commits at lists.llvm.org
Thu Oct 24 14:14:19 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 118445841d4d50b57ea2892a18f0b656526f804d
      https://github.com/llvm/llvm-project/commit/118445841d4d50b57ea2892a18f0b656526f804d
  Author: Dan Gohman <dev at sunfishcode.online>
  Date:   2024-10-24 (Thu, 24 Oct 2024)

  Changed paths:
    M llvm/lib/Target/WebAssembly/WebAssemblyISD.def
    M llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyInstrBulkMemory.td
    M llvm/lib/Target/WebAssembly/WebAssemblySelectionDAGInfo.cpp
    M llvm/test/CodeGen/WebAssembly/bulk-memory.ll
    M llvm/test/CodeGen/WebAssembly/bulk-memory64.ll

  Log Message:
  -----------
  [WebAssembly] Protect memory.fill and memory.copy from zero-length ranges. (#112617)

WebAssembly's `memory.fill` and `memory.copy` instructions trap if the
pointers are out of bounds, even if the length is zero. This is
different from LLVM, which expects that it can call `memcpy` on
arbitrary invalid pointers if the length is zero. To avoid spurious
traps, branch around `memory.fill` and `memory.copy` when the length is
zero.

---------

Co-authored-by: Heejin Ahn <aheejin at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list