Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2818661pxb; Tue, 13 Apr 2021 10:53:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5R8ZAYionNU3fY6ARm925bUdsbGFFXSOj+5VssnBbAtz9Y8gWTgdFSbd7dYDo0/RVIKJQ X-Received: by 2002:a17:906:9344:: with SMTP id p4mr2671888ejw.346.1618336384924; Tue, 13 Apr 2021 10:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618336384; cv=none; d=google.com; s=arc-20160816; b=Ng7jLXhEjT5fycbRQjLAHpWKnVKD1VB9EjqiTfMeM3KLQNelMVqNNTR6BxfALBmjsk 1sILh3K5YwBWNNMUgxdrg2+3vhUTzm6jPBi7MBolemVuX8ASnCrXkBLLpDtEVqG8A0CK U7W6kfeXUgpOkeXGoFNbdSlXxD38esW74tvh/p1gX8M9B2hFuOXPibz98pRP9G0xWJh5 ArEmDszJT6oEAtb3htS3boJd6vhO+INboELhp4e6TLsBsWMmjpTkQoefM60J+GC2pwfc ydHyGhlNIA6fkkOzBtk7GCzWpx86E1V/XOWdyaiek7/8udw2nkuGhGJsni0XPQ/1OEA7 LHtg== 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=uVc3gk3RiW66QHsedJyL+ZyL+daALvPHN8/Ac6uvnds=; b=waVoPO6UndKGeC/zOUPxERDLCBkGixguaJI4wGJIe2Wg1RPC6NOxqW7DLadF3mVVdg AjMPjM6q77yAKmGYXM8FjXed/VTXpnfnHRqNsD2/vylGlZP1VPc/Pq8VBMH7AkwQN5zw cAR3WOmN79fcdSCdT9w85zroUUwSg+ZRsYum1GAonPkmzTmNr9dqibcRefmAvktq/B6G cO7EIvvoGSMwHMfZ09qwmjOa2LudaGr+bG4prwzcEYKq1Et98zIvx/p3BJsEgmSvuKMZ 4z1FO27lxfBfIqPUsfEl0B3UuvnamOKy/5li+3l3W56wmUpjkTbj74wsGNUOSKJPeGHy SPvg== 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 i10si2583714edc.63.2021.04.13.10.52.41; Tue, 13 Apr 2021 10:53:04 -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 S238932AbhDMMzy (ORCPT + 99 others); Tue, 13 Apr 2021 08:55:54 -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: linux-kernel@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