From patchwork Thu Mar 21 16:36:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13599161 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 C367AC6FD1F for ; Thu, 21 Mar 2024 16:37:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 502DB6B0095; Thu, 21 Mar 2024 12:37:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 486206B0096; Thu, 21 Mar 2024 12:37:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D8C26B0098; Thu, 21 Mar 2024 12:37:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0A4306B0095 for ; Thu, 21 Mar 2024 12:37:22 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AAAFDA0278 for ; Thu, 21 Mar 2024 16:37:21 +0000 (UTC) X-FDA: 81921601482.02.202E32D Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf02.hostedemail.com (Postfix) with ESMTP id DD64280006 for ; Thu, 21 Mar 2024 16:37:19 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=HtXEH8wL; spf=pass (imf02.hostedemail.com: domain of 3PmL8ZQYKCCsZbYLUINVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3PmL8ZQYKCCsZbYLUINVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711039039; 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=FcsF8xuW3B4rJ7bvWaC3URPqDGHFVTOJU/Md9c+vki8=; b=zCSyaaPxAr50JfbulOl8QgJZdYdZpQcBCIhDeb0hl8JaZfa1RHlbGoUYCTWUY+wvyLeSja 1MCdqNBe5oQmtC46KtUYi2EH8whzXUwMDmUN3i/reg891SXaA3+rgLXau7/iWdCKYmYolj N9Pdun3PAEir8lr4WKXIeMqfi2ZiRWs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711039039; a=rsa-sha256; cv=none; b=Te3stHbH16sVO69D1TOlIrzcnggH6oSgrewKJExYITFlwW/Cnbl8WqhlO2/wN2l/ZKHTDe Ifavwu7wRlvsNL8jIFY98MY9MVSHFu5Nm9d23MhA8jeUbPbHhueSL24oUM06Is4/sdjxh7 e6AukjJS17mz2W4dDMsGRxU9SDr1csw= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=HtXEH8wL; spf=pass (imf02.hostedemail.com: domain of 3PmL8ZQYKCCsZbYLUINVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3PmL8ZQYKCCsZbYLUINVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-60f9d800a29so20565417b3.0 for ; Thu, 21 Mar 2024 09:37:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1711039039; x=1711643839; 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=FcsF8xuW3B4rJ7bvWaC3URPqDGHFVTOJU/Md9c+vki8=; b=HtXEH8wLLFqHHixt6NdQMhVLyEZOYK46YsnzUx6C21BdGG6wkA3pzN8potsjUe69u3 liNplLg6YTpP0MEX/Jw4lRX05AGm8GRw1qWAC4lg9aALwSPRPtfadgm4qKe0mUYbqTQR NE79YbBHX0vcL8N3fFITe/iW4u3Fm8snX9xlR0vAwbMkROM+H9PRcG8BI9GqMKKsLEwN g+mNhvBlOREuA4G7SuxT0UA4EldvP77i2N6ByoDV1ovAFcrdTs86adaGBuGXt4Jsf0Vk SpkHzYfFy5BjGdZngzn3izaCZUnvCRe7s4SFhecAOYb8RMmxjlMV7n03/oypF0z3gxMr 9FyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711039039; x=1711643839; 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=FcsF8xuW3B4rJ7bvWaC3URPqDGHFVTOJU/Md9c+vki8=; b=mRUgCx07FE5JR5j1BbN3IiTifLEhDVnzJr6bGM9l8lCy4JpemF9WdNGedbgP/cg4SL M7Qj35e47oAnTbwGeVaIRMCqOKs1+KbviMl43o1EZcc+hCWOSEt7AZct298tCT68UpHD nGaGYtGsUmFnbcIlwP5PuIwepqKxA6BLxJRdTOOFWX4g9b8Iilbkrhpah54rSr1qhS4E FjoZfyyUZsBA/m8DszhhCpEUeZM0Tui6nBuRphiZ0VJ5Xs2H4iksjC3LNaLfRFkDcIqi SAAr4HYt/lovwMooidxot/BYurAaP7rCtTcjc3lnYXM0doaSSMmhmrh8Dq2Nv16tzPHy iZ7A== X-Forwarded-Encrypted: i=1; AJvYcCUCVjYHJpLulOo8Ab2KN5fRHsSHI1OaulZCs1DObIsF7bKjECDwz64/QKAymBgP6Ipgy4BouJOsDqqO+jgxfUVkKns= X-Gm-Message-State: AOJu0YwxdQHgV9SY50kIQurqyuTdx5wASpkKXyKE0fbYqqQv4KLVlqyG Av3d/PS6Z6eoUauDL4KuR7QoQW7CsUKEO69oy+Ag3gcM7P0pmxLhux4aqBCo28Ggo+O0J6aFo9R Nhg== X-Google-Smtp-Source: AGHT+IGrkFj5aE/qI6dA3cr3f2zIJD/myHIxBhs84G4EmxlJsslBgaCO9HAP/2XOVSrMpqDkAxdrZ+lOSbY= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:a489:6433:be5d:e639]) (user=surenb job=sendgmr) by 2002:a05:6902:1207:b0:dc6:b982:cfa2 with SMTP id s7-20020a056902120700b00dc6b982cfa2mr1182860ybu.8.1711039038760; Thu, 21 Mar 2024 09:37:18 -0700 (PDT) Date: Thu, 21 Mar 2024 09:36:26 -0700 In-Reply-To: <20240321163705.3067592-1-surenb@google.com> Mime-Version: 1.0 References: <20240321163705.3067592-1-surenb@google.com> X-Mailer: git-send-email 2.44.0.291.gc1ea87d7ee-goog Message-ID: <20240321163705.3067592-5-surenb@google.com> Subject: [PATCH v6 04/37] 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, jhubbard@nvidia.com, 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, songmuchun@bytedance.com, jbaron@akamai.com, aliceryhl@google.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-Queue-Id: DD64280006 X-Rspam-User: X-Stat-Signature: 9k9yjba14xe1yo1er5r6iy6j58reki4e X-Rspamd-Server: rspam03 X-HE-Tag: 1711039039-583487 X-HE-Meta: U2FsdGVkX1/CtBDMn3nSP0I0roWtAROwlqg+zRto2uoLqQ4Stki31JXEdveuvMppd8NRyZcvpZt322JgQszDQtVCOfHWjTruFHYh6QXesWnIqtq8LbvXbRWt/UvEy2iZo+7XErd39aDRy6qLvCQSA6onE/2o4471uYVSNqFRI357oWCVko7TRd7FQbpHMwHoRKObqgvdvl0mldrRXfiPChx24sLCSbDc8EidQt42nVbM6P7kNu2FsDaRaBQuY0CUuzMLEaeXnlyHE3XbWZ/32rn10HXP2f26iqcZF/Yb95Y99BFnzhNHst7lO9E7geuIFZSfgvMWp2YVGmfY6XFqvuFRu2KGFvGM0Gkk4fQrKoOXMCy9SqJA0QWEdGd6KJHfNtr/lP5C3oND8wtyM/nGZ9oD0HIP5tGgJu49oV0yz/cHc0d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kqrKBM91iFIlID8dOniOp1e8jA9UVFH1PLkU1r+ltuWoq0HXKyqVzvQf2bFbUmZKf4wpx0xsCsAU6di3w2XYJyTidAeKNwtuMZeLr3AYc7XnV42bpV0Le2m3qWHckeY9Bz+c0orgW0sp9fWLdGW56rQeC/MOtLa+cAaf0fn0SypD4BoxwITc1JYxgb40RtaH0SN08pygH0X5I5IHjQoAVPVn82tmLoYSia77pViIpKJTGViGDbnb33rIaEc2JAQGXnYvqBM1GcWvh+w4pg7ZlSyoFZM4torzwg1IH2V+d/5b0NwYfZb4i9UWtvG4njR+Q+Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000338, 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 Reviewed-by: Pasha Tatashin --- 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;