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:46:46 +0000 |
commit | 5df9d43a7173e396bb39ff21183b67ba52681993 (patch) | |
tree | c4cd747efe40596dc80afc140b661ccc250c1c0c /meta | |
parent | f4a520cc827187d83f2997614d893bba7d74a152 (diff) | |
download | openembedded-core-contrib-5df9d43a7173e396bb39ff21183b67ba52681993.tar.gz |
ltp: Use upstreamed patch for time64 syscall fixes
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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 @@ -From 09e631419d9763a4ff08b32d9801c12b475d8ec5 Mon Sep 17 00:00:00 2001 +From b66905b094e08a84c30bc135003c3611f65d53ec Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 12 Feb 2020 22:22:17 -0800 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 no longer exist, therefore its better to check for them being available before using them -Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2020-February/015400.html] +Upstream-Status: Submitted [https://patchwork.ozlabs.org/patch/1241258/] Signed-off-by: Khem Raj <raj.khem@gmail.com> --- - lib/tst_clocks.c | 9 +++++++++ - testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | 4 ++++ - testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 4 ++++ - 3 files changed, 17 insertions(+) + lib/tst_clocks.c | 9 +++++---- + testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | 6 ++---- + testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 8 +++----- + 3 files changed, 10 insertions(+), 13 deletions(-) -diff --git a/lib/tst_clocks.c b/lib/tst_clocks.c -index 35798a4aaf..6a5b05c4ea 100644 --- a/lib/tst_clocks.c +++ b/lib/tst_clocks.c -@@ -28,15 +28,24 @@ +@@ -22,21 +22,22 @@ + #define _GNU_SOURCE + #include <unistd.h> + #include <time.h> +-#include <sys/syscall.h> +- ++#define TST_NO_DEFAULT_MAIN ++#include "tst_test.h" + #include "tst_clocks.h" ++#include "lapi/syscalls.h" int tst_clock_getres(clockid_t clk_id, struct timespec *res) { -+#if defined(__NR_clock_getres) - return syscall(SYS_clock_getres, clk_id, res); -+#endif -+ return -1; +- return syscall(SYS_clock_getres, clk_id, res); ++ return tst_syscall(__NR_clock_getres, clk_id, res); } int tst_clock_gettime(clockid_t clk_id, struct timespec *ts) { -+#if defined(__NR_clock_gettime) - return syscall(SYS_clock_gettime, clk_id, ts); -+#endif -+ return -1; +- return syscall(SYS_clock_gettime, clk_id, ts); ++ return tst_syscall(__NR_clock_gettime, clk_id, ts); } int tst_clock_settime(clockid_t clk_id, struct timespec *ts) { -+#if defined(__NR_clock_settime) - return syscall(SYS_clock_settime, clk_id, ts); -+#endif -+ return -1; +- return syscall(SYS_clock_settime, clk_id, ts); ++ return tst_syscall(__NR_clock_settime, clk_id, ts); } -diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c -index 583d8f7b9b..b498de5b68 100644 --- a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c +++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c -@@ -41,7 +41,11 @@ - #include <sys/syscall.h> +@@ -38,10 +38,8 @@ + #include <sys/time.h> + #include <errno.h> + #include "test.h" +-#include <sys/syscall.h> #include <unistd.h> - -+#ifdef __NR_gettimeofday - #define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) -+#else -+#define gettimeofday(a,b) (-1) -+#endif +- +-#define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) ++#include "lapi/syscalls.h" char *TCID = "gettimeofday01"; int TST_TOTAL = 1; -diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c -index 1d60f448e8..218e017df8 100644 +@@ -63,7 +61,7 @@ int main(int ac, char **av) + for (lc = 0; TEST_LOOPING(lc); lc++) { + tst_count = 0; + +- TEST(gettimeofday((void *)-1, (void *)-1)); ++ TEST(ltp_syscall(__NR_gettimeofday, (void *)-1, (void *)-1)); + + /* gettimeofday returns an int, so we need to turn the long + * TEST_RETURN into an int to test with */ --- a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c +++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c -@@ -23,7 +23,11 @@ +@@ -16,14 +16,12 @@ + #include <stdint.h> + #include <sys/time.h> + #include <stdlib.h> +-#include <sys/syscall.h> + #include <unistd.h> + #include <time.h> + #include <errno.h> #include "tst_test.h" - -+#ifdef __NR_gettimeofday - #define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) -+#else -+#define gettimeofday(a,b) (-1) -+#endif +- +-#define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) ++#include "lapi/syscalls.h" static volatile sig_atomic_t done; static char *str_rtime; --- -2.25.0 - +@@ -48,13 +46,13 @@ static void verify_gettimeofday(void) + + alarm(rtime); + +- if (gettimeofday(&tv1, NULL)) { ++ if (tst_syscall(__NR_gettimeofday, &tv1, NULL)) { + tst_res(TBROK | TERRNO, "gettimeofday() failed"); + return; + } + + while (!done) { +- if (gettimeofday(&tv2, NULL)) { ++ if (tst_syscall(__NR_gettimeofday, &tv2, NULL)) { + tst_res(TBROK | TERRNO, "gettimeofday() failed"); + return; + } |