summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/ltp/ltp/0001-cve-meltdown.c-Fix-kernel-symbol-finding.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/ltp/ltp/0001-cve-meltdown.c-Fix-kernel-symbol-finding.patch')
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-cve-meltdown.c-Fix-kernel-symbol-finding.patch81
1 files changed, 0 insertions, 81 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-cve-meltdown.c-Fix-kernel-symbol-finding.patch b/meta/recipes-extended/ltp/ltp/0001-cve-meltdown.c-Fix-kernel-symbol-finding.patch
deleted file mode 100644
index 94f6f5a15a..0000000000
--- a/meta/recipes-extended/ltp/ltp/0001-cve-meltdown.c-Fix-kernel-symbol-finding.patch
+++ /dev/null
@@ -1,81 +0,0 @@
1From fbeda82f440a0098be42dd668cbc47212a86ab48 Mon Sep 17 00:00:00 2001
2From: He Zhe <zhe.he@windriver.com>
3Date: Wed, 21 Aug 2019 16:27:24 +0800
4Subject: [PATCH] cve/meltdown.c: Fix kernel symbol finding
5
6meltdown case fails as below.
7safe_file_ops.c:219: BROK: Expected 3 conversions got 2 at meltdown.c:272
8
9find_kernel_symbol is defined to try twice with each of /proc/kallsyms and
10/boot/System.map-%s. Currently if the symbol is not found in /proc/kallsyms,
11when kernel option CONFIG_KALLSYMS_ALL is disabled, it would stop the case
12immediately due to SAFE_FILE_LINES_SCANF.
13
14This patch turns to use FILE_LINES_SCANF to give find_kernel_symbol second
15chance.
16
17[jstancek] Fix also condition introduced in 7709d2ae92ea, even if
18 /proc/kallsyms is disabled, we still want to try System.map.
19
20Signed-off-by: He Zhe <zhe.he@windriver.com>
21Signed-off-by: Jan Stancek <jstancek@redhat.com>
22
23Upstream-Status: Backport
24[https://github.com/linux-test-project/ltp/commit/c2049b5c874bc071f8185bffb5fd7dcb042d9ec8]
25
26Remove the hunk for upstream 7709d2ae92ea ("cve/meltdown.c: abort the test if kallsyms was not enabled")
27that has been covered by this patch.
28
29Signed-off-by: He Zhe <zhe.he@windriver.com>
30---
31 testcases/cve/meltdown.c | 13 ++++++++++---
32 1 file changed, 10 insertions(+), 3 deletions(-)
33
34diff --git a/testcases/cve/meltdown.c b/testcases/cve/meltdown.c
35index a53ea9b..22651a6 100644
36--- a/testcases/cve/meltdown.c
37+++ b/testcases/cve/meltdown.c
38@@ -267,9 +267,15 @@ find_symbol_in_file(const char *filename, const char *symname)
39 int ret, read;
40 char fmt[strlen(symname) + 64];
41
42+ tst_res(TINFO, "Looking for %s in %s", symname, filename);
43+ if (access(filename, F_OK) == -1) {
44+ tst_res(TINFO, "%s not available", filename);
45+ return 0;
46+ }
47+
48 sprintf(fmt, "%%lx %%c %s%%c", symname);
49
50- ret = SAFE_FILE_LINES_SCANF(filename, fmt, &addr, &type, &read);
51+ ret = FILE_LINES_SCANF(filename, fmt, &addr, &type, &read);
52 if (ret)
53 return 0;
54
55@@ -287,13 +293,11 @@ find_kernel_symbol(const char *name)
56 if (addr)
57 return addr;
58
59- tst_res(TINFO, "not found '%s' in /proc/kallsyms", name);
60 if (uname(&utsname) < 0)
61 tst_brk(TBROK | TERRNO, "uname");
62
63 sprintf(systemmap, "/boot/System.map-%s", utsname.release);
64
65- tst_res(TINFO, "looking in '%s'\n", systemmap);
66 addr = find_symbol_in_file(systemmap, name);
67 return addr;
68 }
69@@ -308,6 +312,9 @@ static void setup(void)
70 saved_cmdline_addr = find_kernel_symbol("saved_command_line");
71 tst_res(TINFO, "&saved_command_line == 0x%lx", saved_cmdline_addr);
72
73+ if (!saved_cmdline_addr)
74+ tst_brk(TCONF, "saved_command_line not found");
75+
76 spec_fd = SAFE_OPEN("/proc/cmdline", O_RDONLY);
77
78 memset(target_array, 1, sizeof(target_array));
79--
802.7.4
81