diff options
author | He Zhe <zhe.he@windriver.com> | 2017-02-08 10:58:46 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-15 20:06:41 -0800 |
commit | 9872c3d2ae80933c89ac59cbe83203bb0671f603 (patch) | |
tree | fd6bdab3fce0cc47d14db5c6122feb2bd47a7082 | |
parent | 4dfa203a65598b4aeea8b308b598d2edce6eef30 (diff) | |
download | poky-9872c3d2ae80933c89ac59cbe83203bb0671f603.tar.gz |
ltp: Fix containers/userns05 failure for lib32
Backport a patch to fix userns05 case:
<<<test_output>>>
user_namespace5 1 TFAIL : userns05.c:95: userns:parent should be not equal to cpid2
user_namespace5 1 TFAIL : userns05.c:95: userns:parent should be not equal to cpid2
user_namespace5 0 TINFO : Child process returned TPASS
user_namespace5 0 TINFO : Child process returned TPASS
user_namespace5 0 TINFO : Child process returned TFAIL
incrementing stop
Rename the previous patch to add a number prefix
(From OE-Core rev: b96c5d18839cff345a3a2c4b952dd62aad119121)
Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-extended/ltp/ltp/0039-fcntl-fix-the-time-def-to-use-time_t.patch (renamed from meta/recipes-extended/ltp/ltp/fcntl-fix-the-time-def-to-use-time_t.patch) | 0 | ||||
-rw-r--r-- | meta/recipes-extended/ltp/ltp/0040-containers-userns05-use-unsigned-int-for-ns-id.patch | 60 | ||||
-rw-r--r-- | meta/recipes-extended/ltp/ltp_20160126.bb | 3 |
3 files changed, 62 insertions, 1 deletions
diff --git a/meta/recipes-extended/ltp/ltp/fcntl-fix-the-time-def-to-use-time_t.patch b/meta/recipes-extended/ltp/ltp/0039-fcntl-fix-the-time-def-to-use-time_t.patch index f7e805a954..f7e805a954 100644 --- a/meta/recipes-extended/ltp/ltp/fcntl-fix-the-time-def-to-use-time_t.patch +++ b/meta/recipes-extended/ltp/ltp/0039-fcntl-fix-the-time-def-to-use-time_t.patch | |||
diff --git a/meta/recipes-extended/ltp/ltp/0040-containers-userns05-use-unsigned-int-for-ns-id.patch b/meta/recipes-extended/ltp/ltp/0040-containers-userns05-use-unsigned-int-for-ns-id.patch new file mode 100644 index 0000000000..4dee1f5a9b --- /dev/null +++ b/meta/recipes-extended/ltp/ltp/0040-containers-userns05-use-unsigned-int-for-ns-id.patch | |||
@@ -0,0 +1,60 @@ | |||
1 | From 3b63d350e9fe9e4271916cc0abfac65a5d6419ff Mon Sep 17 00:00:00 2001 | ||
2 | From: Jiri Jaburek <jjaburek@redhat.com> | ||
3 | Date: Tue, 7 Feb 2017 07:58:16 +0000 | ||
4 | Subject: [PATCH] containers/userns05: use unsigned int for ns id | ||
5 | |||
6 | The kernel defines it as 'unsigned int' in 'struct ns_common' | ||
7 | and formats it as | ||
8 | |||
9 | snprintf(buf, size, "%s:[%u]", ns_ops->name, ns->inum); | ||
10 | |||
11 | This change makes the test work on 32bit systems where LONG_MAX | ||
12 | is smaller than UINT_MAX. | ||
13 | |||
14 | Signed-off-by: Jiri Jaburek <jjaburek@redhat.com> | ||
15 | |||
16 | Upstream-Status: Backport | ||
17 | |||
18 | Signed-off-by: He Zhe <zhe.he@windriver.com> | ||
19 | --- | ||
20 | testcases/kernel/containers/userns/userns05.c | 8 ++++---- | ||
21 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
22 | |||
23 | diff --git a/testcases/kernel/containers/userns/userns05.c b/testcases/kernel/containers/userns/userns05.c | ||
24 | index 8d8c40a..8eac729 100644 | ||
25 | --- a/testcases/kernel/containers/userns/userns05.c | ||
26 | +++ b/testcases/kernel/containers/userns/userns05.c | ||
27 | @@ -49,18 +49,18 @@ static int child_fn1(void) | ||
28 | return 0; | ||
29 | } | ||
30 | |||
31 | -static long getusernsidbypid(int pid) | ||
32 | +static unsigned int getusernsidbypid(int pid) | ||
33 | { | ||
34 | char path[BUFSIZ]; | ||
35 | char userid[BUFSIZ]; | ||
36 | - long id = 0; | ||
37 | + unsigned int id = 0; | ||
38 | |||
39 | sprintf(path, "/proc/%d/ns/user", pid); | ||
40 | |||
41 | if (readlink(path, userid, BUFSIZ) == -1) | ||
42 | tst_resm(TFAIL | TERRNO, "readlink failure."); | ||
43 | |||
44 | - if (sscanf(userid, "user:[%ld]", &id) != 1) | ||
45 | + if (sscanf(userid, "user:[%u]", &id) != 1) | ||
46 | tst_resm(TFAIL, "sscanf failure."); | ||
47 | return id; | ||
48 | } | ||
49 | @@ -68,7 +68,7 @@ static long getusernsidbypid(int pid) | ||
50 | static void test_userns_id(void) | ||
51 | { | ||
52 | int cpid1, cpid2, cpid3; | ||
53 | - long parentuserns, cpid1userns, cpid2userns, newparentuserns; | ||
54 | + unsigned int parentuserns, cpid1userns, cpid2userns, newparentuserns; | ||
55 | |||
56 | parentuserns = getusernsidbypid(getpid()); | ||
57 | cpid1 = ltp_clone_quick(SIGCHLD, (void *)child_fn1, | ||
58 | -- | ||
59 | 2.9.3 | ||
60 | |||
diff --git a/meta/recipes-extended/ltp/ltp_20160126.bb b/meta/recipes-extended/ltp/ltp_20160126.bb index 72d465bed3..aaa63c268c 100644 --- a/meta/recipes-extended/ltp/ltp_20160126.bb +++ b/meta/recipes-extended/ltp/ltp_20160126.bb | |||
@@ -65,7 +65,8 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \ | |||
65 | file://0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \ | 65 | file://0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \ |
66 | file://0037-containers-netns_netlink-Avoid-segmentation-fault.patch \ | 66 | file://0037-containers-netns_netlink-Avoid-segmentation-fault.patch \ |
67 | file://0038-run-posix-option-group-test-replace-CWD-qith-PWD.patch \ | 67 | file://0038-run-posix-option-group-test-replace-CWD-qith-PWD.patch \ |
68 | file://fcntl-fix-the-time-def-to-use-time_t.patch \ | 68 | file://0039-fcntl-fix-the-time-def-to-use-time_t.patch \ |
69 | file://0040-containers-userns05-use-unsigned-int-for-ns-id.patch \ | ||
69 | " | 70 | " |
70 | 71 | ||
71 | S = "${WORKDIR}/git" | 72 | S = "${WORKDIR}/git" |