From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NyqEq-0003FD-3M for qemu-devel@nongnu.org; Mon, 05 Apr 2010 13:37:28 -0400 Received: from [140.186.70.92] (port=47484 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NyqEm-0003DY-9k for qemu-devel@nongnu.org; Mon, 05 Apr 2010 13:37:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NyqEk-0001C1-OU for qemu-devel@nongnu.org; Mon, 05 Apr 2010 13:37:24 -0400 Received: from are.twiddle.net ([75.149.56.221]:60861) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NyqEk-0001BW-FQ for qemu-devel@nongnu.org; Mon, 05 Apr 2010 13:37:22 -0400 Message-Id: From: Richard Henderson Date: Mon, 5 Apr 2010 10:30:12 -0700 Subject: [Qemu-devel] [PATCH 0/7] Fix tests for start+len address valid for guest List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: blauwirbel@gmail.com 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(-)