10 Apr 2012 11:21
unaligned memory access & SIGBUS
Nicolas Joly <njoly <at> pasteur.fr>
2012-04-10 09:21:22 GMT
2012-04-10 09:21:22 GMT
Hi, While trying to chase some unaligned memory access originally noticed on alpha, i wanted to have a way to detect this on amd64 ... Unfortunately, the attached sample code does not fail with SIGBUS on NetBSD/amd64 unlike other OSes i checked (Linux and FreeBSD). It simply tries to set the Alignment Check bit from RFLAGS register and then trigger an unaligned memory access. Any specific reason for such a behaviour ? Thanks. njoly <at> lanfeust [tmp/malign]> uname -a NetBSD lanfeust.sis.pasteur.fr 6.99.4 NetBSD 6.99.4 (LANFEUST) #2: Mon Apr 9 23:30:03 CEST 2012 njoly <at> lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/LANFEUST amd64 njoly <at> lanfeust [tmp/malign]> cc -o malign malign.c njoly <at> lanfeust [tmp/malign]> ./malign 0 njoly <at> kiri-adm1 [~]> uname -a Linux kiri-adm1.cluster.pasteur.fr 2.6.18-274.12.1.el5 #1 SMP Tue Nov 29 13:37:46 EST 2011 x86_64 x86_64 x86_64 GNU/Linux njoly <at> kiri-adm1 [~]> cc -o malign malign.c njoly <at> kiri-adm1 [~]> ./malign zsh: bus error (core dumped) ./malign njoly <at> livarot [~]> uname -a(Continue reading)
RSS Feed