[llvm-bugs] [Bug 43673] New: wasm: zero initialized arrays get encoded in data section

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 14 05:28:03 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43673

            Bug ID: 43673
           Summary: wasm: zero initialized arrays get encoded in data
                    section
           Product: libraries
           Version: 9.0
          Hardware: Macintosh
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedbugs at nondot.org
          Reporter: geert.aj.custers at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 22669
  --> https://bugs.llvm.org/attachment.cgi?id=22669&action=edit
source that causes the bug

Hello,

At the moment the value of global arrays get encoded into the data section of a
wasm module, without it being needed. Memory is guaranteed to be zero
initialized by the wasm spec. The result of this is that large zero initialized
arrays still get inlcuded in the data section of the module, leading to
extremely large binaries.

Attached is an example program that showcases the issue. Compiling the source
code results in a binary of size 9.5MB, mostly consisting of zeroes.
Mutliplying the "number" variable by 10 increases the binary size to 95MB.
Clearly, adding a bunch more zeroes can lead to large binaries, so this could
be seen as an amplification attack...

I would expect clang/llvm to only describe the array in the globals section,
and not to paste the whole contents of the array in the data section if the
array is zero.

Regards,
Geert

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191014/cd06c214/attachment-0001.html>


More information about the llvm-bugs mailing list