[cfe-dev] Weird ud2 generation

via cfe-dev cfe-dev at lists.llvm.org
Sun Aug 14 11:43:43 PDT 2016


First off, sorry if this is the wrong place to send this.

I’m attempting to debug a crash in the Atom editor for users of Arch Linux on kernels before 4.6.0. We compile Atom with Clang, and users of old kernels are now reporting that the main native-code component, Electron, is getting SIGILLs. Hand-decompiling (so there might be mistakes) the area near the crash in the core dump, I found a function that looks like:

void xyzzy(void* addr, size_t len) {
	if(madvise(addr, len, MADV_FREE) != 0)
		__asm__("ud2"); // We’re crashing on the ud2.
}

It doesn’t correspond to any code we’re compiling, however. In Electron and all its dependencies, madvise is only used once, in a completely separate context from the surrounding code. The code looks a lot more like it was generated by Clang than by GCC, though, so I’m suspecting it’s used in some sort of intrinsic or compiler support function?

For reference, Atom is structured like:

Atom -> Electron -> Chromium --\
            \-----> node.js ------> V8

The code surrounding the “xyzzy” function seems to be coming from a file in V8, https://github.com/electron/node/blob/ee8c429deaee0adeeef069c3ad34c0defe53a567/deps/v8/src/base/platform/platform-posix.cc

I’m wondering if either a) someone recognizes this off the bat as something Clang uses for some purpose, or b) if someone with more experience with Clang, or the V8 codebase could help with solving? The part where it’s related to the kernel version is what’s really throwing me off... 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160814/79446de5/attachment.html>


More information about the cfe-dev mailing list