2021-12-22 21:31:26

by Mimi Zohar

[permalink] [raw]
Subject: [PATCH v1 0/2] selftest/kexec: minor update to the existing test

Some distros are now storing the Kconfig in /lib/modules/`uname -r`/config.
Check there first before attempting to read it from /proc or extract it
from the kernel image.

Fix "ignored null byte in input" warning.

Mimi Zohar (2):
selftest/kexec: fix "ignored null byte in input" warning
selftests/kexec: update searching for the Kconfig

tools/testing/selftests/kexec/kexec_common_lib.sh | 13 +++++++++----
.../testing/selftests/kexec/test_kexec_file_load.sh | 5 +++--
2 files changed, 12 insertions(+), 6 deletions(-)

--
2.27.0



2021-12-22 21:36:23

by Mimi Zohar

[permalink] [raw]
Subject: [PATCH v1 1/2] selftest/kexec: fix "ignored null byte in input" warning

Instead of assigning the string to a variable, which might contain a
null character, redirect the output and grep for the string directly.

Signed-off-by: Mimi Zohar <[email protected]>
---
Comment: this patch was previously posted as part of Nageswara's larger
patch set.

tools/testing/selftests/kexec/test_kexec_file_load.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kexec/test_kexec_file_load.sh b/tools/testing/selftests/kexec/test_kexec_file_load.sh
index 2ff600388c30..99f6fc23ee31 100755
--- a/tools/testing/selftests/kexec/test_kexec_file_load.sh
+++ b/tools/testing/selftests/kexec/test_kexec_file_load.sh
@@ -97,10 +97,11 @@ check_for_imasig()
check_for_modsig()
{
local module_sig_string="~Module signature appended~"
- local sig="$(tail --bytes $((${#module_sig_string} + 1)) $KERNEL_IMAGE)"
local ret=0

- if [ "$sig" == "$module_sig_string" ]; then
+ tail --bytes $((${#module_sig_string} + 1)) $KERNEL_IMAGE | \
+ grep -q "$module_sig_string"
+ if [ $? -eq 0 ]; then
ret=1
log_info "kexec kernel image modsig signed"
else
--
2.27.0


2021-12-23 08:42:05

by Petr Vorel

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] selftest/kexec: fix "ignored null byte in input" warning

Hi Mimi,

> Instead of assigning the string to a variable, which might contain a
> null character, redirect the output and grep for the string directly.

Looks reasonable to me.

Reviewed-by: Petr Vorel <[email protected]>

Kind regards,
Petr