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: <464E0CDF.3030703@free.fr>
Date:	Fri, 18 May 2007 22:30:23 +0200
From:	matthieu castet <castet.matthieu@...e.fr>
To:	David Woodhouse <dwmw2@...radead.org>
CC:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ubi: kill homegrown endian macros

Hi,

David Woodhouse wrote:
> On Thu, 2007-05-17 at 20:30 +0000, Matthieu CASTET wrote:
>> On arch that don't support aligned access, packed struct access will be 
>> done byte per byte (but it could be the expected behavior if there 
>> unaligned access).
> 
> When I tested this on ARM, the output for je32_to_cpu et al was fine.
> For _other_ structures where I'd used __attribute__((packed)) to be
> safe, gcc would emit code to handle unaligned loads. But not in the
> simple case where the struct has only one member.
> 
> Are you suggesting that this has changed since I did my testing?
> 
here a small example I made and try with a sourcery 2006q3-27


/tmp/arm-2006q3/bin/arm-none-linux-gnueabi-gcc -S test.c -O3 -o 
test.s.packed
/tmp/arm-2006q3/bin/arm-none-linux-gnueabi-gcc -S test.c -DNOP -O3 -o test.s

$diff test.s test.s.packed                                     19,23c19,34
<       @ link register save eliminated.
<       ldrh    r2, [r1, #0]
<       ldrh    r1, [r0, #2]
<       ldr     r0, [r0, #4]
<       @ lr needed for prologue
---
 >       stmfd   sp!, {r4, r5, r6, lr}
 >       ldrb    r2, [r0, #5]    @ zero_extendqisi2
 >       ldrb    r3, [r0, #4]    @ zero_extendqisi2
 >       mov     lr, r1
 >       ldrb    r4, [r0, #6]    @ zero_extendqisi2
 >       ldrb    r5, [r0, #3]    @ zero_extendqisi2
 >       ldrb    r6, [r1, #1]    @ zero_extendqisi2
 >       orr     r3, r3, r2, asl #8
 >       ldrb    r1, [r0, #2]    @ zero_extendqisi2
 >       ldrb    ip, [r0, #7]    @ zero_extendqisi2
 >       ldrb    r2, [lr, #0]    @ zero_extendqisi2
 >       orr     r3, r3, r4, asl #16
 >       orr     r0, r3, ip, asl #24
 >       orr     r1, r1, r5, asl #8
 >       orr     r2, r2, r6, asl #8
 >       ldmfd   sp!, {r4, r5, r6, lr}


Matthieu

View attachment "test.c" of type "text/x-csrc" (821 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ