[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190926152419.GD10129@kernel.org>
Date: Thu, 26 Sep 2019 12:24:19 -0300
From: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Andi Kleen <ak@...ux.intel.com>, linux-kernel@...r.kernel.org,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 2/2] Avoid raising segv using an obvious null dereference
Em Wed, Sep 25, 2019 at 12:59:24PM -0700, Ian Rogers escreveu:
> An optimized build such as:
> make -C tools/perf CLANG=1 CC=clang EXTRA_CFLAGS="-O3
> will turn the dereference operation into a ud2 instruction, raising a SIGILL
> rather than a SIGSEGV. Use raise(..) for correctness and clarity.
>
> Similar issues were addressed in Numfor Mbiziwo-Tiapo's patch:
> https://lkml.org/lkml/2019/7/8/1234
Added:
Cc: Numfor Mbiziwo-Tiapo <nums@...gle.com>
And:
Cc: Wang Nan <wangnan0@...wei.com>
Fixes: a074865e60ed ("perf tools: Introduce perf hooks")
And:
Committer testing:
Before:
[root@...co ~]# perf test hooks
55: perf hooks : Ok
[root@...co ~]# perf test -v hooks
55: perf hooks :
--- start ---
test child forked, pid 17092
SIGSEGV is observed as expected, try to recover.
Fatal error (SEGFAULT) in perf hook 'test'
test child finished with 0
---- end ----
perf hooks: Ok
[root@...co ~]#
After:
[root@...co ~]# perf test hooks
55: perf hooks : Ok
[root@...co ~]# perf test -v hooks
55: perf hooks :
--- start ---
test child forked, pid 17909
SIGSEGV is observed as expected, try to recover.
Fatal error (SEGFAULT) in perf hook 'test'
test child finished with 0
---- end ----
perf hooks: Ok
[root@...co ~]#
----------------------------------------------------------------------------
Thanks, applied.
- Arnaldo
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
> tools/perf/tests/perf-hooks.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/perf/tests/perf-hooks.c b/tools/perf/tests/perf-hooks.c
> index dbc27199c65e..dd865e0bea12 100644
> --- a/tools/perf/tests/perf-hooks.c
> +++ b/tools/perf/tests/perf-hooks.c
> @@ -19,12 +19,11 @@ static void sigsegv_handler(int sig __maybe_unused)
> static void the_hook(void *_hook_flags)
> {
> int *hook_flags = _hook_flags;
> - int *p = NULL;
>
> *hook_flags = 1234;
>
> /* Generate a segfault, test perf_hooks__recover */
> - *p = 0;
> + raise(SIGSEGV);
> }
>
> int test__perf_hooks(struct test *test __maybe_unused, int subtest __maybe_unused)
> --
> 2.23.0.351.gc4317032e6-goog
--
- Arnaldo
Powered by blists - more mailing lists