From: Zheng Liu <gnehzuil.liu@gmail.com>
To: Bruno.Faccini@BULL.NET
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: Simple echo command to /proc//limits fails with EINVAL due to unhandled leading \n !!
Date: Tue, 6 Dec 2011 09:58:19 +0800 [thread overview]
Message-ID: <20111206015819.GA10068@gmail.com> (raw)
In-Reply-To: <OF39D62938.69D3A85D-ONC125795B.00540D03-C125795B.00550B8C@bull.net>
On Sat, Dec 03, 2011 at 04:28:54PM +0100, Bruno.Faccini@BULL.NET wrote:
> Hello,
>
> I am brand new as a subscriber, in fact I was a long time ago and I need
> to learn the "rules" again !!
Hi,
Would you mind adding 'Signed-off-by' to sign your work? Please read
Documentation/SubmittingPatches and that can help you to learn the
rules. :-)
Regards,
Zheng
> I found this problem running with 2.6.32 Kernel, but seems that the
> current source-tree still has the problem/limitation ...
> That's not a critical problem, but since (like in my case when I faced it
> !!) it may prevent to debug much-more complicated ones simply because
> people who want to take a core-file for some process and will not be able
> to do so simply because it !!!
>
> Here is the scenario/reproducer :
> =================================
> # echo "Max core file size=1000:unlimited" > /proc/3299/limits
> -bash: echo: write error: Invalid argument
> # echo -n "Max core file size=1000:unlimited" > /proc/3299/limits
> #
> =================================
>
> The EINVAL comes from the fact all chars, including the '\n' are taken
> into account to compare with the "unlimited" string ...
>
> This can be easily fixed, and may be help some debuggers to be able to get
> a core-file ..., I think with the following fix :
> ==================================================
> # diff -urN fs/proc/base.c.orig fs/proc/base.c.bfi
> --- fs/proc/base.c.orig 2011-03-26 19:42:26.000000000 +0100
> +++ fs/proc/base.c.bfi 2011-11-14 20:16:29.000000000 +0100
> @@ -562,7 +562,7 @@
> delim = next + 1;
> new_rlimit.rlim_max = simple_strtoul(delim, &next, 0);
> if (*next != 0) {
> - if (strcmp(delim, "unlimited")) {
> + if (strncmp(delim, "unlimited",9)) {
> count = -EINVAL;
> goto put_task;
> }
>
> #
> ==================================================
>
> BTW, it works/fixes not only for core-file but for any limit's hard/max
> value change to "unlimited".
>
> Best Regards.
> B.Faccini (Bull)
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2011-12-06 1:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-03 15:28 Simple echo command to /proc//limits fails with EINVAL due to unhandled leading \n !! Bruno.Faccini
2011-12-06 1:58 ` Zheng Liu [this message]
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=20111206015819.GA10068@gmail.com \
--to=gnehzuil.liu@gmail.com \
--cc=Bruno.Faccini@BULL.NET \
--cc=linux-fsdevel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).