032-misalignment-handling.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. Change the default alingment handling to not be silent failure
  2. Index: linux-2.6.21.7/arch/arm/mm/alignment.c
  3. ===================================================================
  4. --- linux-2.6.21.7.orig/arch/arm/mm/alignment.c
  5. +++ linux-2.6.21.7/arch/arm/mm/alignment.c
  6. @@ -797,6 +797,8 @@ static int __init alignment_init(void)
  7. res->write_proc = proc_alignment_write;
  8. #endif
  9. + ai_usermode = CONFIG_ALIGNMENT_HANDLING;
  10. +
  11. hook_fault_code(1, do_alignment, SIGILL, "alignment exception");
  12. hook_fault_code(3, do_alignment, SIGILL, "alignment exception");
  13. Index: linux-2.6.21.7/arch/arm/Kconfig
  14. ===================================================================
  15. --- linux-2.6.21.7.orig/arch/arm/Kconfig
  16. +++ linux-2.6.21.7/arch/arm/Kconfig
  17. @@ -709,6 +709,19 @@ config ALIGNMENT_TRAP
  18. correct operation of some network protocols. With an IP-only
  19. configuration it is safe to say N, otherwise say Y.
  20. +config ALIGNMENT_HANDLING
  21. + hex "Userspace alignment trap handling"
  22. + default "0x3"
  23. + depends on ALIGNMENT_TRAP
  24. + help
  25. + How should we handle alignment errors in userspace by default? This is a bitfield where:
  26. + 0 - silently ignore alignment errors (will lead to unexpected results)
  27. + 1 - report alignment errors through printk (will lead to unexpected results, but you'll know about them)
  28. + 2 - fix the alignment and make things work properly (performance degradation for un-aligned code)
  29. + 4 - raise SIGBUS on alignment traps
  30. + A good number to choose is probably either 3 (work slowly but log message) or 5 (log message and SIGBUS).
  31. + You can change the behavior at runtime through /proc/cpu/alignment if you have PROC_FS enabled.
  32. +
  33. endmenu
  34. menu "Boot options"