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: <b0d2446f5eed4c0b91cd853ea8033417@huawei.com>
Date: Thu, 12 Sep 2024 09:54:35 +0000
From: duchangbin <changbin.du@...wei.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
CC: James Clark <james.clark@...aro.org>, duchangbin <changbin.du@...wei.com>,
	Mark Rutland <mark.rutland@....com>, Alexander Shishkin
	<alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, "Ian
 Rogers" <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>,
	"Liang, Kan" <kan.liang@...ux.intel.com>, "linux-perf-users@...r.kernel.org"
	<linux-perf-users@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, Peter Zijlstra <peterz@...radead.org>, "Ingo
 Molnar" <mingo@...hat.com>, Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH v2] perf ftrace: Detect whether ftrace is enabled on
 system

On Wed, Sep 11, 2024 at 09:31:02AM -0300, Arnaldo Carvalho de Melo wrote:
> On Wed, Sep 11, 2024 at 11:15:19AM +0100, James Clark wrote:
> > On 11/09/2024 11:01, Changbin Du wrote:
> > > To make error messages more accurate, this change detects whether ftrace is
> > > enabled on system by checking trace file "set_ftrace_pid".
> 
> <SNIP>
> 
> > > @@ -1583,6 +1601,11 @@ int cmd_ftrace(int argc, const char **argv)
> > >   	if (!check_ftrace_capable())
> > >   		return -1;
> > > +	if (!is_ftrace_supported()) {
> > > +		pr_err("ftrace is not supported on this system\n");
> > > +		return -ENOTSUP;
> > > +	}
> > > +
> > >   	ret = perf_config(perf_ftrace_config, &ftrace);
> > >   	if (ret < 0)
> > >   		return -1;
> > 
> > Reviewed-by: James Clark <james.clark@...aro.org>
> 
> Applied and added these comments:
> 
> Committer testing:
> 
> Doing it in an unprivileged toolbox container on Fedora 40:
> 
> Before:
> 
>   acme@...ber:~/git/perf-tools-next$ toolbox enter perf
>   ⬢[acme@...lbox perf-tools-next]$ sudo su -
>   ⬢[root@...lbox ~]# ~acme/bin/perf ftrace
>   failed to reset ftrace
>   ⬢[root@...lbox ~]#
> 
> After this patch:
> 
>   ⬢[root@...lbox ~]# ~acme/bin/perf ftrace
>   ftrace is not supported on this system
>   ⬢[root@...lbox ~]#
> 
> Maybe we could check if we are in such as situation, inside an
> unprivileged container, and provide a HINT line?
> 
I think we could check the mount status of tracefs first, and then check whether
the ftrace node exists. If there's a permission issue in container, maybe we
should also check the errno of access().

> Reviewed-by: James Clark <james.clark@...aro.org>
> Signed-off-by: Changbin Du <changbin.du@...wei.com>
> Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>

-- 
Cheers,
Changbin Du

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ