[PATCH] Cygwin: sched_setscheduler: Fix crash if pid of other process is used
Christian Franke
Christian.Franke@t-online.de
Fri Feb 21 16:32:55 GMT 2025
Obviously my testcases for the SCHED_* enhancement were incomplete, sorry.
--
Regards,
Christian
-------------- next part --------------
From a9e48b5d738c2a683826ab220155778f0f57f003 Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.franke@t-online.de>
Date: Fri, 21 Feb 2025 17:25:51 +0100
Subject: [PATCH] Cygwin: sched_setscheduler: Fix crash if pid of other process
is used
Add missing PID_MAP_RW to allow changes of _pinfo::sched_policy.
Fixes: 48b189245a13 ("Cygwin: sched_setscheduler: accept SCHED_OTHER, SCHED_FIFO and SCHED_RR")
Signed-off-by: Christian Franke <christian.franke@t-online.de>
---
winsup/cygwin/sched.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/sched.cc b/winsup/cygwin/sched.cc
index 43b17357b..86941b2ac 100644
--- a/winsup/cygwin/sched.cc
+++ b/winsup/cygwin/sched.cc
@@ -406,7 +406,7 @@ sched_setscheduler (pid_t pid, int policy,
return -1;
}
- pinfo p (pid ? pid : getpid ());
+ pinfo p ((pid ? pid : getpid ()), PID_MAP_RW);
if (!p)
{
set_errno (ESRCH);
--
2.45.1
More information about the Cygwin-patches
mailing list