OSDN Git Service

linux-user: init_guest_commpage: Add a comment about size check
authorLuke Shumaker <lukeshu@parabola.nu>
Thu, 28 Dec 2017 18:08:09 +0000 (13:08 -0500)
committerLaurent Vivier <laurent@vivier.eu>
Fri, 9 Mar 2018 20:29:49 +0000 (21:29 +0100)
Signed-off-by: Luke Shumaker <lukeshu@parabola.nu>
Message-Id: <20171228180814.9749-7-lukeshu@lukeshu.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/elfload.c

index 6531578..8699f43 100644 (file)
@@ -374,6 +374,11 @@ static int init_guest_commpage(unsigned long guest_base,
 
     /* If the commpage lies within the already allocated guest space,
      * then there is no way we can allocate it.
+     *
+     * You may be thinking that that this check is redundant because
+     * we already validated the guest size against MAX_RESERVED_VA;
+     * but if qemu_host_page_mask is unusually large, then
+     * test_page_addr may be lower.
      */
     if (test_page_addr >= guest_base
         && test_page_addr < (guest_base + guest_size)) {