Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2044123pxb; Sat, 2 Oct 2021 05:15:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYMF10xQt4g2U1bWrbgCi4RPyfVHp4XG6txcZZb3WLdKNXt6aZpaTtrHx8ziKAQtv/g236 X-Received: by 2002:a17:906:3f83:: with SMTP id b3mr3966930ejj.233.1633176959270; Sat, 02 Oct 2021 05:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633176959; cv=none; d=google.com; s=arc-20160816; b=Ih5bmylL9GgjFDEWdgHu/Y48E2EuvkIIfIbS0pKYBdJkFlhPuTTRH8fhfc2MPxD4kw 10r8oYtTREEWbVuQEI/c9kvhmxV0rlPVspZh6A9hwcJIMXMWuVuWgDDay9cFIaZvEkdI KEJV3hto4s1fRHUNbJs2E1ya7yP7HzjJedTImDcKHnhl7MsVQcNcVF0ZsRF86Z7LpSlw Nl5l9BwcYmJ8kV6+w6iSVVq/WfBeJozkiua5z5S4kTgrHGaEnHjAM2GYrwbKF/+D83Tc oPJdDeB4aQlor4cjKmFHzjlo2Lq5972DpJm1U6lHsCIlAd5QpUpLMRQ2Zl3dYO7EcQjp vQ6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=WZjvT50yQzFWI61scL2X9lyUHg5CoIkxnPyS6Z3RhLA=; b=bHa1bdt+NMTtkXcwkoVaFs49Lb8cw+qL9kJGhk01HpiPhEk+SMnaDKDbXC74PTe1Nj zWAf7Lg6eD/UW5Lko+ekDKizcF2Iu8DwUFQ+bWBN+f0NtKu7pNv3fRnYNqGLI233HsJe J/RgfmlFC4/PtDBnOC4JTUqmIFxeQaoHVAINZe3jNHhGSsV3rlSb7KeXz14VoqROf1uo P8ZURjw2yQW0Bf4C2us0fAklzAMW+zjrhUuVVF7Jig0k2IHMrz2GnjsNrv8N3V0zUFvp fRN2wSLi0mGr2akhe23x3jxY5iL78931Xa7SK1hafcPvmuaeu1CUZoUls0/LgasuLLLX hHpw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b25si9693458ejl.496.2021.10.02.05.15.31; Sat, 02 Oct 2021 05:15:59 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233106AbhJBMPs (ORCPT + 99 others); Sat, 2 Oct 2021 08:15:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:39430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233008AbhJBMPr (ORCPT ); Sat, 2 Oct 2021 08:15:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A0DE961A38; Sat, 2 Oct 2021 12:14:01 +0000 (UTC) Date: Sat, 2 Oct 2021 08:13:59 -0400 From: Steven Rostedt To: Alexander Popov Cc: Linus Torvalds , Petr Mladek , "Paul E. McKenney" , Jonathan Corbet , Andrew Morton , Thomas Gleixner , Peter Zijlstra , Joerg Roedel , Maciej Rozycki , Muchun Song , Viresh Kumar , Robin Murphy , Randy Dunlap , Lu Baolu , Kees Cook , Luis Chamberlain , Wei Liu , John Ogness , Andy Shevchenko , Alexey Kardashevskiy , Christophe Leroy , Jann Horn , Greg Kroah-Hartman , Mark Rutland , Andy Lutomirski , Dave Hansen , Will Deacon , David S Miller , Borislav Petkov , Kernel Hardening , linux-hardening@vger.kernel.org, "open list:DOCUMENTATION" , Linux Kernel Mailing List , notify@kernel.org Subject: Re: [PATCH] Introduce the pkill_on_warn boot parameter Message-ID: <20211002081359.5de4e2b1@oasis.local.home> In-Reply-To: References: <20210929185823.499268-1-alex.popov@linux.com> <20210929194924.GA880162@paulmck-ThinkPad-P17-Gen-1> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2 Oct 2021 14:41:34 +0300 Alexander Popov wrote: > Currently, the Linux kernel provides two types of reaction to kernel warnings: > 1. Do nothing (by default), > 2. Call panic() if panic_on_warn is set. That's a very strong reaction, > so panic_on_warn is usually disabled on production systems. > > >From a safety point of view, the Linux kernel misses a middle way of handling > kernel warnings: > - The kernel should stop the activity that provokes a warning, > - But the kernel should avoid complete denial of service. > > >From a security point of view, kernel warning messages provide a lot of useful > information for attackers. Many GNU/Linux distributions allow unprivileged users > to read the kernel log (for various reasons), so attackers use kernel warning > infoleak in vulnerability exploits. See the examples: > https://a13xp0p0v.github.io/2021/02/09/CVE-2021-26708.html > https://a13xp0p0v.github.io/2020/02/15/CVE-2019-18683.html > https://googleprojectzero.blogspot.com/2018/09/a-cache-invalidation-bug-in-linux.html > > Let's introduce the pkill_on_warn parameter. > If this parameter is set, the kernel kills all threads in a process that > provoked a kernel warning. This behavior is reasonable from a safety point of > view described above. It is also useful for kernel security hardening because > the system kills an exploit process that hits a kernel warning. How does this help? It only kills the process that caused the warning, it doesn't kill the process that spawned it. This is trivial to get around. Just fork a process, trigger the warning (it gets killed) and then read the kernel log. If this is your rationale, then I'm not convinced this helps at all. -- Steve