Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp406517imn; Wed, 27 Jul 2022 09:23:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vPKK18RXC5Q7NdkAfKgg9nxmndQCjXNTHeKyTWniVg3Ky5ZaQWoDEVyjYP08kOvtS0kQJ+ X-Received: by 2002:a17:90b:3c8c:b0:1f2:205c:2480 with SMTP id pv12-20020a17090b3c8c00b001f2205c2480mr5561730pjb.54.1658939014183; Wed, 27 Jul 2022 09:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658939014; cv=none; d=google.com; s=arc-20160816; b=IXuUV1CF6sI/7tMTAF4QXgOo+wj1BHHtilDt6rNBdiJtqv9mpmj57C1XDc/g/XLbGX 2slWeZ6WLQmaT4zMShAmBVVfGxPo73xLBFAWo6070k7uo8OKrX2dbIraJtMsunwuLo4d dK9Eh3eE6fqRWM4gTtuVF0taHhkE6JzSHzsmuddGUmsdCipI6BDcMHiaT+BVQd2Z+N12 qbSxKskYTdRN644wZB65sc1z6OSeRP+uIqcdHLZ+x0Fb6WXTYTgyOm3M6GKpf7fkdE+4 uehYf65ImmJ+xKwD6QRKEQJgYRgPOyX8B1Zy1LwZe9jGQGDbNQCWlbTpkRLLrYLPoULx HNzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:autocrypt:from :references:cc:to:subject; bh=pKGpP4KRXuFFvGL5h4Mk/XPzH5mTx/OzN208W074CuQ=; b=J+cIcv4JdXUtH4dNMlHlFuwhUjHB05noOi/JLeBnCUlWK9Ookic9oqwWRAm+wAufGm Xmj9uaCaFL5cR2WgRF4B1CgccTwYPzU5BPWK2vPkoe0SbdsfMYZEczXq7tiyAtcHF8XI jpjXIZT/ZmZpHjdsgsjJ4SWhbE60dgUa6qhGvbeQmJSyTzEHPNlnZ47fmeI3xQCm5o2g ZrynXrClSIlTvQffkB20kGIR/kzDLQ/QDcVelYXHn7GuCLzncCZRTyXe0uzkXKOAYpkn HirYVwWuYI3Ovxy82W3sNCKLzIy9kqohGqE5JWvilav8kA1Nm1L+1Bof7k6pgBbnAngX r8WQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a65508a000000b0040c3a6764b6si20981484pgp.203.2022.07.27.09.23.17; Wed, 27 Jul 2022 09:23:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234843AbiG0QRQ (ORCPT + 99 others); Wed, 27 Jul 2022 12:17:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234884AbiG0QRK (ORCPT ); Wed, 27 Jul 2022 12:17:10 -0400 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F2FF4B0EC; Wed, 27 Jul 2022 09:17:08 -0700 (PDT) Received: from [10.10.2.52] (unknown [10.10.2.52]) by mail.ispras.ru (Postfix) with ESMTPSA id C515040737AE; Wed, 27 Jul 2022 16:17:04 +0000 (UTC) Subject: Re: [PATCH] Introduce the pkill_on_warn boot parameter To: Linus Torvalds , Petr Mladek Cc: "Paul E. McKenney" , Alexander Popov , 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 , Steven Rostedt , Thomas Garnier , Will Deacon , Ard Biesheuvel , Laura Abbott , David S Miller , Borislav Petkov , Kernel Hardening , linux-hardening@vger.kernel.org, "open list:DOCUMENTATION" , Linux Kernel Mailing List , notify@kernel.org References: <20210929185823.499268-1-alex.popov@linux.com> <20210929194924.GA880162@paulmck-ThinkPad-P17-Gen-1> From: Alexey Khoroshilov Autocrypt: addr=khoroshilov@ispras.ru; prefer-encrypt=mutual; keydata= xsFNBFtq9eIBEACxmOIPDht+aZvO9DGi4TwnZ1WTDnyDVz3Nnh0rlQCK8IssaT6wE5a95VWo iwOWalcL9bJMHQvw60JwZKFjt9oH2bov3xzx/JRCISQB4a4U1J/scWvPtabbB3t+VAodF5KZ vZ2gu/Q/Wa5JZ9aBH0IvNpBAAThFg1rBXKh7wNqrhsQlMLg+zTSK6ZctddNl6RyaJvAmbaTS sSeyUKXiabxHn3BR9jclXfmPLfWuayinBvW4J3vS+bOhbLxeu3MO0dUqeX/Nl8EAhvzo0I2d A0vRu/Ze1wU3EQYT6M8z3i1b3pdLjr/i+MI8Rgijs+TFRAhxRw/+0vHGTg6Pn02t0XkycxQR mhH3v0kVTvMyM7YSI7yXvd0QPxb1RX9AGmvbJu7eylzcq9Jla+/T3pOuWsJkbvbvuFKKmmYY WnAOR7vu/VNVfiy4rM0bfO14cIuEG+yvogcPuMmQGYu6ZwS9IdgZIOAkO57M/6wR0jIyfxrG FV3ietPtVcqeDVrcShKyziRLJ+Xcsg9BLdnImAqVQomYr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OuKEvCVu+U/iEEJxx1JRmVAYq848YqtVPY9DkZdBT4E9dHqO n8lr+XPVyMN6SBXkaR5tB6zSkSDrIw+9uv1LN7QIri43fLqhM950ltlveROEdLL1bI30lYO5 J07KmxgOjrvY8X9WOC3O0k/nFpBbbsM4zUrmF6F5wIYO99xafQOlfpUnVtbo3GnBR2LIcPYj SyY3dW28JXo2cftxIOr1edJ+fhcRqYRrPzJrQBZcE2GZjRO8tz6IOMAsc+WMtVfj5grgVHCu kK2E04Fb+Zk1eJvHYRc= Message-ID: <7c567acd-1cc1-a480-ca5a-d50a9c5a69ef@ispras.ru> Date: Wed, 27 Jul 2022 19:17:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01.10.2021 22:59, Linus Torvalds wrote: > On Thu, Sep 30, 2021 at 2:15 AM Petr Mladek wrote: >> >> Honestly, I am not sure if panic_on_warn() or the new pkill_on_warn() >> work as expected. I wonder who uses it in practice and what is >> the experience. > > Afaik, there are only two valid uses for panic-on-warn: > > (a) test boxes (particularly VM's) that are literally running things > like syzbot and want to report any kernel warnings > > (b) the "interchangeable production machinery" fail-fast kind of situation > > So in that (a) case, it's literally that you consider a warning to be > a failure case, and just want to stop. Very useful as a way to get > notified by syzbot that "oh, that assert can actually trigger". > > And the (b) case is more of a "we have 150 million machines, we expect > about a thousand of them to fail for any random reason any day > _anyway_ - perhaps simply due to hardware failure, and we'd rather > take a machine down quickly and then perhaps look at why only much > later when we have some pattern to the failures". > > You shouldn't expect panic-on-warn to ever be the case for any actual > production machine that _matters_. If it is, that production > maintainer only has themselves to blame if they set that flag. > > But yes, the expectation is that warnings are for "this can't happen, > but if it does, it's not necessarily fatal, I want to know about it so > that I can think about it". > > So it might be a case that you don't handle, but that isn't > necessarily _wrong_ to not handle. You are ok returning an error like > -ENOSYS for that case, for example, but at the same time you are "If > somebody uses this, we should perhaps react to it". > > In many cases, a "pr_warn()" is much better. But if you are unsure > just _how_ the situation can happen, and want a call trace and > information about what process did it, and it really is a "this > shouldn't ever happen" situation, a WARN_ON() or a WARN_ON_ONCE() is > certainly not wrong. > > So think of WARN_ON() as basically an assert, but an assert with the > intention to be able to continue so that the assert can actually be > reported. BUG_ON() and friends easily result in a machine that is > dead. That's unacceptable. Hi Linus, Coming back to the discussion of WARN_ON()/pr_warn("WARNING:") semantics. We see a number of cases where WARNING is used to inform userspace that it is doing something wrong, e.g. https://elixir.bootlin.com/linux/v5.19-rc8/source/net/can/j1939/socket.c#L181 https://elixir.bootlin.com/linux/v5.19-rc8/source/drivers/video/fbdev/core/fbmem.c#L1023 It is definitely useful, but it does not make sense in case of fuzzing when the userspace should do wrong things and check if kernel behaves correctly. As a result we have warnings with two different intentions: - warn that something wrong happens in kernel, but we are able to continue; - warn userspace that it is doing something wrong. During fuzzing we would like to report the former and to ignore the latter. Are any ideas how these intentions can be recognized automatically? Best regards, Alexey