From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752793AbdK2W4G (ORCPT ); Wed, 29 Nov 2017 17:56:06 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:51028 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752342AbdK2W4F (ORCPT ); Wed, 29 Nov 2017 17:56:05 -0500 Date: Wed, 29 Nov 2017 14:56:03 -0800 From: Andrew Morton To: Andrei Vagin Cc: Alexey Dobriyan , linux-kernel@vger.kernel.org, xemul@virtuozzo.com Subject: Re: proc: fix /proc/*/map_files lookup Message-Id: <20171129145603.3adf4f0ba2bc9d4a4698d552@linux-foundation.org> In-Reply-To: <20171128052924.GA7047@outlook.office365.com> References: <20171120212706.GA14325@avx2> <20171128052924.GA7047@outlook.office365.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 27 Nov 2017 21:29:25 -0800 Andrei Vagin wrote: > On Tue, Nov 21, 2017 at 12:27:06AM +0300, Alexey Dobriyan 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. > > This patch breaks criu, criu has one places where a file name is generated > as map_files/%p-%p > > openat(1048572, "map_files/0x7f9912dd5000-0x7f9912de4000", O_RDWR) = -1 ENOENT (No such file or directory) <0.000015> > > And this code worked before this patch and it doesn't work with this > patch. And you have to know that we never break user-space programs ;) > > But seriously, the patch looks good to me, but I would prefer to not queue > it into stable kernels. The patch breaks CRIU but you're OK with merging it? How does that work ;) Now I'm worried that it will break other things.