From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Willy Tarreau <w@1wt.eu>
Cc: Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 2/3] tools/nolibc: add support for getrlimit/setrlimit
Date: Sun, 26 Nov 2023 11:42:15 +0100 [thread overview]
Message-ID: <63a86460-23a8-4e5a-a34d-d1825c85b5a0@t-8ch.de> (raw)
In-Reply-To: <20231126092828.GB7407@1wt.eu>
On 2023-11-26 10:28:28+0100, Willy Tarreau wrote:
> Hi Thomas,
>
> > +int test_rlimit(void)
> > +{
> > + struct rlimit rlim = {
> > + .rlim_cur = 1 << 20,
> > + .rlim_max = 1 << 20,
> > + };
> > + int ret;
> > +
> > + ret = setrlimit(RLIMIT_CORE, &rlim);
> > + if (ret)
> > + return -1;
> > +
> > + rlim.rlim_cur = 0;
> > + rlim.rlim_max = 0;
> > +
> > + ret = getrlimit(RLIMIT_CORE, &rlim);
> > + if (ret)
> > + return -1;
> > +
> > + if (rlim.rlim_cur != 1 << 20)
> > + return -1;
> > + if (rlim.rlim_max != 1 << 20)
> > + return -1;
>
> I think you should used two different values here for cur and max so
> that you can also detect stupid API bugs such as a union being used
> instead of a struct, or copy-pastes in the implementation etc. For
> example using 1<<20 and 1<<21 should do the trick.
Good point, I incorporated the suggestion.
> Otherwise Ack-by me for the whole series, of course.
Thanks!
FYI I retested and pushed the series.
Thomas
next prev parent reply other threads:[~2023-11-26 10:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 23:21 [PATCH 0/3] tools/nolibc: rlimit support Thomas Weißschuh
2023-11-22 23:21 ` [PATCH 1/3] tools/nolibc: drop custom definition of struct rusage Thomas Weißschuh
2023-11-22 23:21 ` [PATCH 2/3] tools/nolibc: add support for getrlimit/setrlimit Thomas Weißschuh
2023-11-26 9:28 ` Willy Tarreau
2023-11-26 10:42 ` Thomas Weißschuh [this message]
2023-11-22 23:21 ` [PATCH 3/3] selftests/nolibc: disable coredump via setrlimit Thomas Weißschuh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=63a86460-23a8-4e5a-a34d-d1825c85b5a0@t-8ch.de \
--to=linux@weissschuh.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=w@1wt.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®