Official MINIX sources - Automatically replicated from gerrit.minix3.org
Go to file
Arne Welzel 5e9e5b98f6 bsd.own.mk: use -mno-unaligned-access on ARM
Without this option, gcc may emit code accessing unaligned memory. This,
and the fact that SCTRL.A (System Control Register - Alignment Check) is
set to 1 in Minix causes data aborts when such code is encountered.

This was the cause of #104. The `minix-service' executable caused
unaligned memory accesses calling into getpwnam(). These then trigger
data abort exceptions. On ARM, these were previously forwarded to `vm'
as pagefaults. However, `vm' did not properly handle them, but instead
allocated one page for the faulting address (over and over again) and
then resumed the process at the faulting instruction (over and over
again). This behavior masked the whole story as an OOM.

Below the assembly version getpwent.c in which unaligned memory
accesses are even highlighted...

 ...
 341         ldr     lr, [sp, #48]
 342         cmp     lr, #0
 343         bne     .L46
 344         ldr     r0, [r4]        @ unaligned
 345         add     r1, r7, #5
 346         str     r0, [sp, #4]    @ unaligned
 347         ldr     r4, [sp, #4]
 348         mov     r5, r4, asr #31
 349         strd    r4, [r8, #40]
 ...

This should fix #104. It was tested on an actual Beaglebone Black.

An alternative fix would be to disable alignment checking by setting
SCTRL.A to 0 and allowing unaligned memory accesses.

Change-Id: I4d366eb0af1b2936bca369fd28014fb829228ad5
2018-03-25 11:23:21 +02:00
bin Import NetBSD ps(1) 2016-01-13 20:32:52 +01:00
common w(1): switch to libkvm 2016-01-13 20:32:50 +01:00
crypto etc: synchronize master.password, group to NetBSD 2017-02-18 21:37:24 +00:00
dist/pf/sbin/pfctl Import a subset of PF distribution files 2016-06-18 12:20:46 +00:00
distrib distrib: fix debug builds 2017-05-06 14:43:03 +02:00
docs Import NetBSD networking rc scripts 2017-04-30 13:16:22 +00:00
etc Import NetBSD networking rc scripts 2017-04-30 13:16:22 +00:00
external Fix lua 2017-05-08 11:53:38 +00:00
games Fix ARM noassert builds -g/-O{s/0/1/2/3} 2016-01-24 18:56:38 +01:00
gnu Fix the process for GNU tools on MINIX 2016-11-30 08:42:36 +01:00
include Enable a few more NetBSD functions 2017-03-09 23:40:09 +00:00
lib Import NetBSD libpcap 2017-03-21 22:00:18 +00:00
libexec ftpd(8): drop some MINIX-specific changes 2017-03-21 22:00:34 +00:00
minix kernel/arm: do not treat all data aborts as pagefaults 2018-03-25 11:22:35 +02:00
releasetools ARM: Remove dependency on mtools 2017-07-12 08:20:16 +02:00
sbin ping(8), traceroute(8): adapt to new LWIP service 2017-04-30 13:16:06 +00:00
share bsd.own.mk: use -mno-unaligned-access on ARM 2018-03-25 11:23:21 +02:00
sys pci server crashes during boot on Qubes OS 2017-11-16 23:05:02 +01:00
tests tests: add most kyua kernel tests 2016-01-16 14:04:25 +01:00
tools Improve the process for GNU tools 2016-09-01 21:16:13 +02:00
usr.bin Import NetBSD telnet(1) 2017-03-09 23:40:16 +00:00
usr.sbin ping(8), traceroute(8): adapt to new LWIP service 2017-04-30 13:16:06 +00:00
.gitignore Initial import of NetBSD rc system 2017-02-23 14:08:39 +00:00
.gitreview build:update 'git review' config to match gerrit.minix3.org 2014-07-28 17:05:15 +02:00
build.sh NetBSD re-synchronization of the source tree 2016-01-13 20:32:14 +01:00
LICENSE Fix parameter parsing in cut 2010-01-21 10:16:05 +00:00
Makefile NetBSD re-synchronization of the source tree 2016-01-13 20:32:14 +01:00
Makefile.inc Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00