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  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]
Date:   Thu, 26 Oct 2017 13:21:57 +0530
From:   Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>
To:     acme@...nel.org, mhiramat@...nel.org
Cc:     peterz@...radead.org, mingo@...hat.com,
        alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
        namhyung@...nel.org, elfring@...rs.sourceforge.net,
        kjlx@...pleofstupid.com, naveen.n.rao@...ux.vnet.ibm.com,
        linux-kernel@...r.kernel.org,
        Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>
Subject: [PATCH] perf probe: Restrict user to use only one executable with -V

If multiple executables (-x) are specified with 'perf probe',
listing variables only considers first executable. Ex,

  $ perf probe -V do_sys_open -x ./test -V fun
    Failed to find debug information for address 40
    Debuginfo analysis failed.
      Error: Failed to show vars.
    Available variables at do_sys_open
            @<do_sys_open+0>
                    char*   filename
                    int     dfd
                    int     flags
                    struct open_flags       op
                    umode_t mode

Here, first executable is kernel and second is 'test'. Instead
of finding 'fun()' from 'test', perf is looking for 'fun()' in
kernel. Fix this by restricting user to use only one executable
with -V.

  $ perf probe -V do_sys_open -x ./test -V fun
    Error: Multiple executables are not allowed.

  $ perf probe -V do_sys_open 
    Available variables at do_sys_open
            @<do_sys_open+0>
                    char*   filename
                    int     dfd
                    int     flags
                    struct open_flags       op
                    umode_t mode

  $ perf probe -x ./test -V fun
    Available variables at fun
            @<fun+0>
                    int     arg

Signed-off-by: Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>
---
 tools/perf/util/probe-event.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index b7aaf9b..0e04015 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1128,6 +1128,11 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
 	int i, ret = 0;
 	struct debuginfo *dinfo;
 
+	if (npevs > 1) {
+		pr_err("Error: Multiple executables are not allowed.\n");
+		return 0;
+	}
+
 	ret = init_probe_symbol_maps(pevs->uprobes);
 	if (ret < 0)
 		return ret;
-- 
1.8.3.1

Powered by blists - more mailing lists