summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended
diff options
context:
space:
mode:
authorHe Zhe <zhe.he@windriver.com>2019-08-28 14:25:10 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-08-30 17:10:28 +0100
commit4e1ea3e9c9d6680c008b362f8e767c206bd0290d (patch)
tree8445dae6c8ddca1861595853be7f3ef71bf75b26 /meta/recipes-extended
parent026f53d9773c565b76a7e1e979d37cad712d7f97 (diff)
downloadpoky-4e1ea3e9c9d6680c008b362f8e767c206bd0290d.tar.gz
ltp: cve/meltdown.c: Fix kernel symbol finding
Backport a patch to fix the following error. safe_file_ops.c:219: BROK: Expected 3 conversions got 2 at meltdown.c:272 (From OE-Core rev: 372a211657bfddd7f32f30043ec06198f8c27101) Signed-off-by: He Zhe <zhe.he@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended')
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-cve-meltdown.c-Fix-kernel-symbol-finding.patch81
-rw-r--r--meta/recipes-extended/ltp/ltp_20190517.bb1
2 files changed, 82 insertions, 0 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
new file mode 100644
index 0000000000..94f6f5a15a
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-cve-meltdown.c-Fix-kernel-symbol-finding.patch
@@ -0,0 +1,81 @@
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
diff --git a/meta/recipes-extended/ltp/ltp_20190517.bb b/meta/recipes-extended/ltp/ltp_20190517.bb
index b0e2f969c7..76c45f0103 100644
--- a/meta/recipes-extended/ltp/ltp_20190517.bb
+++ b/meta/recipes-extended/ltp/ltp_20190517.bb
@@ -45,6 +45,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
45 file://0002-check-for-RES_USE_INET6-during-configure.patch \ 45 file://0002-check-for-RES_USE_INET6-during-configure.patch \
46 file://0001-syscalls-tgkill03-wait-for-defunct-tid-to-get-detach.patch \ 46 file://0001-syscalls-tgkill03-wait-for-defunct-tid-to-get-detach.patch \
47 file://0001-ustat02-Fix-EFAULT-in-32bit-compatibility-mode.patch \ 47 file://0001-ustat02-Fix-EFAULT-in-32bit-compatibility-mode.patch \
48 file://0001-cve-meltdown.c-Fix-kernel-symbol-finding.patch \
48 " 49 "
49 50
50S = "${WORKDIR}/git" 51S = "${WORKDIR}/git"