Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2937541imu; Sun, 9 Dec 2018 13:04:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/X0wxTj0XXC+xJoSXkMBSV10k9J0mq1NIMSRqmes4hRTz4OFlFZDp6Vcp2V8xM1miQBN047 X-Received: by 2002:a63:960a:: with SMTP id c10mr8612058pge.106.1544389472893; Sun, 09 Dec 2018 13:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544389472; cv=none; d=google.com; s=arc-20160816; b=iQizEl0NuQxFFFhtlPAvuZ2cpxpohlaI9FjuqyQRRqYKyFKRr1hsn478N3iw1IQsVV jpPVh5RVlov3KpMX8ErnkaF5RoNK61FyIdL1K2XPhK6M98sstRmjKOkahyt0j9W4K4Oy sRz+afF2ltji/Awvyq2gE4roNYLLFGC+pjnYK9ZIKDT5Di1wOvmYwJjLXFjzYluo/zCu LkH6060SCNc4xOd+50LHw/EFDDu5rjH2hT4NnR598RXL/0dVZv60EgoFfBxtZB2bxXuG VldU4pjDvseZ3igMnNGNfg1Is+hjgD1HIuklMgk9RVLQSepmVYdQMcbWb0vZFFwCms5W Rwmw== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=bdqZFJQaccTXL6X/SkgGu/CoX+FPC47jKsA+YF7Q/Us=; b=Jl9U/6QfsuzYxhEVdLc/b4ChNLZt5sLnRCNnsJrz0g0piBJXizJux+Dw5Ex1VF5G6b yzNSPQ7tvPBrr8P6s73FMoIjP7tnSTpaHFke0H9hwyqp01LyHq1x2A9LkbWwkmpPmxfl Bh/0+ccMwO1bTgqBSbW/6IAnNFCjpjg4csr35N5P9iY3qiqeIKOmdtyPDQ/xnj3b5Trm c57riUpsbnqOIS1OXKcDegxkdwSuh0p7RZo0mx6+WK1eQs5JxUpIOWpQCs1YHr3EXEfY S2SAnKL7SrTjOFnEJE2JPo7/W6APZSVAoCkiPgJKN9iJ/dinqjfI9WBEB7V0hLhKuOlA WiWg== 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 u188si8727083pfb.232.2018.12.09.13.04.17; Sun, 09 Dec 2018 13:04:32 -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 S1726296AbeLIVCY (ORCPT + 99 others); Sun, 9 Dec 2018 16:02:24 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:38288 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726194AbeLIVCY (ORCPT ); Sun, 9 Dec 2018 16:02:24 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.91 #2 (Red Hat Linux)) id 1gW6DV-0007v2-5b; Sun, 09 Dec 2018 21:02:21 +0000 Date: Sun, 9 Dec 2018 21:02:21 +0000 From: Al Viro To: Tycho Andersen Cc: linux-sparse@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org Subject: Re: [RFC v1] copy_{to,from}_user(): only inline when !__CHECKER__ Message-ID: <20181209210220.GB2217@ZenIV.linux.org.uk> References: <20181209204449.18906-1-tycho@tycho.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181209204449.18906-1-tycho@tycho.ws> 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 Sun, Dec 09, 2018 at 01:44:49PM -0700, Tycho Andersen wrote: > While working on some additional copy_to_user() checks for sparse, I > noticed that sparse's current copy_to_user() checks are not triggered. This > is because copy_to_user() is declared as __always_inline, and sparse > specifically looks for a call instruction to copy_to_user() when it tries > to apply the checks. > > A quick fix is to explicitly not inline when __CHECKER__ is defined, so > that sparse will be able to analyze all the copy_{to,from}_user calls. > There may be some refactoring in sparse that we can do to fix this, > although it's not immediately obvious to me how, hence the RFC-ness of this > patch. Which sparse checks do not trigger? Explain, please - as it is, I had been unable to guess what could "specifically looks for a call instruction" refer to.