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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-3b0d516463f8deb897a55cb81e9dbbe58a2490ed@git.kernel.org>
Date:	Wed, 17 Mar 2010 11:30:29 GMT
From:	tip-bot for Ingo Molnar <mingo@...e.hu>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, paulus@...ba.org, acme@...hat.com,
	hpa@...or.com, mingo@...hat.com, a.p.zijlstra@...llo.nl,
	efault@....de, fweisbec@...il.com, tglx@...utronix.de,
	mhiramat@...hat.com, mingo@...e.hu
Subject: [tip:perf/core] perf probe: Fix !dwarf build

Commit-ID:  3b0d516463f8deb897a55cb81e9dbbe58a2490ed
Gitweb:     http://git.kernel.org/tip/3b0d516463f8deb897a55cb81e9dbbe58a2490ed
Author:     Ingo Molnar <mingo@...e.hu>
AuthorDate: Wed, 17 Mar 2010 12:13:28 +0100
Committer:  Ingo Molnar <mingo@...e.hu>
CommitDate: Wed, 17 Mar 2010 12:13:28 +0100

perf probe: Fix !dwarf build

Fix the !drawf build.

This uses the existing NO_DWARF_SUPPORT mechanism we use for that,
but it's really fragile and needs a cleanup. (in a separate patch)

1) Such uses:

 #ifndef NO_DWARF_SUPPORT

are double inverted logic a'la 'not not'. Instead the flag should
be called DWARF_SUPPORT.

2) Furthermore, assymetric #ifdef polluted code flow like:

        if (need_dwarf)
 #ifdef NO_DWARF_SUPPORT
                die("Debuginfo-analysis is not supported");
 #else   /* !NO_DWARF_SUPPORT */
                pr_debug("Some probes require debuginfo.\n");

        fd = open_vmlinux();

is very fragile and not acceptable. Instead of that helper functions
should be created and the dwarf/no-dwarf logic should be separated more
cleanly.

3) Local variable #ifdefs like this:

 #ifndef NO_DWARF_SUPPORT
        int fd;
 #endif

Are fragile as well and should be eliminated. Helper functions achieve
that too.

Cc: Masami Hiramatsu <mhiramat@...hat.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Mike Galbraith <efault@....de>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
LKML-Reference: <20100316220612.32050.33806.stgit@...alhost6.localdomain6>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
 tools/perf/util/probe-event.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 64dea6c..f333269 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1012,8 +1012,10 @@ end_dwarf:
 	if (!sym)
 		die("Kernel symbol \'%s\' not found - probe not added.",
 		    tev->point.symbol);
+#ifndef NO_DWARF_SUPPORT
 found:
 	close(fd);
+#endif
 	return ntevs;
 }
 
@@ -1172,10 +1174,13 @@ void show_line_range(struct line_range *lr)
 	unsigned int l = 1;
 	struct line_node *ln;
 	FILE *fp;
+#ifndef NO_DWARF_SUPPORT
 	int fd, ret;
+#endif
 
 	/* Search a line range */
 	init_vmlinux();
+#ifndef NO_DWARF_SUPPORT
 	fd = open_vmlinux();
 	if (fd < 0)
 		die("Could not open debuginfo file.");
@@ -1183,6 +1188,7 @@ void show_line_range(struct line_range *lr)
 	if (ret <= 0)
 		die("Source line is not found.\n");
 	close(fd);
+#endif
 
 	setup_pager();
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ