Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2048657lqe; Tue, 9 Apr 2024 08:11:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVOyAeTVTccfWzky4yk+5D7TbJhdzNppdsBXuTwtOinZxHDlq/IxrKCxsnNrpQxi60z0aeSIwIrZjA3WeooX2c2WyADewNQgFdIoyChng== X-Google-Smtp-Source: AGHT+IGQJr4fgGqGlDRJRvFwn106RGl3qvIar0WaiG8QwcOJHOeIjPhEHrPvLPHlUjjBwXN8y/u/ X-Received: by 2002:ac8:5946:0:b0:434:c012:9bc1 with SMTP id 6-20020ac85946000000b00434c0129bc1mr4854219qtz.32.1712675460993; Tue, 09 Apr 2024 08:11:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712675460; cv=pass; d=google.com; s=arc-20160816; b=HwYQ1kswESX3MrU7AlqVW5M4CKsKsqtSHVkzmXrMwaDwMlq2fs1rHsYdOoYbjpYAYV mxsQZxfxvAxtCXS/ZCeMMQfBUrj8nHBGeYTDWw1FVfo1ta276kSIzMn6qkywB8bTBnD2 eSvlRZ4ruVoEM2eTXXYzJp1huwSBJwX5vj+od5wtl8l4RgrESQZdqvRO90L7L7r6rs9M 2eZXN5e0+PuMYOPd8R9enr4ebYJjlzTkzyClFLr2AGzb+ratsByIGObsVKaW24digaiw s02CgQLQ4lg2aDXaExx/Hc+pED5VgAxOzvfXxjThx7tGgrSrDNYD6fsjHYs7BVr+bWOc HfKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=K9ZmIgxNNGcqdTJbrehXS3OPMQPiMNM/e71i+yjPS20=; fh=Y0i1E4TPAlW1o9JB6zC32WhftYkWnDJTMqbqFWDGBXo=; b=Pdxd6a3tvFsX9NmStosZGTeCLSHc/KURsU/3RJfcusfYPdlzeFe248vrv12QqG33xZ HZQBsI5yDmG49I1a0e0lYzUdUjzx7L6gLAx8ExjEzoiRN1OAY2SpSnkvVhxtY1xsF3zd S7UmlpaD2JxiOWsUT1EAf+/hgvbxV4acxRcIAziDgu7aLg0KLMR7vqhY+D1PCLowoowH PY4Rzw3WEX+2zMTOXPAHFqc1/mdkprBMrDDM/Ge2Dgijt4E3+nhP4Am4JRvRLgiI1hsb JuLM8BDNTUY94U2Pn438ZvCUsk4t9yxlbcH41F8/uKcsVlXfbwccRwkbUhWOsA22O5ll kkJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=c8Wwn4ub; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=WDC6ByAb; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-137175-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137175-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g7-20020ac87d07000000b004343d2359a4si10668069qtb.516.2024.04.09.08.11.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 08:11:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137175-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=c8Wwn4ub; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=WDC6ByAb; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-137175-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137175-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 037141C20AA1 for ; Tue, 9 Apr 2024 15:10:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2368413B59B; Tue, 9 Apr 2024 15:05:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="c8Wwn4ub"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="WDC6ByAb" Received: from fhigh7-smtp.messagingengine.com (fhigh7-smtp.messagingengine.com [103.168.172.158]) (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 D318312FF65; Tue, 9 Apr 2024 15:04:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.158 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712675099; cv=none; b=peNazNQmBCoCiMV7QlKMu4LR87T3CoDDvnwZatgLl2X/kbXaYhxADFHWaYbGuU3wuDkR9sB3Wl/YoU7WQMXJKeaBSshituiV3fqTo5U3Acuqg5mdLchOp35n1nOlm4zaH9kJUxkvp0bPd720SNMj0c1hU+mcapH5Og3tx7JPbYg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712675099; c=relaxed/simple; bh=K9ZmIgxNNGcqdTJbrehXS3OPMQPiMNM/e71i+yjPS20=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=Uo9p0Yk37VoEuSojPCG3j+i7mjO/44ihuQs61ynvOArZdMvhC7GEeb66Z84W1y84XlE1ul4bz0PR10QWkdGjGkaPIpOieD3Mfmp5S7hef7ChXmwr6XNPu2SovhEnf/9y4z2qHnczH5MW8y65VIxfgIgu1ddgsx0MQjWtxODVKwM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=c8Wwn4ub; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=WDC6ByAb; arc=none smtp.client-ip=103.168.172.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id DF595114013C; Tue, 9 Apr 2024 11:04:56 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Tue, 09 Apr 2024 11:04:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1712675096; x=1712761496; bh=K9ZmIgxNNG cqdTJbrehXS3OPMQPiMNM/e71i+yjPS20=; b=c8Wwn4ubBXL7a28OepgsduacGi c7LO4v9Kn1tvZS7AagwBMBS5RwMDf7b7lAc2mRR0STBNOkfiSX6ZPhoHFdIi//// i6WDjtwidkI+MWydDlswprCapC6zYevrwDTXsSVAB4hacntijrnC583yaEjt2pAo 2GauPq/KnQHU+zD1dEiCKYYxujAh4t7aGYgtZ+JSqN1PsEDuAQKD2W2q7MjyZ+ZN rwFrriu3GKoJb4ogc1K2ulxqdxgr02St7Jw5YmU1gSbzeiAjL9t4HRZw15F+674r vcVF4ZdjHVeuGonMJ5DGFmV7iwC3sUplQmxINb3JuDQu1KJLT48I3vT8VO0A== 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:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1712675096; x=1712761496; bh=K9ZmIgxNNGcqdTJbrehXS3OPMQPi MNM/e71i+yjPS20=; b=WDC6ByAbA9fPQpigfuVI/+HAy7ODa7C2FliHQ2NSz1SI 8kb2fJxha4JT1zTgSkrCewXjmZe3aXOiKWDnfus2WcRYOwGdS9g6+txoIYk4J3zK AIXx5J5Mgqfh62oFRT6wXwOD9emWNoyZL25TfWhWweSLLVYGlJu4KfTcVlcQ7fy0 7NP7H78RVze8grD16Kar8iYq0/HthOfwmX+J9y0FZhZ0lofrZwhhQVyPykGw3tNz khpxsviwkexdgiStPoKkG4QCt1zwzLkU15yPhf9Hwo+zC8HumWq0EASG+kG8K8zw U6KdgaSp0wN9trUk7Z/AGGGEuYUxbOKi+/EodRppWw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudehvddgudeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepvefhffeltdegheeffffhtdegvdehjedtgfekueevgfduffettedtkeekueef hedunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 59AD0B60089; Tue, 9 Apr 2024 11:04:56 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-379-gabd37849b7-fm-20240408.001-gabd37849 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: In-Reply-To: <20240409150132.4097042-6-ardb+git@google.com> References: <20240409150132.4097042-5-ardb+git@google.com> <20240409150132.4097042-6-ardb+git@google.com> Date: Tue, 09 Apr 2024 17:04:36 +0200 From: "Arnd Bergmann" To: "Ard Biesheuvel" , linux-kernel@vger.kernel.org Cc: "Ard Biesheuvel" , "Masahiro Yamada" , "Martin KaFai Lau" , Linux-Arch , linux-kbuild@vger.kernel.org, bpf@vger.kernel.org, "Andrii Nakryiko" , "Nick Desaulniers" , "Kees Cook" Subject: Re: [PATCH v2 1/3] kallsyms: Avoid weak references for kallsyms symbols Content-Type: text/plain On Tue, Apr 9, 2024, at 17:01, Ard Biesheuvel wrote: > From: Ard Biesheuvel > > kallsyms is a directory of all the symbols in the vmlinux binary, and so > creating it is somewhat of a chicken-and-egg problem, as its non-zero > size affects the layout of the binary, and therefore the values of the > symbols. > > For this reason, the kernel is linked more than once, and the first pass > does not include any kallsyms data at all. For the linker to accept > this, the symbol declarations describing the kallsyms metadata are > emitted as having weak linkage, so they can remain unsatisfied. During > the subsequent passes, the weak references are satisfied by the kallsyms > metadata that was constructed based on information gathered from the > preceding passes. > > Weak references lead to somewhat worse codegen, because taking their > address may need to produce NULL (if the reference was unsatisfied), and > this is not usually supported by RIP or PC relative symbol references. > > Given that these references are ultimately always satisfied in the final > link, let's drop the weak annotation, and instead, provide fallback > definitions in the linker script that are only emitted if an unsatisfied > reference exists. > > While at it, drop the FRV specific annotation that these symbols reside > in .rodata - FRV is long gone. > > Tested-by: Nick Desaulniers # Boot > Reviewed-by: Nick Desaulniers > Reviewed-by: Kees Cook > Link: https://lkml.kernel.org/r/20230504174320.3930345-1-ardb%40kernel.org > Signed-off-by: Ard Biesheuvel Acked-by: Arnd Bergmann