[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwa-mxOFKGiLmbxyJ+LyEjOG07fuYOmcWaYf-SJntneuw@mail.gmail.com>
Date: Wed, 20 Jun 2018 06:56:04 +0900
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Michal Kubecek <mkubecek@...e.cz>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Alexey Dobriyan <adobriyan@...il.com>
Subject: Re: [PATCH] proc: add missing '\0' back to /proc/$pid/cmdline
On Wed, Jun 20, 2018 at 1:24 AM Michal Kubecek <mkubecek@...e.cz> wrote:
>
> Recent rewrite introduced a regression, /proc/$pid/cmdline is missing the
> trailing null character:
>
> mike@...n:/tmp> cat /proc/self/cmdline | od -t c
> 0000000 c a t \0 / p r o c / s e l f / c
> 0000020 m d l i n e
> 0000026
Thanks, and obviously right you are.
That said, I'm not a fan of your patch. I'd much rather just tweak the
"strnlen()" logic a bit instead, and make the rule be that when we go
into the "slop" area, we always include the last byte of the "real"
argv area.
That limits the slop to a page (well, one byte less, since we want the
one byte of non-slop), but honestly, a page for *everything* was what
we used to do originally, so..
How does the attached patch work for you?
Linus
View attachment "patch.diff" of type "text/x-patch" (1856 bytes)
Powered by blists - more mailing lists