Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp275969rwo; Tue, 1 Aug 2023 17:05:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlFJlnU9oIGFZok7+aF0ZSIHM+17y2hE9oJ66vY70TmzST13ZPnHnY1YhierpCNYKqWrkkvP X-Received: by 2002:a17:906:32cd:b0:99b:e5c3:2e55 with SMTP id k13-20020a17090632cd00b0099be5c32e55mr3622869ejk.38.1690934721285; Tue, 01 Aug 2023 17:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690934721; cv=none; d=google.com; s=arc-20160816; b=DVEBo3Vih2mK+03nlQbcPp0n3dVnNeT1xpjK/jg0MnspN5wwu5X+ppq/HIxSCEWAZN 90iCg6HbovKsadAOrU7TMJEleNdsbPspVamVyUpQUxlCehm2xZV1R6TqzJN2l5MBOOfA 3we0V7wlD7LDk6FiFtpdjZtnFuYY5wZUFDRRhYvX6eKSJ5k5gMx9HR0B6wf/v5+3YdTx zZjDw5rdAAaf/AjSCdKe4P0JYGQoGmE6YD3mRAQ3JmWL7Y6JYOP7SZUoRYJwDMpCRC31 lagPmsSqFxQlViTBtDl18X3/DHTmG/WFs60x13zfrDhk86++q1QTUNVPecyWJ/1vxgle 0Z9Q== 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=qPseTy7IzinUQZpPzP36aZrRMGJ435Us12Gys3Nc6zk=; fh=KAPgUse6zlA+szVUgMgT08nVuDGnmCNSCq3Ruv+JZWQ=; b=eaPOOzrLu29wRYtKzkJqJnpJcg1t1trzk/ecHaKGhAwgQRxggm/nGLJVpXQcK8ebo2 2tquAHv4uO2KuGnqWwdE+kNfEa8FPBuro+eom8RT1gS3WBanC+GWe1V5kA5koz4Dwo2s hvOKcUjfgw43pN+WivYE4ecdjQ+kOjughGa69Hmm3Mq/nQxZDlADG4nZsagdDrxRri03 73fgcsA1LVYhsZQwK7h0WcqLxQ8CLsR8Cx1T/sKSAzCtrYiav1dHmwiVGoCzAYbAxJxS Fr7/uN2h7TGvTet5NNxr5ejEpfrCf/Z5I46B+lPOafe7v6PYh8MpbdAI0M3Iy/i++0wE S5kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=oWRJ4PZk; 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=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a170906838400b00991f5560a1dsi9376085ejx.32.2023.08.01.17.04.32; Tue, 01 Aug 2023 17:05:21 -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=@cloudflare.com header.s=google header.b=oWRJ4PZk; 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=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232537AbjHAWSz (ORCPT + 99 others); Tue, 1 Aug 2023 18:18:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231681AbjHAWSu (ORCPT ); Tue, 1 Aug 2023 18:18:50 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BC6219BE for ; Tue, 1 Aug 2023 15:18:48 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-52227142a27so8043436a12.1 for ; Tue, 01 Aug 2023 15:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; t=1690928327; x=1691533127; 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=qPseTy7IzinUQZpPzP36aZrRMGJ435Us12Gys3Nc6zk=; b=oWRJ4PZkbCJ2ey++KZdiAfsp6lEM0ajwDZWvbZ2+wZ4pZdXAocuW8kuVFjO3dnKtnf 8lzUDjsfEiq9ZGq+SNVu1I1PVaPvDvJ+ZeGXNk6rd9FVxoAV+2Y1PfIgtto1waRbirIz 66lQccpXqqqoVxMDXlAsWc7hkQOt7OkpsWcx4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690928327; x=1691533127; 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=qPseTy7IzinUQZpPzP36aZrRMGJ435Us12Gys3Nc6zk=; b=ib2CZr/2ZkeVKr6Hnu6HxnbUWLwhUgb89Ox1CbzzmMaJ423UwAtCW8AiOA14UsqpfV HqGvBOoAz3teAkxM+YCujyt5bJWf5p8CyDnXiRPtxn2j+Fw8nbnBv/7gq6h2ES5Q3rx3 9iX7mpeS7hkY/IiAPAahMFcPygJqYN3V01qAJeUsLYtyGJUhIvmkDfPqpkz3dSIS8dvx QAKiUV2GtFj+8bv0AeqdA5I3kGMBtj2EIgyVXdsFqapJfVmyAZT8YDpWCXfhcca6eOIu ZdJfmVbm2La/sM4OzPaasIXWA7m5iNBRKKx/cSKOx7NPE04Oz1sE1198A1He5K+2VQkm DS/w== X-Gm-Message-State: ABy/qLb25vp+Em2BLNDyDDleD1FhRyvf07jSTuR9LiG2HR0ldx2zGXG0 JfOn9XqOtS/rBWwY71x39lh/yxDXGhi5K3wDzS/wQw== X-Received: by 2002:a05:6402:125a:b0:51d:e30b:f33a with SMTP id l26-20020a056402125a00b0051de30bf33amr3473017edw.34.1690928327002; Tue, 01 Aug 2023 15:18:47 -0700 (PDT) MIME-Version: 1.0 References: <8b681fe1-4cc6-4310-9f50-1cff868f8f7f@kadam.mountain> <38c61917-98b5-4ca0-b04e-64f956ace6e4@kadam.mountain> In-Reply-To: <38c61917-98b5-4ca0-b04e-64f956ace6e4@kadam.mountain> From: Yan Zhai Date: Tue, 1 Aug 2023 17:18:36 -0500 Message-ID: Subject: Re: [PATCH v4 bpf 1/2] bpf: fix skb_do_redirect return values To: Dan Carpenter Cc: bpf@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Mykola Lysenko , Shuah Khan , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@cloudflare.com, Jordan Griege , Markus Elfring , Jakub Sitnicki 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,T_SCC_BODY_TEXT_LINE, 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 Mon, Jul 31, 2023 at 9:26=E2=80=AFAM Dan Carpenter wrote: > > I'm not a networking person, but I was looking at some use after free > static checker warnings. Did you refer to the gist I posted or something new? > > Apparently the rule with xmit functions is that if they return a value > > 15 then that means the skb was not freed. Otherwise it's supposed to > be freed. So like NETDEV_TX_BUSY is 0x10 so it's not freed. > > This is checked with using the dev_xmit_complete() function. So I feel > like it would make sense for LWTUNNEL_XMIT_CONTINUE to return higher > than 15. Yes I am adopting your suggestion in v5. Dealing with NETDEV_TX_BUSY would be left as another item (potentially more suited for netdev rather than bpf). Would be great to find a reproduction of memleak. > > Because that's the bug right? The original code was assuming that > everything besides LWTUNNEL_XMIT_DONE was freed. > > regards, > dan carpenter > --=20 Yan