Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2815162lqo; Mon, 20 May 2024 19:12:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzkKxXFhJBB6xvTD7WxoWNV8U3NyoPjfQM7FeIVzjTESgf7Oqv2gNWnDFbrqqYd39nepdHhDSLdDfJ2f8uuW989soVeeD9H8yc2lrxQA== X-Google-Smtp-Source: AGHT+IFgwX9fwYIYkk1tidcUE0A3Hfy6C+DaihRUzscbXyKLswMgMQ89LxlEcsnRr464de2KV+MO X-Received: by 2002:a17:90a:ca8b:b0:2bd:6f2e:8c1a with SMTP id 98e67ed59e1d1-2bd6f2e91b7mr5252585a91.2.1716257573630; Mon, 20 May 2024 19:12:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716257573; cv=pass; d=google.com; s=arc-20160816; b=Q9r2cCryWcikOB2gRwHvAqTnOoPecfiOHqt6I4zQWpGy8TYI+t5m0Kll/Uee1hgrxF JdM5UgXJfKD7UgxiTwsG+D/FT/+XSitzgqmqz7WUf6y48CnKbLohTDHEh5E/Y0hMGxX/ 9Re4WlpEvjuVvPouhDZbhjAxsy+ot7ep46WS6zFVH2WPzVWtoGfNQ6jmdlASPwwINt80 du5YHsPLvomqOKlz7RRLQo1qvgoiCqMGMEKOu8BiJDk1IHW9m/WF/t8FCyaQxylSXpsX pLnSCHv7SAOUddVyxS8eWy98wTkZbAExqbvx5FKh9p6OmaCnGV4bPE4z5ieoVaypvaIn l+iA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=KeOR0nXKja+YsNuSzWYUqCWPqH9qbcgn9VPIxCYo4x4=; fh=RJG7EdDfRGhuVWdhVZeeV0Mgg8XGF4GSERqYpJ5RPUc=; b=x0qn7VFpByMmZ5nL6n9lnm8XQ9qWM7+gSAX5XpYROxuF/4aDOQYSi+fI6VeMjYgc1L r66/Zg+KQ7IROsOabC38oOCADEtSpwks1Y6VJnEDurW2u7n1U2KJVe0ZFw2SakLFrTNv h6gDxeJGf19bfjDopRoaSIQmknk/wGOsOLLIkvouyJFZLL4DqiGfcwHFXKiL0PDwaHVx /4UnFYCMqtBfkClKmLQyJcs9tYfG1G3LSAvQhjsKU5bbqn2PqnDFI7heYGI1rpXKs9hw PNVlSLTvnmD4w8NTxXbHvmniEI/EuTjIIake46zl9/AYrWkpFusrvzgtmfTP1RBeaMC9 br/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=YW1nCIu3; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-184360-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184360-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628fb9a96si1157292a91.136.2024.05.20.19.12.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 19:12:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184360-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=YW1nCIu3; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-184360-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184360-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 9A31CB21BD4 for ; Tue, 21 May 2024 02:12:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B74FC11CA9; Tue, 21 May 2024 02:12:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="YW1nCIu3" Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (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 D243B28FA; Tue, 21 May 2024 02:12:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716257558; cv=none; b=PBQVSWgSz4NDABbcoDEjjMtaEPtPSmY87kkpOX0cC47w5ZOOhs3mTJtwM+WRAbmTCDPcyqthzMX2ykYuusDdv2pVLiYkNFdaSX0munexOQgpV7ZK77avP0jJIOcIBA50RIV7a6g1lpKPg2QjtCsIV1Yjr22IjKfZLnCFRmWi4+0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716257558; c=relaxed/simple; bh=V2BJLb8tR3YwIBkh3sbUIQ7yeb/oFg50OLQMB4UoXGk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=c98lhMSzvtDxXZIHTp4+ALLTWDWFXxf8iqXDx7CVcrk5/lA5qRHTUuuhB657qI0Saj26kN0jPiJDXrsMbOWWUjaNDWNdOt0wEK6L7UpOMh8iNdnFjUdGsasyde5oUSY34WHlPH5C3DMFXogqo6Zxvt9G0AskWl19BjUHdB9j6xA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=YW1nCIu3; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: ivan@cloudflare.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1716257554; 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=KeOR0nXKja+YsNuSzWYUqCWPqH9qbcgn9VPIxCYo4x4=; b=YW1nCIu3jqV8jP3fq+3aOh5dqPFcuG0jCJy2RfbwgG/fdcpU5GTQ8g1jZmmCXjTGYd8kF9 dnQMrz816HHVvosxFpzt1wGJebJcK0Qx6B9fIUhoRQg/0+/jlmJI1ajmfX/3Oi+TvblwIW ryWDozoo9WKcR3q35kVToyF5OpYTXZQ= X-Envelope-To: bpf@vger.kernel.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: kernel-team@cloudflare.com X-Envelope-To: quentin@isovalent.com X-Envelope-To: ast@kernel.org X-Envelope-To: daniel@iogearbox.net X-Envelope-To: andrii@kernel.org X-Envelope-To: martin.lau@linux.dev X-Envelope-To: song@kernel.org X-Envelope-To: john.fastabend@gmail.com X-Envelope-To: kpsingh@kernel.org X-Envelope-To: sdf@google.com X-Envelope-To: haoluo@google.com X-Envelope-To: jolsa@kernel.org X-Envelope-To: nathan@kernel.org X-Envelope-To: ndesaulniers@google.com X-Envelope-To: trix@redhat.com X-Envelope-To: ramasha@fb.com Message-ID: <92c38851-5435-4562-9dbc-4270d67af0bc@linux.dev> Date: Mon, 20 May 2024 19:12:26 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] bpftool: un-const bpf_func_info to fix it for llvm 17 and newer Content-Language: en-GB To: Ivan Babrou , bpf@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@cloudflare.com, Quentin Monnet , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Nathan Chancellor , Nick Desaulniers , Tom Rix , Raman Shukhau References: <20240520225149.5517-1-ivan@cloudflare.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yonghong Song In-Reply-To: <20240520225149.5517-1-ivan@cloudflare.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 5/20/24 4:51 PM, Ivan Babrou wrote: > LLVM 17 started treating const structs as constants: > > * https://github.com/llvm/llvm-project/commit/0b2d5b967d98 > > Combined with pointer laundering via ptr_to_u64, which takes a const ptr, > but in reality treats the underlying memory as mutable, this makes clang > always pass zero to btf__type_by_id, which breaks full name resolution. > > Disassembly before (LLVM 16) and after (LLVM 17): > > - 8b 75 cc mov -0x34(%rbp),%esi > - e8 47 8d 02 00 call 3f5b0 > + 31 f6 xor %esi,%esi > + e8 a9 8c 02 00 call 3f510 > > It's a bigger project to fix this properly (and a question whether LLVM > itself should detect this), but for right now let's just fix bpftool. > > For more information, see this thread in bpf mailing list: > > * https://lore.kernel.org/bpf/CABWYdi0ymezpYsQsPv7qzpx2fWuTkoD1-wG1eT-9x-TSREFrQg@mail.gmail.com/T/ > > Fixes: b662000aff84 ("bpftool: Adding support for BTF program names") > Signed-off-by: Ivan Babrou Acked-by: Yonghong Song