From nobody Wed Dec 29 10:39:50 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 6F82D1927E87; Wed, 29 Dec 2021 10:39:51 +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 4JP7Fg1HDWz4plx; Wed, 29 Dec 2021 10:39:51 +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 0BC4023345; Wed, 29 Dec 2021 10:39:51 +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 1BTAdorb087506; Wed, 29 Dec 2021 10:39:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BTAdoXB087505; Wed, 29 Dec 2021 10:39:50 GMT (envelope-from git) Date: Wed, 29 Dec 2021 10:39:50 GMT Message-Id: <202112291039.1BTAdoXB087505@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: dca91e7a1628 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: dca91e7a1628a819175ca20864653f4171ff5258 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640774391; 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=b6lnNdJafGP4f7JGsdMdFzb6Xnvwv5XsPw/ZSMfPURI=; b=jOqjJkq8o81+N2qddcj/R+iiPN8akuEEseiidbxZt0UZyrl+4gEf3kgUBlqnxt26sBKFaq mcyfjhvehnfgNCekE5mI2t7oaUPSkbQ85kfNLBJQY6EO5q6nawYJ26hodEzSaDGjx6/peI Holz1+7Z7R7aQXjeLbKFmZ3AuOWHJnJlXSS/5/yLfPHRSPbExg6EXAWqjaSr1yBstZDYiA nnwON7Eyu4r2/QywApmw4+JA+AiU6TtE8HBsd10qwQXF1aIii51S+X8tKRCnMShv47K5sz mrwiUVaQXSsAQJCSaxAk0fZ6WA52oAiM6m67j9ZLZwGuACOiPFoHzo9uPuVx5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640774391; a=rsa-sha256; cv=none; b=NUqDugEctpOFM8QgXebtPAQxImyzjUs8tIKsWuM2K2mLdY2LrUe57YsUXoqOUIE6AToYks 3fWw/bMx687QAmI+tww4Fno0iFfu9+FiDq0/RtroPVWWGdT8myN7hJ15Yxxug1fqcaHxzT THMU4uPiX3dAY6p5QlUUkGHwG1YJwKTN0i2jIV06UEbRvoysCqhvMK9wUBwhGvlL/93Ms5 Q6g+Xc4epNEzNB989o7K3IhfSEihY3iRaOyxODy4xH0WNpO4KjEHj+bgI2VFkcr01aSTiP 3hzusdPBpNJnR+mtDUEyB9YAQ7gV5d+v6AgzAdRyb9/7nXBjYcARy1Hj+U0XwA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=dca91e7a1628a819175ca20864653f4171ff5258 commit dca91e7a1628a819175ca20864653f4171ff5258 Author: Andrew Turner AuthorDate: 2021-12-06 13:08:39 +0000 Commit: Andrew Turner CommitDate: 2021-12-29 10:05:59 +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 (cherry picked from commit 38dbca724335fec679e79b72d91a8e36b2624fe1) --- 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 6eab5fa5ecd9..17e76c0d5a41 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -7181,11 +7181,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);