lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVxJT8Y42kAubjUBwJOzjOA_FcvAZQO4roFKsYA1sHci8vapg@mail.gmail.com>
Date:	Wed, 27 May 2015 13:17:33 +0300
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Jarod Wilson <jwilson@...hat.com>
Cc:	Jarod Wilson <jarod@...hat.com>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH try #4] proc: fix PAGE_SIZE limit of /proc/$PID/cmdline

On Wed, May 27, 2015 at 8:27 AM, Jarod Wilson <jwilson@...hat.com> wrote:
> On May 26, 2015, at 5:24 PM, Alexey Dobriyan <adobriyan@...il.com> wrote:
>>
>>> On Tue, May 26, 2015 at 04:42:36PM -0400, Jarod Wilson wrote:
>>>> On 5/8/2015 8:28 AM, Alexey Dobriyan wrote:
>>>> /proc/$PID/cmdline truncates output at PAGE_SIZE. It is easy to see with
>>>>
>>>>    $ cat /proc/self/cmdline $(seq 1037) 2>/dev/null
>>>>
>>>> However, command line size was never limited to PAGE_SIZE but to 128 KB and
>>>> relatively recently limitation was removed altogether.
>>>>
>>>> People noticed and ask questions:
>>>> http://stackoverflow.com/questions/199130/how-do-i-increase-the-proc-pid-cmdline-4096-byte-limit
>>>>
>>>> seq file interface is not OK, because it kmalloc's for whole output and
>>>> open + read(, 1) + sleep will pin arbitrary amounts of kernel memory.
>>>> To not do that, limit must be imposed which is incompatible with
>>>> arbitrary sized command lines.
>>>>
>>>> I apologize for hairy code, but this it direct consequence of command line
>>>> layout in memory and hacks to support things like "init [3]".
>>>>
>>>> The loops are "unrolled" otherwise it is either macros which hide
>>>> control flow or functions with 7-8 arguments with equal line count.
>>>>
>>>> There should be real setproctitle(2) or something.
>>>>
>>>> Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
>>>> Tested-by: Jarod Wilson <jarod@...hat.com>
>>>> Acked-by: Jarod Wilson <jarod@...hat.com>
>>>
>>> Should have tested on more than just x86, it appears. We've started
>>> hammering on this internally across all arches, and its exploded
>>> multiple times on ppc64 now:
>>>
>>> [ 2717.074699] ------------[ cut here ]------------
>>> [ 2717.074787] kernel BUG at fs/proc/base.c:244!
>>
>>> OE--------------   3.10.0-255.el7.ppc64.debug #1
>>
>> Which BUG_ON is this?
>>
>>    BUG_ON(*pos < 0);
>>    BUG_ON(arg_start > arg_end);
>>    BUG_ON(env_start > env_end);
>
> Ah, sorry, right, might not be exactly the same with the back-up ported version... It was the env_start > env_end one.

Patch is OK. Checkpoint/restart people aren't checking syscall input properly:

        case PR_SET_MM_ENV_END:
                if (!vma) {
                        error = -EFAULT;
                        goto out;
                }
                if (opt == PR_SET_MM_START_STACK)
                        mm->start_stack = addr;
                else if (opt == PR_SET_MM_ARG_START)
                        mm->arg_start = addr;
                else if (opt == PR_SET_MM_ARG_END)
                        mm->arg_end = addr;
                else if (opt == PR_SET_MM_ENV_START)
                        mm->env_start = addr;
                else if (opt == PR_SET_MM_ENV_END)
                        mm->env_end = addr;
                break;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ