From nobody Fri Dec 19 07:17:40 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19A1AC07E9D for ; Mon, 26 Sep 2022 10:27:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235478AbiIZK1C (ORCPT ); Mon, 26 Sep 2022 06:27:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235514AbiIZKYD (ORCPT ); Mon, 26 Sep 2022 06:24:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CFBA1CFC8; Mon, 26 Sep 2022 03:17:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0705AB80918; Mon, 26 Sep 2022 10:17:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27CF8C433C1; Mon, 26 Sep 2022 10:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187435; bh=zZiD3wg02hC+6/LQJ7nJSnIM5Ko9T6WvF+GpTRd5v30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0nNat9pZNu4YdKElwY+bgXZ6a0fzDYtaPwwq0uOhxrnck687mfRiCYuhxwzQBJwGU 85xpPyRFJX2GMdfcf7/Y4LG0YFDtKeicSuI4Xg/tFBQs0jFYYWzch6S+9xR+Dm7F0B TfgTMJ/rCLpv2cVyZ51DXDk8wv7OlaNww5551pGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Dao , Adrian Hunter , Namhyung Kim , Ian Rogers , Jiri Olsa , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.14 33/40] perf kcore_copy: Do not check /proc/modules is unchanged Date: Mon, 26 Sep 2022 12:12:01 +0200 Message-Id: <20220926100739.571633565@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100738.148626940@linuxfoundation.org> References: <20220926100738.148626940@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adrian Hunter [ Upstream commit 5b427df27b94aec1312cace48a746782a0925c53 ] /proc/kallsyms and /proc/modules are compared before and after the copy in order to ensure no changes during the copy. However /proc/modules also might change due to reference counts changing even though that does not make any difference. Any modules loaded or unloaded should be visible in changes to kallsyms, so it is not necessary to check /proc/modules also anyway. Remove the comparison checking that /proc/modules is unchanged. Fixes: fc1b691d7651d949 ("perf buildid-cache: Add ability to add kcore to t= he cache") Reported-by: Daniel Dao Signed-off-by: Adrian Hunter Tested-by: Daniel Dao Acked-by: Namhyung Kim Cc: Ian Rogers Cc: Jiri Olsa Link: https://lore.kernel.org/r/20220914122429.8770-1-adrian.hunter@intel.c= om Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/symbol-elf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index a0a4afa7e678..866a61d66251 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -1693,8 +1693,8 @@ static int kcore_copy__compare_file(const char *from_= dir, const char *to_dir, * unusual. One significant peculiarity is that the mapping (start -> pgo= ff) * is not the same for the kernel map and the modules map. That happens b= ecause * the data is copied adjacently whereas the original kcore has gaps. Fin= ally, - * kallsyms and modules files are compared with their copies to check that - * modules have not been loaded or unloaded while the copies were taking p= lace. + * kallsyms file is compared with its copy to check that modules have not = been + * loaded or unloaded while the copies were taking place. * * Return: %0 on success, %-1 on failure. */ @@ -1757,9 +1757,6 @@ int kcore_copy(const char *from_dir, const char *to_d= ir) kci.modules_map.len)) goto out_extract_close; =20 - if (kcore_copy__compare_file(from_dir, to_dir, "modules")) - goto out_extract_close; - if (kcore_copy__compare_file(from_dir, to_dir, "kallsyms")) goto out_extract_close; =20 --=20 2.35.1