Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2166466rdh; Sat, 25 Nov 2023 16:52:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGWwUMSmzH3eebrZXtrmvlraltGGKVZ1h5De4vdX7RvQDrGioo9xaj7vKMGhfJtEHRLeY8L X-Received: by 2002:a05:6830:139a:b0:6d6:53fe:2189 with SMTP id d26-20020a056830139a00b006d653fe2189mr8488866otq.2.1700959970662; Sat, 25 Nov 2023 16:52:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700959970; cv=none; d=google.com; s=arc-20160816; b=02KnG4XqxmlS9oyKTK3cAGCDjOqWr00Yujn34LkXIysPU8+rAF3m7uG5poG8eWOFRf oVYqTpzVhlH4UGHImLzjeV54Yr1KOdb70qfDb0XobZ96Ynen79DpK19ec6HRzU/I4U4Z aUcdYO/Gu6MjEKxwy8L/OQQEtHI3zW1FdAQDqaD28lF4CcQjVvXJP2zPcLLX+XSoS9iv PRz3/pGy3oIwtCYIbGxZFInlWJhWoYSbYAre4GPPkQwYhwbygz6myFfB5tolm70txulJ gvJB/bmOYCEIQytqxmgGJ6XbaZZ3oe6dGAqGkLkfnGDOOduseHs6Td+ER85By4G0AAcg A0Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=NPg+/Q1bfdSOekshqxIavDgK/xM+ZX8z48MtbsXRZC0=; fh=O0wyV3kBxKBsvr4IJLpoVbNpy8e+339S2AZzYd/GgZ4=; b=JR37sbs9MbmQ9sCriqlQYnXzteDQm7D+2yfQnzYSE5H0CUhI9HrsuzszKWmgiZHeHm hGEIFTvZLy1mhLGwnpV1SfnHzFaJb1VunIqN2C6J73T3jRTDJaesSXXlQ+v8m+Nmvvzo ptXLHL97zLm0FSuYy0TF7bhP0tye91hd2EcAnSb+i9hiFU+qsb7T7LvmgL7gcSlpaSND scrxyp3ucB9xgAbU4NKtnVSmJPHRS14N+U15l+gWtjeSH2JsPT5Bl7TF3N4Qb7JBomHv aawtkuDNe2GfOYG60JYMlqmlN6+T8QCqe1wE8wBHV7VUb0upD1mXD8/yOb0bjydiIEdW ZPRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ajEzRZqY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id n25-20020a634d59000000b005b8afa325b8si6767728pgl.410.2023.11.25.16.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 16:52:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ajEzRZqY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 1B8AA8068E09; Sat, 25 Nov 2023 16:52:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229505AbjKZAv7 (ORCPT + 99 others); Sat, 25 Nov 2023 19:51:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjKZAv6 (ORCPT ); Sat, 25 Nov 2023 19:51:58 -0500 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [IPv6:2001:41d0:1004:224b::ae]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3948F111 for ; Sat, 25 Nov 2023 16:52:02 -0800 (PST) Message-ID: <0f210cef-c6e9-41c1-9ba8-225f046435e5@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1700959920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NPg+/Q1bfdSOekshqxIavDgK/xM+ZX8z48MtbsXRZC0=; b=ajEzRZqYRvm0a8tqOnR9BhAiabu7ctEBf1vosMXD+gbq/fKZPgDo0ZHXLOCxYbD5mxFGHC QmdB4wjhWfSaaTgEpk5zg7m9Sh7NKSRDEOhPDFGzLruUks42SOo8suBz1ZY032FYOGZ6cf SbdeooZLsqotxux1If0H6Y/nxbnhHzQ= Date: Sat, 25 Nov 2023 16:51:51 -0800 MIME-Version: 1.0 Subject: Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations Content-Language: en-GB To: Daniel Xu , shuah@kernel.org, daniel@iogearbox.net, andrii@kernel.org, ast@kernel.org, steffen.klassert@secunet.com, antony.antony@secunet.com, alexei.starovoitov@gmail.com, Eddy Z Cc: mykolal@fb.com, martin.lau@linux.dev, song@kernel.org, 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, netdev@vger.kernel.org References: <391d524c496acc97a8801d8bea80976f58485810.1700676682.git.dxu@dxuuu.xyz> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yonghong Song In-Reply-To: <391d524c496acc97a8801d8bea80976f58485810.1700676682.git.dxu@dxuuu.xyz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 morse.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 (morse.vger.email [0.0.0.0]); Sat, 25 Nov 2023 16:52:48 -0800 (PST) On 11/22/23 1:20 PM, Daniel Xu wrote: > Switching to vmlinux.h definitions seems to make the verifier very > unhappy with bitfield accesses. The error is: > > ; md.u.md2.dir = direction; > 33: (69) r1 = *(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. Thanks for reporting. I did some preliminary investigation and the failure is due to that we do not support CORE-based bitfield store yet. Besides disabling CORE-relocation as in this patch, there are a few ways to do this: - Change the code to avoid bitfield store and use 1/2/4/8 byte(s) store. A little bit ugly but it should work. - Use to-be-supported 'preserve_static_offset' (https://reviews.llvm.org/D133361) to preserve the offset. This might work (I didn't try it yet). - Eduard did some early study trying to remove CORE attribute (preserve_access_index) from UAPI structures. In this particular case, erspan_metadata is in /usr/include/linux/erspan.h. We will also investigate whether we could store bitfield store directly with CORE. > > Co-developed-by: Antony Antony > Signed-off-by: Antony Antony > Signed-off-by: Daniel Xu > --- > tools/testing/selftests/bpf/progs/test_tunnel_kern.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c > index 3065a716544d..ec7e04e012ae 100644 > --- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c > +++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c > @@ -6,6 +6,7 @@ > * modify it under the terms of version 2 of the GNU General Public > * License as published by the Free Software Foundation. > */ > +#define BPF_NO_PRESERVE_ACCESS_INDEX This is a temporary workaround and hopefully we can lift it in the near future. Please add a comment here with prefix 'Workaround' to explain why this is needed and later on we can earliy search the keyword and remember to tackle this. > #include "vmlinux.h" > #include > #include