Skip to content

Fix tests for start+len address valid for guest

Richard Henderson qemu-devel 1 version Applied

Status from this message: Thanks, applied.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 4 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/7target-sparc: Fix TARGET_{PHYS, VIRT}_ADDR_SPACE_BITS.target-sparc/cpu.h+6 -60 replies
2/7Add guest_start_len_valid function.cpu-all.h+10 -03 replies
3/7linux-user: Use guest_start_len_valid in msync.linux-user/mmap.c+8 -50 replies
4/7linux-user: Use guest_start_len_valid in mremap.linux-user/mmap.c+24 -200 replies
5/7linux-user: Use guest_start_len_valid in mmap.linux-user/mmap.c+2 -60 replies
6/7Fix zero-length write(2).exec.c+3 -01 reply
7/7Use guest_start_len_valid in page_check_range.exec.c+1 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/7] Fix tests for start+len address valid for guest

The first patch in the series fixes a major think-o in the sparc port. The 64 and 32-bit constants were reversed. Fixing these are required to avoid a build error in later patches.

For the actual problem, introduce a guest_start_len_valid macro similar to the existing h2g_valid macro, where we compare the address range against TARGET_VIRT_ADDR_SPACE_BITS (or ULONG_MAX, depending on the host).

Use this in 3 places in the linux-user memory handling functions, and also in the generic page_check_range. In the later case, also remove a mis-conception that I had that page_check_range was already bounds checked -- these values come directly from a guest syscall and so can contain any random errant values.

r~

Richard Henderson (7):
target-sparc: Fix TARGET_{PHYS,VIRT}_ADDR_SPACE_BITS. Add guest_start_len_valid function.
linux-user: Use guest_start_len_valid in msync.
linux-user: Use guest_start_len_valid in mremap.
linux-user: Use guest_start_len_valid in mmap. Fix zero-length write(2).
Use guest_start_len_valid in page_check_range.

 cpu-all.h          |   10 ++++++++
 exec.c             |   12 +++------
 linux-user/mmap.c  |   65 +++++++++++++++++++++++++++------------------------
 target-sparc/cpu.h |   12 ++++----
 4 files changed, 54 insertions(+), 45 deletions(-)