From nobody Tue Dec 07 16:02:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0383B18C7C80; Tue, 7 Dec 2021 16:02:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J7lSF4KQFz3mNQ; Tue, 7 Dec 2021 16:02:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73B55226C9; Tue, 7 Dec 2021 16:02:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1B7G2bVa074304; Tue, 7 Dec 2021 16:02:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B7G2bgZ074303; Tue, 7 Dec 2021 16:02:37 GMT (envelope-from git) Date: Tue, 7 Dec 2021 16:02:37 GMT Message-Id: <202112071602.1B7G2bgZ074303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 38dbca724335 - main - Teach vm.pmap.kernel_maps about both XN bits List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38dbca724335fec679e79b72d91a8e36b2624fe1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638892957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Uwb0uPTm9TnneiCFBM114WnIARSloR21xqJV++uqcjo=; b=RosX/WfWEvUEG2AgbqP0nCkOt/lL6EjuNhG3tvZdvMhUPN70MbFUkGljjioWtM6mmJECwK lJsVitZkShE8zS6unyVYoUgaPkR8CNHh9fwepBHAFDBEH4XLL97OI6AevInWsH8r8S7g/8 lVZqOsownXHlNDhHMYfw+NvA+qxHGeQ4rhv7dB5Z5zkTt+9XLF1agY2gaOSWMnFPTCJukh jb1fn51mGcgzVfFC4N16hKBcOhnLJDUuWfXRDRkiXva+Nw7ccLpHdvRHJKqDfpH7eH7W4B Os8npued2hu7/GIaSd2wyM+rgbYdHG0gOnV/YJ80NyRf7a9snPyYRAbx2aUn5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638892957; a=rsa-sha256; cv=none; b=n+1kU0e5w56xZDsGAowy42W0AJ9JHG7apyH11hfNh7jhLVzygMmU8/+7NLcxHsQmRz06qh 6VoEr6EOXm9lU+HcINWcnRppUD9GXbP2ZWkEQTcsmvd/ILxKzk+mGZ3ZY6bJndoWPpkiUZ aQIcl4jLo/dPfxU16sZKWljpCXuikruqBhlu+uMj61wFx/kgWplrW/TSSONSDVYojYDgnf 42xZ5d4dxz8zSHNLL4bwLXRktCd+mjeb+aNyY1tGTq8hpe/eujClvYGJitiyI9MnvohI+W ZFo5mcJzR0okjoCy8/wrfUBIQIj39y2e2XnBs2GSU4venm34mUQx56lWmtg5kg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=38dbca724335fec679e79b72d91a8e36b2624fe1 commit 38dbca724335fec679e79b72d91a8e36b2624fe1 Author: Andrew Turner AuthorDate: 2021-12-06 13:08:39 +0000 Commit: Andrew Turner CommitDate: 2021-12-07 15:42:18 +0000 Teach vm.pmap.kernel_maps about both XN bits The arm64 vm.pmap.kernel_maps sysctl would only check the kernel XN bit when printing the kernel mapping. It can also be useful to check none of the mappings allow userspace to execute from a given virtual address. To check for this add the user XN bit when getting the kernel maps. While here fix the ATTR_S1_AP_USER check to use ATTR_S1_AP to shift the value to the correct offset. Reviewed by: kib (earlier version), markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33304 --- sys/arm64/arm64/pmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index ef5a42c849dd..a877c0c033f5 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -7000,11 +7000,12 @@ sysctl_kmaps_dump(struct sbuf *sb, struct pmap_kernel_map_range *range, break; } - sbuf_printf(sb, "0x%016lx-0x%016lx r%c%c%c %3s %d %d %d %d\n", + sbuf_printf(sb, "0x%016lx-0x%016lx r%c%c%c%c %3s %d %d %d %d\n", range->sva, eva, (range->attrs & ATTR_S1_AP_RW_BIT) == ATTR_S1_AP_RW ? 'w' : '-', (range->attrs & ATTR_S1_PXN) != 0 ? '-' : 'x', - (range->attrs & ATTR_S1_AP_USER) != 0 ? 'u' : 's', + (range->attrs & ATTR_S1_UXN) != 0 ? '-' : 'X', + (range->attrs & ATTR_S1_AP(ATTR_S1_AP_USER)) != 0 ? 'u' : 's', mode, range->l1blocks, range->l2blocks, range->l3contig, range->l3pages);