All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] cve/meltdown.c: abort the test if kallsyms was not enabled
@ 2019-06-28  9:37 Po-Hsu Lin
  2019-07-01  7:00 ` Jan Stancek
  0 siblings, 1 reply; 2+ messages in thread
From: Po-Hsu Lin @ 2019-06-28  9:37 UTC (permalink / raw)
  To: ltp

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(+)

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;
-- 
2.17.1


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

end of thread, other threads:[~2019-07-01  7:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-28  9:37 [LTP] [PATCH] cve/meltdown.c: abort the test if kallsyms was not enabled Po-Hsu Lin
2019-07-01  7:00 ` Jan Stancek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.