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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AF52C4828D for ; Sat, 3 Feb 2024 14:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bw4eOS2X0Oph4SUgrnB0w8xemv2oBQwgh2ujzjO5LgE=; b=3pWEzX97u5obyv O47sCPrqk1CHu53wzqg60N8HYhhmrJPWazRK6XUezNF0OSyHarzcG/eOAewWe5j2wthqpuDSGM1bf 5yh0kXkFcOISsIfEMNdeyjXK2zkzMS9aFac4415l3lzqD71lhgfH4WIsFU8h/LmWvjHtOt1KcGEyR GBFajimLxtiuCU7BRWI2VFHdocLydlXPqpGUIFIc1a+sLAhI2SLhc0JtR+CSY6CBTKc36cPctf8wU tX25rGk2IKvwSZxjucYVBEmy0oFpyYq47lvCgqCU5DjI2ruJVkVwM3oYBnUpBWgavD7v7cQhy25TO c75js2feOOvQXtY5hbzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWHC5-0000000GdKT-0M9b; Sat, 03 Feb 2024 14:40:33 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWHC2-0000000GdIM-4BMK for linux-arm-kernel@lists.infradead.org; Sat, 03 Feb 2024 14:40:32 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a30f7c9574eso420592766b.0 for ; Sat, 03 Feb 2024 06:40:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706971227; x=1707576027; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=DCI9UWtJp+usKJeSEd4tLIOfQSn4XLwL0p08Rua3AYo=; b=G+LbBDfgCmK3uxY0q8GpxEOdSCkVJGDdZ5cqfPBye4UF+ow/7L1ZQfOVbfZUXxyVs/ FaVv1T23pA6V4q4ZasTqFBwb3vd1E+TtTiRHAxi9zXnKI0Q99IqwJ2SvbyMpbEZldRIl DTO/2cLnykQFVK6YJSQa/SvKzVbASLwCuG6PU05ZYTJJueD0tL7w0jbiGyk2HBF4isn3 8NbajeZqacRqhXaSPjb99MmpminDUj+Il1jV20AXMfdyaeePTOIkassP5higyxz/KUNS 7KYYg76pQOG2i8jothULnZNQcvIzebI2nd2KEBz+9x6R7nmiyOUQB2A94hLrIW6XEmkd pRAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706971227; x=1707576027; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DCI9UWtJp+usKJeSEd4tLIOfQSn4XLwL0p08Rua3AYo=; b=KPYDFb+ENzlv4669yW9idyIOXTDZrpWaeMS/waRAEXoEz8hqXPEBVZlHBpsF9MBzwN +Djh2WLI3nJGItcFVJt+zTjainRmtSiH+4xDpcmECK2LK7oXLggP3FHWb4yOq9tQAYta vijTZzfK6UA+hWPGbbsaG1Y5xfoAlo4a60YBGnAJ4gGAy0RJq3jzbCJ2CY3bA5d5WEY+ 2GRln2IBXG8nYk5uLTDn0qWplqejBmjICfCjFs1GJe0NcwhJaRAQoVEURsBc8IpJQ28p +gsLtClmsCZNTDW8U6qCyejPsSki9PL9fHwgdky6DmMXfGykigNL4mCW0o9nyVbRZYsm wMyw== X-Gm-Message-State: AOJu0YyyV4DVKvVDaEuXjywpl98+fMiTu449SOZvaLbCRw/1QnzqiyZ/ xD/WSk1lH3v2Fbcx/1RcLOKEBWWwObmqb7dUwHM1RhSLSxYeUJfp X-Google-Smtp-Source: AGHT+IEfOssooYznIaR2j16FsW2he+A402wuOVjq8GOI1Sazb6h644eVgsUtw+TPqcVbkCVfbhPGQA== X-Received: by 2002:a17:906:354a:b0:a31:13ce:d64f with SMTP id s10-20020a170906354a00b00a3113ced64fmr5985082eja.55.1706971226841; Sat, 03 Feb 2024 06:40:26 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCW7p53u42FKalV0Q8kOQDCNk7cTeLg/1cDc8Cl36yTh9GgvqcIr7fJ1NjvQ9ua0CqgYnxR364aNQxpFyOm6CIQ0gb9ekMkZLMnjtffuGBFh7/SwbH8A2V4Cto4Z9t7SqkmhNtnZmDkok1c2qd1RfFQDOV150RgiWxpx8rW8jY5HLX59sjRzhCf0WZbk8j3VHdC4Sk5wajn+aECyMMWAsCXsV0KXGT9nWKLpndPx21SX0bgrfqsTNDIPc/iWNxlXMe/DNTkkaJcZjDrROOhF8GBSmYltznkX/eFhz02CpOi/clBOZqQ2m7tq4HA+58OgX9RRJh+QxZkjkG1leXs9iMcJoOKpvzfAKZxDkrG3th72183EyPHJBq6CNncj849pVaX5+wJ93GXZQcSm5ct9Dek5rZgTh6Ss5o1FzRDuRwoi3fovr7rKMbJKbB327QFLO2b/nbpZPWDmDzvujZLA5i4ncjCgM6tUbMGXZl+68sXucayOr2hT4jmrSx53tV0CYc6As03CrbYkckRd85cXsKMzDz+dAJELylyLaMfykRuH8inh+RjSqtvUsHgRfElsOAJb14rOVfNvZsO0dGP79zCSO3eJlpMEb8wd1VKU3N6H4PiYLsoSqmFiRXTWbU+BuJlXrn6MnPpb5AI5MkVhkEx2ncNcJTGLK32JV16SYsg6cHrjz7ZucNA/U8hIVvKytd/DSE0QRQhZKktMiJbC2gVMDDLn0pVu1FPtuswFLZWasa+yhutDIWOpmg== Received: from krava ([83.240.62.96]) by smtp.gmail.com with ESMTPSA id ty5-20020a170907c70500b00a3628e91119sm2039491ejc.180.2024.02.03.06.40.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 06:40:26 -0800 (PST) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Sat, 3 Feb 2024 15:40:24 +0100 To: Manu Bretelle , vmalik@redhat.com Cc: Daniel Xu , linux-trace-kernel@vger.kernel.org, coreteam@netfilter.org, bpf@vger.kernel.org, linux-input@vger.kernel.org, cgroups@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, fsverity@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netfilter-devel@vger.kernel.org, alexei.starovoitov@gmail.com, olsajiri@gmail.com, quentin@isovalent.com, alan.maguire@oracle.com, memxor@gmail.com Subject: Re: [PATCH bpf-next v4 0/3] Annotate kfuncs in .BTF_ids section Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240203_064031_075299_CD9EFA46 X-CRM114-Status: GOOD ( 31.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Feb 02, 2024 at 03:09:05PM -0800, Manu Bretelle wrote: > On Sun, Jan 28, 2024 at 06:24:05PM -0700, Daniel Xu wrote: > > === Description === > > > > This is a bpf-treewide change that annotates all kfuncs as such inside > > .BTF_ids. This annotation eventually allows us to automatically generate > > kfunc prototypes from bpftool. > > > > We store this metadata inside a yet-unused flags field inside struct > > btf_id_set8 (thanks Kumar!). pahole will be taught where to look. > > > > More details about the full chain of events are available in commit 3's > > description. > > > > The accompanying pahole and bpftool changes can be viewed > > here on these "frozen" branches [0][1]. > > > > [0]: https://github.com/danobi/pahole/tree/kfunc_btf-v3-mailed > > [1]: https://github.com/danobi/linux/tree/kfunc_bpftool-mailed > > > I hit a similar issue to [0] on master > 943b043aeecc ("selftests/bpf: Fix bench runner SIGSEGV") > when cross-compiling on x86_64 (LE) to s390x (BE). > I do have CONFIG_DEBUG_INFO_BTF enable and the issue would not trigger if > I disabled CONFIG_DEBUG_INFO_BTF (and with the fix mentioned in [0]). > > What seems to happen is that `tools/resolve_btfids` is ran in the context of the > host endianess and if I printk before the WARN_ON: > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c > index ef380e546952..a9ed7a1a4936 100644 > --- a/kernel/bpf/btf.c > +++ b/kernel/bpf/btf.c > @@ -8128,6 +8128,7 @@ int register_btf_kfunc_id_set(enum bpf_prog_type prog_type, > * WARN() for initcall registrations that do not check errors. > */ > if (!(kset->set->flags & BTF_SET8_KFUNCS)) { > + printk("Flag 0x%08X, expected 0x%08X\n", kset->set->flags, BTF_SET8_KFUNCS); > WARN_ON(!kset->owner); > return -EINVAL; > } > > the boot logs would show: > Flag 0x01000000, expected 0x00000001 > > The issue did not happen prior to > 6f3189f38a3e ("bpf: treewide: Annotate BPF kfuncs in BTF") > has only 0 was written before. > > It seems [1] will be addressing cross-compilation, but it did not fix it as is > by just applying on top of master, so probably some of the changes will also need > to be ported to `tools/include/linux/btf_ids.h`? the fix in [1] is fixing flags in set8's pairs, but not the global flags it looks like Viktor's fix should now also swap that as well? like in the change below on top of Viktor's changes (untested) jirka --- diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c index d01603ef6283..c44d57fec390 100644 --- a/tools/bpf/resolve_btfids/main.c +++ b/tools/bpf/resolve_btfids/main.c @@ -706,6 +706,8 @@ static int sets_patch(struct object *obj) * correctly translate everything. */ if (need_bswap) { + set8->flags = bswap_32(set8->flags); + for (i = 0; i < cnt; i++) { set8->pairs[i].flags = bswap_32(set8->pairs[i].flags); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel