提交 0603d82b 编写于 作者: M Mark-PK Tsai 提交者: Greg Kroah-Hartman

perf/hw_breakpoint: Fix arch_hw_breakpoint use-before-initialization

commit 310aa0a25b338b3100c94880c9a69bec8ce8c3ae upstream.

If we disable the compiler's auto-initialization feature, if
-fplugin-arg-structleak_plugin-byref or -ftrivial-auto-var-init=pattern
are disabled, arch_hw_breakpoint may be used before initialization after:

  9a4903dd ("perf/hw_breakpoint: Split attribute parse and commit")

On our ARM platform, the struct step_ctrl in arch_hw_breakpoint, which
used to be zero-initialized by kzalloc(), may be used in
arch_install_hw_breakpoint() without initialization.
Signed-off-by: NMark-PK Tsai <mark-pk.tsai@mediatek.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alix Wu <alix.wu@mediatek.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: YJ Chiang <yj.chiang@mediatek.com>
Link: https://lkml.kernel.org/r/20190906060115.9460-1-mark-pk.tsai@mediatek.com
[ Minor edits. ]
Signed-off-by: NIngo Molnar <mingo@kernel.org>
Cc: Doug Anderson <dianders@chromium.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 91849adc
...@@ -426,7 +426,7 @@ static int hw_breakpoint_parse(struct perf_event *bp, ...@@ -426,7 +426,7 @@ static int hw_breakpoint_parse(struct perf_event *bp,
int register_perf_hw_breakpoint(struct perf_event *bp) int register_perf_hw_breakpoint(struct perf_event *bp)
{ {
struct arch_hw_breakpoint hw; struct arch_hw_breakpoint hw = { };
int err; int err;
err = reserve_bp_slot(bp); err = reserve_bp_slot(bp);
...@@ -474,7 +474,7 @@ int ...@@ -474,7 +474,7 @@ int
modify_user_hw_breakpoint_check(struct perf_event *bp, struct perf_event_attr *attr, modify_user_hw_breakpoint_check(struct perf_event *bp, struct perf_event_attr *attr,
bool check) bool check)
{ {
struct arch_hw_breakpoint hw; struct arch_hw_breakpoint hw = { };
int err; int err;
err = hw_breakpoint_parse(bp, attr, &hw); err = hw_breakpoint_parse(bp, attr, &hw);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册