Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp689164pxb; Tue, 5 Apr 2022 18:53:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBOo1uBaKeTubIaae77jyg4UniArA8Un1MSC52VC6UXXVnvf+r7qYF03Z5rOTGpAOtbbq3 X-Received: by 2002:a17:907:8a1b:b0:6e7:681e:b4b1 with SMTP id sc27-20020a1709078a1b00b006e7681eb4b1mr6216685ejc.392.1649210013912; Tue, 05 Apr 2022 18:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649210013; cv=none; d=google.com; s=arc-20160816; b=oY1FFqUALF/6qsa5y34zzGSVBSGHRU3kQqeWIqWIlXN8zdseRaPKgPNplPMqGHBddM iaBQdXI9M3ozWFsZx1hvTaIpwRi934v/CnMX/TaL2rjKaKtZ1LK9mvObPmphqKgr/2sO vl7prPHzcJat9Xu05nNbEHKLNCS8u4LX+Szbf49bsNmrsMBpuvV6kOHZRIoYKHDjZ828 CbPilsjB+KctZ4+5ePSYL31+JoaXhbnLGCktEsa1HJDSrYVGVvwEhzFz7LLSno5WGvDc 93CW7vCXhRi24CEjmRDZae1z6bZYgkLVA6alsdm2j30SJnbWh2uJ+FRHBZpig18cw2O3 fxng== 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=Bnh/ReO19veFZs0nCvegxdl7eNXssr+Z51g1snEuqTg=; b=mUDh+zbW7zR5gZv/6ijrRRTG0U4eyhJW2EdCRfbTowZXe64ULz6tzq8H9EPnyFDdBG AB0y9Ht3EVsp6XQdW8nOj2wOAj1Yq0iq6yQTZ8WsVpCaWD80jOjhLHagGJvXLiM3eT5q uO50yp7Y8rC+RKUFhXP6v63XiZQrEKBhSemsFkHFb64m9xMAmskeEXuDHm6PK0QBU0uI dLKlMEQmaayn9Da7ZU5VAiLKfSVKl5NZJCUYDEk/lMu+Z0aiFK7HO/5wv/u8Q2F7Drfe gYerjWnmIK28ZGfd7h5wwOvTY5DTHEw4cG3WQQ6ZUEt3736Q+fDcxpR04Oj6HY43K5Gp 3f3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hc8ARRFL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h2-20020a1709060f4200b006e758101c05si7163894ejj.922.2022.04.05.18.53.08; Tue, 05 Apr 2022 18:53:33 -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=@linuxfoundation.org header.s=korg header.b=Hc8ARRFL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357212AbiDEMvG (ORCPT + 99 others); Tue, 5 Apr 2022 08:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244455AbiDEJJ7 (ORCPT ); Tue, 5 Apr 2022 05:09:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00531255BA; Tue, 5 Apr 2022 01:59:23 -0700 (PDT) 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 7AAC6614E4; Tue, 5 Apr 2022 08:59:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 850DAC385B3; Tue, 5 Apr 2022 08:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149160; bh=KkqvdNudypKbbtIijKOGeT0cNlIeNDr+yKjHsjcNilc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hc8ARRFLolOsNf2veBfQruC/r4k1z8oP9Rii9hzmBLNTEz5SyjJHwO1rrmVVvXgqb 6liwPf6iUHO/D4yrCuV3Vn6ZLKMJ/Pwccef9OSvyND1n7cWI3dapAfkHGf0ogQHA9V ou9DOUEnrAL9ngJyOhojFsElj7Vx8sAnIZV5POow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Sitnicki , Daniel Borkmann , Martin KaFai Lau , Sasha Levin Subject: [PATCH 5.16 0616/1017] selftests/bpf: Fix error reporting from sock_fields programs Date: Tue, 5 Apr 2022 09:25:29 +0200 Message-Id: <20220405070412.567745590@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Jakub Sitnicki [ Upstream commit a4c9fe0ed4a13e25e43fcd44d9f89bc19ba8fbb7 ] The helper macro that records an error in BPF programs that exercise sock fields access has been inadvertently broken by adaptation work that happened in commit b18c1f0aa477 ("bpf: selftest: Adapt sock_fields test to use skel and global variables"). BPF_NOEXIST flag cannot be used to update BPF_MAP_TYPE_ARRAY. The operation always fails with -EEXIST, which in turn means the error never gets recorded, and the checks for errors always pass. Revert the change in update flags. Fixes: b18c1f0aa477 ("bpf: selftest: Adapt sock_fields test to use skel and global variables") Signed-off-by: Jakub Sitnicki Signed-off-by: Daniel Borkmann Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/bpf/20220317113920.1068535-2-jakub@cloudflare.com Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/progs/test_sock_fields.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/progs/test_sock_fields.c b/tools/testing/selftests/bpf/progs/test_sock_fields.c index 81b57b9aaaea..7967348b11af 100644 --- a/tools/testing/selftests/bpf/progs/test_sock_fields.c +++ b/tools/testing/selftests/bpf/progs/test_sock_fields.c @@ -113,7 +113,7 @@ static void tpcpy(struct bpf_tcp_sock *dst, #define RET_LOG() ({ \ linum = __LINE__; \ - bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_NOEXIST); \ + bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_ANY); \ return CG_OK; \ }) -- 2.34.1