From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D5E4C33CB6 for ; Thu, 16 Jan 2020 01:24:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4086D2467E for ; Thu, 16 Jan 2020 01:24:32 +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="SJwnin5n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4086D2467E 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 59DFC8E0019; Wed, 15 Jan 2020 20:24:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5506F8E0003; Wed, 15 Jan 2020 20:24:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 294208E0019; Wed, 15 Jan 2020 20:24:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 0B03A8E0003 for ; Wed, 15 Jan 2020 20:24:25 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id AB75E40FB for ; Thu, 16 Jan 2020 01:24:24 +0000 (UTC) X-FDA: 76381752048.29.rub88_7dca2295f5752 X-HE-Tag: rub88_7dca2295f5752 X-Filterd-Recvd-Size: 4207 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Jan 2020 01:24:24 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id x185so9379648pfc.5 for ; Wed, 15 Jan 2020 17:24:24 -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=SJwnin5nMwZBKrhpnWtYLNNA2XESjaBA5OMZZUiC+dLBovxajhmbEreGNQuSCGlJwg rzwLtTnueeZeF9mo1NZWc/UG++85l/gf4xMNaTD7Mi65olwyiNctPjj7SEzVTf8lz6JY y2wkfmtBIGevOe/HcrOjcNSuIe8PF7VSzsSEI= 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=PxyPZvw+AoZjxVwtrqw4qGsmCIVYQX5IN5Uko4X59QyrwszjlO7H44qfCqBNsy+kJI Pc+OiFGgDHhHknAG2xLHXeX3HUrFzO+ql/vVaRa9MvK/GHKV2XPjY6FgntV3yrQT+Opr 0ftgiyJAtrLHaUhYZjN9AsIYYWZEz9HcdK+2pjK5tj9Uu/h9wYURWhRE/BDc6UsDsAzw DZjSdCIs/RAMmExMiM1eiY29EuxhlRrI9UEV5S+MvaBJvX23EavhNjpYz14ChMXpq9ir kCfoieC9JwHyrFEKFOxViV9UKQ7kh+FjBw3wOJ6KnwKzSYJQjRtloOR9YtBnh71ylRXo 05cA== X-Gm-Message-State: APjAAAWMiWPsXiPE5PKDvY8mMLiBUH4k421N1TcSEWuSWVU2YcPLoePz ShP88WxQ1MxJo50p2pKzr6p2WQ== X-Google-Smtp-Source: APXvYqxsGknX6bnO/GaSkj5DHw5Et7M+pO9sTANSMwjDnHU91axQ6Z/1Fsl4MvtQ189Vh73/ukEWVg== X-Received: by 2002:aa7:9816:: with SMTP id e22mr35105862pfl.229.1579137863425; Wed, 15 Jan 2020 17:24:23 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d20sm1058272pjs.2.2020.01.15.17.24.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2020 17:24:18 -0800 (PST) From: Kees Cook To: Andrew Morton Cc: Kees Cook , Andrey Ryabinin , Elena Petrova , 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 v3 4/6] ubsan: Check panic_on_warn Date: Wed, 15 Jan 2020 17:23:19 -0800 Message-Id: <20200116012321.26254-5-keescook@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116012321.26254-1-keescook@chromium.org> References: <20200116012321.26254-1-keescook@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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_TaXqax3JByUOWB3uk787Ls= yMVcfW6JzzGvg@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) "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n"); =20 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 =3D 0; + panic("panic_on_warn set ...\n"); + } } =20 static void handle_overflow(struct overflow_data *data, void *lhs, --=20 2.20.1