From patchwork Thu Feb 27 18:49:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11409501 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 D0C6592A for ; Thu, 27 Feb 2020 18:49:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9DB1F246C6 for ; Thu, 27 Feb 2020 18:49:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="lTDnhmVn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DB1F246C6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DD34D6B0007; Thu, 27 Feb 2020 13:49:30 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D34AD6B0008; Thu, 27 Feb 2020 13:49:30 -0500 (EST) 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 BD49D6B000A; Thu, 27 Feb 2020 13:49:30 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0140.hostedemail.com [216.40.44.140]) by kanga.kvack.org (Postfix) with ESMTP id A006C6B0007 for ; Thu, 27 Feb 2020 13:49:30 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 782852489 for ; Thu, 27 Feb 2020 18:49:30 +0000 (UTC) X-FDA: 76536795300.28.girl84_35dc8eb5b7220 X-Spam-Summary: 2,0,0,0fe10bee4529a0a7,d41d8cd98f00b204,keescook@chromium.org,,RULES_HIT:41:355:379:541:800:960:967:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1541:1711:1730:1747:1777:1792:2393:2525:2553:2559:2563:2682:2685:2689:2859:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3865:3867:3870:3871:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:5007:6261:6653:6742:7903:8957:9025:10004:11026:11658:11914:12043:12291:12296:12297:12438:12517:12519:12555:12679:12683:12895:13069:13311:13357:13894:14181:14384:14394:14721:14777:21080:21444:21627:21740:21939:21983:30054:30070:30090,0,RBL:209.85.210.195:@chromium.org:.lbl8.mailshell.net-66.100.201.201 62.2.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: girl84_35dc8eb5b7220 X-Filterd-Recvd-Size: 4247 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Thu, 27 Feb 2020 18:49:30 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id i13so289213pfe.3 for ; Thu, 27 Feb 2020 10:49:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=46Z0N6nNFPIgM2OuwNgkHRjYe659IsqNoWw8FG0hdrY=; b=lTDnhmVnqQJEUJ5LnBGPuhXrnv05UkcjRDWNOX4WHR+p4aommd+S5U5/xJ9GYmjDyV D/5GwhtD18WW//fs2/5w1ghXIQm+EKFifaYUneu04fLN8/9y1Mj2SuFmDWjgLzxaen0O 3tTOuDeaafS34wt+AZuoCBaUtcE3qzutj612k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=46Z0N6nNFPIgM2OuwNgkHRjYe659IsqNoWw8FG0hdrY=; b=pEg1vG6xkjOpMSze0KYPKiOlGe5a9jaK0sLm35vHXcJ3bYkkArQ6IAVPZ3h8j6C97w MCVvPTsaUobaKzJ/sYVX5tMaLx59wWy8GHq0PeqhEuQ5SAtls8KmOTe1Vmto4PrtsKcs oBRIlkUZb8vwwOYVdtB22otnCWqzIL2YJhFqKipbSe3eXrObcKGV7w1X5NnXz16caE6f TFZHA9HvkmM9noXItbua0PxBDCe4tJeT+s0/+CMd4Yuw/jyLYYIQFw6a/6+1Gid0kT4I X5TCazxdxH3m5lxPiVM4hSC87ho/Ln2z3V5ZpCCN1oS270HGta6ZLaYzaYy4c9Hjsg7o G85g== X-Gm-Message-State: APjAAAWb2gpZHA6chMozrnxWzpr5225NKfi4T5iGJTGHzxHLNSNS9xuU GTlSq9H9MPxFD3nMxg7HtAqx1w== X-Google-Smtp-Source: APXvYqyp61REIsdWHH37oqm6TnnTLVpBM0r3x0E6/zmvpnUPvvoIlWHFgZSyISwmK1qp5zs0Rz23qw== X-Received: by 2002:a63:3103:: with SMTP id x3mr677715pgx.209.1582829368829; Thu, 27 Feb 2020 10:49:28 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e1sm7998669pff.188.2020.02.27.10.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 10:49:26 -0800 (PST) From: Kees Cook To: Andrew Morton Cc: Kees Cook , Andrey Ryabinin , Elena Petrova , Andrey Konovalov , Alexander Potapenko , Dan Carpenter , "Gustavo A. R. Silva" , Arnd Bergmann , Ard Biesheuvel , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, syzkaller@googlegroups.com Subject: [PATCH v4 4/6] ubsan: Check panic_on_warn Date: Thu, 27 Feb 2020 10:49:19 -0800 Message-Id: <20200227184921.30215-5-keescook@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227184921.30215-1-keescook@chromium.org> References: <20200227184921.30215-1-keescook@chromium.org> MIME-Version: 1.0 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: Syzkaller expects kernel warnings to panic when the panic_on_warn sysctl is set. More work is needed here to have UBSan reuse the WARN infrastructure, but for now, just check the flag manually. Link: https://lore.kernel.org/lkml/CACT4Y+bsLJ-wFx_TaXqax3JByUOWB3uk787LsyMVcfW6JzzGvg@mail.gmail.com Signed-off-by: Kees Cook --- lib/ubsan.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/ubsan.c b/lib/ubsan.c index 7b9b58aee72c..429663eef6a7 100644 --- a/lib/ubsan.c +++ b/lib/ubsan.c @@ -156,6 +156,17 @@ static void ubsan_epilogue(void) "========================================\n"); current->in_ubsan--; + + if (panic_on_warn) { + /* + * This thread may hit another WARN() in the panic path. + * Resetting this prevents additional WARN() from panicking the + * system on this thread. Other threads are blocked by the + * panic_mutex in panic(). + */ + panic_on_warn = 0; + panic("panic_on_warn set ...\n"); + } } static void handle_overflow(struct overflow_data *data, void *lhs,