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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081120081732.GE21785@elte.hu>
Date:	Thu, 20 Nov 2008 09:17:32 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Dhaval Giani <dhaval@...ux.vnet.ibm.com>
Cc:	Bharata B Rao <bharata@...ux.vnet.ibm.com>,
	linux-kernel@...r.kernel.org,
	Srivatsa Vaddagiri <vatsa@...ux.vnet.ibm.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH] sched: Don't allow priority switch to realtime when
	the task doesn't belong to init_task_group and when
	CONFIG_RT_GROUP_SCHED isn't set


* Dhaval Giani <dhaval@...ux.vnet.ibm.com> wrote:

> On Thu, Nov 20, 2008 at 08:58:29AM +0100, Ingo Molnar wrote:
> > 
> > * Bharata B Rao <bharata@...ux.vnet.ibm.com> wrote:
> > 
> > > Applies on 2.6.28-rc5.
> > > 
> > > With CONFIG_RT_GROUP_SCHED not set, don't allow a task's priority 
> > > switch to realtime if the task isn't part of init_task_group.
> > > 
> > > A task belonging to a fair group could use 
> > > sched_setscheduler/sched_setparam to become a realtime task. If such 
> > > a task belongs to one of the child groups of init_task_group and if 
> > > CONFIG_RT_GROUP_SCHED is not set, then it ends up getting queued in 
> > > init_task_group's runqueue. So we have a situation where, a task 
> > > belongs to one group (child) but ends in the runqueue of another 
> > > group (init_task_group). This does not look correct.
> > > 
> > > Fix this by failing such priority change requests in 
> > > sched_setscheduler() and sched_setparam().
> > > 
> > > Signed-off-by: Bharata B Rao <bharata@...ux.vnet.ibm.com>
> > > ---
> > >  kernel/sched.c |    7 +++++++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > --- a/kernel/sched.c
> > > +++ b/kernel/sched.c
> > > @@ -5206,6 +5206,13 @@ recheck:
> > >  		if (rt_bandwidth_enabled() && rt_policy(policy) &&
> > >  				task_group(p)->rt_bandwidth.rt_runtime == 0)
> > >  			return -EPERM;
> > > +#elif defined(CONFIG_FAIR_GROUP_SCHED)
> > > +		/*
> > > +		 * If the task doesn't belong to init_task_group, don't
> > > +		 * allow priority switch to realtime. (!CONFIG_RT_GROUP_SCHED)
> > > +		 */
> > > +		if (rt_policy(policy) && (task_group(p) != &init_task_group))
> > > +			return -EPERM;
> > >  #endif
> > >  
> > >  		retval = security_task_setscheduler(p, policy, param);
> > 
> > hm, another option would be, instead of denying something (which 
> > denial might not even be noticed by the app) that the app clearly has 
> > enough privilege to request - to just act upon it and move the task to 
> > the init_task_group?
> > 
> > the app cannot expect fair scheduling for this task anyway. And if we 
> > want to forbid tasks from doing so - do not give them privilege to go 
> > to RT priorities.
> > 
> 
> I am wondering what would the right action then be if the task drops 
> back to CFS.

yeah. If the integration artifacts around the edges get too awkward, 
then the best would be to consolidate fair-group and rt-group into the 
same group-sched config option and _eliminate_ such artifacts at their 
root. rt-group was started as a separate option mostly because it was 
new and experimental code - that splitup is not cast into stone.

	Ingo
--
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