Skip to content

Recent kernel causes -fPIE ASan executables to abort on x86_64 #837

Open
@jcowgill

Description

@jcowgill

This is just a heads-up about this Linux kernel commit recently committed and pending on a number of stable queues:
torvalds/linux@eab0953

It seems to adjust move the default load address for -fPIE executables into the location ASan uses for its shadow memory map (on x86_64). This then causes ASan to abort on startup. Example error:

$ ./a.out
==5661==Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING.
==5661==ASan shadow was supposed to be located in the [0x00007fff7000-0x10007fff7fff] range.
==5661==Process memory map follows:
	0x000cb5280000-0x000cb5281000	/var/tmp/a.out
	0x000cb5480000-0x000cb5481000	/var/tmp/a.out
	0x000cb5481000-0x000cb5482000	/var/tmp/a.out
	0x7f6d4f9ca000-0x7f6d4fd1c000	
	0x7f6d4fd1c000-0x7f6d4fd32000	/lib/x86_64-linux-gnu/libgcc_s.so.1
	0x7f6d4fd32000-0x7f6d4ff31000	/lib/x86_64-linux-gnu/libgcc_s.so.1
	0x7f6d4ff31000-0x7f6d4ff32000	/lib/x86_64-linux-gnu/libgcc_s.so.1
	0x7f6d4ff32000-0x7f6d4ff33000	/lib/x86_64-linux-gnu/libgcc_s.so.1
[...]

With ASLR enabled, you can sometimes get lucky with the load address and the program runs, but most of the time ASan aborts with this error.

Is it possible for ASan to be a bit more flexible about where it places the shadow map on startup to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions