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:   Wed, 19 Oct 2016 14:43:13 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'zhuyj' <zyjzyj2000@...il.com>,
        David Lebrun <david.lebrun@...ouvain.be>
CC:     netdev <netdev@...r.kernel.org>
Subject: RE: [PATCH 4/9] ipv6: sr: add core files for SR HMAC support

From: zhuyj
> Sent: 19 October 2016 14:21
>  __attribute__((packed)) is potentially unsafe on some systems. The
> symptom probably won't show up on an x86, which just makes the problem
> more insidious; testing on x86 systems won't reveal the problem. (On
> the x86, misaligned accesses are handled in hardware; if you
> dereference an int* pointer that points to an odd address, it will be
> a little slower than if it were properly aligned, but you'll get the
> correct result.)
> 
> On some other systems, such as SPARC, attempting to access a
> misaligned int object causes a bus error, crashing the program.

__attribute__((packed)) causes the compiler to generate byte memory
access and shifts to access the unaligned data.
You don't get a fault, just rather more instructions that you had in mind.

You shouldn't really specify 'packed' unless there are real reasons
why the data structure will appear on misaligned addresses.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ