svn commit: r363055 - in head: lib/libc/sys sys/kern
Mark Johnston
markj at FreeBSD.org
Thu Jul 9 18:34:55 UTC 2020
Author: markj
Date: Thu Jul 9 18:34:54 2020
New Revision: 363055
URL: https://svnweb.freebsd.org/changeset/base/363055
Log:
Apply the logic from r363051 to semctl(2) and __sem_base field.
Reported by: Jeffball <jeffball at grimm-co.com>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25600
Modified:
head/lib/libc/sys/semctl.2
head/sys/kern/sysv_sem.c
Modified: head/lib/libc/sys/semctl.2
==============================================================================
--- head/lib/libc/sys/semctl.2 Thu Jul 9 17:43:25 2020 (r363054)
+++ head/lib/libc/sys/semctl.2 Thu Jul 9 18:34:54 2020 (r363055)
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 23, 2018
+.Dd July 9, 2020
.Dt SEMCTL 2
.Os
.Sh NAME
@@ -148,7 +148,6 @@ is defined as follows:
.Bd -literal
struct semid_ds {
struct ipc_perm sem_perm; /* operation permission struct */
- struct sem *__sem_base; /* kernel data, don't use */
u_short sem_nsems; /* number of sems in set */
time_t sem_otime; /* last operation time */
time_t sem_ctime; /* last change time */
Modified: head/sys/kern/sysv_sem.c
==============================================================================
--- head/sys/kern/sysv_sem.c Thu Jul 9 17:43:25 2020 (r363054)
+++ head/sys/kern/sysv_sem.c Thu Jul 9 18:34:54 2020 (r363055)
@@ -798,6 +798,13 @@ kern_semctl(struct thread *td, int semid, int semnum,
bcopy(&semakptr->u, arg->buf, sizeof(struct semid_ds));
if (cred->cr_prison != semakptr->cred->cr_prison)
arg->buf->sem_perm.key = IPC_PRIVATE;
+
+ /*
+ * Try to hide the fact that the structure layout is shared by
+ * both the kernel and userland. This pointer is not useful to
+ * userspace.
+ */
+ arg->buf->__sem_base = NULL;
break;
case GETNCNT:
More information about the svn-src-all
mailing list