diff options
author | Khem Raj <raj.khem@gmail.com> | 2020-02-20 08:50:50 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-02-21 17:48:09 +0000 |
commit | 7648a69d29a0553adba3a41130b5c5d798b84e8c (patch) | |
tree | 8fcf63d9ebec76ee54bacf05e009d213de1e4810 | |
parent | ea48bdac1d3fcef8b058bb67e2b39cb500cdc94b (diff) | |
download | poky-7648a69d29a0553adba3a41130b5c5d798b84e8c.tar.gz |
ltp: Use upstreamed patch for time64 syscall fixes
(From OE-Core rev: 5df9d43a7173e396bb39ff21183b67ba52681993)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch | 109 |
1 files changed, 66 insertions, 43 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch b/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch index 92e5fdfe6e..c431669716 100644 --- a/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch +++ b/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 09e631419d9763a4ff08b32d9801c12b475d8ec5 Mon Sep 17 00:00:00 2001 | 1 | From b66905b094e08a84c30bc135003c3611f65d53ec Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Wed, 12 Feb 2020 22:22:17 -0800 | 3 | Date: Wed, 12 Feb 2020 22:22:17 -0800 |
4 | Subject: [PATCH] syscalls: Check for time64 unsafe syscalls before using them | 4 | Subject: [PATCH] syscalls: Check for time64 unsafe syscalls before using them |
@@ -7,75 +7,98 @@ musl is using 64bit time_t now on 32bit architectures and these syscalls | |||
7 | no longer exist, therefore its better to check for them being available | 7 | no longer exist, therefore its better to check for them being available |
8 | before using them | 8 | before using them |
9 | 9 | ||
10 | Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2020-February/015400.html] | 10 | Upstream-Status: Submitted [https://patchwork.ozlabs.org/patch/1241258/] |
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
12 | --- | 12 | --- |
13 | lib/tst_clocks.c | 9 +++++++++ | 13 | lib/tst_clocks.c | 9 +++++---- |
14 | testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | 4 ++++ | 14 | testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | 6 ++---- |
15 | testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 4 ++++ | 15 | testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 8 +++----- |
16 | 3 files changed, 17 insertions(+) | 16 | 3 files changed, 10 insertions(+), 13 deletions(-) |
17 | 17 | ||
18 | diff --git a/lib/tst_clocks.c b/lib/tst_clocks.c | ||
19 | index 35798a4aaf..6a5b05c4ea 100644 | ||
20 | --- a/lib/tst_clocks.c | 18 | --- a/lib/tst_clocks.c |
21 | +++ b/lib/tst_clocks.c | 19 | +++ b/lib/tst_clocks.c |
22 | @@ -28,15 +28,24 @@ | 20 | @@ -22,21 +22,22 @@ |
21 | #define _GNU_SOURCE | ||
22 | #include <unistd.h> | ||
23 | #include <time.h> | ||
24 | -#include <sys/syscall.h> | ||
25 | - | ||
26 | +#define TST_NO_DEFAULT_MAIN | ||
27 | +#include "tst_test.h" | ||
28 | #include "tst_clocks.h" | ||
29 | +#include "lapi/syscalls.h" | ||
23 | 30 | ||
24 | int tst_clock_getres(clockid_t clk_id, struct timespec *res) | 31 | int tst_clock_getres(clockid_t clk_id, struct timespec *res) |
25 | { | 32 | { |
26 | +#if defined(__NR_clock_getres) | 33 | - return syscall(SYS_clock_getres, clk_id, res); |
27 | return syscall(SYS_clock_getres, clk_id, res); | 34 | + return tst_syscall(__NR_clock_getres, clk_id, res); |
28 | +#endif | ||
29 | + return -1; | ||
30 | } | 35 | } |
31 | 36 | ||
32 | int tst_clock_gettime(clockid_t clk_id, struct timespec *ts) | 37 | int tst_clock_gettime(clockid_t clk_id, struct timespec *ts) |
33 | { | 38 | { |
34 | +#if defined(__NR_clock_gettime) | 39 | - return syscall(SYS_clock_gettime, clk_id, ts); |
35 | return syscall(SYS_clock_gettime, clk_id, ts); | 40 | + return tst_syscall(__NR_clock_gettime, clk_id, ts); |
36 | +#endif | ||
37 | + return -1; | ||
38 | } | 41 | } |
39 | 42 | ||
40 | int tst_clock_settime(clockid_t clk_id, struct timespec *ts) | 43 | int tst_clock_settime(clockid_t clk_id, struct timespec *ts) |
41 | { | 44 | { |
42 | +#if defined(__NR_clock_settime) | 45 | - return syscall(SYS_clock_settime, clk_id, ts); |
43 | return syscall(SYS_clock_settime, clk_id, ts); | 46 | + return tst_syscall(__NR_clock_settime, clk_id, ts); |
44 | +#endif | ||
45 | + return -1; | ||
46 | } | 47 | } |
47 | diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | ||
48 | index 583d8f7b9b..b498de5b68 100644 | ||
49 | --- a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | 48 | --- a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c |
50 | +++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | 49 | +++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c |
51 | @@ -41,7 +41,11 @@ | 50 | @@ -38,10 +38,8 @@ |
52 | #include <sys/syscall.h> | 51 | #include <sys/time.h> |
52 | #include <errno.h> | ||
53 | #include "test.h" | ||
54 | -#include <sys/syscall.h> | ||
53 | #include <unistd.h> | 55 | #include <unistd.h> |
54 | 56 | - | |
55 | +#ifdef __NR_gettimeofday | 57 | -#define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) |
56 | #define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) | 58 | +#include "lapi/syscalls.h" |
57 | +#else | ||
58 | +#define gettimeofday(a,b) (-1) | ||
59 | +#endif | ||
60 | 59 | ||
61 | char *TCID = "gettimeofday01"; | 60 | char *TCID = "gettimeofday01"; |
62 | int TST_TOTAL = 1; | 61 | int TST_TOTAL = 1; |
63 | diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 62 | @@ -63,7 +61,7 @@ int main(int ac, char **av) |
64 | index 1d60f448e8..218e017df8 100644 | 63 | for (lc = 0; TEST_LOOPING(lc); lc++) { |
64 | tst_count = 0; | ||
65 | |||
66 | - TEST(gettimeofday((void *)-1, (void *)-1)); | ||
67 | + TEST(ltp_syscall(__NR_gettimeofday, (void *)-1, (void *)-1)); | ||
68 | |||
69 | /* gettimeofday returns an int, so we need to turn the long | ||
70 | * TEST_RETURN into an int to test with */ | ||
65 | --- a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 71 | --- a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c |
66 | +++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 72 | +++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c |
67 | @@ -23,7 +23,11 @@ | 73 | @@ -16,14 +16,12 @@ |
74 | #include <stdint.h> | ||
75 | #include <sys/time.h> | ||
76 | #include <stdlib.h> | ||
77 | -#include <sys/syscall.h> | ||
78 | #include <unistd.h> | ||
79 | #include <time.h> | ||
80 | #include <errno.h> | ||
68 | 81 | ||
69 | #include "tst_test.h" | 82 | #include "tst_test.h" |
70 | 83 | - | |
71 | +#ifdef __NR_gettimeofday | 84 | -#define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) |
72 | #define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) | 85 | +#include "lapi/syscalls.h" |
73 | +#else | ||
74 | +#define gettimeofday(a,b) (-1) | ||
75 | +#endif | ||
76 | 86 | ||
77 | static volatile sig_atomic_t done; | 87 | static volatile sig_atomic_t done; |
78 | static char *str_rtime; | 88 | static char *str_rtime; |
79 | -- | 89 | @@ -48,13 +46,13 @@ static void verify_gettimeofday(void) |
80 | 2.25.0 | 90 | |
81 | 91 | alarm(rtime); | |
92 | |||
93 | - if (gettimeofday(&tv1, NULL)) { | ||
94 | + if (tst_syscall(__NR_gettimeofday, &tv1, NULL)) { | ||
95 | tst_res(TBROK | TERRNO, "gettimeofday() failed"); | ||
96 | return; | ||
97 | } | ||
98 | |||
99 | while (!done) { | ||
100 | - if (gettimeofday(&tv2, NULL)) { | ||
101 | + if (tst_syscall(__NR_gettimeofday, &tv2, NULL)) { | ||
102 | tst_res(TBROK | TERRNO, "gettimeofday() failed"); | ||
103 | return; | ||
104 | } | ||