Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4546573rwb; Mon, 31 Jul 2023 08:26:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlH0L40CpAboRw4OUIdC1YSYhEn9+Kt/kGgMdHFQ25fFdP4fxIhAsUZPYy6DCigN6XbrJaS2 X-Received: by 2002:a2e:8290:0:b0:2b9:f31e:51ff with SMTP id y16-20020a2e8290000000b002b9f31e51ffmr182035ljg.37.1690817202200; Mon, 31 Jul 2023 08:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690817202; cv=none; d=google.com; s=arc-20160816; b=i+ZB5/j1Q/pVSl5h5SuMEoX+PCEKj06EJJ5mcSDE71edbKct8s+uXB6sxyX5S4bW6w TQYYMQ5xOz5hpCvbSn0v34ifmJ7jbHbx/G+ZUkMZrjA6RjOnqS2yW4eco5vHyANExr9Z SDDfwgsvM1Opsfx+8K1ULajvdIsF7KqzjISh6qjkFo6gzJ9yZbcRFZu1bqtMHhQ0mwf0 zTignmM2Tm+3Om9hfBUbu9DKgD6RFmrenynS0cobhBwnAVZPFj70SIqPAd/YqLbWwJDq MVqVcCaVTSy8pP3NJEuWIURYXeHTKJ6qiWukAZwZbFMY5i700maOLZn8F0qTzHfrb9gA +3Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=d0amng8ESj5Ivn3+1Qpwn6F8c5hSHQtHpqsKrSaqmyM=; fh=H6UQKSAqGHjb54pZqph1tH1MP6c6rOoC25f6obiXGjY=; b=HH7ZySe4q880PUTGgJA2vuGyrY18eagW18ge0sxnwA7nMHsTJHRp6TFbCN+HVKDOBh 5wl7iQyqSgO0W9qOvV+PLtNyUA7c9Q5YgHVmtg3R9WSzL1pNpLZ1eNDVYZen/U5tbpnD ZPxMDG+DP1U+9JFPEAxw7hW7yNM7gvRuGF5kOpv06JgBZ14OXNq4xcng3rckoCzJlR8z FqKadz7dJEIWzUh+WX9ujC4BAq+lsipui+W9+sTyBkeojdUU3V3/F3lzVVhX6qRtbxvz YVDmEjItQVZBeDWdLhJjMSkDMbbCU1Un7OVDU9m8WggKbxVZN9K8nUqENnZ5MrwM6fwn vkYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uc+fd4z3; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kd27-20020a17090798db00b0099279b2cdddsi3480587ejc.833.2023.07.31.08.26.15; Mon, 31 Jul 2023 08:26:42 -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=@linaro.org header.s=google header.b=uc+fd4z3; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231433AbjGaO1I (ORCPT + 99 others); Mon, 31 Jul 2023 10:27:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbjGaO07 (ORCPT ); Mon, 31 Jul 2023 10:26:59 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C969EB3 for ; Mon, 31 Jul 2023 07:26:57 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fe2048c910so9934165e9.1 for ; Mon, 31 Jul 2023 07:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690813616; x=1691418416; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=d0amng8ESj5Ivn3+1Qpwn6F8c5hSHQtHpqsKrSaqmyM=; b=uc+fd4z3doK5zO6DlkUKmP75VP+YhckG31qRdKmzMx3SfzHxgEvUG4TZJe3y+phASO Vt6Vj2SpM+mhoB8FlaaLfSg4GvJr5glzyru4hhZn2/OF34PIdvyQuuXIC2o82IDlbMkT lvFY0u9O1qGNbQKhcLXSslU6Vjv6a+4hxvgmthJJEMVtsaJzdLjgk1j/Kq9rQ4lHsJTR Ep8xhUPTxZj6UgC7aru352SW/OnJsGkG03+RxM49bagpvN9UyEQbzbEjYCKCq+GDPMFr ipmS+4dk5mg5xGqNuajn9l1LXxr1F4Lh8OtGHZ3MAO2L7rx6TLAp98U/lDNOZOVNjYLy fd2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690813616; x=1691418416; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=d0amng8ESj5Ivn3+1Qpwn6F8c5hSHQtHpqsKrSaqmyM=; b=K1YA+v2JEzT4zFgm+w9wAjkKts/aEeMx2NENMkhZaEogtl8XxJ2s+EfRZOe9pyjrhc wIypJoHM4RW4sfj2In4scRtGjGdGztcDGWnzt3PvILTHK+x7lx3HMN7NXh6Wbrqck7Xk bVR90Lfe1jYb5cNG3R42qS0hvR4mHzDIK5KuRJP4QveoYybaTAvXea5mYS8u6M2gq+Xx zvRxe9zpUa3z6p7ZuDN/3mzw0aZ2RKrwNzPYDWjsXumJgDuPdSnZgHyjuBkzMod7Lf0u IgsJN0vFj7FM5dgjmfh5yF3KGSvxf8phXeBxYqnEbWb7xQse5WtXVfuVucQapgGU3Zox af5Q== X-Gm-Message-State: ABy/qLYeVYr3CnFPlFGOQn9UKGaEw1NbrcUwM7du1XKheirkgzzyWAya mie25CI8aA0ylg6MftAIw8wyWA== X-Received: by 2002:adf:f70c:0:b0:313:f61c:42b2 with SMTP id r12-20020adff70c000000b00313f61c42b2mr5302957wrp.69.1690813616290; Mon, 31 Jul 2023 07:26:56 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id a8-20020adfed08000000b0031417b0d338sm13274552wro.87.2023.07.31.07.26.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:26:56 -0700 (PDT) Date: Mon, 31 Jul 2023 17:26:53 +0300 From: Dan Carpenter To: Yan Zhai 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 Subject: Re: [PATCH v4 bpf 1/2] bpf: fix skb_do_redirect return values Message-ID: <38c61917-98b5-4ca0-b04e-64f956ace6e4@kadam.mountain> References: <8b681fe1-4cc6-4310-9f50-1cff868f8f7f@kadam.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8b681fe1-4cc6-4310-9f50-1cff868f8f7f@kadam.mountain> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 I'm not a networking person, but I was looking at some use after free static checker warnings. 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. Because that's the bug right? The original code was assuming that everything besides LWTUNNEL_XMIT_DONE was freed. regards, dan carpenter