Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Aug 2018 13:19:15 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r337842 - head/sys/arm64/arm64
Message-ID:  <201808151319.w7FDJFbn028195@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Wed Aug 15 13:19:15 2018
New Revision: 337842
URL: https://svnweb.freebsd.org/changeset/base/337842

Log:
  Set the Execute Never flags in EFI device memory as required by the ARMv8
  spec.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/arm64/arm64/efirt_machdep.c

Modified: head/sys/arm64/arm64/efirt_machdep.c
==============================================================================
--- head/sys/arm64/arm64/efirt_machdep.c	Wed Aug 15 13:13:19 2018	(r337841)
+++ head/sys/arm64/arm64/efirt_machdep.c	Wed Aug 15 13:19:15 2018	(r337842)
@@ -162,7 +162,7 @@ bool
 efi_create_1t1_map(struct efi_md *map, int ndesc, int descsz)
 {
 	struct efi_md *p;
-	pt_entry_t *l3;
+	pt_entry_t *l3, l3_attr;
 	vm_offset_t va;
 	uint64_t idx;
 	int i, mode;
@@ -218,12 +218,17 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int 
 		}
 
 		printf("MAP %lx mode %x pages %lu\n", p->md_phys, mode, p->md_pages);
+
+		l3_attr = ATTR_DEFAULT | ATTR_IDX(mode) | ATTR_AP(ATTR_AP_RW) |
+		    L3_PAGE;
+		if (mode == VM_MEMATTR_DEVICE)
+			l3_attr |= ATTR_UXN | ATTR_PXN;
+
 		VM_OBJECT_WLOCK(obj_1t1_pt);
 		for (va = p->md_phys, idx = 0; idx < p->md_pages; idx++,
 		    va += PAGE_SIZE) {
 			l3 = efi_1t1_l3(va);
-			*l3 = va | ATTR_DEFAULT | ATTR_IDX(mode) |
-			    ATTR_AP(ATTR_AP_RW) | L3_PAGE;
+			*l3 = va | l3_attr;
 		}
 		VM_OBJECT_WUNLOCK(obj_1t1_pt);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808151319.w7FDJFbn028195>