Getting rid of alignment faults in userspace

Dave Martin dave.martin at linaro.org
Mon Jun 20 10:33:36 UTC 2011


On Fri, Jun 17, 2011 at 03:23:49PM -0700, Steve Langasek wrote:
> On Fri, Jun 17, 2011 at 01:10:11PM +0100, Dave Martin wrote:
> 
> > For ARM, we can achieve the goal by augmenting the default kernel command-
> > line options: either
> 
> >     alignment=3
> >         Fix up each alingment fault, but also log the faulting address
> >         and name of the offending process to dmesg.
> 
> >     alignment=5
> >         Pass each alignment fault to the user process as SIGBUS (fatal
> >         by default) and log the faulting address and name of the
> >         offending process to dmesg.
> 
> > Fault statistics cat also be obtained at runtime by reading
> > /proc/cpu/alignment.
> 
> > For other architectures, there may be other arch-specific ways of
> > achieving something similar.
> 
> Other architectures[1] use the 'prctl' tool, which uses the
> prctl(PR_SET_UNALIGN,...) kernel interface to control the unaligned trap
> behavior for the process.  If this can be sanely togglable on ARM at
> runtime, it would be keen to use the same interface on this arch.

I guess that would be a new task for someone, if we consider it important
enough -- I'll raise it at today's linaro kernel working group meeting.

I don't know if that prctl call is wired up at all on arm kernels, but
it certainly won't work for v6/v7 at present.  Enabling it looks fairly
straightforward, though.

Cheers
---Dave



More information about the ubuntu-devel mailing list