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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 7ECE8C352A3 for ; Wed, 5 Feb 2020 22:23:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 42B0B2072B for ; Wed, 5 Feb 2020 22:23:12 +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="bsCVEZXy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 42B0B2072B 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 B8DC86B0003; Wed, 5 Feb 2020 17:23:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B17176B0005; Wed, 5 Feb 2020 17:23:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DECF6B0006; Wed, 5 Feb 2020 17:23:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id 7FF0D6B0003 for ; Wed, 5 Feb 2020 17:23:11 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2E85F2DFD for ; Wed, 5 Feb 2020 22:23:11 +0000 (UTC) X-FDA: 76457500182.17.lock96_38d5a5127da16 X-HE-Tag: lock96_38d5a5127da16 X-Filterd-Recvd-Size: 5632 Received: from mail-ot1-f66.google.com (mail-ot1-f66.google.com [209.85.210.66]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Wed, 5 Feb 2020 22:23:10 +0000 (UTC) Received: by mail-ot1-f66.google.com with SMTP id i6so3569271otr.7 for ; Wed, 05 Feb 2020 14:23:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=7BPBFZwYMLdjTS7FC4wsJG0SBY3jzmuiQq5ab/pR8tE=; b=bsCVEZXyO1m1nDWrhyLfqfamqKXOfvuJP41PTr4vHEntSvyBELd7iYKhNse6c2Tn9g iIYLNxjo6KV5OEOU8j19451ahN0XbitPB0O/3aRADfb1w9uvKbYi0JIUSthzfFbgWSZV dMOREBTUlTsa8xBI1nry+fdIWSqxaER3PK0/U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=7BPBFZwYMLdjTS7FC4wsJG0SBY3jzmuiQq5ab/pR8tE=; b=AhVsLZAkT32ftq4jyjweo1w0xwez8VFZLg275UGWeEuRNHldf3GdjoRlW6+XSWqsFp HURpmz2J0jlBs1dJjcPuI+0gCD9KIs0n93ISlcdIp5BmYLF36qkQVoEXEsQpXA+k2m2P 7saAjGAcpb8hBjurmmIRIFpQteq+pVS/Xt/FKfo9zuMUYmk2aFrpizfqoRv50cqB/psk X03NrmpYlmENiTnKS6x9st9muRbcbstcRJeQOroclGzdfc+DHsMMgpy092sg/lQwEvUI fD41eSQzzAzv/Yo11Fx3VOJfNeR7Pg9oYc3i5si1DM8lF3r2PtQbh1nDfok4+wo8he84 R79Q== X-Gm-Message-State: APjAAAVTvpsXQxJTB/MpnsgmAWy1H+pm5gkhzbL3gvlhS3FtdVjIIdWu C3SFCds1EHWt3oSYcCdRMxKmpg== X-Google-Smtp-Source: APXvYqwiWxsqH9jzwGGCPTTA/BuMOcFastWQH/FIEhWKfTbMO7E5g/kRONngb8jpggIUpd8KuKUR/A== X-Received: by 2002:a9d:1ca3:: with SMTP id l35mr27648946ota.271.1580941389697; Wed, 05 Feb 2020 14:23:09 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n22sm369796otj.36.2020.02.05.14.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 14:23:08 -0800 (PST) Date: Wed, 5 Feb 2020 14:23:07 -0800 From: Kees Cook To: Qian Cai Cc: Christian Borntraeger , Grzegorz Halat , Linux Kernel Mailing List , Linux-MM , linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, ssaner@redhat.com, atomlin@redhat.com, oleksandr@redhat.com, vbendel@redhat.com, kirill@shutemov.name, khlebnikov@yandex-team.ru, Andrew Morton , Iurii Zaikin , Luis Chamberlain , Jonathan Corbet , Tetsuo Handa Subject: Re: [PATCH 1/1] mm: sysctl: add panic_on_inconsistent_mm sysctl Message-ID: <202002051421.9419721B@keescook> References: <20200129180851.551109-1-ghalat@redhat.com> <84C253EB-B348-4B62-B863-F192FBA8C202@lca.pw> <34467005-1742-47a0-cd2b-05567584b91e@de.ibm.com> <1580742371.7365.1.camel@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1580742371.7365.1.camel@lca.pw> Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Feb 03, 2020 at 10:06:11AM -0500, Qian Cai wrote: > On Mon, 2020-02-03 at 15:08 +0100, Christian Borntraeger wrote: > >=20 > > On 29.01.20 19:39, Qian Cai wrote: > > >=20 > > >=20 > > > > On Jan 29, 2020, at 1:08 PM, Grzegorz Halat w= rote: > > > >=20 > > > > Memory management subsystem performs various checks at runtime, > > > > if an inconsistency is detected then such event is being logged a= nd kernel > > > > continues to run. While debugging such problems it is helpful to = collect > > > > memory dump as early as possible. Currently, there is no easy way= to panic > > > > kernel when such error is detected. > > > >=20 > > > > It was proposed[1] to panic the kernel if panic_on_oops is set bu= t this > > > > approach was not accepted. One of alternative proposals was intro= duction of > > > > a new sysctl. > > > >=20 > > > > Add a new sysctl - panic_on_inconsistent_mm. If the sysctl is set= then the > > > > kernel will be crashed when an inconsistency is detected by memor= y > > > > management. This currently means panic when bad page or bad PTE > > > > is detected(this may be extended to other places in MM). > > > >=20 > > > > Another use case of this sysctl may be in security-wise environme= nts, > > > > it may be more desired to crash machine than continue to run with > > > > potentially damaged data structures. > > >=20 > > > It is annoying that I have to repeat my feedback, but I don=E2=80=99= t know why > > > admins want to enable this by allowing normal users to crash the sy= stems > > > more easily through recoverable MM bugs where I am sure we have ple= nty. > > > How does that improve the security? > >=20 > > There are cases where data corruption is a no-go, while "one node goi= ng down"=20 > > is acceptable. > > And then there is also the case for payed service providers that ofte= n need > > a dump at the time of the problem to understand rare issues. > >=20 > > So I DO see value in such a thing. We should just piggy-back on panic= _on_warn > > I guess. > >=20 >=20 > Indeed, so change pr_alert() to pr_warn() there then? pr_* are just printk levels. If you want a full trace and to hook to panic_on_warn, you want WARN_ON(condition) (or WARN_ON_ONCE(), etc). --=20 Kees Cook