On Tue, Apr 12, 2016 at 11:00:17AM +0200, Vincent Bernat wrote: > ??? 12 avril 2016 10:38 +0200, Willy Tarreau <[email protected]> : > > > BTW, armv5 is very handy to test alignment. By default it does crap > > (silent read of the wrong word) but you can configure it to fault or > > to emulate the alignment. I've found lots of such issues with just > > a Seagate Dockstar. > > Funny fact, I did learn that you can make x86 sensible to > alignment.
Yes absolutely, it's by setting the AC flag in EFLAGS. And the funniest part of it is that I used to believe for many years that it was enabled by default on Linux and discovered I was wrong a few years ago when Linus reimplemented his fast SHA1 version for Git which relies on unaligned accesses. My first thought was "where did he get rid of alignment check?" then I found he never did :-) > Unfortunately, the libc is not ready for that: > > http://paste.debian.net/427415/ I didn't know it was permitted to clear it from userland (the popf instruction is restricted so the kernel can do whatever it wants with your flags). But indeed the libc knows unaligned accesses are supported and makes use of this useful capability! Ah, it feels good to discuss asm and processor flags again on this list, it changes from systemd issues and spam complaints :-) Cheers, Willy

