[llvm-bugs] [Bug 32143] New: r274162 (SafeStack) causes cryptographic code to miscompile

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 5 07:10:50 PST 2017


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

            Bug ID: 32143
           Summary: r274162 (SafeStack) causes cryptographic code to
                    miscompile
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: ed at 80386.nl
                CC: llvm-bugs at lists.llvm.org

Created attachment 18054
  --> https://bugs.llvm.org/attachment.cgi?id=18054&action=edit
Reduced testcase of the miscompilation

CloudABI is a runtime environment based on a subset of POSIX that allows for
strong sandboxing. CloudABI uses Clang as its C/C++ compiler with LLVM's
SafeStack enabled by default.

One of the lead developers of Bitcoin, Wladimir van der Laan, is currently
working on getting Bitcoin Core ported over to CloudABI:

https://laanwj.github.io/2017/03/02/porting-bitcoin-core-to-cloudabi.html

In the process, he discovered that some of Bitcoin's unit tests tend to fail
when SafeStack is enabled. He observed this when using LLVM/Clang 4.0-rc2:

https://github.com/NuxiNL/cloudabi-ports/issues/30

I've done some bisecting and discovered it's caused by SVN r274162:

270000 ok
272500 ok
273750 ok
274062 ok
274140 ok
274160 ok
274161 ok
274162 bad
274163 bad
274165 bad
274170 bad
274179 bad
274218 bad
274375 bad
275000 bad
280000 bad
296985 bad

Attached you can find a source file of a reduced test case that should build
both on CloudABI and non-CloudABI. When built with SafeStack enabled and -O2 or
higher set, it will call abort(). When built without SafeStack or when using
lower optimisation levels, it will print "O.K." and terminate successfully.

I will add this as a blocker for 4.0.

-- 
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/20170305/8ec9f9a3/attachment.html>


More information about the llvm-bugs mailing list