]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
target/ppc: Add execute permission checking to access authority check
authorSuraj Jitindar Singh <sjitindarsingh@gmail.com>
Wed, 1 Mar 2017 07:12:53 +0000 (18:12 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Fri, 3 Mar 2017 00:30:59 +0000 (11:30 +1100)
Basic storage protection defines various access authority permissions
based on a slb storage key and pte pp value pair. This access authority
defines read, write and execute permissions however currently we only
use this to control read and write permissions and ignore the execute
control.

Fix the code to allow execute permissions based on the key-pp value pair.
Execute is allowed under the same conditions which enable reads.
(i.e. read permission -> execute permission)

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
target/ppc/mmu-hash64.c

index ee94f13481847a0db9ff59d1b54924645d5dea1f..99f936ddbef104310b68000258f44f6678003229 100644 (file)
@@ -308,28 +308,27 @@ static int ppc_hash64_pte_prot(PowerPCCPU *cpu,
         case 0x0:
         case 0x1:
         case 0x2:
-            prot = PAGE_READ | PAGE_WRITE;
+            prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
             break;
 
         case 0x3:
         case 0x6:
-            prot = PAGE_READ;
+            prot = PAGE_READ | PAGE_EXEC;
             break;
         }
     } else {
         switch (pp) {
         case 0x0:
         case 0x6:
-            prot = 0;
             break;
 
         case 0x1:
         case 0x3:
-            prot = PAGE_READ;
+            prot = PAGE_READ | PAGE_EXEC;
             break;
 
         case 0x2:
-            prot = PAGE_READ | PAGE_WRITE;
+            prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
             break;
         }
     }