Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2568995rdb; Wed, 21 Feb 2024 11:42:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV7UsfhdgVwH4g17QPnPiCfijC3cW84oDaoiOhDU7txGfcfckHwLc5vYeBapnbqhwf/Rl1rOxlomaRMnmmF1B81EK6KGUiY2ncr3Lknzg== X-Google-Smtp-Source: AGHT+IEDGCSNmhurFfzLoc7YA91ih/c+DUiNghWEs42fyDRYMXPPyWFXURylC+e8Cc+8dAX6mI9f X-Received: by 2002:a17:906:3a94:b0:a3e:b754:2d71 with SMTP id y20-20020a1709063a9400b00a3eb7542d71mr7203815ejd.76.1708544573850; Wed, 21 Feb 2024 11:42:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708544573; cv=pass; d=google.com; s=arc-20160816; b=wUqLKY4pLNLQIl0+nCtrxWfIh0HbepDdSWfzSBULwe9livxlmajcXJXmLuKKMrNx3L D4OrhrEDg0DKyBRTcY8VXDMnpOqFbrI189u5ilihhyiQCN6bYiW68eqDg8wdm/bG0cFS aSpUEWI4GAr20LzPMz201chuerd826F2GnmD4nIP2jS9QFjmgUMnFzLICGStgTZSjvBr RjXy9ZsXNFstLlC8JWQYil86jwWmthHl+Sxcl+tPA6gAcCRti1szEOEBQNTpas9nYQK8 LZISqipbGgKNX9V+AsmoG8nU+WaKweJ80uc76R/C5phzbLEqRxzZQHIqDfZSb58uE74q jxrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=nNOJH11gO16gI1CGV9wD1JhhI3G0pl89I4/43bWDXAE=; fh=E4F81XFPhjhp4EqJa4PDn8Hky2qqXkEg1lElt4KE2sQ=; b=cp4j85srC1UG27FUncZwr5yUhS0L27UB5i/LOF03PwdObu8h96iRhVl6jb4pbHyXP/ v3DrRmfXxAkS6j4hDAQNBmMNy1NMh1yTVxom6KO7vMt7csKztRK2LiD+npRlhf+o1C2d FSINaLPh8w1UJmO3QOZtfSw0M1ohnPxKjeLw1ccouUC4Fhqhc5UWnVqpkguLaYZiHcxi 6xL53OsRhhvugS7XmxAb0FItTcl/FWEsFJFwuGxxk+z3Qgc9qNFkKPuHBHb8tBei0zrI m4eFx0PeG2hCl1atNx04cPuneizBi33GELr3Ocu7CgM+1CzE+uQnP5q4d4j0K+PNh1Zj OGDw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=H37z25x5; arc=pass (i=1 spf=pass spfdomain=flex--surenb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75383-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75383-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l17-20020a1709066b9100b00a3e69a5dbb2si3641308ejr.368.2024.02.21.11.42.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 11:42:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75383-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=H37z25x5; arc=pass (i=1 spf=pass spfdomain=flex--surenb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75383-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75383-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 747951F2201B for ; Wed, 21 Feb 2024 19:42:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F72612839A; Wed, 21 Feb 2024 19:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="H37z25x5" 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 2C44B1272AF for ; Wed, 21 Feb 2024 19:41:06 +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=1708544467; cv=none; b=eGBPXw7Vw/oy1lkva09c8KSRQ5j/dV32OB2G9sBGwQyHo9tEr8eWUU+5HZ/ZouzHjppCees8OphfJkdTOR6w/02chX96Iap63SeoeRBWxXusW+W9iB/eqKMorNCN8NFS/kmdm1qKtCbbwFUILQ+XmZ8VBDLMay4lI6ImCyPVAVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708544467; c=relaxed/simple; bh=HEHmOJCie8+J7RJiRgymV6TXHRXRZD3Kg9mNxHhJkjU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Dhndsmnv5v8gT5IYkk89QDbnkc9vWCAH6+SJdcsVLij+Gg0IDTmvXXekOrgo9wSP5sv3DU7uyFLyeId3asWkbmsHDQvbK2p2jS2NfdSukLBpvjepNle+5EdCvyvCvHZ2RAY/fwEtrfZ/Vs/UXOpO7Ukay+dK26KuCHhBx2l8oh4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=H37z25x5; 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--surenb.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6089253372cso9640007b3.1 for ; Wed, 21 Feb 2024 11:41:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708544465; x=1709149265; 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=nNOJH11gO16gI1CGV9wD1JhhI3G0pl89I4/43bWDXAE=; b=H37z25x5wvEqUwzd/42xA/Op9Kb8Fd0bYv549DTrI2TY1FrCrkQmoYqACVMpDfqD4y OspB1oI6aB9HGWr2ol/P7wMiZw9MX2tFLcqPdJGAzby6B3v0elGYlsRr4FshFxpVDOBZ AJ1VLsD2PiTfLGyj9LG7ysU5bHCjMwgDXL+25UFC1aurZBEQpx3AB67ny16u57cPH2yX U/lQgoA+pKGM4aoHvqMFfedUkwH2/NcRsRLY+mgM4itaBDL1aKqg4idbJYagOSPcLGtq buHUA1yS57dInoD8oYhGZjYyo0cXPDzWMUwuEJ900z20bs+j9uzayLp55OTSZz1uViN6 wZkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708544465; x=1709149265; 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=nNOJH11gO16gI1CGV9wD1JhhI3G0pl89I4/43bWDXAE=; b=btbDJYmQo6LhTzXtpjxlzxFPDiH8kV0c/Pzma93E4oIjtp+bwyUQNcavr3PmaaETlh X4IlRMARpeguUFLKj2kTJl6xerSailfEBSnBfgE2dAYcYPkTDyj0U+5BzyBml8gOeODj xZ+g1ksWVPyFB5UhNNZQ7ZdvJfFJMwJcm07vi/aivjbltp3KvS9ROCqlyGV/Ig3lftLF KH2a9PSusu87J8RDSTwT6atnGLD3X86GTyKpqNQpl3+b9fuIEkArqJYeynWZTRZHgtNK Fb1KuKo61MI6YGsU0WX3YiuAY31jSBctM8thLIhf1rsytG9UjTSxOYRWb8tMQGWoGGLg tGpw== X-Forwarded-Encrypted: i=1; AJvYcCV+X7Z2bY6exIN4XjD4qc+pb9BEp6NjIMzs+nKjQg/7gKrQnhXzjIFJo1jehrBDWLeTUQUluCiVASzE4pn8mbMpqUdHw0b1qMn/G499 X-Gm-Message-State: AOJu0YwGWl8dkv2Rn6tEWVK0vqArMtwTGh/0pqabem4UbMMBJpjttgZm eEDxwrODSxEC0aaaqKgN7KqYV8u1oiL5K1xaWMfAdYdbYZ+mxKWUsVVpzGrkYMaP3DI6r9nFPPy LYw== X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:953b:9a4e:1e10:3f07]) (user=surenb job=sendgmr) by 2002:a81:528e:0:b0:608:94cb:6f6 with SMTP id g136-20020a81528e000000b0060894cb06f6mr174090ywb.7.1708544465320; Wed, 21 Feb 2024 11:41:05 -0800 (PST) Date: Wed, 21 Feb 2024 11:40:17 -0800 In-Reply-To: <20240221194052.927623-1-surenb@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240221194052.927623-1-surenb@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221194052.927623-5-surenb@google.com> Subject: [PATCH v4 04/36] scripts/kallysms: Always include __start and __stop symbols From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: kent.overstreet@linux.dev, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, penguin-kernel@i-love.sakura.ne.jp, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, surenb@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Content-Type: text/plain; charset="UTF-8" From: Kent Overstreet These symbols are used to denote section boundaries: by always including them we can unify loading sections from modules with loading built-in sections, which leads to some significant cleanup. Signed-off-by: Kent Overstreet Signed-off-by: Suren Baghdasaryan Reviewed-by: Kees Cook --- scripts/kallsyms.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 653b92f6d4c8..47978efe4797 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -204,6 +204,11 @@ static int symbol_in_range(const struct sym_entry *s, return 0; } +static bool string_starts_with(const char *s, const char *prefix) +{ + return strncmp(s, prefix, strlen(prefix)) == 0; +} + static int symbol_valid(const struct sym_entry *s) { const char *name = sym_name(s); @@ -211,6 +216,14 @@ static int symbol_valid(const struct sym_entry *s) /* if --all-symbols is not specified, then symbols outside the text * and inittext sections are discarded */ if (!all_symbols) { + /* + * Symbols starting with __start and __stop are used to denote + * section boundaries, and should always be included: + */ + if (string_starts_with(name, "__start_") || + string_starts_with(name, "__stop_")) + return 1; + if (symbol_in_range(s, text_ranges, ARRAY_SIZE(text_ranges)) == 0) return 0; -- 2.44.0.rc0.258.g7320e95886-goog