diff mbox series

kallsyms: check if CONFIG_KALLSYMS=y

Message ID 20240627021947.13718-1-kuan-ying.lee@canonical.com
State Accepted
Headers show
Series kallsyms: check if CONFIG_KALLSYMS=y | expand

Commit Message

Kuan-Ying Lee June 27, 2024, 2:19 a.m. UTC
Only if CONFIG_KALLSYMS=y enable, node /proc/kallsyms is
generated.

We need to check if this config is set or not.

Signed-off-by: Kuan-Ying Lee <kuan-ying.lee@canonical.com>
---
 testcases/kernel/security/kallsyms/kallsyms.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Po-Hsu Lin June 27, 2024, 9:42 a.m. UTC | #1
Tested with Ubuntu Jammy KVM kernel, this test will be skipped as
expected.

<<<test_start>>>
tag=kallsyms stime=1719396276
cmdline="kallsyms"
contacts=""
analysis=exit
<<<test_output>>>
incrementing stop
tst_kconfig.c:88: TINFO: Parsing kernel config '/lib/modules/5.15.0-1061-kvm/build/.config'
tst_kconfig.c:531: TINFO: Constraint 'CONFIG_KALLSYMS=y' not satisfied!
tst_kconfig.c:477: TINFO: Variables:
tst_kconfig.c:495: TINFO:  CONFIG_KALLSYMS=n
tst_test.c:1192: TCONF: Aborting due to unsuitable kernel config, see above!
<<<execution_status>>>
initiation_status="ok"
duration=0 termination_type=exited termination_id=32 corefile=no
cutime=0 cstime=0
<<<test_end>>>
INFO: ltp-pan reported all tests PASS

Tested-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Reviewed-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Li Wang June 27, 2024, 10 a.m. UTC | #2
Patch applied, thank you both!

On Thu, Jun 27, 2024 at 5:43 PM Po-Hsu Lin <po-hsu.lin@canonical.com> wrote:

> Tested with Ubuntu Jammy KVM kernel, this test will be skipped as
> expected.
>
> <<<test_start>>>
> tag=kallsyms stime=1719396276
> cmdline="kallsyms"
> contacts=""
> analysis=exit
> <<<test_output>>>
> incrementing stop
> tst_kconfig.c:88: TINFO: Parsing kernel config
> '/lib/modules/5.15.0-1061-kvm/build/.config'
> tst_kconfig.c:531: TINFO: Constraint 'CONFIG_KALLSYMS=y' not satisfied!
> tst_kconfig.c:477: TINFO: Variables:
> tst_kconfig.c:495: TINFO:  CONFIG_KALLSYMS=n
> tst_test.c:1192: TCONF: Aborting due to unsuitable kernel config, see
> above!
> <<<execution_status>>>
> initiation_status="ok"
> duration=0 termination_type=exited termination_id=32 corefile=no
> cutime=0 cstime=0
> <<<test_end>>>
> INFO: ltp-pan reported all tests PASS
>
> Tested-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
> Reviewed-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>
diff mbox series

Patch

diff --git a/testcases/kernel/security/kallsyms/kallsyms.c b/testcases/kernel/security/kallsyms/kallsyms.c
index ad3a9265afbe..2a5cbaa325ea 100644
--- a/testcases/kernel/security/kallsyms/kallsyms.c
+++ b/testcases/kernel/security/kallsyms/kallsyms.c
@@ -141,5 +141,9 @@  static struct tst_test test = {
 	.setup = setup,
 	.cleanup = cleanup,
 	.max_runtime = 60,
+	.needs_kconfigs = (const char *const[]){
+		"CONFIG_KALLSYMS=y",
+		NULL
+	},
 	.test_all = test_access_kernel_address,
 };