Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp787784ybk; Wed, 13 May 2020 13:07:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy68/TQGDbWUfuGgoAJ5UhWUeHve/0Br34ImrvcjEvJ/jFyVMzgMcKpJJ3qtzoFodUNlsM7 X-Received: by 2002:a17:906:b250:: with SMTP id ce16mr668740ejb.216.1589400432566; Wed, 13 May 2020 13:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589400432; cv=none; d=google.com; s=arc-20160816; b=FBqmi2YuJ73KKDW7mOzghExmMVgI6I4mL5wZjNMPtkVZ9LvrzZBE7wDC8SCNSGM1ff vp5DvffQSyx8dmb3mU/zI/oJCz4Fbg75Q3l/OTyzk1Bbf7RrnMoSAkejejpmiCO7bhpo utGQJKckvZRM5iv/65hihjPvOMGPvyqMJJ6isIo1c1xrZUsFx5l9OxQcWhW5yE6GKgZf gcEsFST2vBFe12FnzzPxFFkw0VOf0REiSWLyssqwVko3s5vesbmcJlBc8Gko5M7upCxy u/qQbMxtPqBovwQIXaYxG7FYeMPscJbON5MV+I7C200dKxYqKuavboDK01bmD7mY+m5K wJfw== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=q8bx4k6HGy5lI9oMQDUvpfRKQB8DBhk2AZO6NIPgo1s=; b=INU6SMXKQPgYQ6e4g2T1Omn15OHMcYqvWb0GKe/JCZCCgPEQjZ/PLoqfz0jX9qNHrL SNgW4H69zEHCQOjsLRmsA4RYkf2V2EJzy/bqRI3XhacZ7m7CoW51bJAsehcxbCqWjztO O1x0d/FDygamEYYPVScaTsoW9dBmmYhlaGm21tplfyfnLF8GYvk/xIsA4p7y8esMRhFR LBXvA/TuA7dBXwuwv/n+Wd7nrqHT8Dj+vQgToIaHyhknVJS/1ZEkDmY2nGB3h637BIee ew3+Ud5G9PBVU/9OCOO71A67Hp0lsV9nE+O4RIMYNcupkSTN/fFQE9Ijjmn5TXKhX64M /11w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oZX6W3Z4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cz15si363628edb.381.2020.05.13.13.06.49; Wed, 13 May 2020 13:07:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oZX6W3Z4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390687AbgEMUCU (ORCPT + 99 others); Wed, 13 May 2020 16:02:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:35296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733135AbgEMUCT (ORCPT ); Wed, 13 May 2020 16:02:19 -0400 Received: from paulmck-ThinkPad-P72.home (unknown [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D9A59205ED; Wed, 13 May 2020 20:02:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589400139; bh=11+NwsuEwZLSZ28dwjw8cleHyZ7yoUPnIjIVHyFlXTk=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=oZX6W3Z4Hjo/CTI+8u7h4Osjqks/9XTQEDwXqHFaILnzPyHu7nj9OCSmbYtMIZEMZ WXeXMsMXPJ/kFXC0egp86f7XuUfvUI1+fqN8mXB8GtWb9WSRKZuXQttBF2Zssfz4tQ jHHkoOxDKPWI1sdDiSzLEXm3JLmbU0wRlxQfZabc= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 005D5352352C; Wed, 13 May 2020 13:02:18 -0700 (PDT) Date: Wed, 13 May 2020 13:02:18 -0700 From: "Paul E. McKenney" To: Arnd Bergmann Cc: Marco Elver , Dmitry Vyukov , Ingo Molnar , Kees Cook , Andrew Morton , Thomas Gleixner , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH] [v2] ubsan, kcsan: don't combine sanitizer with kcov on clang Message-ID: <20200513200218.GA25892@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200507162617.2472578-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200507162617.2472578-1-arnd@arndb.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 07, 2020 at 06:25:31PM +0200, Arnd Bergmann wrote: > Clang does not allow -fsanitize-coverage=trace-{pc,cmp} together > with -fsanitize=bounds or with ubsan: > > clang: error: argument unused during compilation: '-fsanitize-coverage=trace-pc' [-Werror,-Wunused-command-line-argument] > clang: error: argument unused during compilation: '-fsanitize-coverage=trace-cmp' [-Werror,-Wunused-command-line-argument] > > To avoid the warning, check whether clang can handle this correctly > or disallow ubsan and kcsan when kcov is enabled. > > Link: https://bugs.llvm.org/show_bug.cgi?id=45831 > Link: https://lore.kernel.org/lkml/20200505142341.1096942-1-arnd@arndb.de > Signed-off-by: Arnd Bergmann Applied for v5.9 and pushed, thank you! Thanx, Paul > --- > v2: this implements Marco's suggestion to check what the compiler > actually supports, and references the bug report I now opened. > > Let's wait for replies on that bug report before this gets applied, > in case the feedback there changes the conclusion. > --- > lib/Kconfig.kcsan | 11 +++++++++++ > lib/Kconfig.ubsan | 11 +++++++++++ > 2 files changed, 22 insertions(+) > > diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan > index ea28245c6c1d..a7276035ca0d 100644 > --- a/lib/Kconfig.kcsan > +++ b/lib/Kconfig.kcsan > @@ -3,9 +3,20 @@ > config HAVE_ARCH_KCSAN > bool > > +config KCSAN_KCOV_BROKEN > + def_bool KCOV && CC_HAS_SANCOV_TRACE_PC > + depends on CC_IS_CLANG > + depends on !$(cc-option,-Werror=unused-command-line-argument -fsanitize=thread -fsanitize-coverage=trace-pc) > + help > + Some versions of clang support either KCSAN and KCOV but not the > + combination of the two. > + See https://bugs.llvm.org/show_bug.cgi?id=45831 for the status > + in newer releases. > + > menuconfig KCSAN > bool "KCSAN: dynamic data race detector" > depends on HAVE_ARCH_KCSAN && DEBUG_KERNEL && !KASAN > + depends on !KCSAN_KCOV_BROKEN > select STACKTRACE > help > The Kernel Concurrency Sanitizer (KCSAN) is a dynamic > diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan > index 929211039bac..a5ba2fd51823 100644 > --- a/lib/Kconfig.ubsan > +++ b/lib/Kconfig.ubsan > @@ -26,9 +26,20 @@ config UBSAN_TRAP > the system. For some system builders this is an acceptable > trade-off. > > +config UBSAN_KCOV_BROKEN > + def_bool KCOV && CC_HAS_SANCOV_TRACE_PC > + depends on CC_IS_CLANG > + depends on !$(cc-option,-Werror=unused-command-line-argument -fsanitize=bounds -fsanitize-coverage=trace-pc) > + help > + Some versions of clang support either UBSAN or KCOV but not the > + combination of the two. > + See https://bugs.llvm.org/show_bug.cgi?id=45831 for the status > + in newer releases. > + > config UBSAN_BOUNDS > bool "Perform array index bounds checking" > default UBSAN > + depends on !UBSAN_KCOV_BROKEN > help > This option enables detection of directly indexed out of bounds > array accesses, where the array size is known at compile time. > -- > 2.26.0 >