Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 569894 - sys-devel/llvm: memory sanitizer is broken with recent kernels (4.1.x)
Summary: sys-devel/llvm: memory sanitizer is broken with recent kernels (4.1.x)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: AMD64 Linux
: Normal major (vote)
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-27 10:19 UTC by Alexander Sergeyev
Modified: 2015-12-27 22:52 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Sergeyev 2015-12-27 10:19:30 UTC
The problem is related to memory sanitizer only (thread/address works fine).
Steps to reproduce (tested kernel version is 4.3.3):
compile simple hello-world code with: clang++ -fPIE -fsanitize=memory ./helloworld.cc

It compiles without problems, but the built binary fails with:
FATAL: Code 0x55d2c994e9f0 is out of application range. Non-PIE build?
FATAL: MemorySanitizer can not mmap the shadow memory.
FATAL: Make sure to compile with -fPIE and to link with -pie.
FATAL: Disabling ASLR is known to cause this error.
FATAL: If running under GDB, try 'set disable-randomization off'.

The fixed upstream bug could be found here: https://llvm.org/bugs/show_bug.cgi?id=24155

It would be great to port the bugfix to the portage because this sanitizer functionaly is completely broken at the moment (and according to the upstream the bug is present on stable gentoo kernel 4.1.12).
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-12-27 11:32:35 UTC
I don't seem to be able to connect to llvm.org right now. If the patch isn't unreasonably big, could you upload it here?
Comment 2 Alexander Sergeyev 2015-12-27 14:54:22 UTC
> I don't seem to be able to connect to llvm.org right now. If the patch isn't
> unreasonably big, could you upload it here?

I'm away from my computer now, so can do only within around another 4 hours.
Comment 3 Agostino Sarubbo gentoo-dev 2015-12-27 18:18:37 UTC
(In reply to Michał Górny from comment #1)
> I don't seem to be able to connect to llvm.org right now. If the patch isn't
> unreasonably big, could you upload it here?

patches sent via mail.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-12-27 19:04:34 UTC
I have modified the patches to apply to 3.7.0 and I'm rebuilding LLVM now.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-12-27 22:52:27 UTC
commit 4ea0768355d83631d0baf5c7de9b712ea2ebe12a
Author: Michał Górny <mgorny@gentoo.org>
Date:   Sun Dec 27 23:47:38 2015

    sys-devel/llvm: Backport msan fix for 4.1+ kernels, bug #569894