* [PATCH v1 0/2] selftest/kexec: minor update to the existing test
@ 2021-12-22 21:30 Mimi Zohar
2021-12-22 21:30 ` [PATCH v1 1/2] selftest/kexec: fix "ignored null byte in input" warning Mimi Zohar
2021-12-22 21:30 ` [PATCH v1 2/2] selftests/kexec: update searching for the Kconfig Mimi Zohar
0 siblings, 2 replies; 5+ messages in thread
From: Mimi Zohar @ 2021-12-22 21:30 UTC (permalink / raw)
To: linux-integrity
Cc: Petr Vorel, Nageswara Sastry, Mimi Zohar, Takashi Iwai, Joey Lee,
Shuah Khan, linux-kselftest, linux-kernel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 1/2] selftest/kexec: fix "ignored null byte in input" warning
2021-12-22 21:30 [PATCH v1 0/2] selftest/kexec: minor update to the existing test Mimi Zohar
@ 2021-12-22 21:30 ` Mimi Zohar
2021-12-23 8:41 ` Petr Vorel
2021-12-22 21:30 ` [PATCH v1 2/2] selftests/kexec: update searching for the Kconfig Mimi Zohar
1 sibling, 1 reply; 5+ messages in thread
From: Mimi Zohar @ 2021-12-22 21:30 UTC (permalink / raw)
To: linux-integrity
Cc: Petr Vorel, Nageswara Sastry, Mimi Zohar, Takashi Iwai, Joey Lee,
Shuah Khan, linux-kselftest, linux-kernel
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>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v1 2/2] selftests/kexec: update searching for the Kconfig
2021-12-22 21:30 [PATCH v1 0/2] selftest/kexec: minor update to the existing test Mimi Zohar
2021-12-22 21:30 ` [PATCH v1 1/2] selftest/kexec: fix "ignored null byte in input" warning Mimi Zohar
@ 2021-12-22 21:30 ` Mimi Zohar
2021-12-23 8:35 ` Petr Vorel
1 sibling, 1 reply; 5+ messages in thread
From: Mimi Zohar @ 2021-12-22 21:30 UTC (permalink / raw)
To: linux-integrity
Cc: Petr Vorel, Nageswara Sastry, Mimi Zohar, Takashi Iwai, Joey Lee,
Shuah Khan, linux-kselftest, linux-kernel
First check /lib/modules/`uname -r`/config, before using the IKCONFIG.
In addition, the configs.ko might be compressed. Fix the configs.ko
name.
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
Distros: is storing the Kconfig in /lib/modules/`uname -r`/config common?
tools/testing/selftests/kexec/kexec_common_lib.sh | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/kexec/kexec_common_lib.sh b/tools/testing/selftests/kexec/kexec_common_lib.sh
index 43017cfe88f7..5a1b8ae04c64 100755
--- a/tools/testing/selftests/kexec/kexec_common_lib.sh
+++ b/tools/testing/selftests/kexec/kexec_common_lib.sh
@@ -138,15 +138,20 @@ kconfig_enabled()
return 0
}
-# Attempt to get the kernel config first via proc, and then by
-# extracting it from the kernel image or the configs.ko using
-# scripts/extract-ikconfig.
+# Attempt to get the kernel config first by checking the modules directory
+# then via proc, and finally by extracting it from the kernel image or the
+# configs.ko using scripts/extract-ikconfig.
# Return 1 for found.
get_kconfig()
{
local proc_config="/proc/config.gz"
local module_dir="/lib/modules/`uname -r`"
- local configs_module="$module_dir/kernel/kernel/configs.ko"
+ local configs_module="$module_dir/kernel/kernel/configs.ko*"
+
+ if [ -f $module_dir/config ]; then
+ IKCONFIG=$module_dir/config
+ return 1
+ fi
if [ ! -f $proc_config ]; then
modprobe configs > /dev/null 2>&1
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 2/2] selftests/kexec: update searching for the Kconfig
2021-12-22 21:30 ` [PATCH v1 2/2] selftests/kexec: update searching for the Kconfig Mimi Zohar
@ 2021-12-23 8:35 ` Petr Vorel
0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2021-12-23 8:35 UTC (permalink / raw)
To: Mimi Zohar
Cc: linux-integrity, Nageswara Sastry, Takashi Iwai, Joey Lee,
Shuah Khan, linux-kselftest, linux-kernel
> First check /lib/modules/`uname -r`/config, before using the IKCONFIG.
> In addition, the configs.ko might be compressed. Fix the configs.ko
> name.
> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
> ---
> Distros: is storing the Kconfig in /lib/modules/`uname -r`/config common?
> tools/testing/selftests/kexec/kexec_common_lib.sh | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
> diff --git a/tools/testing/selftests/kexec/kexec_common_lib.sh b/tools/testing/selftests/kexec/kexec_common_lib.sh
> index 43017cfe88f7..5a1b8ae04c64 100755
> --- a/tools/testing/selftests/kexec/kexec_common_lib.sh
> +++ b/tools/testing/selftests/kexec/kexec_common_lib.sh
> @@ -138,15 +138,20 @@ kconfig_enabled()
> return 0
> }
> -# Attempt to get the kernel config first via proc, and then by
> -# extracting it from the kernel image or the configs.ko using
> -# scripts/extract-ikconfig.
> +# Attempt to get the kernel config first by checking the modules directory
> +# then via proc, and finally by extracting it from the kernel image or the
> +# configs.ko using scripts/extract-ikconfig.
> # Return 1 for found.
> get_kconfig()
> {
> local proc_config="/proc/config.gz"
> local module_dir="/lib/modules/`uname -r`"
> - local configs_module="$module_dir/kernel/kernel/configs.ko"
> + local configs_module="$module_dir/kernel/kernel/configs.ko*"
I wonder if * will later work:
if [ ! -f $configs_module ]; then
But there should be just one variant: either configs.ko or configs.ko.xz
(or something other), so it should work, right?
Thus
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
> +
> + if [ -f $module_dir/config ]; then
> + IKCONFIG=$module_dir/config
> + return 1
> + fi
> if [ ! -f $proc_config ]; then
> modprobe configs > /dev/null 2>&1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] selftest/kexec: fix "ignored null byte in input" warning
2021-12-22 21:30 ` [PATCH v1 1/2] selftest/kexec: fix "ignored null byte in input" warning Mimi Zohar
@ 2021-12-23 8:41 ` Petr Vorel
0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2021-12-23 8:41 UTC (permalink / raw)
To: Mimi Zohar
Cc: linux-integrity, Nageswara Sastry, Takashi Iwai, Joey Lee,
Shuah Khan, linux-kselftest, linux-kernel
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 <pvorel@suse.cz>
Kind regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-23 8:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22 21:30 [PATCH v1 0/2] selftest/kexec: minor update to the existing test Mimi Zohar
2021-12-22 21:30 ` [PATCH v1 1/2] selftest/kexec: fix "ignored null byte in input" warning Mimi Zohar
2021-12-23 8:41 ` Petr Vorel
2021-12-22 21:30 ` [PATCH v1 2/2] selftests/kexec: update searching for the Kconfig Mimi Zohar
2021-12-23 8:35 ` Petr Vorel
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).