Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2147359ybc; Wed, 20 Nov 2019 09:33:49 -0800 (PST) X-Google-Smtp-Source: APXvYqyI7KbxbUhCUoke2MqfRnlzYl7/7TYzt3RP5v1iBAJ853CetaMBuEKYP7ruROaxErLSTeU7 X-Received: by 2002:adf:fd45:: with SMTP id h5mr71362wrs.388.1574271229432; Wed, 20 Nov 2019 09:33:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574271229; cv=none; d=google.com; s=arc-20160816; b=fFbjpv2nQsBUBkhHaV4Ds3jCxWDu/102UsnmcxdKVRfdPojFtzbC6NmW3NY3e7O0zk 2tvGL2YO6PEJW/f+HOxzNvSgbiSTsXd2v+iShaa6qkuU9ffd72XwzCgDUiyu/iRL0QIu oza0PfQbC/xYZXNBVeuEBhh6B6oD4dj+obVOsB7DOioONIawrl1xg0UWudY/8bDXe1kN cYDQRfHo5zcnKEj0+zjAeuNoGd1YcGkSchzkGc+GAfT1oXh5E0ILeyUAaXdNoqjq3gKq Y5SV2KDzQKZQ5NEQGnUcTTNtqO0GaYWym9zf+B81H53QbBBnEgRfnST0+Csbv6z2X9sK ZbXA== 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:dkim-signature; bh=Pc/B5s8Op7DZcUpCkoozM2pKb7wkORn3PJUzQ+3VJls=; b=Rfn6RzBvg1625GD0xk3KCdrxkoO5vZ7O2BTTJlk5Kh60iTfwFq59iP4bQ3SPAbvMzk k1ZyV/mMiELaoW2IV36N5KWG2dSQGCryaY0M85EUTMYN7rCuxII0eX/1oEa15JjD0v1O w1kb4vtQkvMWRb82qqsEbcDTG//iwGeqAluE8UB/LsIShXUfKb9vjoWmQU1b0hayKxUn TIASxEPR2UU0TbDZXKdarajBpH2s16a6KkrwoZMsWouRIJOntL0i5yx9QL41T0YCeCHh O1CuYrW4SllKLakMF8sJ5ii8kLitiVpDhXfgP/GypHaxYXFewjXx5fmlQXI1NJZXAvRM VK1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jtMhRC6P; 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 c8si7640edf.79.2019.11.20.09.33.24; Wed, 20 Nov 2019 09:33:49 -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=jtMhRC6P; 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 S1731665AbfKTPzA (ORCPT + 99 others); Wed, 20 Nov 2019 10:55:00 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40414 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731558AbfKTPy7 (ORCPT ); Wed, 20 Nov 2019 10:54:59 -0500 Received: by mail-wm1-f67.google.com with SMTP id y5so111326wmi.5 for ; Wed, 20 Nov 2019 07:54:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Pc/B5s8Op7DZcUpCkoozM2pKb7wkORn3PJUzQ+3VJls=; b=jtMhRC6Pk0HadowGTjQERXbTA9SrlkgA6uoK4GrRBBSya5IrU9FKwc5sKWuazC7hWY 91aODgBraKSoG3+eK4B2Za6Q/SMrQiR5aWNtuyZaBsUjHqSN2Zi+JRcOllkgpeTVuzp8 KDT853LwBilN+sUKYomYUcWf/qSSmZVkW+82quasRshDxUIO+1hR/nIVZmRvxQmr68TG JuuUYYKg35fGImgfsm/WZdIhy6TJt7Bd0SxC2TXYB82TjG7g7WhD7Xc4n2MJVs5c58xj OsGpyLKVVbGaZmacdh697dBEAEP6D0PtBat1Xcjiao3BpaFQFCZ1O7xp2tWnSqIW3UyD DLNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Pc/B5s8Op7DZcUpCkoozM2pKb7wkORn3PJUzQ+3VJls=; b=Rnbnj/RcITXPHis2xNz9PlkEoFH4A+msbot0fxY4WXhRgQIWmhNJWwZ2so4UmVBdnW ebUUSotVYsA4n0b/FbvcgELe6Fct1LTSq8dxT7I7dpnxnYM1MA1sqQOtE/Hta89pAL8E hugRwKfFQAcG8iCr4ivXFb/ge2p+0FkmiNnHF8dyIf7XMRXm2EneOZ6zO6Vf5XPGQT51 mlNHn2n9jQ+tRcVc6sBYyNAYvb1ftv6+uuuR/p9fJruWfljGEEUArmCJeaAT/bZQcDno LOTfF6XDPDSa5elktXzubqodQ8bh2BPVqMMLHJj9ICP/9rdpDF6OZvzXe7SdrgaRlNaf pk4w== X-Gm-Message-State: APjAAAVft1/khecaDi7lfNhDeGme/1+rfIKHhtUdh6EfX5iOo7VvsU3S tDf2ZCp/V7w2H04qOhkhEVJ00w== X-Received: by 2002:a1c:38c3:: with SMTP id f186mr4147629wma.58.1574265294776; Wed, 20 Nov 2019 07:54:54 -0800 (PST) Received: from google.com ([100.105.32.75]) by smtp.gmail.com with ESMTPSA id z6sm33020710wro.18.2019.11.20.07.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 07:54:53 -0800 (PST) Date: Wed, 20 Nov 2019 16:54:48 +0100 From: Marco Elver To: Qian Cai Cc: LKMM Maintainers -- Akira Yokosawa , Alan Stern , Alexander Potapenko , Andrea Parri , Andrey Konovalov , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Boqun Feng , Borislav Petkov , Daniel Axtens , Daniel Lustig , Dave Hansen , David Howells , Dmitry Vyukov , "H. Peter Anvin" , Ingo Molnar , Jade Alglave , Joel Fernandes , Jonathan Corbet , Josh Poimboeuf , Luc Maranget , Mark Rutland , Nicholas Piggin , "Paul E. McKenney" , Peter Zijlstra , Thomas Gleixner , Will Deacon , Eric Dumazet , kasan-dev , linux-arch , "open list:DOCUMENTATION" , linux-efi@vger.kernel.org, Linux Kbuild mailing list , LKML , Linux Memory Management List , the arch/x86 maintainers Subject: Re: [PATCH v4 00/10] Add Kernel Concurrency Sanitizer (KCSAN) Message-ID: <20191120155448.GA21320@google.com> References: <20191114180303.66955-1-elver@google.com> <1574194379.9585.10.camel@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue, 19 Nov 2019, Marco Elver wrote: > On Tue, 19 Nov 2019 at 21:13, Qian Cai wrote: > > > > On Thu, 2019-11-14 at 19:02 +0100, 'Marco Elver' via kasan-dev wrote: > > > This is the patch-series for the Kernel Concurrency Sanitizer (KCSAN). > > > KCSAN is a sampling watchpoint-based *data race detector*. More details > > > are included in **Documentation/dev-tools/kcsan.rst**. This patch-series > > > only enables KCSAN for x86, but we expect adding support for other > > > architectures is relatively straightforward (we are aware of > > > experimental ARM64 and POWER support). > > > > This does not allow the system to boot. Just hang forever at the end. > > > > https://cailca.github.io/files/dmesg.txt > > > > the config (dselect KASAN and select KCSAN with default options): > > > > https://raw.githubusercontent.com/cailca/linux-mm/master/x86.config > > Thanks! That config enables lots of other debug code. I could > reproduce the hang. It's related to CONFIG_PROVE_LOCKING etc. > > The problem is definitely not the fact that kcsan_setup_watchpoint > disables interrupts (tested by removing that code). Although lockdep > still complains here, and looking at the code in kcsan/core.c, I just > can't see how local_irq_restore cannot be called before returning (in > the stacktrace you provided, there is no kcsan function), and > interrupts should always be re-enabled. (Interrupts are only disabled > during delay in kcsan_setup_watchpoint.) > > What I also notice is that this happens when the console starts > getting spammed with data-race reports (presumably because some extra > debug code has lots of data races according to KCSAN). > > My guess is that some of the extra debug logic enabled in that config > is incompatible with KCSAN. However, so far I cannot tell where > exactly the problem is. For now the work-around would be not using > KCSAN with these extra debug options. I will investigate more, but > nothing obviously wrong stands out.. It seems that due to spinlock_debug.c containing data races, the console gets spammed with reports. However, it's also possible to encounter deadlock, e.g. printk lock -> spinlock_debug -> KCSAN detects data race -> kcsan_print_report() -> printk lock -> deadlock. So the best thing is to fix the data races in spinlock_debug. I will send a patch separately for you to test. The issue that lockdep still reports inconsistency in IRQ flags tracing I cannot yet say what the problem is. It seems that lockdep IRQ flags tracing may have an issue with KCSAN for numerous reasons: let's say lockdep and IRQ flags tracing code is instrumented, which then calls into KCSAN, which disables/enables interrupts, but due to tracing calls back into lockdep code. In other words, there may be some recursion which corrupts hardirqs_enabled. Thanks, -- Marco