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]
Date:	Tue, 3 Jun 2014 10:08:26 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Dave Jones <davej@...hat.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	mtk.manpages@...il.com, torvalds@...ux-foundation.org,
	mingo@...nel.org
Subject: Re: sched: Disallow sched_attr::sched_policy < 0

On Mon, Jun 02, 2014 at 04:22:04PM -0400, Dave Jones wrote:
> On Mon, Jun 02, 2014 at 02:13:19AM +0000, Linux Kernel wrote:
>  
>  >     sched: Disallow sched_attr::sched_policy < 0
>  >     
>  >     The scheduler uses policy=-1 to preserve the current policy state to
>  >     implement sys_sched_setparam(), this got exposed to userspace by
>  >     accident through sys_sched_setattr(), cure this.
>  >     
>  > ---
>  >  kernel/sched/core.c |    3 +++
>  >  1 files changed, 3 insertions(+), 0 deletions(-)
>  > 
>  > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>  > index f2205f0..cdefcf7 100644
>  > --- a/kernel/sched/core.c
>  > +++ b/kernel/sched/core.c
>  > @@ -3662,6 +3662,9 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
>  >  	if (retval)
>  >  		return retval;
>  >  
>  > +	if (attr.sched_policy < 0)
>  > +		return -EINVAL;
>  > +
>  >  	rcu_read_lock();
>  >  	retval = -ESRCH;
>  >  	p = find_process_by_pid(pid);
>  
> Todays coverity run picked up..
> 
> 3687
> >>>     CID 1219934:  Unsigned compared against 0  (NO_EFFECT)
> >>>     This less-than-zero comparison of an unsigned value is never true. "attr.sched_policy < 0U".
> 3688            if (attr.sched_policy < 0)
> 3689                    return -EINVAL;
> 

Once upon a time GCC also did warns like that, but my compiler is silent
:-(

Yes, that needs fixing..

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ