Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3568107pxb; Mon, 24 Jan 2022 12:24:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2s+fjvdppXdDcSshKB/bhqdguG0JUV5VBIdAR7uYW1v5tTu1DCgv1DBVfKrlJTuy7dB+x X-Received: by 2002:a05:6a00:b42:b0:4c9:ede0:725a with SMTP id p2-20020a056a000b4200b004c9ede0725amr3944655pfo.35.1643055893537; Mon, 24 Jan 2022 12:24:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055893; cv=none; d=google.com; s=arc-20160816; b=v3VMBgj9oyuUEhDA5GH6w+Z+sdzGz6aYqmIruqdgojOQ0YsWndBfOo+VRiFtuhmZ1m W1E2g6yZXXEVkT/SZ6v7FUlMi1EG5MjAmczzLGMPzy6LkURtl0t8dQ3dVIuGMpLXLoNu VrCY894KUYqIl23IARN9z6NqZ0vWmk0IxsGfAsYSe7bvCeT38rzgtnfREGrbmmpahmZA n8jW7775QSRx+RhORUSl+xYGOrE2vCAG2TYlWSkKtKAQZpyogZM/zgIAkDnBgyaLc0pJ yxOrJz/UMDRpzheEp0sV3Ssk4ihZy5EV63PQ7kNmd4tTLwA3U8PvqZgQKcKYuXGbaCfa LekQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GyqfKlKekyGQFt39jJupeWyC925mSrzkK4qOxqVkheI=; b=TpajBRSXMKXPYOWUSvPgHYTQd7eMWK/8XTo4wkwE3XcuZw57K9mhA5UFZC7MtvEf2K zOSGJZcQXh7lg3JNnd/yTrVlQxsThtC+WJI7k0hcgM/BypgIVH5hk4RWZdBd6of42b6N O7UWpUb9l12tJa0VrJjL3vkQX4LksAmCzIV1C0fEMeoywNFeE/exa/PId2y4lC/JNKmt nMGzlmHxSDmw2sbS+6NKx2GJELxqrHpRJfT4qh2mgwGFZt1FLtgakJzvUP0ufmjXDHET 38RfHhFUTg7++i/WU1yg/o4hgW8DxYqTXVLzDn5yhi0kmJMg0WBw9jLeLcOyKb6gloLL nKHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y45ZUuWq; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t11si13863480plb.353.2022.01.24.12.24.27; Mon, 24 Jan 2022 12:24:53 -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=@linuxfoundation.org header.s=korg header.b=y45ZUuWq; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352394AbiAXTaR (ORCPT + 99 others); Mon, 24 Jan 2022 14:30:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349671AbiAXTVI (ORCPT ); Mon, 24 Jan 2022 14:21:08 -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 1D111C02B847; Mon, 24 Jan 2022 11:08:10 -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 B259060EC4; Mon, 24 Jan 2022 19:08:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92DC7C340E5; Mon, 24 Jan 2022 19:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051289; bh=mIQD3rvB24aaYZEoVuPk+eHBuRYOQU0k+ObbwHf9U9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y45ZUuWqnoDTK9QTsk/DvduCRgfIokn7esrni1Jf0+DDJHXOlHqsuLZIHN+DGXTPZ NRWr35e8OIj0IeM96NH5eGR8DeK4dChYLsBbdNgsqUvgb3cykpgcMLhESarA5E94Ed oJcXIkJBOXmzngj+6Kk4qKhJKDvbdDlXPqpPWEcU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Daniel Borkmann , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Sasha Levin Subject: [PATCH 4.14 107/186] bpf: Do not WARN in bpf_warn_invalid_xdp_action() Date: Mon, 24 Jan 2022 19:43:02 +0100 Message-Id: <20220124183940.557495978@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 40b378bed6033..729e302bba6e9 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -3644,9 +3644,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