c - How to trap unaligned memory access? -


i working on pet open-source project implements stream cipher algorithms , having trouble bug triggered when run on arm processor. have tried running arm binary in x86 under qemu, bug isn't triggered there.

the specifics mechanisms of bug remains elusive, best shot believe caused unaligned memory access attempt made in program, fulfilled qemu, silently ignored real arm processor in development board.

so, since problem showing hard diagnose, know if there tool use trap unaligned memory access made running program, can see problem happens.

i use way of enabling, on arm development board, signal (sigbus, maybe?) issued if process violates memory alignment restrictions, sigsegv when accessing unmapped memory address. running linux 2.6.32.

linux can fixup or warn access.

you can enable behavior in /proc/cpu/alignment, see http://www.mjmwired.net/kernel/documentation/arm/mem_alignment explanation of different values.

0 - nothing (default behavior) 1 - warning in kernel-log pc , memory-address printed. 2 - fixup error 3 - warn , fixup 4 - send sigbus process 5 - send sigbus , output warning 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -