git: dd6d349ab7fc - stable/15 - pthread_cond_clockwait(3): explicitly reject unacceptable clockids

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 17 Nov 2026 01:09:44 UTC
The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=dd6d349ab7fc7285d8879c88e94f0e3607d1b006

commit dd6d349ab7fc7285d8879c88e94f0e3607d1b006
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-11-05 21:38:37 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-17 00:25:00 +0000

    pthread_cond_clockwait(3): explicitly reject unacceptable clockids
    
    (cherry picked from commit 8331d5a2fe967016343fb4322f1ed73e55ff9655)
---
 lib/libthr/thread/thr_cond.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libthr/thread/thr_cond.c b/lib/libthr/thread/thr_cond.c
index cce2ba7b6c3c..c2ce9565e208 100644
--- a/lib/libthr/thread/thr_cond.c
+++ b/lib/libthr/thread/thr_cond.c
@@ -442,6 +442,8 @@ __pthread_cond_clockwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
 	if (abstime == NULL || abstime->tv_sec < 0 || abstime->tv_nsec < 0 ||
 	    abstime->tv_nsec >= 1000000000)
 		return (EINVAL);
+	if (_thr_check_clockid(clockid) != 0)
+		return (EINVAL);
 
 	return (cond_wait_common(cond, mutex, clockid, abstime, true, true));
 }