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: <AANLkTimZOCWY4bAxo6WVn4R075zHZGr9NE3S9nRd407F@mail.gmail.com>
Date:	Wed, 22 Dec 2010 10:34:49 +0000
From:	Will Newton <will.newton@...il.com>
To:	Harvey Harrison <harvey.harrison@...il.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Linux Kernel list <linux-kernel@...r.kernel.org>,
	stable@...nel.org
Subject: Re: [PATCH] include/linux/unaligned: Pack the whole struct rather
 than just the field.

On Tue, Dec 21, 2010 at 11:36 PM, Harvey Harrison
<harvey.harrison@...il.com> wrote:
> On Tue, Dec 21, 2010 at 2:43 AM, Will Newton <will.newton@...il.com> wrote:
>> On Tue, Dec 21, 2010 at 5:44 AM, Andrew Morton
>>>>  #include <linux/kernel.h>
>
>>>>
>>>> -struct __una_u16 { u16 x __attribute__((packed)); };
>>>> -struct __una_u32 { u32 x __attribute__((packed)); };
>>>> -struct __una_u64 { u64 x __attribute__((packed)); };
>>>> +struct __una_u16 { u16 x; } __attribute__((packed));
>>>> +struct __una_u32 { u32 x; } __attribute__((packed));
>>>> +struct __una_u64 { u64 x; } __attribute__((packed));
>>>>
>>>
>>> Yes, that was wrong.
>>>
>>> Do you think this bug affects 2.6.36 or earlier?
>
> Interesting, I thought about this when modifying this awhile ago, and
> was relying on this from the gcc manual:
>
> packed
> <snip>
>
>    Specifying this attribute for struct and union types is equivalent
> to specifying the packed attribute on each of the
>
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> structure or union members. Specifying the -fshort-enums flag on the
> line is equivalent to specifying the packed
> attribute on all enum definitions.

I think that's possibly a gcc documentation deficiency, it is
equivalent to adding the packed attribute to all the struct members
but *also* affects the assumed alignment of the struct.

Looking at the gcc svn it seems the documentation has been improved a
bit in this area.

> What version of gcc was this?

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