Page MenuHomeFreeBSD

D57664.diff
No OneTemporary

D57664.diff

diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1160,6 +1160,7 @@
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
@@ -2192,6 +2193,7 @@
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
--- 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 24, 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,13 @@
.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 pointer provenance
+.Pq see Xr arch 7 for further information .
.It Fn fueword
Fetches a word of data (long) from the user-space address
.Pa base
@@ -130,6 +140,7 @@
.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
--- 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 24, 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 @@
.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 pointer provenance
+.Pq see Xr arch 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
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -357,11 +357,21 @@
int __result_use_check fueword(volatile const void *base, long *val);
int __result_use_check fueword32(volatile const void *base, int32_t *val);
int __result_use_check fueword64(volatile const void *base, int64_t *val);
+#ifdef __CHERI__
+int __result_use_check 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,

File Metadata

Mime Type
text/plain
Expires
Thu, Jun 25, 10:19 AM (2 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34319997
Default Alt Text
D57664.diff (3 KB)

Event Timeline