lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1481642984-13593-1-git-send-email-kan.liang@intel.com>
Date:   Tue, 13 Dec 2016 10:29:44 -0500
From:   kan.liang@...el.com
To:     acme@...nel.org, linux-kernel@...r.kernel.org
Cc:     dima@...retsauce.net, jolsa@...hat.com, namhyung@...nel.org,
        andi@...stfloor.org, Kan Liang <kan.liang@...el.com>
Subject: [PATCH] perf diff: bug fix, donot overwrite valid build id

From: Kan Liang <kan.liang@...el.com>

Fixes a perf diff regression issue which was introduced by
commit 5baecbcd9c9a ("perf symbols: we can now read separate debug-info
files based on a build ID")

The binary name could be same when perf diff different binaries. Build
id is used to distinguish between them.
However, the previous patch assumes the same binary name has same build
id. So it overwrites the build id according to the binary name,
regardless of whether the build id is set or not.

Check the has_build_id in dso__load. If the build id is already set, use
it.

Before the fix applies,
 sudo ./perf diff 1.perf.data 2.perf.data
 # Event 'cycles'
 #
 # Baseline    Delta  Shared Object     Symbol
 # ........  .......  ................  .............................
 #
    99.83%  -99.80%  tchain_edit       [.] f2
     0.12%  +99.81%  tchain_edit       [.] f3
     0.02%   -0.01%  [ixgbe]           [k] ixgbe_read_reg

After the fix applies,
 sudo ./perf diff 1.perf.data 2.perf.data
 # Event 'cycles'
 #
 # Baseline    Delta  Shared Object     Symbol
 # ........  .......  ................  .............................
 #
    99.83%   +0.10%  tchain_edit       [.] f3
     0.12%   -0.08%  tchain_edit       [.] f2

Signed-off-by: Kan Liang <kan.liang@...el.com>
---
 tools/perf/util/symbol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index df2482b..dc93940 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1459,7 +1459,8 @@ int dso__load(struct dso *dso, struct map *map)
 	 * Read the build id if possible. This is required for
 	 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
 	 */
-	if (is_regular_file(dso->long_name) &&
+	if (!dso->has_build_id &&
+	    is_regular_file(dso->long_name) &&
 	    filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
 		dso__set_build_id(dso, build_id);
 
-- 
2.4.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ