Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1200400imj; Sun, 17 Feb 2019 00:00:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IYT8WxJ080nk+AUhQS0223JRhuz59DcTqs6g4CHJIBkpcMXSFas8kqOAS1WeylGO0avfeOy X-Received: by 2002:a17:902:28e6:: with SMTP id f93mr18783646plb.239.1550390416042; Sun, 17 Feb 2019 00:00:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550390416; cv=none; d=google.com; s=arc-20160816; b=N+aYbzyFNJpc/yxPilPGQVELI3SssUDbytbep6QU4sYW53aP6MhCmd3vaYiIez8SOF VpuQqaVCmsNhzrUsYlx8s89Zhi5fY/ym3QkngPN7ss1WqWLRbanEaVD8Bl5mC2L34Q48 tan5aJxhL4BJTZ44Ub8xTit7dGfmw1kL7grawyVRVCSRBS7BBkNsKDjBTaCAyCo9JQHJ xE8d3AJ8+6my8tLWZEsdnmOzmImfpuxvP+Yi8Y++sFUz3+iwsRSAmCQFcDBw5HuGf6jV lrUMSUDswNCRN9dvSOFBMwlqRNNXr+v/RRsD8WE+aOAmXzZQRIy4teuXxIg0LTHRNC4f EEUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=bDrRIyexdoN6f6NiLGLnUuK4sBrUfHJLO2YaKHKipGQ=; b=WsTclrktZVx7B/Mvr00/WG9fbBNCRv7OiMhgPXx9Pw3UkhHYN9+hVbKc3wZvZeN3BJ vbuxP44Pop2bYV87Yadm+kNstl9Nqjbc0suc062UHCYs1JkcWbQQjNwIajmdZjgPqY73 QBfrtYf0Rm2cuzwOM2+KSTv8cYswHZ8vMYD4y6UnL98gtvGCnELXMgtfhX953rzd4fTF MRWMpFSBF0hWaow5kczhKOhed0exTXh6yOQXuc87yh2+qmhUBpbTQiJCZixp0xRZu9Sj UV3CQVaeiHfTmY6yPR29Ha81S114r5/BYEWmDZPVr37MP2CEIGglpEVLuG9jmLegHH4n oeGg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si10389056plo.53.2019.02.16.23.59.59; Sun, 17 Feb 2019 00:00:16 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727443AbfBQACo (ORCPT + 99 others); Sat, 16 Feb 2019 19:02:44 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:52576 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbfBQACo (ORCPT ); Sat, 16 Feb 2019 19:02:44 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.91 #2 (Red Hat Linux)) id 1gv9un-0002Ak-IL; Sun, 17 Feb 2019 00:02:37 +0000 Date: Sun, 17 Feb 2019 00:02:37 +0000 From: Al Viro To: Andy Lutomirski Cc: Thomas Gleixner , Jann Horn , baloo@gandi.net, the arch/x86 maintainers , Ingo Molnar , Borislav Petkov , kernel list , Pascal Bouchareine Subject: Re: [PATCH] x86: uaccess: fix regression in unsafe_get_user Message-ID: <20190217000237.GQ2217@ZenIV.linux.org.uk> References: <20190215235901.23541-1-baloo@gandi.net> <4F2693EA-1553-4F09-9475-781305540DBC@amacapital.net> <20190216234702.GP2217@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190216234702.GP2217@ZenIV.linux.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 16, 2019 at 11:47:02PM +0000, Al Viro wrote: > On Sat, Feb 16, 2019 at 02:50:15PM -0800, Andy Lutomirski wrote: > > > What is the actual problem? We’re not actually demand-faulting this data, are we? Are we just overrunning the buffer because the from_user helpers are too clever? Can we fix it for real by having the fancy helpers do *aligned* loads so that they don’t overrun the buffer? Heck, this might be faster, too. > > Unaligned _stores_ are not any cheaper, and you'd get one hell of > extra arithmetics from trying to avoid both. Check something > like e.g. memcpy() on alpha, where you really have to keep all > accesses aligned, both on load and on store side. > > Can't we just pad the buffers a bit? Making sure that name_buf > and symlink_buf are _not_ followed by unmapped pages shouldn't > be hard. Both are allocated by kmalloc(), so... > > What am I missing here? ... the fact that read_info() might skip copying if everything it wants is already in the buffer passed by decompressor ;-/ It's been a while since I looked into that code...