From patchwork Mon Feb 12 21:38:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13554040 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 490AAC4829E for ; Mon, 12 Feb 2024 21:39:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A7086B0074; Mon, 12 Feb 2024 16:39:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 307376B0075; Mon, 12 Feb 2024 16:39:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E3F66B007B; Mon, 12 Feb 2024 16:39:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id EBE2C6B0074 for ; Mon, 12 Feb 2024 16:39:39 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8DB28120A6C for ; Mon, 12 Feb 2024 21:39:39 +0000 (UTC) X-FDA: 81784468878.02.D37A962 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf04.hostedemail.com (Postfix) with ESMTP id C396240013 for ; Mon, 12 Feb 2024 21:39:37 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=rE9i8FyA; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf04.hostedemail.com: domain of 3GJDKZQYKCJcJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3GJDKZQYKCJcJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707773977; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=G9b+4SdACUtX02zckFp4W9j//70BE65Et6Qs8xfY7vk=; b=VLNcE7bDFCNDDUbIzBS6cmSq/ifgzorBoiYYzOJZ9oh7hCMCtrbRSzqal39T0h5IxMMHiq oGMmyqzbYPm4mDMfAm1a8k+O+hkb3Ak1yTrVYIcuIoIV3MHdIUk9PcJd8bT2jyPCDKMOLk 2D/S3qYagI7yKHeHkWgCmjOhEue8mho= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=rE9i8FyA; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf04.hostedemail.com: domain of 3GJDKZQYKCJcJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3GJDKZQYKCJcJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707773977; a=rsa-sha256; cv=none; b=gaRSvI35o4HzGqMDeS03lIwZE7zKiSinNYdR/KipaYBKT3lH9MO+1UWJv122x3tnjTSbt+ 3CLhCelSPABRiBR7VdP0+o+VV61JmN+KJW9hTqNHMXghJFz+SK60QwMWolJlGg8HjyA76Z JyqRT/P9uIgLtbfow6GznKFT1gyioHw= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-60779e8f67fso4370517b3.0 for ; Mon, 12 Feb 2024 13:39:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707773977; x=1708378777; darn=kvack.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=G9b+4SdACUtX02zckFp4W9j//70BE65Et6Qs8xfY7vk=; b=rE9i8FyAnHg5bwWdhEDRYqoOjoqBAtVzHRnGG/sAZ5AK1j8c5vXsoa3ELQIk+kiuo5 Yov1xpuWcF0DjxXF+Mxpov78pY0AQTkMq0GLPkpUMRNGQu/24NgIVcATILlYRNCklx21 47WZFl+48Ib39L516JJIjlPiMJ51DX/SYhEN4JB0393QjLnMOrBCbfXFt92D0Z2wjvZI 5rySTGK/euKH/hrWKfEjAabz9Q+H3UokJVBMwRiyMADfSvyHVXeKWI/4imzcWmfJ97Sj fqynvnZDC4Oh5ctsFFo4IxOw64cTh/8x23rrGCVPNNxeGMVy+6aqvPHQlD1tjXCCYj88 F6aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707773977; x=1708378777; 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=G9b+4SdACUtX02zckFp4W9j//70BE65Et6Qs8xfY7vk=; b=RcyQcEXfixwuynBaK5a5JB3P8mFc52QZ2fMG/qjKkM30tOmdrNI4Osqye3yANZp495 y8xp6YBmOXA0xWxBIA6AwUOP2UjPOb8PKNMvzmhrVuCcGMzmybx8GvaMFuyRb+sLDRvK GIVBc7qcOgY1KjoiPDIcbLnQ7SQsVl/+PVl2MOI/23vMhxWiASsFuni4oGq+Z+klGPBf YDBE3fJryU+YNSkVASi1ynkPnch9D7RyBSTbm8i1OLm////bhT92p3tDVnO849K5Aw99 N1GHAdLpGDiFkUSGOwg98MV4DjvCY49Os00F6weFtkEFqSdzk0UADgjSFh+0iOb3z3Js gQHw== X-Forwarded-Encrypted: i=1; AJvYcCX8LbNfp1KlQn9Z40gDHmtw67DbHaeWPT0lIgt3eBLYF9ct8R0TraIj9DPjHbB3/X02nv3GNDYbbP/VYiUMEpCGkA8= X-Gm-Message-State: AOJu0Yw4qwrwrJFBB1xVsrFiPBrA7idfY8buQqV5nSeES/lfMUM/kt+S VlUSyiAa2QRcafZ0LtnkVwTg7kAldrMTg2WExXuolhggMFZWu0UAcOi/BGBCXqqD2iFSL3/A3eL 6pg== X-Google-Smtp-Source: AGHT+IEGxw+pumepe2rycJxKPCLRRtMyemZOKJSP2HsBcIOyAk76oq0qhFPUoU2Rl7QOiTv7xvjwgacHnLI= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:b848:2b3f:be49:9cbc]) (user=surenb job=sendgmr) by 2002:a0d:d495:0:b0:607:7f86:dc24 with SMTP id w143-20020a0dd495000000b006077f86dc24mr109272ywd.3.1707773976926; Mon, 12 Feb 2024 13:39:36 -0800 (PST) Date: Mon, 12 Feb 2024 13:38:48 -0800 In-Reply-To: <20240212213922.783301-1-surenb@google.com> Mime-Version: 1.0 References: <20240212213922.783301-1-surenb@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240212213922.783301-3-surenb@google.com> Subject: [PATCH v3 02/35] 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, 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 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C396240013 X-Stat-Signature: 6k3f9pwydx1a7rhp37r6or9gbxxh8t6u X-Rspam-User: X-HE-Tag: 1707773977-735870 X-HE-Meta: U2FsdGVkX18erDtYJbVqGl8X2mfvo02LPaFuZZk+0Rwcfmih6jpWBf2stBcf5m77LVOjnkQFFe2mM/cnTP2N+5lz2WkpvKN0uBdKUNV0tzc2JvTa6jk5/ygSgUSLMxzp8YiBT/7t1M6RYs+UYvOO3MBrW2njkryG8ZvVL3kmjBTg9RFNxDiPr80SfP+r00aIKCteBI8GruBE8U8lGa/SwFn2DYEEenkSCb3SqrEoJJfw7DS3QqzhEqZ1JjAaY5sInbf40y8VLx9vOHQRTES4NfbnM/oXBiqTW2ZdNtqA07cIEndhBpcOTQJ1d4pBHsb9L6eJ+HCWYVVqWtKZjGU0GyoM054cPlV1GCeSylKePTT3jwDrkqEcveWNf2s7uQMZip4MAeskJJsDeHQZgDvwtxq9TxW9Urm/hKrRMUxFlksycuYBNqh5SgJM+sxlrcjMVl+0UTxtmQWpy7oFM4XrqNYg3Ni+KDVUxuL1u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vPtXWZDufBm6cJuMZzfT/oXsxOVYuUAnaZHhwnO6W28vbADpNx+cZLtI4Dlm3aiNcH9hA/HzN2vwLSsb53Usyu0i2/qIUH2KEYKr5iBz8cTSmPhtmCGC9KTitEkOe+h6mYr465wrqvoZC4Om1vYMbrOWLxQu/YBQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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;