diff mbox series

cve/meltdown.c: abort the test if kallsyms was not enabled

Message ID 20190628093709.6625-1-po-hsu.lin@canonical.com
State Accepted
Headers show
Series cve/meltdown.c: abort the test if kallsyms was not enabled | expand

Commit Message

Po-Hsu Lin June 28, 2019, 9:37 a.m. UTC
The cve-2017-5754 meltdown test does not work with a kernel that does
not have CONFIG_KALLSYMS enabled (e.g. Ubuntu KVM kernel).

Add and extra check for /proc/kallsyms to determine if we can run it.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
---
 testcases/cve/meltdown.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jan Stancek July 1, 2019, 7 a.m. UTC | #1
----- Original Message -----
> The cve-2017-5754 meltdown test does not work with a kernel that does
> not have CONFIG_KALLSYMS enabled (e.g. Ubuntu KVM kernel).
> 
> Add and extra check for /proc/kallsyms to determine if we can run it.
> 
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>

Pushed.

Thanks,
Jan
diff mbox series

Patch

diff --git a/testcases/cve/meltdown.c b/testcases/cve/meltdown.c
index 1a3303ec0..f78c38b80 100644
--- a/testcases/cve/meltdown.c
+++ b/testcases/cve/meltdown.c
@@ -269,6 +269,9 @@  find_kernel_symbol(const char *name)
 	struct utsname utsname;
 	unsigned long addr;
 
+	if (access("/proc/kallsyms", F_OK) == -1)
+		tst_brk(TCONF, "/proc/kallsyms not enabled");
+
 	addr = find_symbol_in_file("/proc/kallsyms", name);
 	if (addr)
 		return addr;