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]
Message-ID: <20180503121921.588e3961@gandalf.local.home>
Date:   Thu, 3 May 2018 12:19:21 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Federico Vaga <federico.vaga@...a.pv.it>
Cc:     LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] trace-cmd:show: be picky on user argument 'cpu'

On Wed,  6 Dec 2017 06:12:12 +0100
Federico Vaga <federico.vaga@...a.pv.it> wrote:

> Before this patch the following command worked without errors:
> 
>     trace-cmd show -c b
> 
> This command opens the CPU0 files. From `strace(1)`:
> 
>     openat(AT_FDCWD, "/sys/kernel/tracing/per_cpu/cpu0/trace", O_RDONLY) = 3

Thanks, I just applied it. Will push it out shortly.

-- Steve

> 
> Signed-off-by: Federico Vaga <federico.vaga@...a.pv.it>
> ---
>  trace-show.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/trace-show.c b/trace-show.c
> index f13db31..7d04012 100644
> --- a/trace-show.c
> +++ b/trace-show.c
> @@ -149,7 +149,14 @@ void trace_show(int argc, char **argv)
>  		file = "snapshot";
>  
>  	if (cpu) {
> -		snprintf(cpu_path, 128, "per_cpu/cpu%d/%s", atoi(cpu), file);
> +		char *endptr;
> +		long val;
> +
> +		errno = 0;
> +		val = strtol(cpu, &endptr, 0);
> +		if (errno || cpu == endptr)
> +			die("Invalid CPU index '%s'", cpu);
> +		snprintf(cpu_path, 128, "per_cpu/cpu%ld/%s", val, file);
>  		file = cpu_path;
>  	}
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ