Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2920237ybk; Mon, 18 May 2020 11:08:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPITSfWYyMxaCeL3jKLjOlUQGWdtreBSZe7KAXpc3nF/JdBRU2jbqcnFpWSv+Cet3ZLUTv X-Received: by 2002:a05:6402:22d9:: with SMTP id dm25mr14919031edb.380.1589825307149; Mon, 18 May 2020 11:08:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589825307; cv=none; d=google.com; s=arc-20160816; b=Uc3CvBb2hZng2fjJUszCZkBLBWq4FfgyMzdlZtLKbvYd4UDNHV8x400HED6qQEA560 uKUa5K6gIkVWfBUR4lVVmHw8cRfDDu2aeOjF6blRzuOCR7l3QwthMHHaYJkpQIpYsGwU yhFGk7VCKa/5dSX5fvDq53Wy9OjVGMV9qJ4PZPCyugHP5r4hdT4vUbyWl4Wktcg60NRC FdKRp9tH3cPyaJD4SFiALHX2UMtOiGCaX8Iet29L7GkfCqkgXL/QmB4g7GBN50e4CwSL SN1LB5GjsTM5kNe8B+HHIgGt3OltLiovDaiThJUs8CCTPzKttXSJgcfwtBpG7exkXp3w XMqQ== 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=A1Of05sXfKMuAB6KElfJxv+kaM0ti5HUQFDuIZAc/hE=; b=GXAR4qRbXeMIh+YMGUeekrhcX8SR7fUJJ5cROiQfzbkhQzFJUqtRsdGz0zdbbSx1mH qozWRuGu5UVxK3yApQKAS8LChv9Qc/Ozecy7m2sVsTjpVkK5T8d7bSPrXzve+e4EhrCW Xh3hhzrAzFe/aKS0lEY+aQgDTW3IPwlHhYXlmQDbnyOl/e4kOCFVN4tLyBOPsnt8ukbx SjVQ7Zt6wUFpT2P/CLikkuGj0ljZaNsK3V+xEEj3Mf7PqG03HHD6u/2OuDPPe7phz24D keJgb/09ji2KF2H5x8hhiwc7EFo/M90IOjjgdRomnzB5AU87wC9UxtpvHnMWeyMJuwj2 LjRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Z3ybWwqd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a25si6419428ejk.462.2020.05.18.11.08.03; Mon, 18 May 2020 11:08:27 -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=@google.com header.s=20161025 header.b=Z3ybWwqd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732959AbgERSF2 (ORCPT + 99 others); Mon, 18 May 2020 14:05:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732945AbgERSFX (ORCPT ); Mon, 18 May 2020 14:05:23 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3AB5C061A0C for ; Mon, 18 May 2020 11:05:22 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id f13so417689wmc.5 for ; Mon, 18 May 2020 11:05:22 -0700 (PDT) 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=A1Of05sXfKMuAB6KElfJxv+kaM0ti5HUQFDuIZAc/hE=; b=Z3ybWwqdtGutFqkYpxyJ3NvHxesk4P1GpN5crclw0g5Bhh5blc5m//unaEZeI7X55d 4J/ixt+HvqP8lGNVCVQrOPU1ieYYzf/4nZMJaCsTXQ5B7vhd1dPKk0gRFDzw7tMT3dFH JCK4zbCD3O0az5FHCzYncI1yhUgvtGfnoYKyIxPDYAwNm354run82h1u7WaNYHV8ZYV4 JdzJHHZjUKbdKq3zDoReNiUUXDfioOq/DgbHEmzkB1PzcK1jaSFZy646lrHq60UtBaZL EGZlGVfesITF6+TA287z9q6A/0o/1fj3N8Angfc0TxrzjPfg8vQaklNf508drp2mi/X9 BE7g== 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=A1Of05sXfKMuAB6KElfJxv+kaM0ti5HUQFDuIZAc/hE=; b=WvunTSvbKv9IsyS8YgqkwXqwqI8+dPlOj6tJdXwpddJqJEbgCiD+UYPpdlnSKnyd4/ 6XG2tjftT37qdV5tuDoF1unBkZUEOGpiv3KkxYJZ7Koef+NAxzm0OVR/Xeh99CCIYQAM ++m1/IVaUNWmkGSlaJ85ANM3WZmF94NQ8+VFFXL/vzCg8iPGqouFfbOUb3PdebWv+QNn 4tPbWdr0ta7PI5K3BoYh+hPPaZWqEvs/ETVsR/t4V+94a+XG7/A9+77+o2JTv7xw5p/6 FWr64k72bPwdGz4nFMljSeAeE5AfQ7l2/AmYxXRICf0rZvm8saB4nrjLWAgsHiaV57/M IN+w== X-Gm-Message-State: AOAM5334aWzXQLfbN+11qqTsIw9h0VuhWcA5NBBoWfEBMJSlP2StRahL J6ZGFfvrt5fYKBnHdIz7jeXSbA== X-Received: by 2002:a1c:7410:: with SMTP id p16mr627463wmc.134.1589825121166; Mon, 18 May 2020 11:05:21 -0700 (PDT) Received: from google.com ([100.105.32.75]) by smtp.gmail.com with ESMTPSA id l11sm457783wmf.28.2020.05.18.11.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:05:19 -0700 (PDT) Date: Mon, 18 May 2020 20:05:13 +0200 From: Marco Elver To: Nick Desaulniers Cc: Kan Liang , clang-built-linux , kasan-dev , kernel test robot , Peter Zijlstra , LKML , LKP , "Paul E. McKenney" , Dmitry Vyukov , Alexander Potapenko , Andrey Konovalov Subject: Re: [rcu] 2f08469563: BUG:kernel_reboot-without-warning_in_boot_stage Message-ID: <20200518180513.GA114619@google.com> References: <20200517011732.GE24705@shao2-debian> <20200517034739.GO2869@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.13.2 (2019-12-18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 18 May 2020, 'Nick Desaulniers' via kasan-dev wrote: > On Mon, May 18, 2020 at 7:34 AM Marco Elver wrote: > > > > On Mon, 18 May 2020 at 14:44, Marco Elver wrote: > > > > > > [+Cc clang-built-linux FYI] > > > > > > On Mon, 18 May 2020 at 12:11, Marco Elver wrote: > > > > > > > > On Sun, 17 May 2020 at 05:47, Paul E. McKenney wrote: > > > > > > > > > > On Sun, May 17, 2020 at 09:17:32AM +0800, kernel test robot wrote: > > > > > > Greeting, > > > > > > > > > > > > FYI, we noticed the following commit (built with clang-11): > > > > > > > > > > > > commit: 2f08469563550d15cb08a60898d3549720600eee ("rcu: Mark rcu_state.ncpus to detect concurrent writes") > > > > > > https://git.kernel.org/cgit/linux/kernel/git/paulmck/linux-rcu.git dev.2020.05.14c > > > > > > > > > > > > in testcase: boot > > > > > > > > > > > > on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 8G > > > > > > > > > > > > caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace): > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > If you fix the issue, kindly add following tag > > > > > > Reported-by: kernel test robot > > > > > > > > > > > > > > > > > > [ 0.054943] BRK [0x05204000, 0x05204fff] PGTABLE > > > > > > [ 0.061181] BRK [0x05205000, 0x05205fff] PGTABLE > > > > > > [ 0.062403] BRK [0x05206000, 0x05206fff] PGTABLE > > > > > > [ 0.065200] RAMDISK: [mem 0x7a247000-0x7fffffff] > > > > > > [ 0.067344] ACPI: Early table checksum verification disabled > > > > > > BUG: kernel reboot-without-warning in boot stage > > > > > > > > > > I am having some difficulty believing that this commit is at fault given > > > > > that the .config does not list CONFIG_KCSAN=y, but CCing Marco Elver > > > > > for his thoughts. Especially given that I have never built with clang-11. > > > > > > > > > > But this does invoke ASSERT_EXCLUSIVE_WRITER() in early boot from > > > > > rcu_init(). Might clang-11 have objections to early use of this macro? > > > > > > > > The macro is a noop without KCSAN. I think the bisection went wrong. > > > > > > > > I am able to reproduce a reboot-without-warning when building with > > > > Clang 11 and the provided config. I did a bisect, starting with v5.6 > > > > (good), and found this: > > > > - Since v5.6, first bad commit is > > > > 20e2aa812620439d010a3f78ba4e05bc0b3e2861 (Merge tag > > > > 'perf-urgent-2020-04-12' of > > > > git://git.kernel.org/pub/scm/linux/kernel//git/tip/tip) > > > > - The actual commit that introduced the problem is > > > > 2b3b76b5ec67568da4bb475d3ce8a92ef494b5de (perf/x86/intel/uncore: Add > > > > Ice Lake server uncore support) -- reverting it fixes the problem. > > > > Some more clues: > > > > 1. I should have noticed that this uses CONFIG_KASAN=y. > > Thanks for the report, testing, and bisection. I don't see any > smoking gun in the code. > https://godbolt.org/z/qbK26r My guess is data layout and maybe some interaction with KASAN. I also played around with leaving icx_mmio_uncores empty, meaning none of the data it refers to end up in the data section (presumably because optimized out), which resulted in making the bug disappear as well. > > > > 2. Something about function icx_uncore_mmio_init(). Making it a noop > > also makes the issue go away. > > > > 3. Leaving icx_uncore_mmio_init() a noop but removing the 'static' > > from icx_mmio_uncores also presents the issue. So this seems to be > > something about how/where icx_mmio_uncores is allocated. > > Can you share the disassembly of icx_uncore_mmio_init() in the given > configuration? ffffffff8102c097 : ffffffff8102c097: e8 b4 52 bd 01 callq ffffffff82c01350 <__fentry__> ffffffff8102c09c: 48 c7 c7 e0 55 c3 83 mov $0xffffffff83c355e0,%rdi ffffffff8102c0a3: e8 69 9a 3b 00 callq ffffffff813e5b11 <__asan_store8> ffffffff8102c0a8: 48 c7 05 2d 95 c0 02 movq $0xffffffff83c388e0,0x2c0952d(%rip) # ffffffff83c355e0 ffffffff8102c0af: e0 88 c3 83 ffffffff8102c0b3: c3 retq The problem still happens if we add a __no_sanitize_address (or even KASAN_SANITIZE := n) here. I think this function is a red herring: you can make this function be empty, but as long as icx_mmio_uncores and its dependencies are added to the data section somewhere, does the bug appear. Thanks, -- Marco