Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp74031rdh; Mon, 18 Dec 2023 11:58:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IF7OsDHuTvIKQ2AwX5lq7PVrNeRY4eTwZrunpPN7cH4je//8ijzkJqXvzM3TdXB2hP+pJ3j X-Received: by 2002:a05:6870:9346:b0:1fb:75b:2baa with SMTP id j6-20020a056870934600b001fb075b2baamr9815311oak.102.1702929501588; Mon, 18 Dec 2023 11:58:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702929501; cv=none; d=google.com; s=arc-20160816; b=YeBwLrpZ4J9U5KXet1o5TpEv08JW4+aBPb3Y+XAfqWRis1PJII+eZ3i9cj9P+bBHlM OLzUaCUDmmwgZfWCzgz88H7jPgBupo9cye5/tsguDT/0O8Ec0VXaqDxF/Kc2oRX82j13 T+wd+WzXsNQ7FWFFBgM+I2JVpm1TeAxFcfWAeeYwTPIj4REygtzLsqLl6yjkFM+MSanM RONh8LJPmvrYmZ22aJRxS7KLKMSd0YRKo/y/RTH5828EdP1WE0M3RTcdE0DpcdS9XcP7 PLBGVx4bgrdUgItSBR2e3YSJSxB5nFIN6LrXDTQRuM1Mz0gjw8QqWxs+/P5BMK6Qv+dW XvkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=grKlAQWV5xV5wJkfKbKrDwxqfLJY1vUR6WlZYNNuA/M=; fh=6vv6QE8WWMgGDZmVbwzv04phgPedl5FJOYB5JAEyRgo=; b=b80Y/k0BJZSG1jvStE+IyWgYgOmOP/YYKA8pRRUU68RRdb2JVaeqmjaL1cTNnMgdAQ UmoZsn4qs+Mo8EtQwEIdP0a33H7i7pjAVUhpnE5dJJt98BsHN32FKiunwjqYm9GutylS NlF2Etf/DfnXL9dOCwZ8AsdvxT6UyEqybz1vN+5MAubImissz6QfW2Yp2yy70j74B0e0 L5AiE9jxRafnq2Q3xuwhDsRIzNXZVpImZ/BFD0cCqnokRkh1e1V75yuWgD1heRWgridL 3XtLuO5hm9YF55M2B8WWbuidt+ThnJ5z5TmF1Ot3St+7bSACY+u8OzQJtOe3peHZAdQm fbIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RuFXviiD; spf=pass (google.com: domain of linux-kernel+bounces-4327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4327-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z18-20020a63c052000000b005c65bbc794asi18607387pgi.53.2023.12.18.11.58.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 11:58:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RuFXviiD; spf=pass (google.com: domain of linux-kernel+bounces-4327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4327-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 78BBBB213F7 for ; Mon, 18 Dec 2023 19:58:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C7F57609F; Mon, 18 Dec 2023 19:56:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RuFXviiD" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A812372047; Mon, 18 Dec 2023 19:56:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26CDEC433CA; Mon, 18 Dec 2023 19:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702929400; bh=grKlAQWV5xV5wJkfKbKrDwxqfLJY1vUR6WlZYNNuA/M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=RuFXviiDAzvfM6oPPwKPeQxhxx0ROEeGABDBXhq8+EgQGsx84/SxCdxu6h2KyALeC yS18QnDvUZ+3Aa7PQRbyli72gr8maRcPxAkZpL/O6f6wOMUooq3TsDjzodkp50+6iY sdereDZp7Y5Kf2KTpOaVRw12M7DrO2RRGRO5PDJ1dxeRBZcB9UOCG77XZMA1ZdKQqk vvIAWPG9koo53krWGRGspu4tFnL2m3PLxMDI9pGKROG1tAkxcXec51DyZZ22fly72U RNtUB/YNiVzjqBx4cNhX3U/jpz5GKUQxa5WsCIvm7Ckru4YcNE+eNx1hcDTx96lOxx kYN53AyvKi9dQ== Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-50e384cd6ebso1758627e87.3; Mon, 18 Dec 2023 11:56:40 -0800 (PST) X-Gm-Message-State: AOJu0YwAP8U83ZAT1OGBJ3UcXy7vRGMFbsj5JS8RATS3L6epacpwBtYN yKiOOHm9URsaTSeGPdL3SUPqhI38kt04mAugcNw= X-Received: by 2002:a05:6512:96a:b0:50e:1ce0:b510 with SMTP id v10-20020a056512096a00b0050e1ce0b510mr1996591lft.97.1702929398315; Mon, 18 Dec 2023 11:56:38 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <2f33be45-fe11-4b69-8e89-4d2824a0bf01@daynix.com> In-Reply-To: <2f33be45-fe11-4b69-8e89-4d2824a0bf01@daynix.com> From: Song Liu Date: Mon, 18 Dec 2023 11:56:27 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Should I add BPF kfuncs for userspace apps? And how? To: Akihiko Odaki Cc: Alexei Starovoitov , Jason Wang , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Jonathan Corbet , Willem de Bruijn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Michael S. Tsirkin" , Xuan Zhuo , Mykola Lysenko , Shuah Khan , Yuri Benditovich , Andrew Melnychenko , Benjamin Tissoires , bpf , "open list:DOCUMENTATION" , kvm@vger.kernel.org, LKML , virtualization@lists.linux-foundation.org, "open list:KERNEL SELFTEST FRAMEWORK" , Network Development Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Akihiko, On Tue, Dec 12, 2023 at 12:05=E2=80=AFAM Akihiko Odaki wrote: > [...] > --- > > I'm working on a new feature that aids virtio-net implementations using > tuntap virtual network device. You can see [1] for details, but > basically it's to extend BPF_PROG_TYPE_SOCKET_FILTER to report four more > bytes. AFAICT, [1] adds a new program type, which is really hard to ship. However, you mentioned it is basically "extend BPF_PROG_TYPE_SOCKET_FILTER to report four more bytes", which confuses me. Can we achieve the same goal by extending BPF_PROG_TYPE_SOCKET_FILTER (without adding a new program type)? Does this require extending __sk_buff, which is also not an option any more? Thanks, Song