Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp76822lqi; Wed, 6 Mar 2024 10:26:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWIkiN++341PG58QpL+BU+HkagKnUf6kb/yg0KTw7PNbv9YBuUGYiSs5FF8GE7XMA2p3WZglwsQXEHzyMsLbwBhX4X9Pijt0kLCus3Hbw== X-Google-Smtp-Source: AGHT+IHU3dfxLzULw5LyCs2WwTEaXXgmuDSOKpMDWhwNme41NMKRsAERNswPz4ExdPl6DxP85ock X-Received: by 2002:a05:6214:114d:b0:68f:6410:99d7 with SMTP id b13-20020a056214114d00b0068f641099d7mr5658746qvt.64.1709749597253; Wed, 06 Mar 2024 10:26:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709749597; cv=pass; d=google.com; s=arc-20160816; b=fYa7AqdjAIx8VlV8egb76hV19anL7FKvvb2nRdh7c4KSQcwEZOIaJPkdIx6febBwKp c7ljfTkE3XzzkoexAZgmQFMTia59gW/f5CWpWqm4gpHe60g3MYTbxX9BKorQ3WWyJ5Vm +BdAxNqG9r9eeWSIlk0FU69wLAzMESKYHvXLBaJ7qs0fKCbVOnsPpHChyc35C9qY8qkP s+5ow1vkOMDtIUG+q+moV89/O+w5VU4JFzQXArBehNfw+/8hMGB1zaH5WqfT4rdAvMVw 6qldO+uJfkTnlnWdc9L+NlQLIcsDaJAMtX2oRVkFOxEJ5FgsqJA94EEkZyYzkZr7tNtx G1XQ== 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=5nTBv3DNXNZIxIc1ZBoC1bDpLfB6IB4LOR7eT5PZErs=; fh=X0X9zJxN0gU52yer2mHdAdtHrTlq1jJqhYinoxU0g6o=; b=js44+nRSNvfgYfAuiDbDVqKXTPVM/PiSS5lET63H3O6PRCdOkItsqcXgYpAEOe8GIP U5LY9COGQykjf6ko7ZpU1YAn5oqq9OakjhXPTvDxORST9wxaIoiWYe4bZwycJVg0Zt5r J+AI9J4kwWTXuLshxKG+OjPVPeb/4dzkUhs1/Tr+9xiTTB71O1xgfsa1Bs1KUr5F/ixQ gyLOIZJfcuBIrRgnZW5+/RzJ53o04bt6npzCg1emaNdiAqCMGY5TfdZcy/98eKNbVtxP rHWh3rP2TEbORnedGyvugstjTW4xnUtRB8bdCXSvYChdAmxRdi5vDQ9bK5SUlZWZPMB5 0SOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=shnnHBRb; 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-94395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94395-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h2-20020a0562140da200b0068f6a21487fsi14646284qvh.15.2024.03.06.10.26.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 10:26:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=shnnHBRb; 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-94395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94395-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D5A191C20E37 for ; Wed, 6 Mar 2024 18:26:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CB8414372E; Wed, 6 Mar 2024 18:24:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="shnnHBRb" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.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 7610B140E50 for ; Wed, 6 Mar 2024 18:24:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709749498; cv=none; b=YLLgizwJKseMreUJwfhvFAzfmEhTGPaNapMYRY4KhqXoB71RJYeCzM2Jrrpd/bz92OiT3qTP2BktXiCC/yfG9zBUGvJp4NsKSYfRR2nv7yOJlUVlbFs9DtbeQlfHzqaiGSq7o5KCkRIkpIPAxOac0pkwfbPsa7xIgR1CaR2inbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709749498; c=relaxed/simple; bh=ZqsbHPLTqR5vr2hfJmCxnAF/y893b7KN4UH1mJR1TTs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=KS0+f7I1TCpTg6u4+AQ78Dp7SVNFDeDYtj0QF9jMg79YbBEUSinshjsCbV+5KcWeb/INhQnqIb1xGkTQ4SwL80bPG1lIV1AdkLW5wPt7nINAPjGT2ES9PwQEhXc5tBOJqu8A5D3xIgm48uVOarTU6BVHhIxuFdT2C/BUT0CKOBM= 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=shnnHBRb; arc=none smtp.client-ip=209.85.219.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--surenb.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6b267bf11so8285450276.2 for ; Wed, 06 Mar 2024 10:24:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709749493; x=1710354293; 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=5nTBv3DNXNZIxIc1ZBoC1bDpLfB6IB4LOR7eT5PZErs=; b=shnnHBRbQBYZtJVhyNwHvVRzZy+Evm2lS8VagOsCzaiCHc6GmmFRV36ibA+N/q6F3r LYvXjkGlzvrO326JxhEHIm7Wq32UUR9uGNo0qLC/rvbKyIpp2bH7NNiE3BlJRzxKg/MS 8vejCOUz0P+b0uH+DlAG4jm4miZPtTkBaP/GHNp2BuarYul6Y4ROIF8hQNFud65s1V5W 2y1fH9p2vKYpkQePKlcVkCA6FzrzPQUkCtS4nay/ZAL1Wu6MEgGJRdCSlJCDNEwyqd9M m2NG5scOVhCLX9FtEbs+L3AJz+KkpqP/meXpuSU1rQ6YmKSmrboAerQ327T2LZerNLFH 3jKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709749493; x=1710354293; 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=5nTBv3DNXNZIxIc1ZBoC1bDpLfB6IB4LOR7eT5PZErs=; b=B8xlJLWDA6ot08rXnZ9vnYTGy/Tt9zvUN3q593RP+eLBx91pJTiONvDLw40KnR6mIv S3/5CI1tscz6dq0iTyk4SOCqhR4lpr5/kW7s8wviHj4iW31dT2AtmsnRm2+kfNf90vkq ku86JTbRaSIcFB/1eW5SZF3vwF5zWbzxgjZA5yNFbAr4YzIuTdFBOwxFYUXgZUADPHCy v1i4bOdGuBr68DJTaF8xjMP2xkku2j5q4vCMB5wTaoCyQ6LVu/MeBHyS0prH6qsKnpkd vgSnuvsyG2eHAMhfZH2//Zmo3VjXWG2U9i2vSP0JkWdYuqI/kjAZse9A7erXH5d5utxQ O6bg== X-Forwarded-Encrypted: i=1; AJvYcCV2NW2BA2Oqkj2avVKq24N8Qwupvpbaa/hfa1ImF6SmK0X6nsF0Sh2KhzU9kB5v2ErdiH3qTegv/N/5VqhKuVH1cT6K6yQM5Ap0Trek X-Gm-Message-State: AOJu0Yw8ed8LVpMZ30og7zZwXU/6fKkn/GGjPAjfrq0gxseUYQnHBcpW mFi05FljVzMmrB9tZ88RiWxfwFTe+3iYPvDnDkF2J1N0So435knTMEM8dttMxFD0T+Tn/5l/YZx bOw== X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:85f0:e3db:db05:85e2]) (user=surenb job=sendgmr) by 2002:a05:6902:1009:b0:dbe:387d:a8ef with SMTP id w9-20020a056902100900b00dbe387da8efmr534074ybt.1.1709749493516; Wed, 06 Mar 2024 10:24:53 -0800 (PST) Date: Wed, 6 Mar 2024 10:24:02 -0800 In-Reply-To: <20240306182440.2003814-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: <20240306182440.2003814-1-surenb@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240306182440.2003814-5-surenb@google.com> Subject: [PATCH v5 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, shakeelb@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 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 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; -- 2.44.0.278.ge034bb2e1d-goog