summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended
diff options
context:
space:
mode:
authorHe Zhe <zhe.he@windriver.com>2019-04-19 16:59:23 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-05-12 09:13:38 +0100
commitc5c36b5b69fdbd44afb1c64a98b0b4c1fd9b6545 (patch)
tree12a0c76a5885ac67b202b393f778b56e8d1c786e /meta/recipes-extended
parentb62826a6e75b12b4ee62cc7468edea66f7ce7269 (diff)
downloadpoky-c5c36b5b69fdbd44afb1c64a98b0b4c1fd9b6545.tar.gz
ltp: Fix setrlimit03 call succeeded unexpectedly
Backport a patch from upstream to fix the following error. "setrlimit03.c:54: FAIL: call succeeded unexpectedly" (From OE-Core rev: 908173cfbec631139283f3b35be03865eb7d73b1) Signed-off-by: He Zhe <zhe.he@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.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-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch70
-rw-r--r--meta/recipes-extended/ltp/ltp_20190115.bb1
2 files changed, 71 insertions, 0 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch b/meta/recipes-extended/ltp/ltp/0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch
new file mode 100644
index 0000000000..39623c37d8
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch
@@ -0,0 +1,70 @@
1From db57ddc1497e72947da2b14f471ab521478ef99d Mon Sep 17 00:00:00 2001
2From: Tommi Rantala <tommi.t.rantala@nokia.com>
3Date: Thu, 31 Jan 2019 19:49:00 +0200
4Subject: [PATCH] syscalls/setrlimit03.c: read /proc/sys/fs/nr_open for
5 RLIMIT_NOFILE limit
6
7Since kernel v2.6.25 RLIMIT_NOFILE limit is no longer hardcoded to
8NR_OPEN, but can be set via /proc/sys/fs/nr_open, see kernel commit
99cfe015aa424b3c003baba3841a60dd9b5ad319b ("get rid of NR_OPEN and
10introduce a sysctl_nr_open").
11
12nr_open default value is 1024*1024, so setrlimit03 has been passing fine
13on new kernels, only "unexpectedly succeeding" if nr_open is set to some
14larger value.
15
16Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
17Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
18
19Upstream-Status: Backport [db57ddc1497e ("syscalls/setrlimit03.c: read /proc/sys/fs/nr_open for RLIMIT_NOFILE limit")]
20
21Signed-off-by: He Zhe <zhe.he@windriver.com>
22---
23 testcases/kernel/syscalls/setrlimit/setrlimit03.c | 13 +++++++++++--
24 1 file changed, 11 insertions(+), 2 deletions(-)
25
26diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit03.c b/testcases/kernel/syscalls/setrlimit/setrlimit03.c
27index 29b52aa..12455fe 100644
28--- a/testcases/kernel/syscalls/setrlimit/setrlimit03.c
29+++ b/testcases/kernel/syscalls/setrlimit/setrlimit03.c
30@@ -35,7 +35,10 @@
31 # define NR_OPEN (1024*1024)
32 #endif
33
34+#define NR_OPEN_PATH "/proc/sys/fs/nr_open"
35+
36 static struct rlimit rlim1, rlim2;
37+static unsigned int nr_open = NR_OPEN;
38
39 static struct tcase {
40 struct rlimit *rlimt;
41@@ -51,7 +54,10 @@ static void verify_setrlimit(unsigned int n)
42
43 TEST(setrlimit(RLIMIT_NOFILE, tc->rlimt));
44 if (TST_RET != -1) {
45- tst_res(TFAIL, "call succeeded unexpectedly");
46+ tst_res(TFAIL, "call succeeded unexpectedly "
47+ "(nr_open=%u rlim_cur=%lu rlim_max=%lu)", nr_open,
48+ (unsigned long)(tc->rlimt->rlim_cur),
49+ (unsigned long)(tc->rlimt->rlim_max));
50 return;
51 }
52
53@@ -65,10 +71,13 @@ static void verify_setrlimit(unsigned int n)
54
55 static void setup(void)
56 {
57+ if (!access(NR_OPEN_PATH, F_OK))
58+ SAFE_FILE_SCANF(NR_OPEN_PATH, "%u", &nr_open);
59+
60 SAFE_GETRLIMIT(RLIMIT_NOFILE, &rlim1);
61 rlim2.rlim_max = rlim1.rlim_cur;
62 rlim2.rlim_cur = rlim1.rlim_max + 1;
63- rlim1.rlim_max = NR_OPEN + 1;
64+ rlim1.rlim_max = nr_open + 1;
65 }
66
67 static struct tst_test test = {
68--
692.7.4
70
diff --git a/meta/recipes-extended/ltp/ltp_20190115.bb b/meta/recipes-extended/ltp/ltp_20190115.bb
index ddf97e26ce..1d0c00b64b 100644
--- a/meta/recipes-extended/ltp/ltp_20190115.bb
+++ b/meta/recipes-extended/ltp/ltp_20190115.bb
@@ -49,6 +49,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
49 file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \ 49 file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
50 file://define-sigrtmin-and-sigrtmax-for-musl.patch \ 50 file://define-sigrtmin-and-sigrtmax-for-musl.patch \
51 file://setregid01-security-string-formatting.patch \ 51 file://setregid01-security-string-formatting.patch \
52 file://0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch \
52 " 53 "
53 54
54S = "${WORKDIR}/git" 55S = "${WORKDIR}/git"