From patchwork Thu Sep 10 07:03:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 11766767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EABF759D for ; Thu, 10 Sep 2020 07:03:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A3AE720809 for ; Thu, 10 Sep 2020 07:03:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="SWzaAF3z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A3AE720809 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A9A69900007; Thu, 10 Sep 2020 03:03:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A49C66B0080; Thu, 10 Sep 2020 03:03:52 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93A47900007; Thu, 10 Sep 2020 03:03:52 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id 7D8B46B007E for ; Thu, 10 Sep 2020 03:03:52 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 510CC3625 for ; Thu, 10 Sep 2020 07:03:52 +0000 (UTC) X-FDA: 77246261904.24.cow40_1f12ad2270e4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 25AC91A4A7 for ; Thu, 10 Sep 2020 07:03:52 +0000 (UTC) X-Spam-Summary: 1,0,0,277378ff66456a7b,d41d8cd98f00b204,31s9zxwgkcn0c9uhcfnvfnnfkd.bnlkhmtw-llju9bj.nqf@flex--davidgow.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1431:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3152:3352:3865:3866:3867:3868:3870:3871:4250:5007:6261:6653:6737:9969:10004:10400:10450:10455:11026:11473:11658:11914:12043:12048:12291:12296:12297:12438:12555:12683:12895:13069:13156:13221:13228:13229:13255:13311:13357:14040:14181:14394:14659:14721:19904:19999:21080:21444:21451:21627:21939:30054:30090,0,RBL:209.85.219.201:@flex--davidgow.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04yf5jofuuoa7m57zd4as48hon1qfyc5eigeake3iw14x1r7h8aosd4kkuuxckw.mk4adzm1wqjyb68h41ng5ohwgmpt6hi79j7pa9isod141i5wakkqngsce5z7tao.w-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSB L:0,DNSB X-HE-Tag: cow40_1f12ad2270e4 X-Filterd-Recvd-Size: 4725 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Sep 2020 07:03:51 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id b127so4559545ybh.21 for ; Thu, 10 Sep 2020 00:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=yVT9yLW7JYWhoMqFcNSvIQqOD/OC9Y5kGyMXj6mDfzA=; b=SWzaAF3z61UdDBRXy/OCKHiF8fjMlKLNvdTmk6/Dbh+Kq1lqavqta7ibeGJDMVVjK9 9axKITn1wFqjz5tlBRpOkLHHQYFcxzoWXqmY1Wr+HNvMkBdSC5mKf3xMXU+ryg27V0jn Th4btmcNJXuVRUgMFzA+P1ccT7ZakwLeIba9vmrMXLytgcsHgtPq/ujpT4Fvy8CJSLCl Qe3OIPeflNh4YVVch2brsFc0DsYZFIzzMQKNykwBbU9Kf3BE4FGLV7RgkC7+kUlkcYlm vQCACO2h7BOQiACwrP48GTHlEEljHMJN9F8kLZF8t731qo/RgTIaPzL/vO9bN/p+0HRJ 8pZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=yVT9yLW7JYWhoMqFcNSvIQqOD/OC9Y5kGyMXj6mDfzA=; b=iIzbLX4KCkbPGTPzy7FySzl5fQC70I3GiikfSXtHxJx9MRUm6JXR8px1e7K6rjH/EM j56rMFzOKLhu1ccEm5RF6HM6Mu79L5NaFVW3mxx3XFF+twiDHgiDKY2KA5go1htaFdCl vB/Y1JQQyFbW+IXuvPS/F1G0dYwp/FVOrXkuRwOel8t9fPHXiQpMovfmE57nygHpPsrr D53p5UAFaRxS5XNPWv4NURXgnm1C+a71Fc8RByoRumQ4gW4XmFrRqk1xbQwIEd/CxOoO 5WOrdFgDFkL2H6Ja74PoKMXGTu/kvBXAMcaAOvw3JJvALQDz3wATjpSyjdTKpHE0L7z4 y/0g== X-Gm-Message-State: AOAM532/Jz4dRGN0H41AblkhLcgrAnHGDy8fsiZoxxxIx1VcCXJ2+76K 5XRTGn7EdEjXwO5Dn3qcFeubDHZ+QvC1gg== X-Google-Smtp-Source: ABdhPJx6wYqq0LRezDVx5FLW+SCF9/8HZEb3hTyx5Wg3k/fevn1boLeFIzGzqQKYhcL1qVh2j1dn8STpGk5QXw== X-Received: from spirogrip.svl.corp.google.com ([2620:15c:2cb:201:42a8:f0ff:fe4d:3548]) (user=davidgow job=sendgmr) by 2002:a25:ef03:: with SMTP id g3mr9920500ybd.364.1599721430919; Thu, 10 Sep 2020 00:03:50 -0700 (PDT) Date: Thu, 10 Sep 2020 00:03:30 -0700 In-Reply-To: <20200910070331.3358048-1-davidgow@google.com> Message-Id: <20200910070331.3358048-6-davidgow@google.com> Mime-Version: 1.0 References: <20200910070331.3358048-1-davidgow@google.com> X-Mailer: git-send-email 2.28.0.526.ge36021eeef-goog Subject: [PATCH v13 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, andreyknvl@google.com, shuah@kernel.org, akpm@linux-foundation.org Cc: David Gow , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-mm@kvack.org X-Rspamd-Queue-Id: 25AC91A4A7 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Andrey Konovalov Reviewed-by: Brendan Higgins Tested-by: Andrey Konovalov --- 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 e2c14b10bc81..00a53f1355ae 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -95,7 +95,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