From owner-svn-src-head@freebsd.org Wed Aug 15 13:19:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A0A910844E1; Wed, 15 Aug 2018 13:19:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 30E508C3CF; Wed, 15 Aug 2018 13:19:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 136282B9F; Wed, 15 Aug 2018 13:19:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7FDJF48028200; Wed, 15 Aug 2018 13:19:15 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7FDJFbn028195; Wed, 15 Aug 2018 13:19:15 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201808151319.w7FDJFbn028195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 15 Aug 2018 13:19:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r337842 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 337842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Aug 2018 13:19:16 -0000 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); }