]> git.proxmox.com Git - mirror_qemu.git/commit - linux-user/mmap.c
linux-user: Validate mmap/mprotect prot value
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 19 May 2020 18:56:44 +0000 (11:56 -0700)
committerLaurent Vivier <laurent@vivier.eu>
Sun, 23 Aug 2020 14:57:58 +0000 (16:57 +0200)
commit9dba3ca5af80a7d4b5269685ceaa27ca04199cf4
treef1206d93700dbd5bdafe8d6125341e98b024eb29
parent664441ea0111ef4dc68510d87b89b983ef838500
linux-user: Validate mmap/mprotect prot value

The kernel will return -EINVAL for bits set in the prot argument
that are unknown or invalid.  Previously we were simply cropping
out the bits that we care about.

Introduce validate_prot_to_pageflags to perform this check in a
single place between the two syscalls.  Differentiate between
the target and host versions of prot.  Compute the qemu internal
page_flags value at the same time.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200519185645.3915-2-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/mmap.c