git: a24bbfb09f43 - stable/14 - thr_new(2): check param.flags for reserved bits

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 12 Jun 2025 18:03:12 UTC
The branch stable/14 has been updated by kib:

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

commit a24bbfb09f43303bfaa65c774bcbe7bdde07dddd
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-05-30 22:40:47 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-06-12 18:02:51 +0000

    thr_new(2): check param.flags for reserved bits
    
    (cherry picked from commit c25ddffc51a1e2c0e03fa6f168abc022955d598f)
---
 sys/kern/kern_thr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 1dd4d6915546..19ee082ad7f0 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -182,6 +182,9 @@ kern_thr_new(struct thread *td, struct thr_param *param)
 	struct rtprio rtp, *rtpp;
 	int error;
 
+	if ((param->flags & (THR_SUSPENDED | THR_SYSTEM_SCOPE |
+	    THR_C_RUNTIME)) != 0)
+		return (EINVAL);
 	rtpp = NULL;
 	if (param->rtp != 0) {
 		error = copyin(param->rtp, &rtp, sizeof(struct rtprio));