Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp784130ybk; Fri, 15 May 2020 13:28:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/tbNjtDaSyHd2CswFzVcp9TOxZiqUjaqfMRKG1GvuvigFNVw8drGW3tVE39XvezSut0fI X-Received: by 2002:a05:6402:21cc:: with SMTP id bi12mr4556846edb.294.1589574528950; Fri, 15 May 2020 13:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589574528; cv=none; d=google.com; s=arc-20160816; b=zMh33jeCrQnnROHkdr7NgA0PrD+JYsRavRsxZmH1El6MVhSgbl0YHMWHIypPp1x8If KkqGkGEpJkCIWEzRrf4+mskl/VipZSd8mKyxVNXfY4YmGhoQdGx/Ofi5pdYwj+gpAjQ6 XSjEn1Jg/AVX0rawAM2ieKN8sqpLDPyCv5js8Bm5lOGHSLCKswEKHilPeNxMt7TCmuTl Fg+aVoQcrP/VVg0JxGnFkqhf7F0maAi+EfocZ7w3VePVj9eJhk7RZa3cG7GbB68984FI jd/By+G47jSPajVRHghr7SpEjWONYk2UaMwy06SFPVgGZEY/cVP2XUiuA3PYm5ezSorP 8wgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=BjLEoH1/onS9gWc/WGPUDHWQzqwo7CrmGrZOV7KWi24=; b=cNcSrCYHu6DY9XiWQTZBLPue7hx9ayaZnwxBvstc+SmDfrSZvr0NVV+lMvWkQT4JfM y1QJt6iJcuRdEXNAxS1nw2tac38FJ8wi5u+XR+oy/W3FPq1nvdtLz3xD+SNGV794kboo DrWCWcdvm22KVsczdHsA8M2nwLD/iWSAM3qYi46SkAQ1rz9FrsXe5VVhFH/oWjdiDCDZ Gi26TZmT+zAJ0vZjVbmWxY89jBvrJHACnzWXTDtiZPtSXY4a+36Mnz/q2mo+8rXtGzTG lCOjNsoEstCJI4zeQZ6/Fg+rlyfvikebT0x/pzw6XdmGZLKTgVZ3yQJl+bNiqyhiN5nk tmlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gr5si1787062ejb.509.2020.05.15.13.28.26; Fri, 15 May 2020 13:28:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726558AbgEOU1A (ORCPT + 99 others); Fri, 15 May 2020 16:27:00 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43785 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbgEOU1A (ORCPT ); Fri, 15 May 2020 16:27:00 -0400 Received: by mail-pf1-f196.google.com with SMTP id v63so1515480pfb.10; Fri, 15 May 2020 13:26:59 -0700 (PDT) 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:in-reply-to:user-agent; bh=BjLEoH1/onS9gWc/WGPUDHWQzqwo7CrmGrZOV7KWi24=; b=UamxaYbhgmj4ujJONx9S2X0l7P6wumcxE4lCGY7L+hC75LuNCGzJEMVPtzKi3tAkm0 ZjNsthL6BZX6hgsdieTZuM9UDtBXG8JjW+SzW2IK6F79BYnh925FesrYfzhtQncTuhal scZM6DgFKImNeRAgxcq4e2L0t6eq6+ttNwcm4DENzstvSE2jVtnucOitxtaEUsIgt5Uo nv4EHBREXpcwTKl9VfV9+oZbIT1y9pUpMPCJBFAVewlTHeyEMsUp384i7UGYKPzllDHK UHfopQlU+IticbbiN9Q5dwMZfEKeJZN8Jr4rDW0PpF3dl2H/Gg/IJjFoIQwg7yDLaarJ +Hzg== X-Gm-Message-State: AOAM531FQfaSSrvtxOHnfCYDpvINMx4IMb4Bzn63zur9rX2DuWdGAeY+ X4bQZPds47HkgnQFgaml8rE= X-Received: by 2002:a65:608c:: with SMTP id t12mr4951599pgu.46.1589574418563; Fri, 15 May 2020 13:26:58 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id d18sm2638767pfq.177.2020.05.15.13.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 13:26:57 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id B49A240246; Fri, 15 May 2020 20:26:56 +0000 (UTC) Date: Fri, 15 May 2020 20:26:56 +0000 From: Luis Chamberlain To: Rafael Aquini Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org, dyoung@redhat.com, bhe@redhat.com, corbet@lwn.net, keescook@chromium.org, akpm@linux-foundation.org, cai@lca.pw, rdunlap@infradead.org, tytso@mit.edu, bunk@kernel.org, torvalds@linux-foundation.org, gregkh@linuxfoundation.org, labbott@redhat.com, jeffm@suse.com, jikos@kernel.org, jeyu@suse.de, tiwai@suse.de, AnDavis@suse.com, rpalethorpe@suse.de Subject: Re: [PATCH v5] kernel: add panic_on_taint Message-ID: <20200515202656.GZ11244@42.do-not-panic.com> References: <20200515175502.146720-1-aquini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200515175502.146720-1-aquini@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 15, 2020 at 01:55:02PM -0400, Rafael Aquini wrote: > Analogously to the introduction of panic_on_warn, this patch introduces a kernel > option named panic_on_taint in order to provide a simple and generic way to stop > execution and catch a coredump when the kernel gets tainted by any given flag. > > This is useful for debugging sessions as it avoids having to rebuild the kernel > to explicitly add calls to panic() into the code sites that introduce the taint > flags of interest. For instance, if one is interested in proceeding with a > post-mortem analysis at the point a given code path is hitting a bad page > (i.e. unaccount_page_cache_page(), or slab_bug()), a coredump can be collected > by rebooting the kernel with 'panic_on_taint=0x20' amended to the command line. > > Another, perhaps less frequent, use for this option would be as a mean for > assuring a security policy case where only a subset of taints, or no single > taint (in paranoid mode), is allowed for the running system. > The optional switch 'nousertaint' is handy in this particular scenario, > as it will avoid userspace induced crashes by writes to sysctl interface > /proc/sys/kernel/tainted causing false positive hits for such policies. > > Suggested-by: Qian Cai > Signed-off-by: Rafael Aquini Reviewed-by: Luis Chamberlain Luis