git: fa1d803c0f65 - main - epoch: replace hand coded assertion
Date: Fri, 20 Jan 2023 18:05:17 UTC
The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=fa1d803c0f652d72840a3c59139baf9d30792860 commit fa1d803c0f652d72840a3c59139baf9d30792860 Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2023-01-20 18:03:39 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2023-01-20 18:04:40 +0000 epoch: replace hand coded assertion The assertion is equivalent to kstack_contains() so use that rather than spelling it out. Suggested by: jhb Reviewed by: jhb MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D38107 --- sys/kern/subr_epoch.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c index 100221cd62f9..98a560e44c9d 100644 --- a/sys/kern/subr_epoch.c +++ b/sys/kern/subr_epoch.c @@ -468,9 +468,7 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE) MPASS(cold || epoch != NULL); td = curthread; - MPASS((vm_offset_t)et >= td->td_kstack && - (vm_offset_t)et + sizeof(struct epoch_tracker) <= - td->td_kstack + td->td_kstack_pages * PAGE_SIZE); + MPASS(kstack_contains(td, (vm_offset_t)et, sizeof(*et))); INIT_CHECK(epoch); MPASS(epoch->e_flags & EPOCH_PREEMPT);