[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171120141614.b1c4d42da8503963d887917b@linux-foundation.org>
Date: Mon, 20 Nov 2017 14:16:14 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: linux-kernel@...r.kernel.org, xemul@...tuozzo.com
Subject: Re: [PATCH] proc: fix /proc/*/map_files lookup
On Tue, 21 Nov 2017 00:27:06 +0300 Alexey Dobriyan <adobriyan@...il.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@...il.com>
> Cc: stable@...nel.org
OK, but why is this a problem worthy of backporting into -stable kernels?
Powered by blists - more mailing lists