svn commit: r358241 - stable/12/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Sat Feb 22 10:54:12 UTC 2020
Author: kib
Date: Sat Feb 22 10:54:11 2020
New Revision: 358241
URL: https://svnweb.freebsd.org/changeset/base/358241
Log:
MFC r357983:
sem_remove(): add some asserts.
Modified:
stable/12/sys/kern/sysv_sem.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/kern/sysv_sem.c
==============================================================================
--- stable/12/sys/kern/sysv_sem.c Sat Feb 22 10:48:42 2020 (r358240)
+++ stable/12/sys/kern/sysv_sem.c Sat Feb 22 10:54:11 2020 (r358241)
@@ -558,8 +558,14 @@ sem_remove(int semidx, struct ucred *cred)
int i;
KASSERT(semidx >= 0 && semidx < seminfo.semmni,
- ("semidx out of bounds"));
+ ("semidx out of bounds"));
+ mtx_assert(&sem_mtx, MA_OWNED);
semakptr = &sema[semidx];
+ KASSERT(semakptr->u.__sem_base - sem + semakptr->u.sem_nsems <= semtot,
+ ("sem_remove: sema %d corrupted sem pointer %p %p %d %d",
+ semidx, semakptr->u.__sem_base, sem, semakptr->u.sem_nsems,
+ semtot));
+
semakptr->u.sem_perm.cuid = cred ? cred->cr_uid : 0;
semakptr->u.sem_perm.uid = cred ? cred->cr_uid : 0;
semakptr->u.sem_perm.mode = 0;
More information about the svn-src-stable-12
mailing list