summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/ltp
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-04-23 23:30:10 +0100
commit6f1c0f9be9bb9de52268563f43f4bfc793284341 (patch)
tree0d57784e02277fb6cdf5dae7594f76d8f1b3d689 /meta/recipes-extended/ltp
parent1b423547803e97fac0bbc3c94d5bab4f2dba83ae (diff)
downloadopenembedded-core-contrib-6f1c0f9be9bb9de52268563f43f4bfc793284341.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" Signed-off-by: He Zhe <zhe.he@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/ltp')
-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 @@
+From db57ddc1497e72947da2b14f471ab521478ef99d Mon Sep 17 00:00:00 2001
+From: Tommi Rantala <tommi.t.rantala@nokia.com>
+Date: Thu, 31 Jan 2019 19:49:00 +0200
+Subject: [PATCH] syscalls/setrlimit03.c: read /proc/sys/fs/nr_open for
+ RLIMIT_NOFILE limit
+
+Since kernel v2.6.25 RLIMIT_NOFILE limit is no longer hardcoded to
+NR_OPEN, but can be set via /proc/sys/fs/nr_open, see kernel commit
+9cfe015aa424b3c003baba3841a60dd9b5ad319b ("get rid of NR_OPEN and
+introduce a sysctl_nr_open").
+
+nr_open default value is 1024*1024, so setrlimit03 has been passing fine
+on new kernels, only "unexpectedly succeeding" if nr_open is set to some
+larger value.
+
+Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
+Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
+
+Upstream-Status: Backport [db57ddc1497e ("syscalls/setrlimit03.c: read /proc/sys/fs/nr_open for RLIMIT_NOFILE limit")]
+
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ testcases/kernel/syscalls/setrlimit/setrlimit03.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit03.c b/testcases/kernel/syscalls/setrlimit/setrlimit03.c
+index 29b52aa..12455fe 100644
+--- a/testcases/kernel/syscalls/setrlimit/setrlimit03.c
++++ b/testcases/kernel/syscalls/setrlimit/setrlimit03.c
+@@ -35,7 +35,10 @@
+ # define NR_OPEN (1024*1024)
+ #endif
+
++#define NR_OPEN_PATH "/proc/sys/fs/nr_open"
++
+ static struct rlimit rlim1, rlim2;
++static unsigned int nr_open = NR_OPEN;
+
+ static struct tcase {
+ struct rlimit *rlimt;
+@@ -51,7 +54,10 @@ static void verify_setrlimit(unsigned int n)
+
+ TEST(setrlimit(RLIMIT_NOFILE, tc->rlimt));
+ if (TST_RET != -1) {
+- tst_res(TFAIL, "call succeeded unexpectedly");
++ tst_res(TFAIL, "call succeeded unexpectedly "
++ "(nr_open=%u rlim_cur=%lu rlim_max=%lu)", nr_open,
++ (unsigned long)(tc->rlimt->rlim_cur),
++ (unsigned long)(tc->rlimt->rlim_max));
+ return;
+ }
+
+@@ -65,10 +71,13 @@ static void verify_setrlimit(unsigned int n)
+
+ static void setup(void)
+ {
++ if (!access(NR_OPEN_PATH, F_OK))
++ SAFE_FILE_SCANF(NR_OPEN_PATH, "%u", &nr_open);
++
+ SAFE_GETRLIMIT(RLIMIT_NOFILE, &rlim1);
+ rlim2.rlim_max = rlim1.rlim_cur;
+ rlim2.rlim_cur = rlim1.rlim_max + 1;
+- rlim1.rlim_max = NR_OPEN + 1;
++ rlim1.rlim_max = nr_open + 1;
+ }
+
+ static struct tst_test test = {
+--
+2.7.4
+
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 \
file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
file://define-sigrtmin-and-sigrtmax-for-musl.patch \
file://setregid01-security-string-formatting.patch \
+ file://0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch \
"
S = "${WORKDIR}/git"