linux-user: Add emulation for MADV_WIPEONFORK and MADV_KEEPONFORK in madvise()
commit4530deb1fe81152ae2384a56eb7edb5467f894fa
authorHelge Deller <deller@gmx.de>
Tue, 13 Dec 2022 17:03:09 +0000 (13 18:03 +0100)
committerLaurent Vivier <laurent@vivier.eu>
Fri, 3 Feb 2023 21:55:12 +0000 (3 22:55 +0100)
treec5a55a278ceb04cdf0fc36e44678efc59d944208
parentab6c497e7eb8a9dca45978e5118f5c67bb74ab62
linux-user: Add emulation for MADV_WIPEONFORK and MADV_KEEPONFORK in madvise()

Both parameters have a different value on the parisc platform, so first
translate the target value into a host value for usage in the native
madvise() syscall.

Those parameters are often used by security sensitive applications (e.g.
tor browser, boringssl, ...) which expect the call to return a proper
return code on failure, so return -EINVAL if qemu fails to forward the
syscall to the host OS.

While touching this code, enhance the comments about MADV_DONTNEED.

Tested with testcase of tor browser when running hppa-linux guest on
x86-64 host.

Signed-off-by: Helge Deller <deller@gmx.de>
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <Y5iwTaydU7i66K/i@p100>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/mmap.c