Re: Simple echo command to /proc//limits fails with EINVAL due to unhandled leading \n !!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Dec 03, 2011 at 04:28:54PM +0100, Bruno.Faccini@xxxxxxxx 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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux