From patchwork Tue Sep 15 03:58:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 11775459 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 D53C192C for ; Tue, 15 Sep 2020 03:59:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 898EB20738 for ; Tue, 15 Sep 2020 03:59:00 +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="Qg6CHZ5g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 898EB20738 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 D536F8E0009; Mon, 14 Sep 2020 23:58:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CB150900012; Mon, 14 Sep 2020 23:58:48 -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 B52178E000B; Mon, 14 Sep 2020 23:58:48 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id 9C6C68E0009 for ; Mon, 14 Sep 2020 23:58:48 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 651CE3624 for ; Tue, 15 Sep 2020 03:58:48 +0000 (UTC) X-FDA: 77263939536.03.girl72_01020532710e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 313AB28A4E8 for ; Tue, 15 Sep 2020 03:58:48 +0000 (UTC) X-Spam-Summary: 1,0,0,91162dc103cfb0c9,d41d8cd98f00b204,39ztgxwgkcpavsnavygoyggydw.ugedafmp-eecnsuc.gjy@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;04yg9nxzewyuc3o1kh3c1gozozmfaoc5eigeake3s93zu3pbqqaosd4kkuuxckw.mk4adzm1wqjyb687onubm4ae95pt6hi79j7pa9isod141i5wakkqngsce5z7tao.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: girl72_01020532710e X-Filterd-Recvd-Size: 4722 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Sep 2020 03:58:47 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id b3so2035222ybg.23 for ; Mon, 14 Sep 2020 20:58:47 -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=jND5K7nrTIUr/jnKohKbWFO0ev/Az4T5zj9+dc82ED0=; b=Qg6CHZ5gHjhda+KwUOhclR4Q3kDy3biP0i2FZHBxpfArWudV4ORqkavGZ804ogOMUy 8AUNGmNkzsDG73STZid0h0HXNjcgdhU4z3oj6pqyPjdc1v1BMSCNOBh546+lDwWinBM4 cSlB1yrVcuwV2HUQQYnA6r4/PxntWOm1hhTkIerea3b0w8zu6c5UEDEtj+WcoE3hx7R1 YA1AxmrHGF7aGsI8eMd0/1MjlansTNSSQzyABO6LIF06D7toFkjbaSfU/b9S5nvjHrim VBUPtn9VDxBpNA7C2qX9ZnMsLj+kasG45T7Fsvm4BO4z47Kg6OcXsgjtIINYa94fy2AP jaQA== 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=jND5K7nrTIUr/jnKohKbWFO0ev/Az4T5zj9+dc82ED0=; b=qad2pyFDPYkwZAuPsULOY8iS2RLxeCl8bH3VlBfutCHnuyZwQ3pikuZi2VtkHvxICL Mo7tUKO2fPL1oAqPcrQ4Pmqwh6JLoIerZZpctUuSySDbZJOcph6NZ7j6tsl3wCsrGURy ClF8c8L76kug6Ha7FfF7H0oHcmBB1l9X8zt22qlVus+n+BJBfdd8m9JwkrRc1R1lEogt m2lEstFPvyugBP2jVS/OnFJKH0QmuresnsXkVqFx1tuBM9knQylF7mIbCorRT4sgZOK5 3TAX0JmtNowbA2A3wrCfqGoQgXStPwg9ypPB/OVtzDb9rXNCWzwPjTczBz9NogNA1IYc 4lww== X-Gm-Message-State: AOAM533X1TAFu25zAJuFRbbTlgnxJbZ7Y1lW01FbHF8JDMspjyS1Zsg3 IFD3g0/ozoEOg8ZqrZ56LjmHdQeRS2+cCA== X-Google-Smtp-Source: ABdhPJwNy5/SF/gC/zNSc6jUHjF6RdEpH1yc/KAlxvozMks7rfzxf+Z68GE5eK2NaQQX5jQCMnFNIydwDzj4gw== X-Received: from spirogrip.svl.corp.google.com ([2620:15c:2cb:201:42a8:f0ff:fe4d:3548]) (user=davidgow job=sendgmr) by 2002:a25:10c1:: with SMTP id 184mr23945299ybq.407.1600142327208; Mon, 14 Sep 2020 20:58:47 -0700 (PDT) Date: Mon, 14 Sep 2020 20:58:28 -0700 In-Reply-To: <20200915035828.570483-1-davidgow@google.com> Message-Id: <20200915035828.570483-6-davidgow@google.com> Mime-Version: 1.0 References: <20200915035828.570483-1-davidgow@google.com> X-Mailer: git-send-email 2.28.0.618.gf4bc123cb7-goog Subject: [PATCH v14 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: 313AB28A4E8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000014, 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