Building UML with ASan on x86

Alexander Potapenko glider at google.com
Wed May 24 08:46:25 PDT 2023


Hi UML maintainers,

I am trying to build and run x86_64 UML with ASan (some patches to do
so are at [1]).
This is more of an experiment, but the idea behind it is that
userspace ASan should be able to instrument the whole kernel code,
while KASAN does not instrument its own building blocks (SLAB/SLUB,
stack unwinder, stackdepot).

The problem I am hitting is that by default my kernel is loaded
between 0x60000000-0x62000000, and UML attempts to allocate its
physical memory so that it starts around those addresses.
Unfortunately ASan's shadow memory on x86_64 Linux is located at
0x00007fff8000-0x10007fff8000, so if I run UML with e.g. `mem=512` the
physical memory allocated by setup_physmem() will overlap with ASan
shadow, leading to crashes.

Is there an easy way to move UML's physical memory above 0x10007fff8000?

I tried e.g. adjusting START in arch/x86/Makefile.um to
0x200060000000, but that led to boot-time vmap allocation failures.
Could it be that there are some implicit conditions on this address -
maybe something related to TASK_SIZE?

Thanks,
Alex

[1] https://github.com/ramosian-glider/linux/commits/uml-asan



More information about the linux-um mailing list