Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1277169ybz; Fri, 17 Apr 2020 20:21:03 -0700 (PDT) X-Google-Smtp-Source: APiQypLIUBlPbA/+SrEKqoBPEgYvUk0IwDd+S48J6hACKwx/Vfdbb4VUsTpPrtTsBwVYkKFMZQIq X-Received: by 2002:a05:6402:7d6:: with SMTP id u22mr5768478edy.149.1587180063354; Fri, 17 Apr 2020 20:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587180063; cv=none; d=google.com; s=arc-20160816; b=kmIzHzVFHJXWvyjtPl97yo/ub+bnDIhEFTiODP1XbZS2I+/oPfUEbH+SXCtB60kGtc WliyIOcpHmc9Jofx2pDj8uhlocyQX7rZKqCLFx+CQbNYJRyI2cdFXIqnu1yNiOSadCMK dzGZDGNiVr/ab+CoQgnLFHIA63L/RpiBkC7RZORbRigegzu1fQpcKlMxmgJmMGfa6nN8 Nzz1R+LBbJcSrrCbmI/q6REjBrXQ2FxPlQJXJpNw3pQPKfQgI1NPUyFzE19ZBIXnrbgK fSy7v2cbDk6m+miHcyTpOdQGNyGzBwRKvcZruxEXrwVi/hA0a8f54A7QdWB7hHSIfXio Mwsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=3docRvuzttJC+Wkb9Bk065FrkPZtq4zMQ8pW4rPpfW0=; b=F1ASzQSRSDX7pnZM7qgONt5GqI9BkU6sh/7UWNrKA6ZjJ1end1raDGeslwQIf6BzVa URkHFGrYTNxR0rdsgsfbJ0SADj94+EYOzJt6LobACwrHoRtZEhYeKtTWxeQI5Ifi2grB 0aYPyvQg2cmMW6ujFALFxGYpbFRZNS4sOSq4RujaGnHlB8L9qGrkld9nHnUzYkiDz2SM UABlURE4HzQ4uMt4ds9CTnRBYiLFSqbTvCmILnqt22we5MF3Hf1P44mdsVskRaNGnRMO jOw0Uz/yRnnjfJkvZ0Yy5WGPtzt2/BcD5z7kCr+LzQxz1tFJ+J9Z4TsvTQf5dA3EGmFW yCiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tsvxfJmT; 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 w25si15282915edt.358.2020.04.17.20.20.39; Fri, 17 Apr 2020 20:21:03 -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=tsvxfJmT; 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 S1726151AbgDRDTD (ORCPT + 99 others); Fri, 17 Apr 2020 23:19:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725991AbgDRDS7 (ORCPT ); Fri, 17 Apr 2020 23:18:59 -0400 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 326EEC061A0C for ; Fri, 17 Apr 2020 20:18:59 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id w14so3979713pfq.3 for ; Fri, 17 Apr 2020 20:18:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=3docRvuzttJC+Wkb9Bk065FrkPZtq4zMQ8pW4rPpfW0=; b=tsvxfJmTMqQagdYMcGxWaiaBVUv/Xj9MJWLW8Dkj2Rh+QyEZNG2meafwJo1YjCR9XR 5kx/fQJl2afogVcJn5Fxz2Yyqo1pSLded1b4yj6BSbRR1X95xnMUj3NqcfpA+oTcmuck tSepuqs2CyUuCHzyjGJkqpQsPa9q+FIQrEEcEiqjfrxZw0D2zASxS1frtHURyy5tmApZ jhOTxK+GmZ1vc4ixnC/CjwFtdbHrQZQu2edc8kcXC+9dYUYgxU7QpnWG5zWylmT1HWaz I43ZoSfAC+4PqweU7MfKrkmONOwe8xum+hRW/iXwKhmNMNScqfk044TyaoabJvSyyda5 Qf7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=3docRvuzttJC+Wkb9Bk065FrkPZtq4zMQ8pW4rPpfW0=; b=W3f7PP+fzYvrMcuWKKFu0wvJjOPk94kPTHclz6y9y0LEyoMhBbx/9kEpjAroL7Nhlc HpdLNxJ0sNxwabbBcIiRlHtLuBHXH7lDWZaBHE7IP4qNvseREbiZWm9r4EHU2Dd9tgak cezSY0WVk0SB3KI1fSVakxzB0sRCfDXhxhRFIdID8k6UEPR7GUVMxmekgSGyaOXOZiCD QFVfiXtIcqcYbd7ruhi7VUOENpOHlnb8Tyyzgi6f52hN8RaTzIwKSebtnEPvpUz34V/5 Xg3a8AYxen+hBo9xfJ7sAxbZjkDTWN2MQNv1iptbyjIHnBVxVsHSVmXVBHBQi/2i1nvS 9NbQ== X-Gm-Message-State: AGi0PuZQ6umre5l2i/mpu/UFXaUVoHywAmqHnJMIMvtcPNQnfoWxGL+C Aiz20mLsvy5Muzb37VrpkvkkR/LTELHwmg== X-Received: by 2002:a63:f64d:: with SMTP id u13mr6075605pgj.151.1587179938644; Fri, 17 Apr 2020 20:18:58 -0700 (PDT) Date: Fri, 17 Apr 2020 20:18:33 -0700 In-Reply-To: <20200418031833.234942-1-davidgow@google.com> Message-Id: <20200418031833.234942-6-davidgow@google.com> Mime-Version: 1.0 References: <20200418031833.234942-1-davidgow@google.com> X-Mailer: git-send-email 2.26.1.301.g55bc3eb7cb9-goog Subject: [PATCH v6 5/5] mm: kasan: Do not panic if both panic_on_warn and kasan_multishot set From: David Gow To: trishalfonso@google.com, brendanhiggins@google.com, aryabinin@virtuozzo.com, dvyukov@google.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org Cc: David Gow , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org 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 KASAN errors will currently trigger a panic when panic_on_warn is set. This renders kasan_multishot useless, as further KASAN errors won't be reported if the kernel has already paniced. By making kasan_multishot disable this behaviour for KASAN errors, we can still have the benefits of panic_on_warn for non-KASAN warnings, yet be able to use kasan_multishot. This is particularly important when running KASAN tests, which need to trigger multiple KASAN errors: previously these would panic the system if panic_on_warn was set, now they can run (and will panic the system should non-KASAN warnings show up). Signed-off-by: David Gow --- mm/kasan/report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 0c206bbf9cb3..79fe23bd4f60 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -94,7 +94,7 @@ static void end_report(unsigned long *flags) pr_err("==================================================================\n"); add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); spin_unlock_irqrestore(&report_lock, *flags); - if (panic_on_warn) { + if (panic_on_warn && !test_bit(KASAN_BIT_MULTI_SHOT, &kasan_flags)) { /* * This thread may hit another WARN() in the panic path. * Resetting this prevents additional WARN() from panicking the -- 2.26.1.301.g55bc3eb7cb9-goog