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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 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 8CA9EC43460 for ; Tue, 13 Apr 2021 12:55:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B36E613B6 for ; Tue, 13 Apr 2021 12:55:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240523AbhDMMz4 (ORCPT ); Tue, 13 Apr 2021 08:55:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:51892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231493AbhDMMzu (ORCPT ); Tue, 13 Apr 2021 08:55:50 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5674A613B3; Tue, 13 Apr 2021 12:55:24 +0000 (UTC) Date: Tue, 13 Apr 2021 08:55:22 -0400 From: Steven Rostedt To: Dmitry Vyukov Cc: Yonghong Song , syzbot , Andrew Morton , andrii@kernel.org, Alexei Starovoitov , Borislav Petkov , bpf , Daniel Borkmann , David Miller , Jesper Dangaard Brouer , "H. Peter Anvin" , Jim Mattson , John Fastabend , Joerg Roedel , Martin KaFai Lau , kpsingh@kernel.org, Jakub Kicinski , KVM list , LKML , Mark Rutland , masahiroy@kernel.org, Ingo Molnar , netdev , Paolo Bonzini , Peter Zijlstra , rafael.j.wysocki@intel.com, Sean Christopherson , Song Liu , syzkaller-bugs , Thomas Gleixner , vkuznets@redhat.com, wanpengli@tencent.com, will@kernel.org, x86@kernel.org Subject: Re: [syzbot] WARNING in bpf_test_run Message-ID: <20210413085522.2caee809@gandalf.local.home> In-Reply-To: References: <000000000000d9fefa05bee78afd@google.com> <97b5573f-9fcc-c195-f765-5b1ed84a95bd@fb.com> X-Mailer: Claws Mail 3.17.8 (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: netdev@vger.kernel.org On Tue, 13 Apr 2021 09:56:40 +0200 Dmitry Vyukov wrote: > Thanks for looking into this. > If this is not a kernel bug, then it must not use WARN_ON[_ONCE]. It > makes the kernel untestable for both automated systems and humans: > > https://lwn.net/Articles/769365/ > > > Greg Kroah-Hartman raised the problem of core kernel API code that > will use WARN_ON_ONCE() to complain about bad usage; that will not > generate the desired result if WARN_ON_ONCE() is configured to crash > the machine. He was told that the code should just call pr_warn() > instead, and that the called function should return an error in such > situations. It was generally agreed that any WARN_ON() or > WARN_ON_ONCE() calls that can be triggered from user space need to be > fixed. > I agree. WARN_ON(_ONCE) should be reserved for anomalies that should not happen ever. Anything that the user could trigger, should not trigger a WARN_ON. A WARN_ON is perfectly fine for detecting an accounting error inside the kernel. I have them scattered all over my code, but they should never be hit, even if something in user space tries to hit it. (with an exception of an interface I want to deprecate, where I want to know if it's still being used ;-) Of course, that wouldn't help bots testing the code. And I haven't done that in years) Any anomaly that can be triggered by user space doing something it should not be doing really needs a pr_warn(). Thanks, -- Steve