Skip to contentSkip to conversation

linux-user: Allow -R values up to 0xffff0000 for 32-bit ARM guests

PATCH In review Peter Maydell 2 participants 2 messages Oct 3, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Allow -R values up to 0xffff0000 for 32-bit ARM guests

The 32-bit ARM validate_guest_space() check tests whether the specified -R value leaves enough space for us to put the commpage in at 0xffff0f00. However it was incorrectly doing a <= check for the check against (guest_base + guest_size), which meant that it wasn't permitting the guest space to butt right up against the commpage.

Fix the comparison, so that -R values all the way up to 0xffff0000 work correctly.

---
 linux-user/elfload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/elfload.c +1 -1
index 7906288..3b857fb 100644
@@ -377,7 +377,7 @@ static int validate_guest_space(unsigned long guest_base,
      * then there is no way we can allocate it.
      */
     if (test_page_addr >= guest_base
-        && test_page_addr <= (guest_base + guest_size)) {
+        && test_page_addr < (guest_base + guest_size)) {
         return -1;
     }
 
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Peter Maydell

The 32-bit ARM validate_guest_space() check tests whether the specified -R value leaves enough space for us to put the commpage in at 0xffff0f00. However it was incorrectly doing a <= check for the check against (guest_base + guest_size), which meant that it wasn't permitting the guest space to butt right up against the commpage.

Fix the comparison, so that -R values all the way up to 0xffff0000 work correctly.

		E.