* Simple echo command to /proc//limits fails with EINVAL due to unhandled leading \n !!
@ 2011-12-03 15:28 Bruno.Faccini
2011-12-06 1:58 ` Zheng Liu
0 siblings, 1 reply; 2+ messages in thread
From: Bruno.Faccini @ 2011-12-03 15:28 UTC (permalink / raw)
To: linux-fsdevel
Hello,
I am brand new as a subscriber, in fact I was a long time ago and I need
to learn the "rules" again !!
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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Simple echo command to /proc//limits fails with EINVAL due to unhandled leading \n !!
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
0 siblings, 0 replies; 2+ messages in thread
From: Zheng Liu @ 2011-12-06 1:58 UTC (permalink / raw)
To: Bruno.Faccini; +Cc: linux-fsdevel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-06 1:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).