The kernel fails madvise() with ENOMEM when it is given a partially or a
fully unmapped address range. qemu-user differed from this and returned
0 instead.
Patch 1 makes target_madvise() check the range with page_check_range()
and potentially fail with ENOMEM while still giving precedence to
advice specific errors.
Patch 2 adds test cases, calling madvise() with partially and fully
unmapped address ranges.
Roi Klevansky (2):
linux-user: return ENOMEM from madvise on unmapped ranges
tests/tcg: add linux-user test for madvise returning ENOMEM
linux-user/mmap.c | 7 +++-
tests/tcg/multiarch/linux/linux-madvise.c | 43 +++++++++++++++++++++++
2 files changed, 49 insertions(+), 1 deletion(-)
--
2.55.0