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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to