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] [day] [month] [year] [list]
Date:   Tue, 1 Jun 2021 10:37:41 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Riccardo Mancini <rickyman7@...il.com>
Cc:     Namhyung Kim <namhyung@...nel.org>,
        Ian Rogers <irogers@...gle.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>, linux-perf-users@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf: fix segfault when wrong option for --debug is
 provided

Em Mon, May 31, 2021 at 11:28:28PM +0200, Riccardo Mancini escreveu:
> The command `perf --debug record` causes a segfault instead of notifying
> the user of the unrecognized option for --debug (the correct syntax would
> be `perf --debug verbose=2 record`).
> 
> The bug is caused by a call to pr_err before debug_file (debug.c:34) is
> set via perf_debug_setup(). It has been introduced in
> commit 8abceacff87d ("perf debug: Add debug_set_file function").
> 
> This patch resolves the bug by calling perf_debug_setup earlier in the
> main, so that debug_file is set to stderr before any call to a debug
> printing function is made.

Ian fixed this earlier and it is already even upstream:

https://git.kernel.org/torvalds/c/c59870e2110e1229a6e4

Thanks,

- Arnaldo
 
> Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
> ---
>  tools/perf/perf.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/perf/perf.c b/tools/perf/perf.c
> index 20cb91ef06ffc..cffbab2d085a7 100644
> --- a/tools/perf/perf.c
> +++ b/tools/perf/perf.c
> @@ -448,6 +448,7 @@ int main(int argc, const char **argv)
>  	pager_init(PERF_PAGER_ENVIRONMENT);
>  
>  	libperf_init(libperf_print);
> +	perf_debug_setup();
>  
>  	cmd = extract_argv0_path(argv[0]);
>  	if (!cmd)
> @@ -531,8 +532,6 @@ int main(int argc, const char **argv)
>  	 */
>  	pthread__block_sigwinch();
>  
> -	perf_debug_setup();
> -
>  	while (1) {
>  		static int done_help;
>  
> -- 
> 2.23.0
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ