Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4082411rdh; Tue, 28 Nov 2023 11:16:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFsOf0Sz1zltBrtlqHTFq5dkAeolZ4YoXkA2H8UzmiuA00TsDZyuRxvxCrm57FJVhH9oxr X-Received: by 2002:a17:90a:3fc7:b0:280:37a0:69d4 with SMTP id u7-20020a17090a3fc700b0028037a069d4mr27593414pjm.19.1701198991541; Tue, 28 Nov 2023 11:16:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701198991; cv=none; d=google.com; s=arc-20160816; b=DLUYOlvTCjxxk++RDd8XCXcaAbe4nWHDhnJoRjljQMKG48MjOGgvX/McUuZWkdkDLj v7DB6cwau3FwsbcK/CHUG2KtybF2WOwcjHETgq+yf/RnIUBBgZIcM1niOl0K4QGplX0a ntGxZq/0kiC2HxtloRz95vs3f05l8EsSTsjrUqb3mklSq1gUC5P7+7Q9hogo9W7cX3Ap wXiur35LTFOo1ltKgXfa9UF+oUa7AdgGi6tP+N/VFcuofjnh23G+qgcTWJhd/sAe51Bc TTDRrZC6dg9sEe+oP5Eomf6VXzcI+bXCkbxSUAgh2jt7rLqFcDPFDGf+JCmz+n4sPESM QQXQ== 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:feedback-id :dkim-signature:dkim-signature; bh=cYOZQ38Ev4q/vOiKyAZOmafzVAVzihcQxUYgmkqmmR8=; fh=/egugHjxSwer1PwZhrTi3aNTvuaXdmOpRXiAqLbb8d8=; b=t45aFMWTUmCcePGvqNDFPEwRyb7vs3Pb5t83WTMhbYpDTYg6Jy0voQ1qYdsqLQlEqE jbu+/+XWcEvKiiQj/xd9VGBsxj/EnjvFT5TStlCvs1/3/HZcaIpBkXPa8QsM9Xw3BuX1 6f0UCOJIyvw3EjQzw0kL6blhTywojLuxvczkKD5nZKaDygFQFHiKojZmLte6WfEpPTUS mCvUeQID5tvCqxXaSBY5qUzoSqlkxJ4asQL14/3/xoflNUFrfD8qI8eharrm+tWdoHkV sBUlbX6jvzdc39wxd4csjFB4ipW/GyPv09C9/krU3rpIG4n8ggme1StdxvDNdMBwQTDe XfwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b=Ie5DH8Oh; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=YC5rg7c9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e13-20020a17090a9a8d00b00285aaf2d6aesi7703524pjp.116.2023.11.28.11.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 11:16:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b=Ie5DH8Oh; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=YC5rg7c9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 723578072148; Tue, 28 Nov 2023 11:15:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345487AbjK1TPs (ORCPT + 99 others); Tue, 28 Nov 2023 14:15:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344875AbjK1TPq (ORCPT ); Tue, 28 Nov 2023 14:15:46 -0500 Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84D67D66; Tue, 28 Nov 2023 11:15:52 -0800 (PST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailnew.west.internal (Postfix) with ESMTP id BA6E32B0011C; Tue, 28 Nov 2023 14:15:46 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Tue, 28 Nov 2023 14:15:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dxuuu.xyz; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1701198946; x=1701206146; bh=cY OZQ38Ev4q/vOiKyAZOmafzVAVzihcQxUYgmkqmmR8=; b=Ie5DH8OhUPUS8UVIYu QAQsUPJ9SijS+yZOJ+Ohi5LFlA/p5S0YB+RXSN7Zt+8en9SveUsXAp0VAi9gPp8P 4qBjAis12AEHiocvAYrct/whzkR3nM/jTjS+80fKg6ofcyl9g2180gHC8xn5h5Xx RZ02k/gjuafT82Wyt8+ZEUrQHDODZtstEhyqAleHaD4hwrIJ/2Z0cpJGgJrFaEYi /WIHpOkDZ4HpEAO2A42u6wQ4+PBEqMYeoNKiIIY+1W7mAMSdFPISV5EXVE4uPl4M dN2YdCgajG7AXSN6ecG42gj7eTm/Mf5mrT1vBSqjkdtSVnPQXV6oksOnPgtpAFkx azjw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1701198946; x=1701206146; bh=cYOZQ38Ev4q/v OiKyAZOmafzVAVzihcQxUYgmkqmmR8=; b=YC5rg7c9WsU6h0PUBFWCMz3/MqM/q F6rk44aqQmxnOCPdnvXRroqJetVbIFMTF2/hnU784IvyOxENW/Y4S7CGDVwmRQds igPUY7H3pPRbuiPZbcqjXSgOQ7im8U1yHi1bxQdcO/x53kLD1yXh6Q/Kbj4nkhWg 7P7U6qgzXJ/DMm0vbRDyKYqzIIGr1RBErTT0N/GbVGalvYhAbPneZY2XzzQOBTRh WZJBuK5430+bnChoZg8+8+Ih5ZuwcjNLWDur+MDFRknahYlaG17xc/xPXRQJ+Z/v k5pdVR3usMcL2tx7TZfVBdPTjMD3N2FsO3RkBmy8SxmvQaO766x+Lvs3g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeifedguddvudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecufghrlhcuvffnffculddvfedmnecujfgurhepff fhvfevuffkfhggtggujgesthdtsfdttddtvdenucfhrhhomhepffgrnhhivghlucgiuhcu oegugihusegugihuuhhurdighiiiqeenucggtffrrghtthgvrhhnpeeftdffueduheehud fhgefgfeejlefhteegieetveeiieehfedvheduieefvdefudenucffohhmrghinheplhhl vhhmrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepugiguhesugiguhhuuhdrgiihii X-ME-Proxy: Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Nov 2023 14:15:43 -0500 (EST) Date: Tue, 28 Nov 2023 13:15:41 -0600 From: Daniel Xu To: Eduard Zingerman Cc: ndesaulniers@google.com, andrii@kernel.org, nathan@kernel.org, daniel@iogearbox.net, ast@kernel.org, steffen.klassert@secunet.com, antony.antony@secunet.com, alexei.starovoitov@gmail.com, yonghong.song@linux.dev, martin.lau@linux.dev, song@kernel.org, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, trix@redhat.com, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, devel@linux-ipsec.org, netdev@vger.kernel.org Subject: Re: [PATCH ipsec-next v2 3/6] libbpf: Add BPF_CORE_WRITE_BITFIELD() macro Message-ID: References: <20c593b6f31720a3d24d75e5e5cc3245b67249d1.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20c593b6f31720a3d24d75e5e5cc3245b67249d1.camel@gmail.com> 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_PASS,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 28 Nov 2023 11:15:59 -0800 (PST) On Tue, Nov 28, 2023 at 07:59:01PM +0200, Eduard Zingerman wrote: > On Tue, 2023-11-28 at 10:54 -0700, Daniel Xu wrote: > > Similar to reading from CO-RE bitfields, we need a CO-RE aware bitfield > > writing wrapper to make the verifier happy. > > > > Two alternatives to this approach are: > > > > 1. Use the upcoming `preserve_static_offset` [0] attribute to disable > > CO-RE on specific structs. > > 2. Use broader byte-sized writes to write to bitfields. > > > > (1) is a bit a bit hard to use. It requires specific and > > not-very-obvious annotations to bpftool generated vmlinux.h. It's also > > not generally available in released LLVM versions yet. > > > > (2) makes the code quite hard to read and write. And especially if > > BPF_CORE_READ_BITFIELD() is already being used, it makes more sense to > > to have an inverse helper for writing. > > > > [0]: https://reviews.llvm.org/D133361 > > From: Eduard Zingerman > > > > Signed-off-by: Daniel Xu > > --- > > Could you please also add a selftest (or several) using __retval() > annotation for this macro? Sure, I'll take a look. Thanks, Daniel