git: c25ddffc51a1 - main - thr_new(2): check param.flags for reserved bits

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 31 May 2025 14:56:04 UTC
The branch main has been updated by kib:

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

commit c25ddffc51a1e2c0e03fa6f168abc022955d598f
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-05-30 22:40:47 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-05-31 14:55:24 +0000

    thr_new(2): check param.flags for reserved bits
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 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 afd016ec9e75..6266dec27700 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -178,6 +178,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));