Received: by 10.223.164.202 with SMTP id h10csp4977078wrb; Wed, 29 Nov 2017 15:24:29 -0800 (PST) X-Google-Smtp-Source: AGs4zMaBmnxU9GV5IEvp9CXxr+ZbgjGS4l7R9zMto5xgNujSz9eDdR2qtDQGfz5VXZio2oJWkf/0 X-Received: by 10.84.218.143 with SMTP id r15mr515428pli.53.1511997869728; Wed, 29 Nov 2017 15:24:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511997869; cv=none; d=google.com; s=arc-20160816; b=jeINcoXusYGMgzhQkohZKEtE4pk2MUZtJRdnDXEzRBX/lw4GklKq4vRKVQG4Ep3do/ ElSnV/HVKdxhTgO1X8giZmpZYMYCiY75QzXgH8vYsJunvJogJVf0O3U6FTvCxsu/WUkJ 7qPlOk63D2O4MbVK7Pc7KB3SaAEQw0PgMuXv/1UGSfiphHoomB0JLY4gu+pob24RwVlN mk8aZIT8tS+b4jPdc0TgGHhxxftoQ7ZD3aeg8Od8SEq/S3eKgVc6kNLIoG2d2Jc5fAh2 flhy+f5VmfMpo17rE69XgF76tV6TLMo7Uq/f3mA6738fGpztuQNEdRghaAR0JOl6nZrH HpqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=sknar+jT7dWAlufXoL6y0uUI9vLKujIdZNx7mvOGYfA=; b=WCkk1Vc0WI5OTG7DxV7FhaMy7RB+PY4chGicIWjv8PQ7PjC4C4/gQpuGWjX3oQ76mo trpq4tULF/Iwaom13jqczLiuCTiyflN28x93I0puU82OnOmH8Lknv3SM0CINUuMRRqyu ZHETCNlNdpKr8jjp+M+zoLJuG7WEBOazQ6vLQwzw/N7GOCRzUip8MeCw1OBW8iot/sHl XSEVLxw11mvisePeOAgLc+tAm6SJF0cq4oH0eESZ0xhyMQ77nqTxSoiHCSZmQbmXo64J RtpKTbN+GWe+fsjnio5Kg5r64lbhWOLZtwL8WJeJLAJk9DifRlKSbT0dj+1mgin6U1L0 OVYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=cDdeU3Za; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si2006091plr.778.2017.11.29.15.24.16; Wed, 29 Nov 2017 15:24:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=cDdeU3Za; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752718AbdK2XXy (ORCPT + 99 others); Wed, 29 Nov 2017 18:23:54 -0500 Received: from mail-ve1eur01on0091.outbound.protection.outlook.com ([104.47.1.91]:45074 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752292AbdK2XXx (ORCPT ); Wed, 29 Nov 2017 18:23:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sknar+jT7dWAlufXoL6y0uUI9vLKujIdZNx7mvOGYfA=; b=cDdeU3ZasRVfwMh+LMxjFsGYCaTL47Kxdq7RGkJBLzdeWvybU/uYgurXlIJOr+7Xbec/nuXOoFp0tjdnQU3gYB5xJqcFfAHtZxYgAfmM8Xnie/CyZqyXBcwQ76IrblQipxOwryETNgypw0JFxjdDJrUkLR+JYON5fh32ESSOU3I= Received: from outlook.office365.com (65.152.152.74) by VI1PR08MB0750.eurprd08.prod.outlook.com (2a01:111:e400:5a04::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Wed, 29 Nov 2017 23:23:48 +0000 Date: Wed, 29 Nov 2017 15:23:42 -0800 From: Andrei Vagin To: Andrew Morton Cc: Alexey Dobriyan , linux-kernel@vger.kernel.org, xemul@virtuozzo.com Subject: Re: proc: fix /proc/*/map_files lookup Message-ID: <20171129232341.GA32749@outlook.office365.com> References: <20171120212706.GA14325@avx2> <20171128052924.GA7047@outlook.office365.com> <20171129145603.3adf4f0ba2bc9d4a4698d552@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20171129145603.3adf4f0ba2bc9d4a4698d552@linux-foundation.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Originating-IP: [65.152.152.74] X-ClientProxiedBy: HE1PR05CA0248.eurprd05.prod.outlook.com (2603:10a6:3:fb::24) To VI1PR08MB0750.eurprd08.prod.outlook.com (2a01:111:e400:5a04::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4784881-27d0-4591-e70d-08d537803f1d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603277);SRVR:VI1PR08MB0750; X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB0750;3:w+Y8UMfpoTn4WWB7K4INoWildoD89q220UI9Rn9RJVQIu+/twFRQjJ9OVNGxo9ZkmSDCopSbeM+uvmyVkOWlNZMoC2+chTVVOVuTcyiqmU0M2Z/Wg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P+RZFduv3SxiMvMS6S0ehNMfWodZOyBmMyxsZ/NtYZKVaiKgP5946RmlJmcjNbEemzM/nR6Az3+9Qr1olqDs+zEBC87f4dOGQRmzlnUnJAmIlZFeZ6RxZQza9HSLYeoVUTIsTsguZlM8aXixCSKiujZGJ+8GinJ85lagdACG6/Y=;4:DSzTUarOrQ3FRgxoTuVuRQexx0wlVLxmD6+tlIVI2cWXTRUN7tfG+/2sj3+E29gVSxDCjrTkYXE4PHzu72zAfyyfFtVMsqJyl24zoIeLn+Tm88W76AbU9RId+Y2NrVga+qycLUTJiMyiIWv50Jb5BUY7KPRY23RUQ1KCjJf3CscXtsAnquxJcWAoBW1udYPMDdxaSlXQVQRZdyXJKEM2tSK/G1GGgPPBgXtIZR52VQlhU4FD545yrEr1MNsarLkV2IGemPm9WMv+lDCCPFXtkQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231022)(10201501046)(3002001)(6041248)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123564025)(6072148)(201708071742011);SRVR:VI1PR08MB0750;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:VI1PR08MB0750; X-Forefront-PRVS: 05066DEDBB X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(366004)(376002)(346002)(199003)(189002)(24454002)(16586007)(316002)(39060400002)(50466002)(58126008)(6916009)(4326008)(52116002)(7696005)(6246003)(16526018)(53416004)(2906002)(8936002)(5660300001)(6666003)(2950100002)(23686003)(6506006)(68736007)(86362001)(107886003)(8676002)(229853002)(305945005)(6116002)(3846002)(83506002)(1076002)(66066001)(7736002)(69596002)(81156014)(81166006)(53936002)(55016002)(478600001)(25786009)(189998001)(9686003)(47776003)(97736004)(101416001)(106356001)(33656002)(105586002)(54356010)(50986010)(76176010)(18370500001);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR08MB0750;H:outlook.office365.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=avagin@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: =?koi8-r?Q?1;VI1PR08MB0750;23:eb2GxJt2i0XpHCgS+H/W5j+KhMEGvPXENq9jNHpOAqV?= =?koi8-r?Q?imXjlw6NT2ux2672RUvhrKPfMqrDhKqmoIxffubBzA93xn+i5flSjmmgaiVlHW?= =?koi8-r?Q?LHbOEYRVLyKJhCp459kI88OJlRO4mU0zvUDYGQx6NOZNrHDpr/UIrOIOmR+jRg?= =?koi8-r?Q?TmzwjsMLKXUIqw2fwxf8Ztm6W63aFmC6naK8JXcAZXvmvmUYDrp7b2ECo9EwOA?= =?koi8-r?Q?R9TJEUFWHgqp1mjbn9ugvBfHNLMiDG3a6tzcmhAktThtXjOVG3OGVt0ezb4tk8?= =?koi8-r?Q?1qUNzzHWbmxLDs0+yjgmvmqEVx+wIg9OcR4Va0nH2etGITkEk9r66tkChj+gcw?= =?koi8-r?Q?/7p0ysO6uPBR33fX92xj6M3tgz8JDUz2FSqL6x5eS/cjRFf+wks8mF6C0P52SO?= =?koi8-r?Q?nMBs0YkCO8aMOysFsQ1FbdRm+HubeEj4plLH50aDT1X0zVR/t5azyPs5Upoxmk?= =?koi8-r?Q?WpDt2+aZSpafNUbZAV8nbIXBTDBE4XyKhjED569xUWOgZ+f48f/ZxXEBww79Xd?= =?koi8-r?Q?7NlfMoxVFyt/x1ep0fW4Zh7ryWmO8y95jCycYU+tsVVXa2eMKnt7UXbpRvqzpV?= =?koi8-r?Q?gHlE/7yr3Dk+EuC0sHFygbQbt4apDbMlzSQrKp71vsCRvnNW6ggyYF/IZlc2OJ?= =?koi8-r?Q?rMcV0vriGrjWg98zy9M4ntE/L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0Bywmt7a7dxFkFNTRGBMEY0LkCh88TcwprS/hzULVR+uNkUwaA5vLwLG4n/SNRwvRNXn3jjfZieYzYWM2YPvNpMwzjW9l2TGswDiifw=;5:frHZ9KgLHmO6Nx7YtOo3jqV3f6+m8rJfQkdGeUyQkuYJBVcUhJpf65UgI0Z5wfX5sclTO/2tN/bcG2AGICVhrSdz9kN3LHZ7OxXwxFHbBpAvyd5PYYUT+CqX9k8Xr7Vgbtv0yFCAF16UE+zysFjjuBfDQHX8D8wfeOc6S876M7A=;24:CievFxYILxlVPg88T+vHkvHKpZOXzA/W/jl8O5Hz1ZXp4cSthyIUm0LGSz6/URq+zi4DvPTAj5rbSb/hlUwg0nQNCZiTxvuHUvv5Mvqg97M=;7:+pWj1+1maVyY8nZZ5oQKMHpgI89RKQXyYUSueNCIX90pqFtUg7UXYo7lbZiLDxcNH5+vIPpjhoUEwRZtNbhuGgocl/N5I6esWngyJ4NoNKwjHbb484oL3JvROIpoV3O1To0vS0QMhN/PV406rDFV3OzAA+idSo/vmqxBWauQrXipGMfoXEeG9hgDCAd4u0sLjh7Sz2vHVLuDoKIZ/K7zMzANinw0biLP0CCsxkVnLyL3V1ZvYKLVQDCQMiFmlxLI SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB0750;20:OtRMqYh5Q1+U4LUoFKhoGCzlsCetTmTq0ZzvSyW1QjKIwMu2XPTkasZ32rr4X8aVsAaq6QuWu9gA7fFfmtRioNREFDguwae0ipAR6nTvmrca9QMa+0JRvjuSJfzzCD8qolJ4N5AJXkHbWWw0EyJlWZfFKMlU1R0bggwsMcWaWWY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2017 23:23:48.1902 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4784881-27d0-4591-e70d-08d537803f1d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB0750 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 29, 2017 at 02:56:03PM -0800, Andrew Morton wrote: > 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 ;) It was a bug in criu. And this bug is on a minor path, which works when memfd_create() isn't available. It is a reason why I ask to not backport this patch to stable kernels. In CRIU this bug can be triggered, only if this patch will be backported to a kernel which version is lower than v3.16. > > Now I'm worried that it will break other things. I think a chance is very small. All programs should use names which listed in /proc/PID/map_files/. From 1585442988192334402@xxx Wed Nov 29 22:57:37 +0000 2017 X-GM-THRID: 1584621974020232218 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread