Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3389931pxb; Mon, 17 Jan 2022 19:24:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHMmDQi7GkyexGyB3zjPxAk7AUyeTr51bb4ZP3z6we6rmEeFxHcU+LOZf1yD6B9F5HMgjR X-Received: by 2002:a17:90b:3809:: with SMTP id mq9mr20810951pjb.234.1642476244332; Mon, 17 Jan 2022 19:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642476244; cv=none; d=google.com; s=arc-20160816; b=muR6x27n8kRbr02zN3XBCFYPz7wsTISRh9lRKIsGFMbyYFKZg6mGbuYQLyE0H2PCcM n1j5oFayLjaf+qNXxrllqzt3Rty+JGxmz1NuYJXQawFrKgX2wtvnl0qn0U5BAI+3dmg5 H5oQUngv2N0ICTRb2qJeyBW0UJ49nqIoANEmInU7Hpc0LYVVbx6OM7bcLCK7PtvU2Xg4 jwhgh+Zzh5cQSiSFd4kbeptDaA16UFu7kau4exxv5nefaH1xdctEwtH1bdZwT6hR3VLW s8ihmYpmgWoiLgDl8BhudFbW8Hc3HVk7DJEbD9gyhlnDVDXy/aBr/8ud8kASBKExTvUI LY4Q== 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:date:subject:cc:to:from :dkim-signature; bh=8hrW1M2VZ3NjDrgELAeMcYdS6Z7Dh3a8qACNphmnm2c=; b=q17xWcRs5sMo8r9QcCQlOKQxb2Opckss2JmCYimulm0ZGY+z3XqejWqb4mwSi3xuHc PS/QQYrxjUUW68WYS2KC+B9yTVO1jkiBL2uimHkbWV8NjlRCupMdHIZyjHO2zSkB8Vcm ZCzNwx5J4L8jtfZEkKTn35rylOXkMgElTYS8BUHDNmHZGBcz1tMpSy1OeGgCz20mL9cB BuWUBck4uDVSlODehm84P5F37Fg/9L/yFBLlHhQrpGN5VPBZTBhHH1rONWk3LvP1shgt CGZn+rnHI6bgGA3NFVUJrWGfqDeXMoAwyIx9pMFMjYsSrzK95d/0Lw6vcdQfVHDL8VH1 FhNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jmtH46wV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q5si17847956pfj.253.2022.01.17.19.23.52; Mon, 17 Jan 2022 19:24:04 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jmtH46wV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245757AbiARCdJ (ORCPT + 99 others); Mon, 17 Jan 2022 21:33:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344079AbiARC2w (ORCPT ); Mon, 17 Jan 2022 21:28:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FC63C0612AD; Mon, 17 Jan 2022 18:26:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C2E0F60AE3; Tue, 18 Jan 2022 02:26:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9579C36AEB; Tue, 18 Jan 2022 02:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472762; bh=v4GfyUoxO/3i7wg7IBAZoBsHea3YJJ73B4jQ4QK/cWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jmtH46wVrTx+CCCwsFGwTY5DZiIRwqLuCcKTYrTtjkXV/75cfXRQFad7PELcUg5EE AeJWrJ5RXEgdfoFybDwKS3vsSopCObasYvwUxfmFJ743+UqnIJK/8C3wmtJIEs4pHk 2xlaJssl0LN5uWQaqR4xhKHda/jcwvSYK1IUYCFD3isRB9pJrer1pcxlbYx36+quXb kLyu4IEtKIH5iQGd/araTzjcNSbJs3nBEAO6C1nES40KzhQKK4GmXkinN/aNpZu7Yc p7cC0Yk1iqGdZa/UyTQ6edZbMDg8M0t5UtcQCydecN0tTs1hQPzTvguEluwu9V12ss 8csQ/Eft94XVQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Paolo Abeni , Daniel Borkmann , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Sasha Levin , ast@kernel.org, andrii@kernel.org, davem@davemloft.net, kuba@kernel.org, hawk@kernel.org, john.fastabend@gmail.com, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 129/217] bpf: Do not WARN in bpf_warn_invalid_xdp_action() Date: Mon, 17 Jan 2022 21:18:12 -0500 Message-Id: <20220118021940.1942199-129-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paolo Abeni [ Upstream commit 2cbad989033bff0256675c38f96f5faab852af4b ] The WARN_ONCE() in bpf_warn_invalid_xdp_action() can be triggered by any bugged program, and even attaching a correct program to a NIC not supporting the given action. The resulting splat, beyond polluting the logs, fouls automated tools: e.g. a syzkaller reproducers using an XDP program returning an unsupported action will never pass validation. Replace the WARN_ONCE with a less intrusive pr_warn_once(). Signed-off-by: Paolo Abeni Signed-off-by: Daniel Borkmann Acked-by: Toke Høiland-Jørgensen Link: https://lore.kernel.org/bpf/016ceec56e4817ebb2a9e35ce794d5c917df572c.1638189075.git.pabeni@redhat.com Signed-off-by: Sasha Levin --- net/core/filter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index 6102f093d59a5..04032f64e01bc 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -8185,9 +8185,9 @@ void bpf_warn_invalid_xdp_action(u32 act) { const u32 act_max = XDP_REDIRECT; - WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n", - act > act_max ? "Illegal" : "Driver unsupported", - act); + pr_warn_once("%s XDP return value %u, expect packet loss!\n", + act > act_max ? "Illegal" : "Driver unsupported", + act); } EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); -- 2.34.1