Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp454989ybc; Fri, 22 Nov 2019 07:50:14 -0800 (PST) X-Google-Smtp-Source: APXvYqwlfzYLJAqbL3/Di8ScDGI1cvaSdQL9vqHO2UuTkgIRRnZd1tR5GjM5PaERoFo7IoVmHagP X-Received: by 2002:a17:906:1da1:: with SMTP id u1mr23251088ejh.275.1574437814121; Fri, 22 Nov 2019 07:50:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574437814; cv=none; d=google.com; s=arc-20160816; b=PkvqDsDxSIQ1PPw4QkZaeVOjNddO5sqGUBxWVOAc8G0hnpmbOs3qQA+2ATxwytK6gl HDDsspjq6oKmXjxad9vofQYSy1QUaXrMMRMUx36XP5s6CojGp/NKlpxd/uOEMujXsHkA 2TZVglVLGj4xsl5612dDypE6xSP3mKcZ/ze6+srPXcCeKgj7UdcVmMph/ZWkkmKtTLnB DOtl4G3gAi8w1NrhKvuhajTAAjowfyy9o8gykRU9xQemJQwZcba81ZrqXfi+3QRmv6R1 hL2FbZ0WhDqHeNGYRTPFqazgkqfNeDXZE064Z/qqDisW1Xs4I/9R/reGdtJHfbCWDTf/ UeRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VoLw4CussgMLLZxAWl96Nmphb4wWEeXh0ad0ursaGQc=; b=QxfNAbJVjuX5TziQ5HmFtjV8mgUaQqEfG9USGVPkaFmgXRA8r2pfyfP2KKHku1wOKi AsnNsS44WN4FushxVqRhOcAF+LcHp6Cw9ZloI8F3CI/KOjoTyQxODxoTHjLidue7ex3C cQCzUc/wSr9+LEqveDmlKqudc96iu/CVFbfomuiDi9VUOP4jy5z9NPpEsbaC4yZiNZyA bFhhZ4osim6QN1YNfCty/0F8xtXO/uAXDdgE3GoN4TuT/jkImrQ3QO0HDfU0WWux4ihu t8dlYVZdl3dtafpos+hF+louZl7htPhj4z7Zv26Gk+YcvsWRy7kQM4VT/ezT7EttZV7J 3g1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=GNOwZ31n; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si4862585edp.264.2019.11.22.07.49.50; Fri, 22 Nov 2019 07:50:14 -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=@google.com header.s=20161025 header.b=GNOwZ31n; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727187AbfKVPsd (ORCPT + 99 others); Fri, 22 Nov 2019 10:48:33 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:41837 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727112AbfKVPsc (ORCPT ); Fri, 22 Nov 2019 10:48:32 -0500 Received: by mail-ot1-f67.google.com with SMTP id 94so6535336oty.8 for ; Fri, 22 Nov 2019 07:48:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VoLw4CussgMLLZxAWl96Nmphb4wWEeXh0ad0ursaGQc=; b=GNOwZ31nRkkRtCObNuW1iTtfgqFs92bLcrWVBnJDrDrWXxmhu5jHB1W3qmVloZkxvv I7lirUZJKHODNPKD8Lnhi1ZLbKVQi7hxFaJzn/8+1mFtnqWsCvgnOwcKT0a6fk0Mla7C lx72owbQ9FRTQQcHSyruPmj48sUfj0BaZnq2eCQ8XSe/1cCVnNtF2jxyft38Pdxbwy+D BsjLNJnCvMgH+MyHNHBALbAnxXC3D5Hk0RwttL4/6f2iEN6bso1fq9MkYaIS8VQwNkNR HrqaQ3hAl2JuwpjiD912NpJ2AAxN7ZNLl0ehoc2hXpCxpqDZWuMounqR9hupqFGVoJC5 3kmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VoLw4CussgMLLZxAWl96Nmphb4wWEeXh0ad0ursaGQc=; b=Em+Zc7ODyUc4Cdoo5RF8RkCImUWhO1/+rMSwqZJ418Qg/LqWul4pSm7lJzOfWmROhJ yL5wPQo++riCzDwdYmwM36K5rAncVTxcHnAuw6byIXqQGltBpdMVbR+dyW8nhps3+aU8 hvZhD7HFXiv1qy/8M9xZxuXkMMGIxa7XzhLDwxisYywXWxbWhpEvovzEmeycCHZb9PQY x7xABhCGtiihRYH0Q7P0krboKw6yj4064uH+Dxcc9EyE6mveTf+mWGVQieaKSh14dtlk 8gaV0C9ife53JpYo8aK+t0+lb56k04GJi6JdqCAK5q3Gol0TQjA59/SKqTjwv228LyiB fdTA== X-Gm-Message-State: APjAAAU8txuNFuTFvYUbfu8eWtNJK4UGSvowH2Rfo6ZIm7PgHuwF30I/ QqmpIxLgIanzEkVGGkFgtbgU+Pf0pLkcaAvzRvQDbNDaw4FfTiE0 X-Received: by 2002:a9d:82e:: with SMTP id 43mr11609145oty.23.1574437711101; Fri, 22 Nov 2019 07:48:31 -0800 (PST) MIME-Version: 1.0 References: <20191120203434.2a0727b3@canb.auug.org.au> <58708908-84a0-0a81-a836-ad97e33dbb62@infradead.org> <20191121183711.w2qnysscwnbxocc4@treble> In-Reply-To: From: Marco Elver Date: Fri, 22 Nov 2019 16:48:20 +0100 Message-ID: Subject: Re: linux-next: Tree for Nov 20 (kcsan + objtool) To: Josh Poimboeuf Cc: Randy Dunlap , Stephen Rothwell , Linux Next Mailing List , Linux Kernel Mailing List , Dmitry Vyukov , "Paul E. McKenney" , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 Nov 2019 at 19:43, Marco Elver wrote: > > On Thu, 21 Nov 2019 at 19:37, Josh Poimboeuf wrote: > > > > On Wed, Nov 20, 2019 at 08:48:41PM +0100, Marco Elver wrote: > > > On Wed, 20 Nov 2019 at 17:18, Randy Dunlap wrote: > > > > > > > > On 11/20/19 1:34 AM, Stephen Rothwell wrote: > > > > > Hi all, > > > > > > > > > > Changes since 20191119: > > > > > > > > > > > > > on x86_64: > > > > > > > > kernel/kcsan/core.o: warning: objtool: kcsan_found_watchpoint()+0xa: call to kcsan_is_enabled() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read1()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write1()+0x10: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read2()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write2()+0x10: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read4()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write4()+0x10: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read8()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write8()+0x10: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read16()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write16()+0x10: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read_range()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write_range()+0x10: call to find_watchpoint() with UACCESS enabled > > > > > > > > kernel/trace/trace_branch.o: warning: objtool: ftrace_likely_update()+0x361: call to __stack_chk_fail() with UACCESS enabled > > > > > > > > > > > > Full randconfig file is attached. > > > > > > Thanks. > > > > > > This is due to CONFIG_CC_OPTIMIZE_FOR_SIZE=y. It seems the compiler > > > decides to not even inline small static inline functions. I tried to > > > make this go away by adding __always_inline, but then we're also left > > > with atomic64_try_cmpxchg which never gets inlined. > > > > > > The optimized build simply inlines the small static inline functions. > > > We certainly do not want to add more functions to the objtool > > > whitelist, especially those that are private to KCSAN. > > > > > > We could fix it by either: > > > > > > 1. Adding __always_inline to every function used by the KCSAN runtime > > > outside user_access_save + also fix atomic64_try_cmpxchg > > > (atomic-instrumented.h). > > > > > > 2. Just not compile KCSAN with -Os, i.e. have the Makefile strip -Os > > > and replace it with -O2 for kcsan/core.c. #2 is the simpler option, > > > and would probably make KCSAN more effective even with -Os. Although > > > it might violate the assumption of whoever decided they want both > > > CC_OPTIMIZE_FOR_SIZE and KCSAN. It might also mean that future > > > compilers that have a new inlining algorithm will have the same > > > problem. > > > > > > What do people think is better? > > > > I haven't had a chance to look at this yet, and probably won't be able > > to do so until at least Monday... > > > > Adding PeterZ who's the objtool uaccess expert. > > Thanks. I have a patch which does #1, since it's probably cleaner. I > will send it out soon. > > If there is a better way to resolve this, any suggestions welcome. I have sent a patch which addresses the issue: http://lkml.kernel.org/r/20191122154221.247680-1-elver@google.com It is currently based on the locking/kcsan branch of the tip tree. Thanks, -- Marco