Re: Getting rid of alignment faults in userspace
On Fri, 17 Jun 2011, Arnd Bergmann wrote:
> On Friday 17 June 2011 14:10:11 Dave Martin wrote:
> > As part of the general effort to make open source on ARM better, I think
> > it would be great if we can disable the alignment fixups (or at least
> > enable logging) and work with upstreams to get the affected packages
> > fixed.
> > For release images we might want to be more forgiving, but for development
> > we have the option of being more aggressive.
> Yes, makes sense.
> > These apps typically generate hundreds or thousands of faults per session,
> > but not millions, but it's still quite a lot of noise in syslog.
> Then we should make sure that an appropriate rate limiting is in place,
> like the patch below (untested) would do.
> ARM: Add rate-limiting to alignment trap printk
> Malicious or buggy applications can easily flood syslog by accessing unaligned
> data. Better use printk_ratelimited for the warning to prevent this while also
> allowing us to see the important output.
No. The logging doesn't happen by default. You have to set the
appropriate flag via the kernel cmdline or at runtime by echoing that
flag to /proc/cpu/alignment which can be done by root only. This is
therefore a debugging facility that should not be rate limited otherwise
it loses its purpose.
The only effective rate limiting configuration I would recommend is to
SIGBUS misaligned accesses by default. And that's also supported
already with the right flag.