From nobody Mon Jun 29 13:01:41 2026 X-Original-To: dev-commits-src-main@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 4gpmd15JwTz6hchd for ; Mon, 29 Jun 2026 13:01:41 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gpmd11vyZz40my for ; Mon, 29 Jun 2026 13:01:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782738101; 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=KwW4GQi5MKDMd0Q6tmy46bgfcOksccTxs+47p9xBrZs=; b=iyIYE+qeIRx/897v4DEe/Z0Ujr7xTPBGL5+1/A+Sd/jxRh6fz+LhNRe07qRStuuZR5GX8S 6Cc2cVUnDG2m3QmSZ1kpHmEKIBKTm8m8BjHJjXUAQ/cyg5LcuBsUcAeV6IfjN/uFNAIQO5 igkmfumV+zkU8tSCD53TwylG9HPfo6OfAbnMbbjZM5BYI0VhGTmBKDtvQJ3/iVV7MvphzR qXGgRcShlZHY9ODZegr8hteJCdZsY3fx8lhPXmJYJs7yc5CPdYsYf5q3+XiQ5/BWxy3X3L 2/RMy8WJGpgTXQuZRoo3wr5Tdn6kedhIti+9gwmi6JL2lGVc/pROucEGQnqlfg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782738101; a=rsa-sha256; cv=none; b=Kq35MDhRBI+BDqS2nnkRbgtDWXHnbj/U6UUhNuIYgA4d8qofMfdhloV8qKePsRHzJ4wYSR f3Rn2DRP6OKrWn4b+VUzyMi6cwPhK82PXvJntmGDIcXxDwNzBjC3/kG8qdjJd1iwl2dngV 4YonsUTAA/l8fGVEj0vRN6DRWftq0+LIZv5QY27bovh496CgLVvMMMycrrF2AtP5lneRxJ OtV+mGay2Of0HJhhPvRKw6mc0HLnBq/NXAIfSBrk0fZoRzsTAjTVyFairkAsogJ6aA5/ZB GXExAaKEluxY27Bkzz1Ugf65G8n2Ukosno3W+2YRYIBn+thpUOECB7soXkZNAg== 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=1782738101; 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=KwW4GQi5MKDMd0Q6tmy46bgfcOksccTxs+47p9xBrZs=; b=D9FJ9ik3r8s+fZ+IxNtYx7U4DDo+UyeSSWih0k1jzx0mZh8pNxJo6vUinWmmyhRxktRQBg C6XMZFCx2r6BFJ7C2Ok/LbBdWKAzmQXZe+ADDglas67QnKJfUSy5XLUd1sgkFkTJQvxOd4 f9dKz02g/wxpP+XzFdel7F1NSDpz2f/bs3vkoLHxXIDAUOF20S/AXhDBN0JT3GMriLcvw9 wIVbhCr5LGPLnpQPlmYZKI7/E3DSd7VKjbR6QS6uT2HEg5TLuEM7V0qWtgwnxc/uFvq+5g 4XFCT2C+XL5e53uQB5GbZRSad92PvcskVPMDMJwKxt/7gtVp7wOuXfiRAUmUcg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gpmd108nZzy2M for ; Mon, 29 Jun 2026 13:01:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1fc5f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 29 Jun 2026 13:01:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: a1c52e05f571 - main - CHERI: declare fueptr and suptr List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1c52e05f571607db361f49993b36b0288f1d8f3 Auto-Submitted: auto-generated Date: Mon, 29 Jun 2026 13:01:41 +0000 Message-Id: <6a426cb5.1fc5f.20f8acae@gitrepo.freebsd.org> The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=a1c52e05f571607db361f49993b36b0288f1d8f3 commit a1c52e05f571607db361f49993b36b0288f1d8f3 Author: Brooks Davis AuthorDate: 2026-06-29 12:59:44 +0000 Commit: Brooks Davis CommitDate: 2026-06-29 12:59:44 +0000 CHERI: declare fueptr and suptr These should replace fueword and suword when manipulating pointers in memory. On CHERI targets they will be implemented using capability aware instructions and otherwise they are defined to fueword and suword. Reviewed by: kib, markj Effort: CHERI upstreaming Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D57664 --- share/man/man9/Makefile | 2 ++ share/man/man9/fetch.9 | 14 +++++++++++++- share/man/man9/store.9 | 10 +++++++++- sys/sys/systm.h | 10 ++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index fb9f5bca72c5..f465c7f49696 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1160,6 +1160,7 @@ MLINKS+=fetch.9 fubyte.9 \ fetch.9 fuword16.9 \ fetch.9 fuword32.9 \ fetch.9 fuword64.9 \ + fetch.9 fueptr.9 \ fetch.9 fueword.9 \ fetch.9 fueword32.9 \ fetch.9 fueword64.9 @@ -2190,6 +2191,7 @@ MLINKS+=stack.9 stack_copy.9 \ stack.9 stack_sbuf_print_ddb.9 \ stack.9 stack_zero.9 MLINKS+=store.9 subyte.9 \ + store.9 suptr.9 \ store.9 suword.9 \ store.9 suword16.9 \ store.9 suword32.9 \ diff --git a/share/man/man9/fetch.9 b/share/man/man9/fetch.9 index c544ec802d68..a9dd90d81bfb 100644 --- a/share/man/man9/fetch.9 +++ b/share/man/man9/fetch.9 @@ -32,7 +32,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 22, 2021 +.Dd June 29, 2026 .Dt FETCH 9 .Os .Sh NAME @@ -42,6 +42,7 @@ .Nm fuword16 , .Nm fuword32 , .Nm fuword64 , +.Nm fueptr , .Nm fueword , .Nm fueword32 , .Nm fueword64 @@ -60,6 +61,8 @@ .Ft int64_t .Fn fuword64 "volatile const void *base" .Ft int +.Fn fueptr "volatile const void *base" "intptr_t *val" +.Ft int .Fn fueword "volatile const void *base" "long *val" .Ft int .Fn fueword32 "volatile const void *base" "int32_t *val" @@ -96,6 +99,14 @@ Fetches 32 bits of data from the user-space address .It Fn fuword64 Fetches 64 bits of data from the user-space address .Pa base . +.It Fn fueptr +Fetches a pointer from the user-space address +.Pa base +and stores the result in the variable pointed by +.Pa val . +.Fn fueptr +preserves the provenance of pointers fetched from users-space +.Pq see Xr memory_model 7 for further information . .It Fn fueword Fetches a word of data (long) from the user-space address .Pa base @@ -130,6 +141,7 @@ and .Fn fuword64 functions return the data fetched or -1 on failure. The +.Fn fueptr , .Fn fueword , .Fn fueword32 and diff --git a/share/man/man9/store.9 b/share/man/man9/store.9 index 18fd646d609d..85128f17c005 100644 --- a/share/man/man9/store.9 +++ b/share/man/man9/store.9 @@ -32,12 +32,13 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 22, 2021 +.Dd June 29, 2026 .Dt STORE 9 .Os .Sh NAME .Nm store , .Nm subyte , +.Nm suptr , .Nm suword .Nd store data to user-space .Sh SYNOPSIS @@ -47,6 +48,8 @@ .Ft int .Fn subyte "volatile void *base" "int byte" .Ft int +.Fn suptr "volatile void *base" "intptr_t ptr" +.Ft int .Fn suword "volatile void *base" "long word" .Ft int .Fn suword16 "volatile void *base" "int word" @@ -70,6 +73,11 @@ routines provide the following functionality: .It Fn subyte Stores a byte of data to the user-space address .Pa base . +.It Fn suptr +Stores a pointer to the user-space address +.Pa base +preserving the provenance of that pointer +.Pq see Xr memory_model 7 for further information . .It Fn suword Stores a word of data to the user-space address .Pa base . diff --git a/sys/sys/systm.h b/sys/sys/systm.h index f2c5051ac03d..83023d24fe7d 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -350,11 +350,21 @@ int64_t fuword64(volatile const void *base); __nodiscard int fueword(volatile const void *base, long *val); __nodiscard int fueword32(volatile const void *base, int32_t *val); __nodiscard int fueword64(volatile const void *base, int64_t *val); +#ifdef __CHERI__ +__nodiscard int fueptr(volatile const void *base, intptr_t *val); +#else +#define fueptr(base, val) fueword((base), (long *)(val)) +#endif __nodiscard int subyte(volatile void *base, int byte); __nodiscard int suword(volatile void *base, long word); __nodiscard int suword16(volatile void *base, int word); __nodiscard int suword32(volatile void *base, int32_t word); __nodiscard int suword64(volatile void *base, int64_t word); +#ifdef __CHERI__ +__nodiscard int suptr(volatile void *base, intptr_t ptr); +#else +#define suptr(base, val) suword((base), (val)) +#endif uint32_t casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t newval); u_long casuword(volatile u_long *p, u_long oldval, u_long newval); int casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp,