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] [day] [month] [year] [list]
Message-ID: <20171115151052.27y2uzwwxlu4vtr2@gmail.com>
Date:   Wed, 15 Nov 2017 16:10:52 +0100
From:   Ingo Molnar <mingo@...nel.org>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     luca abeni <luca.abeni@...tannapisa.it>,
        Peter Zijlstra <peterz@...radead.org>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        linux-kernel@...r.kernel.org
Subject: Re: New sparse warnings from sched.h


* Matthew Wilcox <willy@...radead.org> wrote:

> On Wed, Nov 15, 2017 at 09:27:43AM +0100, Ingo Molnar wrote:
> > * Matthew Wilcox <willy@...radead.org> wrote:
> > > commit 799ba82de01e7543f6b2042e1a739f3a20255f23
> > > Author: luca abeni <luca.abeni@...tannapisa.it>
> > > Date:   Thu Sep 7 12:09:31 2017 +0200
> > > 
> > >     sched/deadline: Use C bitfields for the state flags
> > >     
> > >     Ask the compiler to use a single bit for storing true / false values,
> > >     instead of wasting the size of a whole int value.
> > >     Tested with gcc 5.4.0 on x86_64, and the compiler produces the expected
> > >     Assembly (similar to the Assembly code generated when explicitly accessing
> > >     the bits with bitmasks, "&" and "|").
> > > 
> > > produces four warnings from sparse for every file which includes sched.h:
> > > 
> > > ./include/linux/sched.h:476:62: error: dubious one-bit signed bitfield
> > > ./include/linux/sched.h:477:62: error: dubious one-bit signed bitfield
> > > ./include/linux/sched.h:478:62: error: dubious one-bit signed bitfield
> > > ./include/linux/sched.h:479:62: error: dubious one-bit signed bitfield
> > > 
> > > This seems like the trivial fix (untested):
> > > 
> > > 
> > > diff --git a/include/linux/sched.h b/include/linux/sched.h
> > > index a5dc7c98b0a2..21991d668d35 100644
> > > --- a/include/linux/sched.h
> > > +++ b/include/linux/sched.h
> > > @@ -473,10 +473,10 @@ struct sched_dl_entity {
> > >  	 * conditions between the inactive timer handler and the wakeup
> > >  	 * code.
> > >  	 */
> > > -	int				dl_throttled      : 1;
> > > -	int				dl_boosted        : 1;
> > > -	int				dl_yielded        : 1;
> > > -	int				dl_non_contending : 1;
> > > +	unsigned int			dl_throttled      : 1;
> > > +	unsigned int			dl_boosted        : 1;
> > > +	unsigned int			dl_yielded        : 1;
> > > +	unsigned int			dl_non_contending : 1;
> > >  
> > >  	/*
> > >  	 * Bandwidth enforcement timer. Each -deadline task has its
> > 
> > Mind sending a proper patch with a SOB once it's tested?
> 
> I'd be more than happy to do that.  I have no idea what this code is,
> what it's used for, or how to test it, so I'll have to rely on somebody
> else to test it.

Oh, I thought you wanted to test whether it fixes the Sparse bug.

Converting these bitfields from signed to unsigned should have no effect on the 
deadline scheduler.

I.e. I basically only need your Signed-off-by.

Thnaks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ