Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp51431rdb; Mon, 30 Oct 2023 23:28:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbgWxVJimUYaP8abv+FGT09+HBAWd3ADJ9sn2CyQfTQCKsv0QIo42GbCwC8p8mO4q+ImTf X-Received: by 2002:a17:907:831b:b0:9b6:aac1:6fa5 with SMTP id mq27-20020a170907831b00b009b6aac16fa5mr7330570ejc.55.1698733711442; Mon, 30 Oct 2023 23:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698733711; cv=none; d=google.com; s=arc-20160816; b=c92YKgvIpMvSJeDYVd7lPrjErYlds9o9UzUl2MGJqtUc29MiJke7/BvAzkquigt765 2/GFKgYV6Hc3IxldSUANq+6FITv3Vf+8xrEEoC86au3vFnNGjEQ9g1Jz5G/n+D7/MeCI XO5E6LHTVJpNApLvJhhr44pO1lX2+JnVmobpKApVzS/6QrhZi6Ch1JddnGQTZrYS2MXd EubVV0BCwa+pvyUlJJyYInBn60oWstvwRO8ZxaaGplgKRJkc5vfAe3x8CXGnb/EzXpjK dn2ujyeadAz8+FoH38usbnOVtvVq/LuYTWA9LvUb1q+d03XRWkcxafUl0+fzNhUiSFCp ifMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=H890dxrJWN3yT/xHp1vZtLZXjq98ozy2u9aQnWRZfHI=; fh=fVVxygk+zpCMK3n1z8+a3B0avSS/j1/wuM3CHzOzJ38=; b=n05ahPE3ERnr0T96UmfkvXcCiEvi51V39uj6FniPTELlVE5Qse23IdeQEqVjAP6cX+ T0ptyR0LmpROfpQrv7gMcLjH99r6W7IG+0Fwuvsa8HRRmOrzFsp99CkQPSg/UvCwuQYr wPxNI27S9t80lTsOsUiyXPiEZfqwbav9ijpE6ksYamHCzJ1+4YBbJerqE/eg3Kf8rx2t zbSdeYjw4tIR2G38mbd461v3Ge/r9/eUVhx2/Y158CT1if0OTcnVZBV6rVdAnBraa6HJ L24F3QZdzIv7QUyJ7ahKOK3xhubxb3BBc2zvhVppi3M2maECzdJgcyqelJJXzJlJIGwx ctkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BUkr4v6X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id go14-20020a1709070d8e00b009a0955acaaasi278626ejc.370.2023.10.30.23.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 23:28:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BUkr4v6X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B4A28807C5EA; Mon, 30 Oct 2023 23:26:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235706AbjJaG0M (ORCPT + 99 others); Tue, 31 Oct 2023 02:26:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbjJaG0K (ORCPT ); Tue, 31 Oct 2023 02:26:10 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 983FE91; Mon, 30 Oct 2023 23:26:08 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-9d0b4dfd60dso533469166b.1; Mon, 30 Oct 2023 23:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698733567; x=1699338367; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=H890dxrJWN3yT/xHp1vZtLZXjq98ozy2u9aQnWRZfHI=; b=BUkr4v6X8D/3UNbdm2kgS0BbnUAfIG8AouOLgv/RP4j6kyNe3duEmZY5/hgRzxXx51 z8FmdPh57/aJr+QyYefUb6ht3KmjNum2fa8MNhfiY2TjquhF9AbMYVAW6Bvf1KaEcDPl Y/EQbqncW4X4ZOkpdljnQRduzQoqYlw1a2cAihnTte0sfXIU8OGl1wmDvE+cTrhb8OHv 3Z+UaPtBGL91Sz0OGzyckzQY3COP+s5LhdCY+WAqalo9ZBpvAbLIEIP4rh4Kk4/sz+2D U3VDqmlmT9l65RGvrpZy/V1Ar8lPBhNoQGNQ0/jS4gShNHI+D484MvblEVW9ZMxeB5uP Jg2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698733567; x=1699338367; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H890dxrJWN3yT/xHp1vZtLZXjq98ozy2u9aQnWRZfHI=; b=TUBJhjQlozXi96pn/MOVQCN6LL62mH+i6aPEOLfuSc5B7yV27gM5carrV/XGt7Y6ZY DjAMpgt1e1HMZfqYzuNELQneIE627RRrbz7TPtypJl2qj4SnkwIQTWFESaO8iPXKIUtt C+kUg39KDTEXZqHysKOEJaqmbBCIA58IcvPs83GPW2VeSo4t1pyFCYH5Damm74JnXUp9 zjX4rJ4+A3fyfSAG0tF4P5sI46yrSbFyQE/RFpzoQRrHzYvDd9TeUeSfk9DmCcf8rUU3 Zv4aDhUxB+obMLa+ZhzI6VJx23m4AJnctX/f86E25osi9rzMuFN/S12qjEJs7bqQYIl8 yfaw== X-Gm-Message-State: AOJu0YxedJSAl51F9JwGO/LT6DLHYuaD9WdY6vtRxVfjKDsHLwQaSLeK vSIu0ZiVbaitYYnpU3YI1maCjQWKDF05yCE7l1E= X-Received: by 2002:a17:906:7146:b0:9d3:afe1:b3e5 with SMTP id z6-20020a170906714600b009d3afe1b3e5mr3595874ejj.75.1698733567002; Mon, 30 Oct 2023 23:26:07 -0700 (PDT) MIME-Version: 1.0 References: <111a64c3e6ccda6b8a2826491715d4e8a645e384.1698431765.git.dxu@dxuuu.xyz> <73xnkgitatvymw2bqwo6elqmdpsvj2atmh6ugrityvqyegguq7@cjos2bsw2ico> In-Reply-To: <73xnkgitatvymw2bqwo6elqmdpsvj2atmh6ugrityvqyegguq7@cjos2bsw2ico> From: Andrii Nakryiko Date: Mon, 30 Oct 2023 23:25:55 -0700 Message-ID: Subject: Re: [RFC bpf-next 5/6] bpf: selftests: test_tunnel: Disable CO-RE relocations To: Daniel Xu Cc: ast@kernel.org, andrii@kernel.org, shuah@kernel.org, daniel@iogearbox.net, steffen.klassert@secunet.com, antony.antony@secunet.com, mykolal@fb.com, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, devel@linux-ipsec.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Mon, 30 Oct 2023 23:26:17 -0700 (PDT) On Sun, Oct 29, 2023 at 4:22=E2=80=AFPM Daniel Xu wrote: > > On Fri, Oct 27, 2023 at 01:33:09PM -0700, Andrii Nakryiko wrote: > > On Fri, Oct 27, 2023 at 11:46=E2=80=AFAM Daniel Xu wrot= e: > > > > > > Switching to vmlinux.h definitions seems to make the verifier very > > > unhappy with bitfield accesses. The error is: > > > > > > ; md.u.md2.dir =3D direction; > > > 33: (69) r1 =3D *(u16 *)(r2 +11) > > > misaligned stack access off (0x0; 0x0)+-64+11 size 2 > > > > > > It looks like disabling CO-RE relocations seem to make the error go > > > away. > > > > > > > for accessing bitfields libbpf provides > > BPF_CORE_READ_BITFIELD_PROBED() and BPF_CORE_READ_BITFIELD() macros > > In this case the code in question is: > > __u8 direction =3D 0; > md.u.md2.dir =3D direction; > > IOW the problem is assigning to bitfields, not reading from them. > > Is that something that libbpf needs to support as well? Ah, I missed that this is a write into a struct. I think we can support BPF_CORE_WRITE_BITFIELD() (not the PROBED version, though) using all the same CO-RE relocations. It's probably a very niche case, but BPF_CORE_READ_BITFIELD() is niche as well (though an absolute necessity when the need does come up). > > Thanks, > Daniel