diff options
author | Maciej Żenczykowski <maze@google.com> | 2020-01-28 19:18:07 -0800 |
---|---|---|
committer | Maciej Żenczykowski <maze@google.com> | 2020-01-28 19:23:29 -0800 |
commit | 40fe1568e63c5c6b92f3c6ea5279228c77c2f595 (patch) | |
tree | a1912d88631b99d896603b6b6ece5721d928d6de /net/test | |
parent | 277404bee6f570f078fe63a3df4f0fbeaf2d1171 (diff) | |
download | kernel_tests-40fe1568e63c5c6b92f3c6ea5279228c77c2f595.tar.gz kernel_tests-40fe1568e63c5c6b92f3c6ea5279228c77c2f595.tar.bz2 kernel_tests-40fe1568e63c5c6b92f3c6ea5279228c77c2f595.zip |
net-test: always pass entropy to qemu instances as well
This works around the lack of virtio-rng device in the gki image.
(See reasoning on https://android-review.googlesource.com/c/kernel/common/+/1116415 )
Test: 4.19 qemu net tests no longer spews tons of rng init related warnings
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I61a2712c4cbb05970399dee9979cbe2ea7bf8d48
Diffstat (limited to 'net/test')
-rwxr-xr-x | net/test/run_net_test.sh | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/net/test/run_net_test.sh b/net/test/run_net_test.sh index 5e20bae0..aa9aa6ba 100755 --- a/net/test/run_net_test.sh +++ b/net/test/run_net_test.sh @@ -280,6 +280,21 @@ fi cmdline="$cmdline panic=1 init=/sbin/net_test.sh" cmdline="$cmdline net_test_args=\"$test_args\" net_test_mode=$testmode" +# Experience shows that we need at least 128 bits of entropy for the +# kernel's crng init to complete (before it fully initializes stuff behaves +# *weirdly* and there's plenty of kernel warnings and some tests even fail), +# hence net_test.sh needs at least 32 hex chars (which is the amount of hex +# in a single random UUID) provided to it on the kernel cmdline. +# +# Just to be safe, we'll pass in 384 bits, and we'll do this as a random +# 64 character base64 seed (because this is shorter than base16). +# We do this by getting *three* random UUIDs and concatenating their hex +# digits into an *even* length hex encoded string, which we then convert +# into base64. +entropy="$(cat /proc/sys/kernel/random{/,/,/}uuid | tr -d '\n-')" +entropy="$(xxd -r -p <<< "${entropy}" | base64 -w 0)" +cmdline="${cmdline} entropy=${entropy}" + if [ "$ARCH" == "um" ]; then # Get the absolute path to the test file that's being run. cmdline="$cmdline net_test=/host$SCRIPT_DIR/$test" @@ -287,21 +302,6 @@ if [ "$ARCH" == "um" ]; then # Use UML's /proc/exitcode feature to communicate errors on test failure cmdline="$cmdline net_test_exitcode=/proc/exitcode" - # Experience shows that we need at least 128 bits of entropy for the - # kernel's crng init to complete (before it fully initializes stuff behaves - # *weirdly* and there's plenty of kernel warnings and some tests even fail), - # hence net_test.sh needs at least 32 hex chars (which is the amount of hex - # in a single random UUID) provided to it on the kernel cmdline. - # - # Just to be safe, we'll pass in 384 bits, and we'll do this as a random - # 64 character base64 seed (because this is shorter than base16). - # We do this by getting *three* random UUIDs and concatenating their hex - # digits into an *even* length hex encoded string, which we then convert - # into base64. - entropy="$(cat /proc/sys/kernel/random{/,/,/}uuid | tr -d '\n-')" - entropy="$(xxd -r -p <<< "${entropy}" | base64 -w 0)" - cmdline="${cmdline} entropy=${entropy}" - # Map the --readonly flag to UML block device names if ((nowrite == 0)); then blockdevice=ubda |