summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2019-02-05 15:43:34 -0800
committerMaciej Żenczykowski <maze@google.com>2019-02-05 16:07:47 -0800
commitd8cd1253af486f5129cb52fb503d616dffc92794 (patch)
treede1f6e56d8aee89570b9bd4fde9ba179dbd66fd2
parent508391f2c48e71603625456c32f4648393c1751c (diff)
downloadtests-d8cd1253af486f5129cb52fb503d616dffc92794.tar.gz
net-test: try to detect vsyscall=none uml and warn about it.
Bug: 123953923 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: Ib05019a1db10fbaae4bf4aa5000d8c617b9837d5
-rwxr-xr-xnet/test/run_net_test.sh27
1 files changed, 25 insertions, 2 deletions
diff --git a/net/test/run_net_test.sh b/net/test/run_net_test.sh
index 17b44d9..a81ad33 100755
--- a/net/test/run_net_test.sh
+++ b/net/test/run_net_test.sh
@@ -306,9 +306,32 @@ if [ "$ARCH" == "um" ]; then
blockdevice=ubdar
fi
+ exitcode=0
$KERNEL_BINARY >&2 umid=net_test mem=512M \
- $blockdevice=$SCRIPT_DIR/$ROOTFS $netconfig $consolemode $cmdline
- exitcode=$?
+ $blockdevice=$SCRIPT_DIR/$ROOTFS $netconfig $consolemode $cmdline \
+ || exitcode=$?
+
+ # UML is kind of crazy in how guest syscalls work. It requires host kernel
+ # to not be in vsyscall=none mode.
+ if [[ "${exitcode}" != '0' ]]; then
+ {
+ # Hopefully one of these exists
+ cat /proc/config || :
+ zcat /proc/config.gz || :
+ cat "/boot/config-$(uname -r)" || :
+ zcat "/boot/config-$(uname -r).gz" || :
+ } 2>/dev/null \
+ | egrep -q '^CONFIG_LEGACY_VSYSCALL_NONE=y' \
+ && ! egrep -q '(^| )vsyscall=(native|emulate)( |$)' /proc/cmdline \
+ && {
+ echo '-----=====-----'
+ echo 'If above you saw a "net_test.sh[1]: segfault at ..." followed by'
+ echo '"Kernel panic - not syncing: Attempted to kill init!" then please'
+ echo 'set "vsyscall=emulate" on *host* kernel command line.'
+ echo '(for example via GRUB_CMDLINE_LINUX in /etc/default/grub)'
+ echo '-----=====-----'
+ }
+ fi
else
# We boot into the filesystem image directly in all cases
cmdline="$cmdline root=/dev/vda"