From: Andrew Morton <akpm@linux-foundation.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-kernel@vger.kernel.org, xemul@virtuozzo.com
Subject: Re: [PATCH] proc: fix /proc/*/map_files lookup
Date: Mon, 20 Nov 2017 14:16:14 -0800 [thread overview]
Message-ID: <20171120141614.b1c4d42da8503963d887917b@linux-foundation.org> (raw)
In-Reply-To: <20171120212706.GA14325@avx2>
On Tue, 21 Nov 2017 00:27:06 +0300 Alexey Dobriyan <adobriyan@gmail.com> wrote:
> Current code does:
>
> if (sscanf(dentry->d_name.name, "%lx-%lx", start, end) != 2)
>
> However sscanf() is broken garbage.
>
> It silently accepts whitespace between format specifiers
> (did you know that?).
>
> It silently accepts valid strings which result in integer overflow.
>
> Do not use sscanf() for any even remotely reliable parsing code.
>
> OK
> # readlink '/proc/1/map_files/55a23af39000-55a23b05b000'
> /lib/systemd/systemd
>
> broken
> # readlink '/proc/1/map_files/ 55a23af39000-55a23b05b000'
> /lib/systemd/systemd
>
> broken
> # readlink '/proc/1/map_files/55a23af39000-55a23b05b000 '
> /lib/systemd/systemd
>
> very broken
> # readlink '/proc/1/map_files/1000000000000000055a23af39000-55a23b05b000'
> /lib/systemd/systemd
>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> Cc: stable@kernel.org
OK, but why is this a problem worthy of backporting into -stable kernels?
next prev parent reply other threads:[~2017-11-20 22:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-20 21:27 Alexey Dobriyan
2017-11-20 22:16 ` Andrew Morton [this message]
2017-11-21 5:48 ` Alexey Dobriyan
2017-11-28 5:29 ` Andrei Vagin
2017-11-28 10:12 ` Alexey Dobriyan
2017-11-29 22:56 ` Andrew Morton
2017-11-29 23:23 ` Andrei Vagin
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=20171120141614.b1c4d42da8503963d887917b@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=adobriyan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xemul@virtuozzo.com \
/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
all inboxes | Powered by JetHome®