Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: unaligned memory access & SIGBUS



In article <20120410092122.GA26870%lynche.sis.pasteur.fr@localhost>,
Nicolas Joly  <njoly%pasteur.fr@localhost> wrote:
>-=-=-=-=-=-
>
>
>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@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%lanfeust.sis.pasteur.fr@localhost:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/LANFEUST
> amd64
>njoly@lanfeust [tmp/malign]> cc -o malign malign.c 
>njoly@lanfeust [tmp/malign]> ./malign 
>0
>
>njoly@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@kiri-adm1 [~]> cc -o malign malign.c 
>njoly@kiri-adm1 [~]> ./malign 
>zsh: bus error (core dumped)  ./malign
>
>njoly@livarot [~]> uname -a
>FreeBSD livarot.sis.pasteur.fr 8.1-RELEASE-p5 FreeBSD 8.1-RELEASE-p5 #0:
>Tue Sep 27 16:49:00 UTC 2011    
>root%amd64-builder.daemonology.net@localhost:/usr/obj/usr/src/sys/GENERIC  
>amd64
>njoly@livarot [~]> cc -o malign malign.c 
>njoly@livarot [~]> ./malign 
>zsh: bus error (core dumped)  ./malign

PSL_AC needs to be part of PSL_USER?

christos



Home | Main Index | Thread Index | Old Index