lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <507F20AC.6000308@canonical.com>
Date:	Wed, 17 Oct 2012 23:18:36 +0200
From:	Maarten Lankhorst <maarten.lankhorst@...onical.com>
To:	Lennart Poettering <lennart@...ttering.net>
CC:	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] sched: allow unsetting SCHED_RESET_ON_FORK when new policy
 is not realtime

When implementing SIGXCPU handling for a thread boosted with rtkit to realtime
priority, I noticed that sched_setscheduler(somepid, SCHED_OTHER) would return
-EPERM because the thread was previously SCHED_RR | SCHED_RESET_ON_FORK,
and looking from the code that flag cannot be reset without sufficient rights.

sched_setscheduler(somepid, SCHED_OTHER | SCHED_RESET_ON_FORK) which worked,
and seems to be the only way to remove realtime priority set by rtkit on all
kernels since the patch was introduced.

This patch allows SCHED_RESET_ON_FORK to be removed when the user sets a new
policy on itself without realtime.

Cc: Stable <stable@...r.kernel.org> [v2.6.32+]
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@...onical.com>

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2d8927f..4c0712a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3757,6 +3757,12 @@ recheck:
 			if (param->sched_priority > p->rt_priority &&
 			    param->sched_priority > rlim_rtprio)
 				return -EPERM;
+
+			/* Normal users shall not reset the
+			 * sched_reset_on_fork flag
+			 */
+			if (p->sched_reset_on_fork && !reset_on_fork)
+				return -EPERM;
 		}
 
 		/*
@@ -3771,10 +3777,6 @@ recheck:
 		/* can't change other user's priorities */
 		if (!check_same_owner(p))
 			return -EPERM;
-
-		/* Normal users shall not reset the sched_reset_on_fork flag */
-		if (p->sched_reset_on_fork && !reset_on_fork)
-			return -EPERM;
 	}
 
 	if (user) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ