From nobody Thu Apr 16 17:46:28 2026 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 4fxQRn3Gvjz6ZKHN for ; Thu, 16 Apr 2026 17:46:29 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fxQRn0rjKz3dqH for ; Thu, 16 Apr 2026 17:46:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776361589; 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=W81MTl/A0V1SEuMKTXFEL2RixrnKQYvV8H3cMC32qDk=; b=MVdk8eNtr5GjxrB+e7E7zU2Mpmo/GJX0M+m4huwy2KM1yxvLvIyChHGZYPa1MV8y7o9Lqq m+asnGyX2VQ8hRsXqp/fyxGTMl7VS/E+mLOGLs89PP+RGhnno/QgDyO7FHsbtkyptSgvbC noro4fDPJv9w1fagNsi9bMqzbhrPI95sTQksJNx0DEmLGoZR10tlafZTrFi131PaBwi3Q2 2LzAL735ra6icpohCaEsF8vqRmgCFvD1RyXc4R5xbrCgpLaN6DH5dBe2pnGyU9IlQo3jmv w+HeIYi5793yHl4N05npirloVnvRPpjpZJ33gakJwOllr0MvqgRQfvpO2fXZdQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776361589; a=rsa-sha256; cv=none; b=nGRkIo/PM0K8FJ1WLPoa6JXiCoJUzsrWaFlhvMxu8fOz1zzBqGQ2xIyP+rTASri7gGpS0p xxY7emtXM3IYsoQve4Jc2uA84ML3dZkPTT4bL16FZmNvqY+f4Hoy+5MGH3GDyDWoGV9Y/p AFU/P9mLKFJzY7TFR8v0WYxdmr5wu5ozZO7YSiXhJrNsBAlDe6PWXLDBTodgHB2cTVS5qO dxm1V9RnTvm1YYB79VBFK4d9BONKGsBWvvsMsyJ+jtbUqu/23EyiNHoRGoGAtGERZHLgs5 +mczo+lYpkHoSHj1Hsa6lkLgahl+uRLOAR0OUeB8mGk4Qaz3yLUw/yhJOOxDpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776361589; 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=W81MTl/A0V1SEuMKTXFEL2RixrnKQYvV8H3cMC32qDk=; b=YuOZ3XyQAWmHIOeVcjeudkg7BdJ3oYeQYLbGq46LSavV+AEfocNWmENyDKbhQ4BcibY62w hOj8UQECzurvLhxvbexGmXHM0VqMD1xjAWzgopW1cHHkmY7JE9aXugxhW4GvJg5pj6KGuZ ytLEkGiTgl0bQkG+ZYNtjN6BhAyILc3d1iVKqWXsZv2MJyvnDcntZdeCbPg1oyl0AQ/SQF oJmejRcl6UBNyLF/odR7RbSI5wgsYqchuq9tERcLzG1Trsc3ekxxIOsLtcBuAsOtVemdCh 9itBaEOp5PA7nl8IqanI+8IVF27wM002Nn45iJTY5vYdDulTwZOnFOiMult2aA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fxQRm6h2Nz2xJ for ; Thu, 16 Apr 2026 17:46:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35df5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 16 Apr 2026 17:46:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: fa77fecb0e06 - main - pkru.3: Note that the kernel may not respect PKRU protections 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa77fecb0e06ec697e3d7a9ed899e568f1d2090c Auto-Submitted: auto-generated Date: Thu, 16 Apr 2026 17:46:28 +0000 Message-Id: <69e12074.35df5.2ea31c3d@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fa77fecb0e06ec697e3d7a9ed899e568f1d2090c commit fa77fecb0e06ec697e3d7a9ed899e568f1d2090c Author: Mark Johnston AuthorDate: 2026-04-16 17:46:11 +0000 Commit: Mark Johnston CommitDate: 2026-04-16 17:46:11 +0000 pkru.3: Note that the kernel may not respect PKRU protections There are cases where the kernel will be able to access memory covered by a PKRU key which nomially prohibits accesses. I believe regular copyin()/copyout() are subject to the contents of PKRU, but memory accesses via uiomove_fromphys() will not be. This can arise when performing fault I/O, for instance. I didn't test, but I suspect AIO is another case. Update the man page to acknowledge this. Reviewed by: alc, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D56416 --- lib/libsys/x86/pkru.3 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/libsys/x86/pkru.3 b/lib/libsys/x86/pkru.3 index 06837a39858d..75580953e6ed 100644 --- a/lib/libsys/x86/pkru.3 +++ b/lib/libsys/x86/pkru.3 @@ -71,13 +71,16 @@ Only one key may apply to a given range at a time. The default protection key index is zero, it is used even if no key was explicitly assigned to the address, or if the key was removed. .Pp -The protection prevents the system from accessing user addresses as well -as the user applications. -When a system call was unable to read or write user memory due to key -protection, it returns the -.Er EFAULT -error code. -Note that some side effects may have occurred if this error is reported. +If the user application attempts a memory access which is prohibited by the +PKRU register, the offending thread receives a synchronous +.Dv SIGSEGV +signal with +.Va si_code +set to +.Dv SEGV_PKUERR . +PKRU protections might prevent the kernel from accessing protected +user addresses when handling system calls, but this is not guaranteed and +must not be relied upon. .Pp Both 64-bit and 32-bit applications can use protection keys. More information about the hardware feature is provided in the IA32 Software