Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp893900rdb; Sun, 20 Aug 2023 07:31:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEgEOXvH2ZmP06kR6A5Ha7JtmAhBzf8SFXLMP8R8tMu9YLfln2r+H0rtVzsh/OF59t8ce/ X-Received: by 2002:a05:6358:9317:b0:129:d242:f782 with SMTP id x23-20020a056358931700b00129d242f782mr6048029rwa.0.1692541894350; Sun, 20 Aug 2023 07:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692541894; cv=none; d=google.com; s=arc-20160816; b=VgTgZ+JbPrz+Hyys3DeSyk0Xc54Kv3R8UyI9aF5sYp7nqRSmvAqE0ykUvKW8G4ChNe 5qTtAHewpNP8OXGKM+GMP0TmVol6dQOIkhwuC/Gx51T87LALBzZNcxQVorqYKSedOKw7 xFRvYdz9IeWjdsVo0hVgY0eC6ze6BlMyFZY4gETLcW//nXH35BhY/Z9XBlXPt37IX1qH 2guTANZyyYHFbLv+zmhlfrbKv+/uRniqTqikXiMWdbS3RiHBjR5WFZINzsB1RA8qsTSk Tkx7IbWrIeiP8s4833GYK5TnB2iAFxMOUlHsZx1lZxaS2fOyWyP+nNiuk8hKVZXG4kzF nx/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yo+bJl+y4f/gcBpiSV3BMiHVoCuXZGbyDLViIJN4HNU=; fh=kt7xFDevMz7sc9mEdZZ8SAwCSryrLgMW/sGDt3kGcjU=; b=GLL23nKD9CA4NqV6ebWylOFguqmmyBhnXaisYOvoBnrAWKpB9XJ7tR3lX8jrNgKyVY AO33e57ZACbrMzYLYkAdexXIIGEsSwaGjYWCUPm+EwhRhGmNq+J70Pzaskq+Stxqkrdm c1X4EdhzJtxMKTAUqYc1soIg13TkaEOIOPkjrON6hChRntv1cyJy5tmOtBC1TWmaM2Xs PI8sj6YFv9pTloTstD+JMJ9lt+NbwTky/bi8u34YpKbqT/oBzOH+xTTyd8AleDuMZLtS wmbSAhfLbks1MnX1qI33W7SDFZqFft45mg9ylOEka8FHc3DQAuwFLK77uunngPO585S4 VcDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=woCGuL35; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a7-20020a656407000000b00553c4551a08si5395483pgv.887.2023.08.20.07.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Aug 2023 07:31:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=woCGuL35; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 015933298FB; Sat, 19 Aug 2023 12:00:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344065AbjHPPVn (ORCPT + 99 others); Wed, 16 Aug 2023 11:21:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344130AbjHPPV2 (ORCPT ); Wed, 16 Aug 2023 11:21:28 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73F632736 for ; Wed, 16 Aug 2023 08:21:22 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4fe0c566788so10538798e87.0 for ; Wed, 16 Aug 2023 08:21:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; t=1692199281; x=1692804081; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yo+bJl+y4f/gcBpiSV3BMiHVoCuXZGbyDLViIJN4HNU=; b=woCGuL35AXyt6Hws5akvROlF7RqebS9eOYXxHntzLeGYVk1NTV0JRHtHtiO3R5vUpJ /E3V4iORbL295JckGqfv6muslFFEb3myhBYmvFMBP6Mz2Qmi0ZaHuXIPB6T5SZ//1xWa QXnna47bdllgzRJcsO5lD5J7lUBa6Bo8Y0qNs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692199281; x=1692804081; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yo+bJl+y4f/gcBpiSV3BMiHVoCuXZGbyDLViIJN4HNU=; b=YS1GYs0CnSizTlAD5m4FatX28DrTTkpxAMOiAtReSo8eBKrSVYtIcxnyrUedXlSL0Z hu3Z6Yo4kWonchenEuWyObNA+PDMu8riR/SNdalIey4qHcREX+eJ3odPTCUhQqeb1bSK qioHffqzAOpDagCZe6AnJnztT8oLBlSkTKCbJ4pDaoJE7TIOgN3lhbkhYJZvSMMgeIVh 8J2TsLYobLn1ulSrHQK+uzu2Yzcn+mMgGX+fabVqDfQU9ckydHL5qgoog987NqvdrboQ rr8PVVHOuKoXpvyxCovnWsRFeZM8+VIYjnX7zo2O3109bTrNaQZvr/Qf9k0/woQqG615 CepQ== X-Gm-Message-State: AOJu0Ywr/hW1V1IF82Y9kFWQnW3eaNclu2YiV8bd8gDou3vxtqJauQoS BGkMZflAoR5zjWJX9xUuXZhwI/n1BNmD8vNy+Avpew== X-Received: by 2002:a19:675b:0:b0:4fb:8aeb:d9be with SMTP id e27-20020a19675b000000b004fb8aebd9bemr1593548lfj.30.1692199280579; Wed, 16 Aug 2023 08:21:20 -0700 (PDT) MIME-Version: 1.0 References: <9ac9d459-9bc3-bcee-b912-3ab66d2a7fe7@iogearbox.net> In-Reply-To: <9ac9d459-9bc3-bcee-b912-3ab66d2a7fe7@iogearbox.net> From: Yan Zhai Date: Wed, 16 Aug 2023 10:21:09 -0500 Message-ID: Subject: Re: [PATCH v5 bpf 0/4] lwt: fix return values of BPF ops To: Daniel Borkmann Cc: bpf@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , Thomas Graf , Jordan Griege , Dan Carpenter , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=unavailable 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 On Wed, Aug 16, 2023 at 9:27=E2=80=AFAM Daniel Borkmann wrote: > > Hi Yan, > > On 8/16/23 4:54 AM, Yan Zhai wrote: > > lwt xmit hook does not expect positive return values in function > > ip_finish_output2 and ip6_finish_output. However, BPF programs can > > directly return positive statuses such like NET_XMIT_DROP, NET_RX_DROP, > > and etc to the caller. Such return values would make the kernel continu= e > > processing already freed skbs and eventually panic. > > > > This set fixes the return values from BPF ops to unexpected continue > > processing, and checks strictly on the correct continue condition for > > future proof. In addition, add missing selftests for BPF_REDIRECT > > and BPF_REROUTE cases for BPF-CI. > > > > v4: https://lore.kernel.org/bpf/ZMD1sFTW8SFiex+x@debian.debian/T/ > > v3: https://lore.kernel.org/bpf/cover.1690255889.git.yan@cloudflare.com= / > > v2: https://lore.kernel.org/netdev/ZLdY6JkWRccunvu0@debian.debian/ > > v1: https://lore.kernel.org/bpf/ZLbYdpWC8zt9EJtq@debian.debian/ > > > > changes since v4: > > * fixed same error on BPF_REROUTE path > > * re-implemented selftests under BPF-CI requirement > > BPF CI failed: https://github.com/kernel-patches/bpf/actions/runs/5874202= 507/job/15929012788 > > Looks like due to dummy device issue. Either you might need to add this t= o > the tools/testing/selftests/bpf/config* or perhaps just use veth instead = for > link_err dev. > It is indeed the dummy driver issue. I will update the config. Thanks for notifying me, now I know where to look at build results. Yan > Error from the above link: > > Notice: Success: 370/3177, Skipped: 21, Failed: 2 > Error: #131 lwt_redirect > Error: #131 lwt_redirect > test_lwt_redirect:PASS:pthread_create 0 nsec > Error: #131/1 lwt_redirect/lwt_redirect_normal > Error: #131/1 lwt_redirect/lwt_redirect_normal > test_lwt_redirect_run:PASS:netns_create 0 nsec > open_netns:PASS:malloc token 0 nsec > open_netns:PASS:open /proc/self/ns/net 0 nsec > open_netns:PASS:open netns fd 0 nsec > open_netns:PASS:setns 0 nsec > test_lwt_redirect_run:PASS:setns 0 nsec > open_tuntap:PASS:open(/dev/net/tun) 0 nsec > open_tuntap:PASS:ioctl(TUNSETIFF) 0 nsec > open_tuntap:PASS:fcntl(O_NONBLOCK) 0 nsec > setup_redirect_target:PASS:open_tuntap 0 nsec > setup_redirect_target:PASS:if_nametoindex 0 nsec > setup_redirect_target:FAIL:ip link add link_err type dummy unexpected = error: 512 (errno 0) > test_lwt_redirect_normal:FAIL:setup_redirect_target unexpected setup_r= edirect_target: actual -1 < expected 0 > close_netns:PASS:setns 0 nsec > Error: #131/2 lwt_redirect/lwt_redirect_normal_nomac > Error: #131/2 lwt_redirect/lwt_redirect_normal_nomac > test_lwt_redirect_run:PASS:netns_create 0 nsec > open_netns:PASS:malloc token 0 nsec > open_netns:PASS:open /proc/self/ns/net 0 nsec > open_netns:PASS:open netns fd 0 nsec > open_netns:PASS:setns 0 nsec > test_lwt_redirect_run:PASS:setns 0 nsec > open_tuntap:PASS:open(/dev/net/tun) 0 nsec > open_tuntap:PASS:ioctl(TUNSETIFF) 0 nsec > open_tuntap:PASS:fcntl(O_NONBLOCK) 0 nsec > setup_redirect_target:PASS:open_tuntap 0 nsec > setup_redirect_target:PASS:if_nametoindex 0 nsec > setup_redirect_target:FAIL:ip link add link_err type dummy unexpected = error: 512 (errno 0) > test_lwt_redirect_normal_nomac:FAIL:setup_redirect_target unexpected s= etup_redirect_target: actual -1 < expected 0 > close_netns:PASS:setns 0 nsec > Error: #131/3 lwt_redirect/lwt_redirect_dev_down > Error: #131/3 lwt_redirect/lwt_redirect_dev_down > test_lwt_redirect_run:PASS:netns_create 0 nsec > open_netns:PASS:malloc token 0 nsec > open_netns:PASS:open /proc/self/ns/net 0 nsec > open_netns:PASS:open netns fd 0 nsec > open_netns:PASS:setns 0 nsec > test_lwt_redirect_run:PASS:setns 0 nsec > open_tuntap:PASS:open(/dev/net/tun) 0 nsec > open_tuntap:PASS:ioctl(TUNSETIFF) 0 nsec > open_tuntap:PASS:fcntl(O_NONBLOCK) 0 nsec > setup_redirect_target:PASS:open_tuntap 0 nsec > setup_redirect_target:PASS:if_nametoindex 0 nsec > setup_redirect_target:FAIL:ip link add link_err type dummy unexpected = error: 512 (errno 0) > __test_lwt_redirect_dev_down:FAIL:setup_redirect_target unexpected set= up_redirect_target: actual -1 < expected 0 > close_netns:PASS:setns 0 nsec > Error: #131/4 lwt_redirect/lwt_redirect_dev_down_nomac > Error: #131/4 lwt_redirect/lwt_redirect_dev_down_nomac > test_lwt_redirect_run:PASS:netns_create 0 nsec > open_netns:PASS:malloc token 0 nsec > open_netns:PASS:open /proc/self/ns/net 0 nsec > open_netns:PASS:open netns fd 0 nsec > open_netns:PASS:setns 0 nsec > test_lwt_redirect_run:PASS:setns 0 nsec > open_tuntap:PASS:open(/dev/net/tun) 0 nsec > open_tuntap:PASS:ioctl(TUNSETIFF) 0 nsec > open_tuntap:PASS:fcntl(O_NONBLOCK) 0 nsec > setup_redirect_target:PASS:open_tuntap 0 nsec > setup_redirect_target:PASS:if_nametoindex 0 nsec > setup_redirect_target:FAIL:ip link add link_err type dummy unexpected = error: 512 (errno 0) > __test_lwt_redirect_dev_down:FAIL:setup_redirect_target unexpected set= up_redirect_target: actual -1 < expected 0 > close_netns:PASS:setns 0 nsec > Error: #131/5 lwt_redirect/lwt_redirect_dev_carrier_down > Error: #131/5 lwt_redirect/lwt_redirect_dev_carrier_down > test_lwt_redirect_run:PASS:netns_create 0 nsec > open_netns:PASS:malloc token 0 nsec > open_netns:PASS:open /proc/self/ns/net 0 nsec > open_netns:PASS:open netns fd 0 nsec > open_netns:PASS:setns 0 nsec > test_lwt_redirect_run:PASS:setns 0 nsec > open_tuntap:PASS:open(/dev/net/tun) 0 nsec > open_tuntap:PASS:ioctl(TUNSETIFF) 0 nsec > open_tuntap:PASS:fcntl(O_NONBLOCK) 0 nsec > setup_redirect_target:PASS:open_tuntap 0 nsec > setup_redirect_target:PASS:if_nametoindex 0 nsec > setup_redirect_target:FAIL:ip link add link_err type dummy unexpected = error: 512 (errno 0) > test_lwt_redirect_dev_carrier_down:FAIL:setup_redirect_target unexpect= ed setup_redirect_target: actual -1 < expected 0 > close_netns:PASS:setns 0 nsec > test_lwt_redirect:PASS:pthread_join 0 nsec > Error: #132 lwt_reroute > Error: #132 lwt_reroute > test_lwt_reroute:PASS:pthread_create 0 nsec > Error: #132/1 lwt_reroute/lwt_reroute_normal_xmit > Error: #132/1 lwt_reroute/lwt_reroute_normal_xmit > test_lwt_reroute_run:PASS:netns_create 0 nsec > open_netns:PASS:malloc token 0 nsec > open_netns:PASS:open /proc/self/ns/net 0 nsec > open_netns:PASS:open netns fd 0 nsec > open_netns:PASS:setns 0 nsec > test_lwt_reroute_run:PASS:setns 0 nsec > open_tuntap:PASS:open(/dev/net/tun) 0 nsec > open_tuntap:PASS:ioctl(TUNSETIFF) 0 nsec > open_tuntap:PASS:fcntl(O_NONBLOCK) 0 nsec > setup:PASS:open_tun 0 nsec > setup:PASS:if_nametoindex 0 nsec > setup:FAIL:ip link add link_err type dummy unexpected error: 512 (errn= o 0) > test_lwt_reroute_normal_xmit:FAIL:setup_reroute unexpected setup_rerou= te: actual -1 < expected 0 > close_netns:PASS:setns 0 nsec > Error: #132/2 lwt_reroute/lwt_reroute_qdisc_dropped > Error: #132/2 lwt_reroute/lwt_reroute_qdisc_dropped > test_lwt_reroute_run:PASS:netns_create 0 nsec > open_netns:PASS:malloc token 0 nsec > open_netns:PASS:open /proc/self/ns/net 0 nsec > open_netns:PASS:open netns fd 0 nsec > open_netns:PASS:setns 0 nsec > test_lwt_reroute_run:PASS:setns 0 nsec > open_tuntap:PASS:open(/dev/net/tun) 0 nsec > open_tuntap:PASS:ioctl(TUNSETIFF) 0 nsec > open_tuntap:PASS:fcntl(O_NONBLOCK) 0 nsec > setup:PASS:open_tun 0 nsec > setup:PASS:if_nametoindex 0 nsec > setup:FAIL:ip link add link_err type dummy unexpected error: 512 (errn= o 0) > test_lwt_reroute_qdisc_dropped:FAIL:setup_reroute unexpected setup_rer= oute: actual -1 < expected 0 > close_netns:PASS:setns 0 nsec > test_lwt_reroute:PASS:pthread_join 0 nsec > Test Results: > bpftool: PASS > test_progs: FAIL (returned 1) > shutdown: CLEAN > Error: Process completed with exit code 1. > > Thanks, > Daniel --=20 Yan