From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 727F339AD5 for ; Mon, 22 Jan 2024 09:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705914769; cv=none; b=Un3aEC32iNV6pywFT5kndLa/vkh3xeCh1NeBIMOw7MJcJApAUovi/ENlz4WmQaCvs2/Aac4tXatinpxlaFibhedVdaEcmFBDmkPINRP0hyQgxBshsEDJyMamxV8R6m6GB2CTXJ2YuU+ledZiNMt9P3bWI7lFdems39T7zIpl3lc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705914769; c=relaxed/simple; bh=FI1bdkhRdpG4w1m18XkG1rAosi5jGY3arzDb2dniOFM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=T2ROFFS7cAKpKHP5XrrF9CJ5YQQAk7ujf1OlbCaOrEB38t6QSXJilUR8pORLQHvl2zVZNzzmDwX18Lc2XRMlTsHGFQSUPOAPt44+MTSBKbGahPsnpGlnAMr0ybMbzI/QmwTSxEfNx3+/fSr3U0PqsXwHCqrs/oI6eupMcNB3Sg4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UkKOtNv3; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UkKOtNv3" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-5ffc7ce3343so14576107b3.1 for ; Mon, 22 Jan 2024 01:12:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705914767; x=1706519567; darn=lists.linux.dev; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=6+ATsTLfC/nfRiaNDc88cmvgZOlK0W3C+DyqDLNAS68=; b=UkKOtNv3MVi/UCWhTlfLBZ4HDzPwxOs4rzRiWTAkn54Z+Slf/UNmUPhbqxMNCW27NP THzx+GwRH8Tug96OX4s2F3Hoh0vwxnujnreqWTf9rJAjZCivhfSfESldaCk/33X8Uupx aJSs5wGb28wAJeYTTMuLWr2lWa0bpjWZ9MbqXxMvh7muaoLxd43IvYZXEdNxTxnIsThI vidHF8mmZ19mn19jmHgBYa4k4qLUCVFv7antJ3KNH3m8jNSw46aEg5YGrmZKeuK5TG7l ZCV9HRoIjmJDu1s+V4Wxxn3iDoklA/Czr2j0Ic6aVp9MXe2Mre+4VEBf1QxWDyM8Bohe JHFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705914767; x=1706519567; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6+ATsTLfC/nfRiaNDc88cmvgZOlK0W3C+DyqDLNAS68=; b=jIeuKsGiinF5uUfhX/3X9oTMfAZxYy3oTV8qg+an2JusqgkKFTKm+YXe/LkoP6KGmO m6nk5Sm588NOB1auuV4c3g77i5MFLGLYZnnAlNyz9QxolA+dcUlTphBRzxoJ+dgVRcP7 IqDcXH3E8xRosgku8vMXD1OIua+p9MrgaEFVX9fHVVvLEL52TU/MwxgLZfBpOCVjvOuR d0JyIM8BhO90tSxTT1Vwkg710dFpNdyEvRu5MbVhCCWrbwqqHTHO+y29pdUUzgBikIt9 AxnmDwNFE/ECAEiRUkWut4wu4QZZ93bPxNjXN28Eh+s7uEfqamB0PaoSuaqHxl/TTEM/ zjSw== X-Gm-Message-State: AOJu0YzgiI6s+lI/LMmUVJqovu5buBC5momDGnvU8qMLGhKI42tOJgm5 pykuU+wfhZNc1fB/2OFdQoLYSL2VYcLfCE4HQ25l/XGJ1mambKRTZcbAncQN8ENytVUSjw== X-Google-Smtp-Source: AGHT+IHj5jP1/bPHn1fKlYTBs3hflLPsW502amseDci9rhfzPpL0hjRqnXR0+7HXx4D0UcvjnLYzNOYw X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a81:5753:0:b0:5fb:7e5b:b877 with SMTP id l80-20020a815753000000b005fb7e5bb877mr1288192ywb.7.1705914767726; Mon, 22 Jan 2024 01:12:47 -0800 (PST) Date: Mon, 22 Jan 2024 10:08:54 +0100 In-Reply-To: <20240122090851.851120-7-ardb+git@google.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240122090851.851120-7-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1618; i=ardb@kernel.org; h=from:subject; bh=A4glY9lFGh3ZCS2BolwbxkiHAY08LMb32QJUAkFZOD4=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIXWdwbIambt6UbumlW3o3fUnes5Ggxs7A9m5dyfPXsn/d JVi3k3njlIWBjEOBlkxRRaB2X/f7Tw9UarWeZYszBxWJpAhDFycAjAR7l2MDFurHzxqXGW4W4t3 ia3/+5v/H5kWi8SUzC64/r7UO4X93XqGX8w7t6fEqAq8Lsi/1jt580dBlTI521k3p5SKLZda6x5 VwAcA X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240122090851.851120-9-ardb+git@google.com> Subject: [RFC PATCH 2/5] vmlinux: Avoid weak reference to notes section From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel , Kevin Loughlin , Tom Lendacky , Dionna Glaze , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Andy Lutomirski , Arnd Bergmann , Martin KaFai Lau , Nathan Chancellor , Nick Desaulniers , Justin Stitt , linux-arch@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" From: Ard Biesheuvel Weak references are references that are permitted to remain unsatisfied in the final link. This means they cannot be implemented using place relative relocations, resulting in GOT entries when using position independent code generation. The notes section should always exist, so the weak annotations can be omitted. Signed-off-by: Ard Biesheuvel --- kernel/ksysfs.c | 4 ++-- lib/buildid.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 1d4bc493b2f4..347beb763c59 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c @@ -226,8 +226,8 @@ KERNEL_ATTR_RW(rcu_normal); /* * Make /sys/kernel/notes give the raw contents of our kernel .notes section. */ -extern const void __start_notes __weak; -extern const void __stop_notes __weak; +extern const void __start_notes; +extern const void __stop_notes; #define notes_size (&__stop_notes - &__start_notes) static ssize_t notes_read(struct file *filp, struct kobject *kobj, diff --git a/lib/buildid.c b/lib/buildid.c index e3a7acdeef0e..15109fe191ae 100644 --- a/lib/buildid.c +++ b/lib/buildid.c @@ -182,8 +182,8 @@ unsigned char vmlinux_build_id[BUILD_ID_SIZE_MAX] __ro_after_init; */ void __init init_vmlinux_build_id(void) { - extern const void __start_notes __weak; - extern const void __stop_notes __weak; + extern const void __start_notes; + extern const void __stop_notes; unsigned int size = &__stop_notes - &__start_notes; build_id_parse_buf(&__start_notes, vmlinux_build_id, size); -- 2.43.0.429.g432eaa2c6b-goog