Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1525400pxa; Thu, 6 Aug 2020 09:29:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLezE2M7LymI3S9M2LkzPrZC1o60BPL6GGjL6RTgRAWh7Ym0XhH60CAFzxyX89kB+UOs4o X-Received: by 2002:a05:6402:1d17:: with SMTP id dg23mr4860979edb.198.1596731356361; Thu, 06 Aug 2020 09:29:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596731356; cv=none; d=google.com; s=arc-20160816; b=m9G+Thn7na0P+hhfFv3urtpZK8KUQktZnLkRB1OQb+SiyyZRoDzgYvfeHxIBUxK9hp xaTgtyrorZkkzgRztm0Bn6hmE35LPc7G/SxiigfPUSSpeAaL6F6wfPTwyHd5XkOYiSiC gNun7coE13kq5cOX7P55xJPMJJUWaIbhh5sbeudJeU8r1FLt4u2NU6Oijh/abAxGxhRR H4AVbBotm8GewdhJBQ3fWmCj4L8E3IsgNd/0K9vhj4VQwAP75hfA78aUKY2FlMVelKq7 JRR/4tFprkIMKuZOpY06hpFhjqW2Tjoni7PSpvZW9lnbhOfGG03nQp4ZrLcIkmbeQzci vzUw== 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=kRzJPbiSWqPMYf9cXUnubjz9KwLdR0t2PlxbglQqDmQ=; b=tWGvNNNn+G894UdecXoVhQEMgtdPJmGnMOymo+e4LfjeAZwMReBK12PbD43ebqWwoN ItYygN02g5ANpUv5G7pcefSYDm4SsvxqUAs8fuYuxTLhGNccnHD+2X5NutqYU+UKvikb 8uOEzuaQiVthm7cg3RhgYvAWOpjXhCaLrMPfwPkoI1QJBk/XhBxY9IzND2q8fr9JKfW7 rRBr9Umdrf0YxfAYMhUxankOHZEyWNaYbXy3zfTFuxAyrQ6A/fIDRVxlwAlHaG9R9fXW 3fSkyjA5hhLAZcgv5//Sx4sHGhSGob9YGoDGLJ3+M50W9zlnMtqUyaGZ2DyicQiy2WcX J/Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=t+y4Obij; 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 s26si3509673ejv.28.2020.08.06.09.28.53; Thu, 06 Aug 2020 09:29:16 -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=t+y4Obij; 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 S1726413AbgHFQ14 (ORCPT + 99 others); Thu, 6 Aug 2020 12:27:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727868AbgHFQSr (ORCPT ); Thu, 6 Aug 2020 12:18:47 -0400 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37AD3C002168 for ; Thu, 6 Aug 2020 09:06:59 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id h16so16524036oti.7 for ; Thu, 06 Aug 2020 09:06:59 -0700 (PDT) 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=kRzJPbiSWqPMYf9cXUnubjz9KwLdR0t2PlxbglQqDmQ=; b=t+y4ObijkT9CwJCdosVyvo3hNb0ZL2IQqYE+OfodlfDj45ikA05n+fCWNnY5GD4pZ8 ZnMT0RRGiqj1cgMNTKenHMDNmTSR0lUMYqDGgYq45E9L/SP5axhkyDqluQIuqi8uSEmX PGfLd1vme9MOv4ADHA4yxeORytbopb4k9g+NSiKNdn+vkAT5YmfhIO2yIhgVvzTGM+q+ R2LpxADUnvKlV6epXzLdAiAbZfIw+gx0o2rOwcziRgP13Cpqwth84og51FzOZwqP8hAh 5G22Wr1oLKPn0gpw0Mg4Iclbh0omDHMj4XcLiz4/3MiUIIXZv6PmXo9I1D+ab/4F4+/C QH6g== 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=kRzJPbiSWqPMYf9cXUnubjz9KwLdR0t2PlxbglQqDmQ=; b=p9W77EOGC9ZpcNjki6Ne08E5rXpKfTMsIFrivnEVg01KlbpG8woJWffhlgTk3cHFd9 j8I1qdodLJF5bcrvnYUiSvS9htcjrWZkmA/w/6ucHYoapdQy5CO/1QbTkMxIWUhI9yZg jFmIbcI4NoPnK5l5bXBnqopVAF2o8X/geRlUKyknMrcnvwgMahaEOkx53s8OsDESjZQv YajI649BO+VFXGuynsDWzIDNZzPTqosAAEl0DY1kq5Ypgi5xC8WYSAQHXlFMQOz+ACy2 OEyoD/WN3zB85+gg3DplXMZqccz0CD6bg5NtOB+t7SwkJ/+AHONqxbD4PdHtTkrSox5C zZJA== X-Gm-Message-State: AOAM531rSmVDDvnVbweFYMqSqy+owbG9GA/pj+7zHmKJ/NBcafJv5XuF fFl0xirhRd9M4GLXPdi7r+ngAmhSwTKZzVuoK/XPQA== X-Received: by 2002:a9d:65d3:: with SMTP id z19mr8224587oth.233.1596730016189; Thu, 06 Aug 2020 09:06:56 -0700 (PDT) MIME-Version: 1.0 References: <0000000000007d3b2d05ac1c303e@google.com> <20200805132629.GA87338@elver.google.com> <20200805134232.GR2674@hirez.programming.kicks-ass.net> <20200805135940.GA156343@elver.google.com> <20200805141237.GS2674@hirez.programming.kicks-ass.net> <20200805141709.GD35926@hirez.programming.kicks-ass.net> <20200806074723.GA2364872@elver.google.com> <20200806113236.GZ2674@hirez.programming.kicks-ass.net> <20200806131702.GA3029162@elver.google.com> In-Reply-To: <20200806131702.GA3029162@elver.google.com> From: Marco Elver Date: Thu, 6 Aug 2020 18:06:43 +0200 Message-ID: Subject: Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers To: Peter Zijlstra Cc: Borislav Petkov , Dave Hansen , fenghua.yu@intel.com, "H. Peter Anvin" , LKML , Ingo Molnar , syzkaller-bugs , Thomas Gleixner , "Luck, Tony" , "the arch/x86 maintainers" , yu-cheng.yu@intel.com, jgross@suse.com, sdeep@vmware.com, virtualization@lists.linux-foundation.org, kasan-dev , syzbot 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, 6 Aug 2020 at 15:17, Marco Elver wrote: > > On Thu, Aug 06, 2020 at 01:32PM +0200, peterz@infradead.org wrote: > > On Thu, Aug 06, 2020 at 09:47:23AM +0200, Marco Elver wrote: > > > Testing my hypothesis that raw then nested non-raw > > > local_irq_save/restore() breaks IRQ state tracking -- see the reproducer > > > below. This is at least 1 case I can think of that we're bound to hit. > ... > > > > /me goes ponder things... > > > > How's something like this then? > > > > --- > > include/linux/sched.h | 3 --- > > kernel/kcsan/core.c | 62 ++++++++++++++++++++++++++++++++++++--------------- > > 2 files changed, 44 insertions(+), 21 deletions(-) > > Thank you! That approach seems to pass syzbot (also with > CONFIG_PARAVIRT) and kcsan-test tests. > > I had to modify it some, so that report.c's use of the restore logic > works and not mess up the IRQ trace printed on KCSAN reports (with > CONFIG_KCSAN_VERBOSE). > > I still need to fully convince myself all is well now and we don't end > up with more fixes. :-) If it passes further testing, I'll send it as a > real patch (I want to add you as Co-developed-by, but would need your > Signed-off-by for the code you pasted, I think.) With CONFIG_PARAVIRT=y (without the notrace->noinstr patch), I still get lockdep DEBUG_LOCKS_WARN_ON(!lockdep_hardirqs_enabled()), although it takes longer for syzbot to hit them. But I think that's expected because we can still get the recursion that I pointed out, and will need that patch. I also get some "BUG: MAX_LOCKDEP_CHAINS too low!" on syzbot (KCSAN is not in the stacktrace). Although it may be unrelated: https://lore.kernel.org/lkml/0000000000005613c705aaf88e04@google.com/ -- when are they expected? Thanks, -- Marco