Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2293741ybc; Wed, 20 Nov 2019 11:50:20 -0800 (PST) X-Google-Smtp-Source: APXvYqwFRuZZWt5QMkdZ17I+pyRFoDSH+NLk1Qy7BNG5dHid2zXjdygqTxO/fuYBnl52UvIdTV2c X-Received: by 2002:a17:906:e0c8:: with SMTP id gl8mr7335642ejb.49.1574279420239; Wed, 20 Nov 2019 11:50:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574279420; cv=none; d=google.com; s=arc-20160816; b=z2+BIzgmuvub1p7SHw3avAu5ptJV1kHk3zyNf3mPD4ZZ1gyS4p4dlv8K/7GWAsiyeI 5uE0DPBJU06edujfWNv8cXDX5SnxN4sLPkE+b3cnVdNoTDl3h/jQQBReQhiPvdiJtmod 2ax60oSpfrh6xdoQankZYuFRKYAXdJipfIYzzCKeCWMtONZRKZTyC5aEkvRAmzNO6gZe J0sejUosJglEqv+I3UAbRixOemRjDzmKsPWd0lZakM4X5AAB26KydAqN4iakvoTDPeYc R6VWO49iRJOjgBXqRTDrsaWJkCp0IsRU3XbZEVdcs+1eYhOBJTINlivxFvx10OlsLMG4 br3Q== 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=dsU7uehqL7wnWMosnxZD743IVZUrswQeWUXFNhR2dAA=; b=ZgdOSz1oQcxB4/sK7qRgnpprf2S2zFL2ZPAeVKWiJMorJ0VTj3vo0AlzXlxo/8TG5V SeIPyJsuFkVstnsjNX17C0RzIxTKV22+D1BiPtbu4gwTN2C8lk5qZpotMliKRdFbd6X1 a+jIvqftveD4yRFddyxKw6svbDWDGmHKQKNzt+om3miwgDuBhEYOiFYSeYvvn610Mv+r E52vXoHGFRtPyFYHmClrXD4oBuxq8+jFdBlnyFPNtgWLmH4jIDaPgeBBP2KT58YEOD98 XZOTjiPTr/50KHVzNFNHBmpl99HwxyYcm38+oxtoKuPTLzps9Y0TMbIQ3fji4uqA2ZHn o26g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ruI8uTSH; 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 u2si92891ejo.137.2019.11.20.11.49.55; Wed, 20 Nov 2019 11:50:20 -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=ruI8uTSH; 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 S1727307AbfKTTsx (ORCPT + 99 others); Wed, 20 Nov 2019 14:48:53 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:40677 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727179AbfKTTsx (ORCPT ); Wed, 20 Nov 2019 14:48:53 -0500 Received: by mail-oi1-f194.google.com with SMTP id d22so903510oic.7 for ; Wed, 20 Nov 2019 11:48:53 -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=dsU7uehqL7wnWMosnxZD743IVZUrswQeWUXFNhR2dAA=; b=ruI8uTSHdjBoqHZ2jFzEh7W0jWZ2DMLFOLqWav6aSkbhdtZkS9s38+PTWD8ACMDMur Qgx3CVYnGVT9JwJTu/yEYBBjfU31F+UDKyGGNaed2Xi1xsxhLGDEA1/fYiemRsxVcZQD DNiz7L9xTOaVQBts8EwUnzYGQAsax0mgBWWF/7fpSEHvow8q5YEzonc4jKyCI7g8XXKX z/S81nXxfadZ6yvKvMSPvRLnk80wTuxP59PKbezy7K4BcZBKD6yY+0CG/EoHzCpqWhFs pIBzMALNOFqt5y42crsVXrLUUJgyBsMUImUxQaucbCs9+FPT5oyYy49hU5Gsn62c+Dec M6rg== 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=dsU7uehqL7wnWMosnxZD743IVZUrswQeWUXFNhR2dAA=; b=OdoAZEx/CpheVOH/B3XqObwXD/i2agiN5rhUpgxE/4VdGcskLci+lrSlojZIYXuJTI mtKaQBMUI0qK1JJKwzMbrzWIkNN7QT9TgUGVG0xen5sAt5dAJ6oITFgsMml1wXvSAuez apk9g+SglTDkDGd0F72tkloIgP6PifPa+A1G2/VDy773g++ROIeJVHbl3QiOQQY1G53l XbVdEBT7WNYY+X4Xy71h2PlR5Be+jWrheNkRJFPl8ulkcfDyA15BVjhkN16D73eaFxDy 9opq1fertqKCsKIvKyPyPfgVAEdWt9k3HwKNiD7nmsdvIsrEp9Ynh/qkcrJNFTjMOjXQ Cynw== X-Gm-Message-State: APjAAAUFlIBm/XnrSbb66gOFCRfZncX1oUWP4W/nS+1hQPA386bW2quX T0kvnf00A4e3ZjttxbcrvMeAlMiKpUSc9TNENF36zg== X-Received: by 2002:aca:d80b:: with SMTP id p11mr4437774oig.83.1574279332230; Wed, 20 Nov 2019 11:48:52 -0800 (PST) MIME-Version: 1.0 References: <20191120203434.2a0727b3@canb.auug.org.au> <58708908-84a0-0a81-a836-ad97e33dbb62@infradead.org> In-Reply-To: <58708908-84a0-0a81-a836-ad97e33dbb62@infradead.org> From: Marco Elver Date: Wed, 20 Nov 2019 20:48:41 +0100 Message-ID: Subject: Re: linux-next: Tree for Nov 20 (kcsan + objtool) To: Randy Dunlap Cc: Stephen Rothwell , Linux Next Mailing List , Linux Kernel Mailing List , Josh Poimboeuf , Dmitry Vyukov , "Paul E. McKenney" 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 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? Thanks, -- Marco > -- > ~Randy > Reported-by: Randy Dunlap