From patchwork Wed Sep 25 15:01:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 830666 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 504FF18B47F for ; Wed, 25 Sep 2024 15:02:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727276530; cv=none; b=fcwo1x00TzqWz1sMBauFALW75qxqNrAk7s62LHVLRyZjWz4r+h5t2Cl4fvdi8PhpQ3IKIBauQvPuRNY0p4xOwyw2fLkD0fQtVFAR6/McIGLpfLTkr3CmiwWpRW0j8C7AbOUhKCQfKA4+fmw5XpQa6x8JZPr7bnBmL3OhnOgqztk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727276530; c=relaxed/simple; bh=rvAMLnpCc/KpfZ5R41lgUDfd/m3KQZyhOktFD8tg98U=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=OUAlIscNGh07JVOvlFncFsJ02PJTf2XJJhvArxN4y5HmYglwi5WG3xFn+Aaji2BX2BzcPizbz6svxzKoGb70BJECqyqr4H3qRQZ00swgGmfCdcNixjLQD3o3ATQOmSKdOWUA4LgKfwlYiMkhmwQGCP3AEB5XsC9V4VVs2JaDbiw= 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=1NrzdrvG; arc=none smtp.client-ip=209.85.128.201 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="1NrzdrvG" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e2261adfdeso8785277b3.2 for ; Wed, 25 Sep 2024 08:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1727276527; x=1727881327; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=rTUv2yGZRT/iYzBSyilbN8CQ+H5OcaG9Xif73xCYTUU=; b=1NrzdrvGdFOoEJwA4NtSHJQuS2Au5gVzJYv/mFcE0Np8PSGy7tvIwAJ8IcidVu1OW3 HfbC0gEqMOMFnsGAuqFKZWHsJSghaCD97sOZA9LtJjQfIEeTk7cUyfOynR9O2FeJexmD HDQ2qSS07oE3ZH4eiub+QmUsjHVbeLaHC9HiAMjrX3gnNK/BtsA0rbdLBoAH8Qg8ZmCb aJ9bqILDvZJGWyBFmkdEpl8U6mudNXXh2Pqf3gnFpJ2o0qdm/k6ueQ9BbPJVTubyusW3 LnpWqnDYqttPTKuPaCsel2Xhjy5DspsKnryXSvBWpE0b8KIaiPHQoBfe/upLfjB9qW08 HZXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727276527; x=1727881327; 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=rTUv2yGZRT/iYzBSyilbN8CQ+H5OcaG9Xif73xCYTUU=; b=IWNscsFQ0RT2KJgZhjhlyS308Pvp/fFqCUt7ZdKnRYVLxPMUEbbKbl4vh3V+Uv/dEp RFvmPn744dDdiT0pJQkoVKh7GDUJoT5oTn+4R7UUAnO8Ykcn+rJuvmq3SaIMGwiwz3gn q3MKenh5oypsUCllR+FgACIbwvd38iYnI/6DO8hvopcniwvMe5QWW0iqhgvNJ4QxDTJZ P9SdA3r1FaUR87ykS5GAVWK8Lm9uvLDTF72LSMiO/ro8ZuvD0961jBSAQ3ysvhVToe6a JcThOayGYH7Vvs1bOUd/QswLApBNtINmYGXvyPEeINpbF2L71HZNfDdbpL2zaa+Z9Cfv cEJg== X-Forwarded-Encrypted: i=1; AJvYcCX3HgwQLkIXz+tSu0k/AgCzAkUyWo/QDaQwbZky0wb3TPF0xzpQnoM+uClQUthMeK+7OFtfUQDLzQ==@vger.kernel.org X-Gm-Message-State: AOJu0YzFjiN9dyg9H2sVrr4LMD43sVmkcw1r18KQRTxn6LGwISEYVIPk yLx1VKBtqa+CZuJEMlrfTXp4zAVVkAwC4oXt1jqQD56y9CeYbjbF/Owl8yVu8A4Hm28CeQ== X-Google-Smtp-Source: AGHT+IGLT7yTqD1HRbp0g+dVaksf1xzveaZLP+yFkMN9Z3pXXXvCU4M/LA5dyeTTzQHsrcQFQ2z7Ogbs X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:7b:198d:ac11:8138]) (user=ardb job=sendgmr) by 2002:a05:690c:3583:b0:6b0:57ec:c5f9 with SMTP id 00721157ae682-6e21d0dc0d2mr147787b3.0.1727276527085; Wed, 25 Sep 2024 08:02:07 -0700 (PDT) Date: Wed, 25 Sep 2024 17:01:07 +0200 In-Reply-To: <20240925150059.3955569-30-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240925150059.3955569-30-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=882; i=ardb@kernel.org; h=from:subject; bh=h9wNxRa08o4eoAqCSyYKOZyZKBTJUImThQPxe9qE/+Y=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIe2L6taH/xoldmidSK479WfKnGWr8jq4V3v+610hdCLdd HLxEtXHHaUsDGIcDLJiiiwCs/++23l6olSt8yxZmDmsTCBDGLg4BWAiB3cwMjS+ttry3/KZyAZx s7TOmpSVs1htspZOu2OitnHlgdL1srsY/goaVByePZOfkbc43zeoadWW9TLmExXTXvxNfTl7XfX dejYA X-Mailer: git-send-email 2.46.0.792.g87dc391469-goog Message-ID: <20240925150059.3955569-37-ardb+git@google.com> Subject: [RFC PATCH 07/28] scripts/kallsyms: Avoid 0x0 as the relative base From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel , x86@kernel.org, "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Uros Bizjak , Dennis Zhou , Tejun Heo , Christoph Lameter , Mathieu Desnoyers , Paolo Bonzini , Vitaly Kuznetsov , Juergen Gross , Boris Ostrovsky , Greg Kroah-Hartman , Arnd Bergmann , Masahiro Yamada , Kees Cook , Nathan Chancellor , Keith Packard , Justin Stitt , Josh Poimboeuf , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , linux-doc@vger.kernel.org, linux-pm@vger.kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, linux-efi@vger.kernel.org, linux-arch@vger.kernel.org, linux-sparse@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-perf-users@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev From: Ard Biesheuvel In some cases, LLVM's lld linker may emit the following symbol into the symbol table 0000000000000000 ? _GLOBAL_OFFSET_TABLE_ and its presence throws off the relative base logic in kallsyms. Since 0x0 is never a valid relative base, just ignore it. Signed-off-by: Ard Biesheuvel --- scripts/kallsyms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 03852da3d249..09757d300a05 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -747,7 +747,7 @@ static void record_relative_base(void) unsigned int i; for (i = 0; i < table_cnt; i++) - if (!symbol_absolute(table[i])) { + if (table[i]->addr && !symbol_absolute(table[i])) { /* * The table is sorted by address. * Take the first non-absolute symbol value.