linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] selftest/kexec: fix "ignored null byte in input" warning
@ 2021-11-24  7:08 Nageswara R Sastry
  2021-11-24  7:08 ` [PATCH 2/3] selftests/kexec: Enable secureboot tests for PowerPC Nageswara R Sastry
  2021-11-24  7:08 ` [PATCH 3/3] Add tests to verify kexec of blacklist and non blacklist kernel Nageswara R Sastry
  0 siblings, 2 replies; 5+ messages in thread
From: Nageswara R Sastry @ 2021-11-24  7:08 UTC (permalink / raw)
  To: zohar, linux-kselftest, linux-integrity, mpe, shuah; +Cc: nayna, dja, gcwilson

From: Mimi Zohar <zohar@linux.ibm.com>

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 <zohar@linux.ibm.com>
---
 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.23.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-05 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24  7:08 [PATCH 1/3] selftest/kexec: fix "ignored null byte in input" warning Nageswara R Sastry
2021-11-24  7:08 ` [PATCH 2/3] selftests/kexec: Enable secureboot tests for PowerPC Nageswara R Sastry
2021-12-13 23:23   ` Mimi Zohar
2022-01-05 16:09   ` Nayna
2021-11-24  7:08 ` [PATCH 3/3] Add tests to verify kexec of blacklist and non blacklist kernel Nageswara R Sastry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).