From patchwork Wed Aug 5 04:29:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 11701281 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 AB52B138C for ; Wed, 5 Aug 2020 04:30:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8134B22CA0 for ; Wed, 5 Aug 2020 04:30:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OtjJ7ZSO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8134B22CA0 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 91CFA6B0025; Wed, 5 Aug 2020 00:30:01 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8CFB26B0026; Wed, 5 Aug 2020 00:30:01 -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 774196B0027; Wed, 5 Aug 2020 00:30:01 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0207.hostedemail.com [216.40.44.207]) by kanga.kvack.org (Postfix) with ESMTP id 55F036B0025 for ; Wed, 5 Aug 2020 00:30:01 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 15C6A8248047 for ; Wed, 5 Aug 2020 04:30:01 +0000 (UTC) X-FDA: 77115237402.14.humor08_530de4726fac Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id E0A4B18229835 for ; Wed, 5 Aug 2020 04:30:00 +0000 (UTC) X-Spam-Summary: 1,0,0,5fd595b6bf1d6c98,d41d8cd98f00b204,3xzuqxwgkcno96re9cksckkcha.8kihejqt-iigr68g.knc@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.202:@flex--davidgow.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04ygbuntkq6x4ya9tbr4dy8ombsi1yc5eigeake3s93zu3pbqqh7551icymmckw.mk4adzyts4yef6ecs8dcrd66mdnh4xoi8mtpa9isod141i5wakkqngsg1agrcqp.o-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: humor08_530de4726fac X-Filterd-Recvd-Size: 4477 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Wed, 5 Aug 2020 04:30:00 +0000 (UTC) Received: by mail-yb1-f202.google.com with SMTP id 7so52923392ybl.5 for ; Tue, 04 Aug 2020 21:30:00 -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=Y00REmw7cW2Ho0KOM1NABcGJpQIr8u0gXHD6A1O7ZXc=; b=OtjJ7ZSOy+P1/e1/ee1YUJbWdg+u0tTRw6B9Yl1dD1X+EXBfL8hI28LcD2xNuRVxv7 UO+Tg7Ldk8N4W4MYp/ciEcY6LKafeRPJJKXgMRdXWWFT4TdS0cSN9PTQKTnT6iF05IdD cJBozNbmRDQdqlZgNG1KZb5uAi2w1kr8VJLa8QZTXVPR5OY3q9AvRTTEbBt3Hw78zlAn rW8JVHoIrl2OUuJ7SCP3lFRx7Py2mmWxNGTuKU6KTYMQYYwPHmZGUtoCgTTr9WJJZQvZ Zdh8zAzKkkws2u8fNMAzBsh4WCWBRjA4QIwuFdiesJu8oFhsAg368qSQumimvA/t52sh mhBA== 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=Y00REmw7cW2Ho0KOM1NABcGJpQIr8u0gXHD6A1O7ZXc=; b=rz4LjIT4e4s0u2RcXWS8/tOB2kn9dwF8vccW3UG2NBD33mcvAY4pIv8bVw+LHKOGfj k+zaf4vWe2yjJzUpVeljPYwRhrX7vbjAQKekm8vkMUPO4I603EqYFxqNnGUNl76QFXWL UkLNIeH+oi/uM85aWd76k31wcnv1r/D67b6n5ZkidBcuR1SfLQCsqoNe9XmePkcV0SZi WDOQg2QA7orpolPxmSJrchbCjxgEDly75eOfk5rdqUCAMnB+hv+9Qso1JC+ja3x8ity7 ieBj1z8fiKWJARRcFZ97aH0xQSJcw6WoV2vEZ+65cA9PzKbiMxhmhCUrAjiijmzhYhLM A3vA== X-Gm-Message-State: AOAM531mrpObhSFv+QfWDgn7Qxzp4MxKhzzII6bLDEaJI/d1C20PCP8P w75mATLTIs8TMNVS9hgK2m0htzmwT2cOIw== X-Google-Smtp-Source: ABdhPJxXjGFwD40kee1mNnaPkbYMTsK0NB+Nl4pE7YyjsA4sfahOk4MpuFQvMN8FFzVOGOoGSQTphyt0akERlg== X-Received: by 2002:a25:8411:: with SMTP id u17mr658207ybk.95.1596601799856; Tue, 04 Aug 2020 21:29:59 -0700 (PDT) Date: Tue, 4 Aug 2020 21:29:38 -0700 In-Reply-To: <20200805042938.2961494-1-davidgow@google.com> Message-Id: <20200805042938.2961494-7-davidgow@google.com> Mime-Version: 1.0 References: <20200805042938.2961494-1-davidgow@google.com> X-Mailer: git-send-email 2.28.0.163.g6104cc2f0b6-goog Subject: [PATCH v11 6/6] 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: E0A4B18229835 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, 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 --- 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