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: <1331256050.31442.9.camel@debian>
Date:	Fri, 09 Mar 2012 09:20:50 +0800
From:	Alex Shi <alex.shi@...el.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	Arnd Bergmann <arnd@...db.de>, gcc@....gnu.org, tglx@...utronix.de,
	"mingo@...hat.com" <mingo@...hat.com>, hpa@...or.com,
	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	x86@...nel.org, andi.kleen@...el.com, gcc-help@....gnu.org
Subject: Re: [RFC patch] spindep: add cross cache lines checking

On Thu, 2012-03-08 at 08:13 +0100, Ingo Molnar wrote:
> * Alex Shi <alex.shi@...el.com> wrote:
> 
> > On Wed, 2012-03-07 at 14:39 +0100, Ingo Molnar wrote:
> > > * Alex Shi <alex.shi@...el.com> wrote:
> > > 
> > > > > I think the check should be (__alignof__(lock) < 
> > > > > __alignof__(rwlock_t)), otherwise it will still pass when 
> > > > > you have structure with attribute((packed,aligned(2)))
> > > > 
> > > > reasonable!
> > > > 
> > > > >> 1, it is alignof bug for default gcc on my fc15 and Ubuntu 11.10 etc?
> > > > >>
> > > > >> struct sub {
> > > > >>         int  raw_lock;
> > > > >>         char a;
> > > > >> };
> > > > >> struct foo {
> > > > >>         struct sub z;
> > > > >>         int slk;
> > > > >>         char y;
> > > > >> }__attribute__((packed));
> > > > >>
> > > > >> struct foo f1;
> > > > >>
> > > > >> __alignof__(f1.z.raw_lock) is 4, but its address actually can align on
> > > > >> one byte. 
> > > > > 
> > > > > That looks like correct behavior, because the alignment of 
> > > > > raw_lock inside of struct sub is still 4. But it does mean 
> > > > > that there can be cases where the compile-time check is not 
> > > > > sufficient, so we might want the run-time check as well, at 
> > > > > least under some config option.
> > > > 
> > > > what's your opinion of this, Ingo?
> > > 
> > > Dunno. How many real bugs have you found via this patch?
> > 
> > None. Guess stupid code was shot in lkml reviewing. But if the 
> > patch in, it is helpful to block stupid code in developing.
> 
> The question is, if in the last 10 years not a single such case 
> made it through to today's 15 million lines of kernel code, why 
> should we add the check now?
> 
> If it was a simple build time check then maybe, but judging by 
> the discussion it does not seem so simple, does it?

Oh, It is may better to have, but I don't mind it was slided. Since even
alignof works as our expectation, it also can't cover all problems.
Currently, we heavily depend gcc's behavior.

Anyway, thanks for review! 


> 
> Thanks,
> 
> 	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