From nobody Sun May 3 15:45:41 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 4g7pyZ0Rgsz6W2yZ for ; Sun, 03 May 2026 15:45:42 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g7pyY4KMyz3JTj for ; Sun, 03 May 2026 15:45:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777823141; 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=z1Mj8hCCvAtxUnDX+evjhZffKdZ4efudyrPeqGlecw0=; b=UCuIIvPxp+EDfMGktdkGGqM5t8fhzmpClAk5bwSwMfjyPHlNIwBQ6N2nHtnOOtEgT8zr71 L2fYwWcckpBSimBQxSaVsfchG4uiUfum6kGMokEY2WRjrByk9R+HAaNeko/eaJu/dW/nAT CdF7VRb9ooe+oUdZSkrR3MUIViJusXUFN2NjWBr8rHjRpfOXOdCaes2g13nRgXB//ZNpzz JcwGcyJ8xyKMn/VL7FU0E7zjOpmA+L79HzKTV5eisvaJLsaJk68+lCAZuBoBpC8ijYZvWk Ygsp+cXEwQ2dUVAMuSPWl/FFVC3xSH8K2W67w7f6hJSZQw8yjoJmpjEDrJO1xg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777823141; a=rsa-sha256; cv=none; b=qA3oGaN5lTnjR7Io7GfuBNeJE5LbgVjdyqFjOmwB/tuos4KdEunOeWEjtDwg6f8hzdIUeh cAaP2/LvO+4RlXGkQB/Wx9AoeDIRTTutyHmeWUKpqncYxni+LmIzmYHxznKLNMDocDr4+a lyCBn4iIUEDlC5xz9vPXYuKWSoGqUvYuOlsgYMLkp71ZdDJyErAcM+SpQKiThpXbZxo/sO kfNWRTuqMg9QelFwpSYF0TgZjHXSA4asc6u8Xfay/RfHgpJpRIYDoew8me5Z37/zmrR1VB D8LauFhS2rMPKNghmBXYpu186hQj47h57kyEj3W3vFSVdHcs3qj+FfcF1u65Iw== 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=1777823141; 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=z1Mj8hCCvAtxUnDX+evjhZffKdZ4efudyrPeqGlecw0=; b=HkcR1dk0MVJIxyk9dYMKDMe6eZb2l5uHpteSrwUEV/d0sm46qGg2kNYK8tpTMDlKBlEVQR J7M7dZSOq/j505qz7Qd2k11LzrCTzW0w5VeTKOnJFvCHnNWWnbctZcwhPTBuLMr/vxXg1k Kw07KDbjHGdhedlDI9XuKYbPtFRq5YMwOSxi2JOCKP0nz8d95uoSSnrlvy+cVUO6UzQbOa +pgf8CaxlA6CfcuMKRdmqpl/AMMD0FEMs9h1mKDSZbieW2F8DHYlkqCGRcfGAKjc3LgBZQ 2piF9cXR3fKwa4k9FkIQKgRDEZoeQ6ODyIdFimRHV/yFIAEPFsN1YRalttMHIQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g7pyY3m1VzfMk for ; Sun, 03 May 2026 15:45:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1d95f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 03 May 2026 15:45:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 59aa556aa833 - stable/15 - 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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/stable/15 X-Git-Reftype: branch X-Git-Commit: 59aa556aa833c075d43b7095a28a6c856285794a Auto-Submitted: auto-generated Date: Sun, 03 May 2026 15:45:41 +0000 Message-Id: <69f76da5.1d95f.5b2fdef6@gitrepo.freebsd.org> The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=59aa556aa833c075d43b7095a28a6c856285794a commit 59aa556aa833c075d43b7095a28a6c856285794a Author: Mark Johnston AuthorDate: 2026-04-16 17:46:11 +0000 Commit: Mark Johnston CommitDate: 2026-05-03 14:40:10 +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 (cherry picked from commit fa77fecb0e06ec697e3d7a9ed899e568f1d2090c) --- 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 b977082c362f..45b7093bd094 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