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: <201203060932.45223.arnd@arndb.de>
Date:	Tue, 6 Mar 2012 09:32:45 +0000
From:	Arnd Bergmann <arnd@...db.de>
To:	Alex Shi <alex.shi@...el.com>
Cc:	Ingo Molnar <mingo@...e.hu>, 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 Tuesday 06 March 2012, Alex Shi wrote:
> I have one concern and one questions here:
> concern: maybe the lock is in a well designed 'packed' struct, and it is
> safe for cross lines issue. but __alignof__ will return 1;
> 
> struct abc{
>         raw_spinlock_t lock1;
>         char            a;
>         char            b;
> }__attribute__((packed));
> 
> Since the lock is the first object of struct, usually it is well placed.

No, it's actually not. The structure has an external alignment of 1, so
if you have an array of these or put it into another struct like

struct xyz {
	char x;
	struct abc a;
};

then it will be misaligned. Thre is no such thing as a well designed 'packed'
struct. The only reason to use packing is to describe structures we have no
control over such as hardware layouts and on-wire formats that have unusal
alignments, and those will never have a spinlock on them.

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