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:	Mon, 25 Oct 2010 14:43:35 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	David Howells <dhowells@...hat.com>
Cc:	akpm@...ux-foundation.org, Tejun Heo <tj@...nel.org>,
	linux-am33-list@...hat.com, linux-kernel@...r.kernel.org,
	Akira Takeuchi <takeuchi.akr@...panasonic.com>,
	Mark Salter <msalter@...hat.com>
Subject: Re: [PATCH] workqueue: Fix alignment calculation in alloc_cwqs()

On Mon, Oct 25, 2010 at 2:27 PM, David Howells <dhowells@...hat.com> wrote:
> In the MN10300 arch, we occasionally see an assertion being tripped in
> alloc_cwqs() at the following line:
>
>        /* just in case, make sure it's actually aligned */
>  --->  BUG_ON(!IS_ALIGNED(wq->cpu_wq.v, align));
>        return wq->cpu_wq.v ? 0 : -ENOMEM;
>
> The values are:
>
>        wa->cpu_wq.v => 0x902776e0
>        align => 0x100
>
> and align is calculated by the following:
>
>        const size_t align = max_t(size_t, 1 << WORK_STRUCT_FLAG_BITS,
>                                   __alignof__(unsigned long long));
>
> which is wrong.  __alignof__() returns its value in bytes, but:
>
>        1 << WORK_STRUCT_FLAG_BITS
>
> returns the value in bits.  It needs dividing by the number of bits in a byte.

No it doesn't. Those bits really require that many bytes of alignment.

Think about it: if the low 8 bits of the pointer are used for flags,
then the actual pointer itself needs to be aligned to a 256-byte
boundary.

So the code is right. If needs to ask for "1 << WORK_STRUCT_FLAG_BITS"
alignment, and if it doesn't get it (because the allocator is somehow
broken - percpu allocator issues?), things will break.

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