All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/2] syscalls/kill11, abort01: Also raise hard limit when possible
@ 2020-02-13 10:35 Yang Xu
  2020-02-13 10:35 ` [LTP] [PATCH v2 2/2] syscalls/kill11, abort01: lower MIN_RLIMIT_CORE size Yang Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Yang Xu @ 2020-02-13 10:35 UTC (permalink / raw)
  To: ltp

Currently, running this two cases will report EINVAL error if I run "ulimit -c
1023" command firstly. From setrlimit(2)manpage, it got EINVAL error because
rlim->rlim_cur was greater than rlim->rlim_max. So raise the limit when possible.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
 testcases/kernel/syscalls/abort/abort01.c | 9 +++++++++
 testcases/kernel/syscalls/kill/kill11.c   | 8 ++++++++
 2 files changed, 17 insertions(+)

diff --git a/testcases/kernel/syscalls/abort/abort01.c b/testcases/kernel/syscalls/abort/abort01.c
index 386a22f26..6fde3721c 100644
--- a/testcases/kernel/syscalls/abort/abort01.c
+++ b/testcases/kernel/syscalls/abort/abort01.c
@@ -70,6 +70,15 @@ static void setup(void)
 
 	/* make sure we get core dumps */
 	SAFE_GETRLIMIT(RLIMIT_CORE, &rlim);
+
+	if (rlim.rlim_max < MIN_RLIMIT_CORE) {
+		if (geteuid() != 0) {
+			tst_brk(TCONF, "hard limit(%lu)less than MIN_RLIMT_CORE(%i)",
+				rlim.rlim_max, MIN_RLIMIT_CORE);
+		}
+		tst_res(TINFO, "Raising rlim_max to %i", MIN_RLIMIT_CORE);
+		rlim.rlim_max = MIN_RLIMIT_CORE;
+	}
 	if (rlim.rlim_cur < MIN_RLIMIT_CORE) {
 		rlim.rlim_cur = MIN_RLIMIT_CORE;
 		SAFE_SETRLIMIT(RLIMIT_CORE, &rlim);
diff --git a/testcases/kernel/syscalls/kill/kill11.c b/testcases/kernel/syscalls/kill/kill11.c
index 83fba5beb..4025fcc87 100644
--- a/testcases/kernel/syscalls/kill/kill11.c
+++ b/testcases/kernel/syscalls/kill/kill11.c
@@ -201,6 +201,14 @@ void setup(void)
 
 	SAFE_GETRLIMIT(NULL, RLIMIT_CORE, &rlim);
 
+	if (rlim.rlim_max < MIN_RLIMIT_CORE) {
+		if (geteuid() != 0) {
+			tst_brkm(TCONF, NULL, "hard limit(%lu)less than MIN_RLIMT_CORE(%i)",
+				rlim.rlim_max, MIN_RLIMIT_CORE);
+		}
+		tst_resm(TINFO, "Raising rlim_max to %i", MIN_RLIMIT_CORE);
+		rlim.rlim_max = MIN_RLIMIT_CORE;
+	}
 	if (rlim.rlim_cur < MIN_RLIMIT_CORE) {
 		tst_resm(TINFO, "Adjusting RLIMIT_CORE to %i", MIN_RLIMIT_CORE);
 		rlim.rlim_cur = MIN_RLIMIT_CORE;
-- 
2.18.0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH v2 2/2] syscalls/kill11, abort01: lower MIN_RLIMIT_CORE size
  2020-02-13 10:35 [LTP] [PATCH v2 1/2] syscalls/kill11, abort01: Also raise hard limit when possible Yang Xu
@ 2020-02-13 10:35 ` Yang Xu
  2020-02-13 12:40   ` Jan Stancek
  0 siblings, 1 reply; 4+ messages in thread
From: Yang Xu @ 2020-02-13 10:35 UTC (permalink / raw)
  To: ltp

From ulimit manpage, ulimit -c options used 512-bytes-block in posix mode
and used 1024-bytes-block in common mode. Usually, this case used "ulimit
 -c 1024" to test, but it will report TCONF in posix mode under unprivileged user.
Since these two cases only check correct signal, lower this size doesn't affect
this result. This also can avoid github issue(640[1],83[2]).

[1]https://github.com/linux-test-project/ltp/issues/640
[2]https://github.com/linux-test-project/ltp/issues/83

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
 testcases/kernel/syscalls/abort/abort01.c | 2 +-
 testcases/kernel/syscalls/kill/kill11.c   | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/abort/abort01.c b/testcases/kernel/syscalls/abort/abort01.c
index 6fde3721c..9505a5eec 100644
--- a/testcases/kernel/syscalls/abort/abort01.c
+++ b/testcases/kernel/syscalls/abort/abort01.c
@@ -62,7 +62,7 @@ void verify_abort(void)
 		tst_res(TFAIL, "abort() raised %s", tst_strsig(sig));
 }
 
-#define MIN_RLIMIT_CORE (1024 * 1024)
+#define MIN_RLIMIT_CORE (512 * 1024)
 
 static void setup(void)
 {
diff --git a/testcases/kernel/syscalls/kill/kill11.c b/testcases/kernel/syscalls/kill/kill11.c
index 4025fcc87..9b81e0095 100644
--- a/testcases/kernel/syscalls/kill/kill11.c
+++ b/testcases/kernel/syscalls/kill/kill11.c
@@ -192,8 +192,7 @@ void do_child(void)
 	exit(1);
 }
 
-/* 1024 GNU blocks */
-#define MIN_RLIMIT_CORE (1024 * 1024)
+#define MIN_RLIMIT_CORE (512 * 1024)
 
 void setup(void)
 {
-- 
2.18.0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH v2 2/2] syscalls/kill11, abort01: lower MIN_RLIMIT_CORE size
  2020-02-13 10:35 ` [LTP] [PATCH v2 2/2] syscalls/kill11, abort01: lower MIN_RLIMIT_CORE size Yang Xu
@ 2020-02-13 12:40   ` Jan Stancek
  2020-02-14  5:48     ` Li Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Stancek @ 2020-02-13 12:40 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> From ulimit manpage, ulimit -c options used 512-bytes-block in posix mode
> and used 1024-bytes-block in common mode. Usually, this case used "ulimit
>  -c 1024" to test, but it will report TCONF in posix mode under unprivileged
>  user.
> Since these two cases only check correct signal, lower this size doesn't
> affect
> this result. This also can avoid github issue(640[1],83[2]).
> 
> [1]https://github.com/linux-test-project/ltp/issues/640
> [2]https://github.com/linux-test-project/ltp/issues/83
> 
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>

both look good to me, ack


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH v2 2/2] syscalls/kill11, abort01: lower MIN_RLIMIT_CORE size
  2020-02-13 12:40   ` Jan Stancek
@ 2020-02-14  5:48     ` Li Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Li Wang @ 2020-02-14  5:48 UTC (permalink / raw)
  To: ltp

On Thu, Feb 13, 2020 at 8:41 PM Jan Stancek <jstancek@redhat.com> wrote:

>
>
> ----- Original Message -----
> > From ulimit manpage, ulimit -c options used 512-bytes-block in posix mode
> > and used 1024-bytes-block in common mode. Usually, this case used "ulimit
> >  -c 1024" to test, but it will report TCONF in posix mode under
> unprivileged
> >  user.
> > Since these two cases only check correct signal, lower this size doesn't
> > affect
> > this result. This also can avoid github issue(640[1],83[2]).
> >
> > [1]https://github.com/linux-test-project/ltp/issues/640
> > [2]https://github.com/linux-test-project/ltp/issues/83
> >
> > Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
>
> both look good to me, ack
>

Tested and pushed. Thanks!

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200214/c4d5764b/attachment.htm>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-14  5:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13 10:35 [LTP] [PATCH v2 1/2] syscalls/kill11, abort01: Also raise hard limit when possible Yang Xu
2020-02-13 10:35 ` [LTP] [PATCH v2 2/2] syscalls/kill11, abort01: lower MIN_RLIMIT_CORE size Yang Xu
2020-02-13 12:40   ` Jan Stancek
2020-02-14  5:48     ` Li Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.