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: <20110331141424.GD19540@flint.arm.linux.org.uk>
Date:	Thu, 31 Mar 2011 15:14:24 +0100
From:	Russell King <rmk@....linux.org.uk>
To:	Jiri Slaby <jslaby@...e.cz>
Cc:	Arnd Bergmann <arnd@...db.de>,
	Arend van Spriel <arend@...adcom.com>,
	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	devel@...uxdriverproject.org, gregkh@...e.de,
	linux-wireless@...r.kernel.org, Jiri Slaby <jirislaby@...il.com>
Subject: Re: [PATCH 1/1] drivers: brcmaxi: provide amba axi functionality
	in separate module

On Thu, Mar 31, 2011 at 04:09:32PM +0200, Jiri Slaby wrote:
> On 03/31/2011 03:51 PM, Russell King wrote:
> > On Thu, Mar 31, 2011 at 03:48:20PM +0200, Jiri Slaby wrote:
> >> How it can? Packed only tells the compiler to have one byte alignment
> >> steps. And it should not matter here as all the members are 32-bit long.
> > 
> > It also tells the compiler that it may be misaligned, so to avoid
> > alignment faults it will use byte loads/stores.
> 
> No, it should not (if offsetof % sizeof == 0). Otherwise it's a bug in
> the compiler.
> 
> Am I missing something?

$ cat t1.c
struct foo {
        unsigned long bar;
} __attribute__((packed));

unsigned long baz(struct foo *f)
{
        return f->bar;
}
$ arm-linux-gcc -O2 -S -o - t1.c
...
        .global baz
        .type   baz, %function
baz:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        ldrb    r3, [r0, #0]    @ zero_extendqisi2
        ldrb    r2, [r0, #1]    @ zero_extendqisi2
        ldrb    r1, [r0, #2]    @ zero_extendqisi2
        orr     r3, r3, r2, asl #8
        ldrb    r0, [r0, #3]    @ zero_extendqisi2
        orr     r3, r3, r1, asl #16
        orr     r0, r3, r0, asl #24
        mov     pc, lr
        .size   baz, .-baz
        .ident  "GCC: (GNU) 4.3.5"
        .section        .note.GNU-stack,"",%progbits

It does this because with the packed attribute, it can't make assumptions
about the alignment of 'f'.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
--
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