From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD297C4332D for ; Thu, 19 Mar 2020 22:52:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B5972076E for ; Thu, 19 Mar 2020 22:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584658360; bh=1seDosREJOhhN/DIT3MtMv9WxoMSuvD5X19yJopAGLk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=ejlOVYe4bjc8DzktSilEANrpMs9D0k0Mff4vjl2wfD0eZm0wgHbXGoFpr0sq3h8GQ 8/H4CsCTBNxUU1d3rTLuP6M2JZ/DjRC12YhVTvvOmVtKOWJEYFJ8zyfBwRqhfPfwKm r67tloVDHX+uAiX8FTukDNpaxbY72v4aBjE3BN8A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727521AbgCSWwk (ORCPT ); Thu, 19 Mar 2020 18:52:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:59452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726856AbgCSWwj (ORCPT ); Thu, 19 Mar 2020 18:52:39 -0400 Received: from kicinski-fedora-PC1C0HJN (unknown [163.114.132.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A82E1206D7; Thu, 19 Mar 2020 22:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584658359; bh=1seDosREJOhhN/DIT3MtMv9WxoMSuvD5X19yJopAGLk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GSd6QMyVqyzSahoPBTsvMeslgFHTFWRa/2cncDr2DOf7qdwk7HZ0AoEdkmz594Byx 4q1QicgxUPiZvtLumZ/wmasZotOS1aXYoeYzcBp6qvXb0AjlZOlMMgr85o/R2OcR7j THumiyWvrTZ9LDnn+2KeLRtD1/u2lxD4KpN3gNiA= Date: Thu, 19 Mar 2020 15:52:36 -0700 From: Jakub Kicinski To: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= Cc: Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , "David S. Miller" , Jesper Dangaard Brouer , John Fastabend , Lorenz Bauer , Andrey Ignatov , netdev@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH bpf-next 1/4] xdp: Support specifying expected existing program when attaching XDP Message-ID: <20200319155236.3d8537c5@kicinski-fedora-PC1C0HJN> In-Reply-To: <158462359315.164779.13931660750493121404.stgit@toke.dk> References: <158462359206.164779.15902346296781033076.stgit@toke.dk> <158462359315.164779.13931660750493121404.stgit@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, 19 Mar 2020 14:13:13 +0100 Toke H=C3=B8iland-J=C3=B8rgensen wrote: > From: Toke H=C3=B8iland-J=C3=B8rgensen >=20 > While it is currently possible for userspace to specify that an existing > XDP program should not be replaced when attaching to an interface, there = is > no mechanism to safely replace a specific XDP program with another. >=20 > This patch adds a new netlink attribute, IFLA_XDP_EXPECTED_FD, which can = be > set along with IFLA_XDP_FD. If set, the kernel will check that the program > currently loaded on the interface matches the expected one, and fail the > operation if it does not. This corresponds to a 'cmpxchg' memory operatio= n. >=20 > A new companion flag, XDP_FLAGS_EXPECT_FD, is also added to explicitly > request checking of the EXPECTED_FD attribute. This is needed for userspa= ce > to discover whether the kernel supports the new attribute. >=20 > Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen I didn't know we wanted to go ahead with this... If we do please run this thru checkpatch, set .strict_start_type, and make the expected fd unsigned. A negative expected fd makes no sense.