Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4878150iob; Mon, 9 May 2022 03:54:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPpOv9ut6v0jUcLKKOpKcERU+48/bFcOZHOHalKvps5xE0is32O9MeDNhY8gYNOVOwn56/ X-Received: by 2002:a63:3206:0:b0:3c2:8205:1e00 with SMTP id y6-20020a633206000000b003c282051e00mr12723302pgy.242.1652093651527; Mon, 09 May 2022 03:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652093651; cv=none; d=google.com; s=arc-20160816; b=coQ0BbSLdZzIzJobq8oBliTHTmrX9g9LwEMDtn5nKmRPYMlPww2lFr9Fmldpm6aV7v BoJMp2yKTGeZHZKm1yCo0NDCEM9VBxFln/0SaSyHAlsp3k/RvEk4TRov0noB6Y4yGgHK eB7okb26GWLDQ78Kt9JyRtz0grPc1xlgE9LQxpkzoNTNOcLtA9tFtbD3dM50J5znVO7Z a5NisgbDSWKQ08i60jqJdXrifZPZZxx+cyRg5UEMkpIRErnKPrkGFN/9eRMfgSmWMagd fxu3eGF7ojFlcWEf4JKfRuzrAsY4FvPuF5wdUH+ICQ6xtiwPhns2C4+WIvfalZSn5Kuc R1NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=Dj04vXxAkYJ5HJm69T0ul46686nkb8ZYAz4M/bwWH4g=; b=Vs1gOAtdx3M12EISLYuN0+VuQ9aDYh7qKYBISdDVlDrFtnSNE+3pBNWvXS4Sd3c+pE dMpac89qV/SUzYG8/J88lQkIAWpJvKjIuH1teCqdRKjm3ySYmYd39cfG4KiD59GbF2vy 3oWkKe/UZEmznh7A0pI8u1RpgCzfkfGCRlm7CS2hSQas/R/PTxAfL3TquXG4x6ynG+pG So2WObH9bucLJ1ntpXPNNqBfJqDqE1hTvFDzAsvxb0EdfwfuOUtTwDyuoriOgGjqskv5 uMZTDdVj3dbDzKZ/R5K5uHIuUomXpRbUEeR6267PFxZCcq7litUWdmToQ66zIPmgFiSG pxEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="J15uEuW/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id o21-20020a056a0015d500b0050d3b31772bsi16507264pfu.182.2022.05.09.03.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 03:54:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="J15uEuW/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1A6E017568D; Mon, 9 May 2022 03:11:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231904AbiEIJx4 (ORCPT + 99 others); Mon, 9 May 2022 05:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230224AbiEIJvT (ORCPT ); Mon, 9 May 2022 05:51:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D062213334; Mon, 9 May 2022 02:47:26 -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 EF6066151A; Mon, 9 May 2022 09:46:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D372C385A8; Mon, 9 May 2022 09:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652089583; bh=Dj04vXxAkYJ5HJm69T0ul46686nkb8ZYAz4M/bwWH4g=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=J15uEuW//bzGlU0oq5UAtEwcq1keS9BwnzTYBQhHrzucTu0fMt6XzaK1XuZSkZmzB lQTF+95goP+Xc32FVVYzurcmc9fA0vnxf4Z/KjECrtTZRMi5Dipk6sMfzS44fL1OUH drNq+p241yPeEY+vav656bfSfPAS5KZ9UrJX+NrqhXbqgXlIQyiRaxzpvE+j0Skdyl OXIkySvWZ4AVdWj4U96oDvjHhKIkD1w0dRPYFi4u59sqfJ3LIF0W9UjXtcCTsTvALS 6gFiBaTZEP/VFlgWosyFV7OobQ44WNDwWPKFW5iRnRri2dL2YQJmq30uwCYJtWTgmP 7UzN7Xpz2zEpQ== Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 2B74134DD23; Mon, 9 May 2022 11:46:20 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Zhengchao Shao , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, davem@davemloft.net, kuba@kernel.org, hawk@kernel.org, john.fastabend@gmail.com, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, kpsingh@kernel.org Cc: weiyongjun1@huawei.com, shaozhengchao@huawei.com, yuehaibing@huawei.com Subject: Re: [PATCH bpf-next] samples/bpf: check detach prog exist or not in xdp_fwd In-Reply-To: <20220509005105.271089-1-shaozhengchao@huawei.com> References: <20220509005105.271089-1-shaozhengchao@huawei.com> X-Clacks-Overhead: GNU Terry Pratchett Date: Mon, 09 May 2022 11:46:20 +0200 Message-ID: <87pmknyr6b.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Zhengchao Shao writes: > Before detach the prog, we should check detach prog exist or not. If we're adding such a check we should also check that it's the *right* program. I.e., query the ID for the program name and check that it matches what the program attached, then obtain an fd and pass that as XDP_EXPECTED_FD on detach to make sure it wasn't swapped out in the meantime... -Toke