Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp480669imn; Wed, 27 Jul 2022 11:23:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vLpAwu2ua9w+C/eb/WnJiH4DBqc2W6WWzpq+8JCTSHkqsZU8fxGlZIXNmyC9GtXKbWLfqW X-Received: by 2002:a17:902:d642:b0:16b:d5b7:1117 with SMTP id y2-20020a170902d64200b0016bd5b71117mr21448497plh.167.1658946197823; Wed, 27 Jul 2022 11:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946197; cv=none; d=google.com; s=arc-20160816; b=hNj2xgG6y8kwJS8saVMX3s0D5XNWpDD0DiO0mDNGv18yfvP274ArKgsqvxDE4ld08x tIn5MiBofTDxvDW+wiH54cw1Jk8zN4GiLhMIWZbTerWdIxzSc2fm/qjSiqdAtaf3hm21 wKfkJzsC6r+gceCOVZrFekNkRSEgh/ov2S3q4oAQCIbh4jukwlrZEp309INDlj20ptil xc+rTdqLOqbyH79dlTq3u+c5t6kMiIexJX8+2Tf/jJk6Zhxu11rjsaKAZrKyPsiFlAI7 JOxXgH4uD5gKjmoXnXzN2PKroc/BOyAWHOWn8DgAMoYcSu83PlLKzxbGobl6WUV/7w7M sB+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AcPJOkIHEC0icvBEnpWtnVKxz/BvRtFJOpxpTEHoQRg=; b=BQqjpT+8FyMJKJhtf4w9+T0U8AmA4iCJ9z5vfNGHfIr2NsBoP+TyQohQCCZDjXIs5B Gvuy6qG01oE17D0L0PbVpnGcvduEK16cuEDMv52igT4c/63zRFXDEwaRP6JoqXTlYoKK 3xNL7XNJzLPK58AHPPL3SHwtAtmodcak9uYkwug9a7nTjwwq/Pf8hbOqDSdAEVvNryot u1cHYjMosGPUvan9JOTdHGh7R8j9oalhlivxEiw8012bwnShJzWtnWaD0ItaOOecCKgM 5VU+ArHNcHcC+R39E23pJ9Wez3A5ggzdPFtcRd8PnHpXKhMsXqMJzKyFl8rNTwlE80NN 5+/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=dnnAblfb; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e2-20020a170902cf4200b0016bcfc5f7f0si2551203plg.127.2022.07.27.11.23.03; Wed, 27 Jul 2022 11:23:17 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=dnnAblfb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241583AbiG0RP0 (ORCPT + 99 others); Wed, 27 Jul 2022 13:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241674AbiG0ROL (ORCPT ); Wed, 27 Jul 2022 13:14:11 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECB027754E for ; Wed, 27 Jul 2022 09:42:33 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id z23so32275903eju.8 for ; Wed, 27 Jul 2022 09:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AcPJOkIHEC0icvBEnpWtnVKxz/BvRtFJOpxpTEHoQRg=; b=dnnAblfbBitvVzSIxg4x60tAPSI8URVjg+EFtGQCO+Egbv95vWxxuJA0seKRUNvCni MH/l2lfP3y3m2n82QniX+RZ7l/z/R/u1/iB5fRHweoFmNcwnKUaQHfBq5L2Tk1oDNYlw q+xyWk2wZadVAhHiWbYj77fvxQHCyW96l9uJ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AcPJOkIHEC0icvBEnpWtnVKxz/BvRtFJOpxpTEHoQRg=; b=LTHT4f6C4jZrlo4MyeihkoUp57FkTo7VU5kDdsf5ND+DXvlx/6NJS/Xpl3oeOwVydH jgCzt99QPswd8+7K3d2KXe5ZZt4817k0tm7puRLwc3JMFngmMLnLXwlO1RUdm1fE9YjW 90yQMF+VgTCaLg8tzg16g5DVn0vK2mtEYAVSt4tRDAJ4lOVRllHQtEW9xz6t7uDm4PjS J5uPgUVmlKkuYa8fGNem2e8/ztd+AxG0Dpwb7lCa2pOeRfPJFko7bOd4DAf619ljYo8L 2Bw6i0oDfn46SvfXtMfspXqxtLnF2WPMVGytavp+E/BaW7NyvtkNmr3ahLtuqWgaHrHl lukg== X-Gm-Message-State: AJIora+jfMscaORpr8LT92V0jbUrBXZ8pzmNlTyVi8WAzvDZJ5G+uk5l xg3kK3LDmmMrl3OoaLC9kMnkuD61aCnVEK0X X-Received: by 2002:a17:906:9b0a:b0:72b:4f33:b247 with SMTP id eo10-20020a1709069b0a00b0072b4f33b247mr18633962ejc.267.1658940150043; Wed, 27 Jul 2022 09:42:30 -0700 (PDT) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com. [209.85.221.41]) by smtp.gmail.com with ESMTPSA id i21-20020aa7c715000000b0043a6fde6e7bsm10346422edq.19.2022.07.27.09.42.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Jul 2022 09:42:29 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id d8so25226977wrp.6 for ; Wed, 27 Jul 2022 09:42:28 -0700 (PDT) X-Received: by 2002:a05:600c:4ed0:b0:3a3:3ef3:c8d1 with SMTP id g16-20020a05600c4ed000b003a33ef3c8d1mr3721170wmq.154.1658940137807; Wed, 27 Jul 2022 09:42:17 -0700 (PDT) MIME-Version: 1.0 References: <20210929185823.499268-1-alex.popov@linux.com> <20210929194924.GA880162@paulmck-ThinkPad-P17-Gen-1> <7c567acd-1cc1-a480-ca5a-d50a9c5a69ef@ispras.ru> In-Reply-To: <7c567acd-1cc1-a480-ca5a-d50a9c5a69ef@ispras.ru> From: Linus Torvalds Date: Wed, 27 Jul 2022 09:42:01 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Introduce the pkill_on_warn boot parameter To: Alexey Khoroshilov Cc: Petr Mladek , "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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Wed, Jul 27, 2022 at 9:17 AM Alexey Khoroshilov wrote: > > 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 That first case is entirely bogus. WARN_ON() should only be used for "This cannot happen, but if it does, I want to know how we got here". But the second case is fine: Using "pr_warn()" is fine. A kernel warning (without a backtrace) is a normal thing for something that is deprecated or questionable, and you want to tell the user that "this app is doing something wrong". So if that j1939 thing is something that can be triggered by a user, then the backtrace should be reported to the driver maintainer, and then either (a) the WARN_ON_ONCE() should just be removed ("ok, this can happen, we understand why it can happen, and it's fine") (b) the problem the WARN_ON_ONCE() reports about should be made impossible some way (c) it might be downgraded to a pr_warn() if people really want to tell user space that "guys, you're doing something wrong" and it's considered a useful warning. Honestly, for something like that j1939 can driver, I doubt (c) is ever an option. The "return -EBUSY" is the only real information that a user needs. Linus