提交 317f9f64 编写于 作者: Z Zhen Lei 提交者: Zheng Zengkai

perf tools: set the default length of HW_BREAKPOINT_X as 4 for non X86_64

hulk inclusion
category: bugfix
bugzilla: 47254
CVE: NA

-------------------------------------------------------------------------

Some products may run both 32bit(ILP32) and 64bit APPs on arm64, such as
SD5122. And RTOS will only provides 64bit perf tool. At present, if the
user did not obviously specify the the length of HW_BREAKPOINT_X, perf
will use sizeof(long) as default. For 64bit perf tool, this value is 8.
But the ILP32 syscall only accepts the length 2(Thumb) and 4.

In fact, the original default length is 4 before below patch, because the
length of some instructions is larger than 4 on X86_64.

Use macro HAVE_ARCH_X86_64_SUPPORT to make sure that the default length
is sizeof(long) on X86_64, and HW_BREAKPOINT_LEN_4 for others.

Fixes: aa59a485 ("perf: Don't use 4 bytes as a default instruction breakpoint length")
Signed-off-by: NZhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: NLi Bin <huawei.libin@huawei.com>
Signed-off-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NLi Huafei <lihuafei1@huawei.com>
Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 8d79e3ec
......@@ -955,7 +955,11 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx,
/* Provide some defaults if len is not specified */
if (!len) {
if (attr.bp_type == HW_BREAKPOINT_X)
#ifdef HAVE_ARCH_X86_64_SUPPORT
len = sizeof(long);
#else
len = HW_BREAKPOINT_LEN_4;
#endif
else
len = HW_BREAKPOINT_LEN_4;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册