From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- ...eck-for-time64-unsafe-syscalls-before-usi.patch | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 external/poky/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch (limited to 'external/poky/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch') diff --git a/external/poky/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch b/external/poky/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch new file mode 100644 index 00000000..ac8f08ef --- /dev/null +++ b/external/poky/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch @@ -0,0 +1,122 @@ +From 89c5841bd148a7ae70c65f4a1ca5996b7f0cddfa Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 19 Feb 2020 22:52:04 -0800 +Subject: [PATCH] syscalls: Check for time64 unsafe syscalls before using them + +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 + +Signed-off-by: Khem Raj +Reviewed-by: Yang Xu +Reviewed-by: Petr Vorel +Signed-off-by: Petr Vorel +Upstream-Status: accepted as 5b57ae2913e2d2d167cbd3822784b4c4ba336812 +--- + lib/tst_clocks.c | 16 ++++++---------- + .../syscalls/gettimeofday/gettimeofday01.c | 6 ++---- + .../syscalls/gettimeofday/gettimeofday02.c | 8 +++----- + 3 files changed, 11 insertions(+), 19 deletions(-) + +diff --git a/lib/tst_clocks.c b/lib/tst_clocks.c +index 5195da38f..fa2f1cb84 100644 +--- a/lib/tst_clocks.c ++++ b/lib/tst_clocks.c +@@ -3,28 +3,24 @@ + * Copyright (c) 2017 Cyril Hrubis + */ + +-/* +- * clock_gettime() and clock_getres() functions +- */ +- +-#define _GNU_SOURCE +-#include + #include +-#include + ++#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) + { +- 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) + { +- 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) + { +- 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 583d8f7b9..08ea1673a 100644 +--- a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c ++++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c +@@ -38,10 +38,8 @@ + #include + #include + #include "test.h" +-#include + #include +- +-#define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) ++#include "lapi/syscalls.h" + + char *TCID = "gettimeofday01"; + int TST_TOTAL = 1; +@@ -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 */ +diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c +index 1d60f448e..5170ad2f7 100644 +--- a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c ++++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c +@@ -16,14 +16,12 @@ + #include + #include + #include +-#include + #include + #include + #include + + #include "tst_test.h" +- +-#define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) ++#include "lapi/syscalls.h" + + static volatile sig_atomic_t done; + static char *str_rtime; +@@ -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; + } +-- +2.25.1 -- cgit 1.2.3-korg