Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
98f07013
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
98f07013
编写于
4月 11, 2014
作者:
R
Russell King
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'devel-stable' into for-next
上级
53f1d9af
98775936
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
562 addition
and
551 deletion
+562
-551
arch/arm/kernel/kprobes-common.c
arch/arm/kernel/kprobes-common.c
+3
-1
arch/arm/kernel/kprobes-test-arm.c
arch/arm/kernel/kprobes-test-arm.c
+302
-301
arch/arm/kernel/kprobes-test-thumb.c
arch/arm/kernel/kprobes-test-thumb.c
+224
-223
arch/arm/kernel/kprobes-test.c
arch/arm/kernel/kprobes-test.c
+7
-6
arch/arm/kernel/kprobes-test.h
arch/arm/kernel/kprobes-test.h
+1
-1
arch/arm/kernel/kprobes-thumb.c
arch/arm/kernel/kprobes-thumb.c
+12
-8
arch/arm/kernel/kprobes.c
arch/arm/kernel/kprobes.c
+5
-4
arch/arm/kernel/probes.c
arch/arm/kernel/probes.c
+8
-7
未找到文件。
arch/arm/kernel/kprobes-common.c
浏览文件 @
98f07013
...
...
@@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/kprobes.h>
#include <asm/opcodes.h>
#include "kprobes.h"
...
...
@@ -153,7 +154,8 @@ kprobe_decode_ldmstm(probes_opcode_t insn, struct arch_probes_insn *asi,
if
(
handler
)
{
/* We can emulate the instruction in (possibly) modified form */
asi
->
insn
[
0
]
=
(
insn
&
0xfff00000
)
|
(
rn
<<
16
)
|
reglist
;
asi
->
insn
[
0
]
=
__opcode_to_mem_arm
((
insn
&
0xfff00000
)
|
(
rn
<<
16
)
|
reglist
);
asi
->
insn_handler
=
handler
;
return
INSN_GOOD
;
}
...
...
arch/arm/kernel/kprobes-test-arm.c
浏览文件 @
98f07013
此差异已折叠。
点击以展开。
arch/arm/kernel/kprobes-test-thumb.c
浏览文件 @
98f07013
此差异已折叠。
点击以展开。
arch/arm/kernel/kprobes-test.c
浏览文件 @
98f07013
...
...
@@ -113,7 +113,7 @@
* @ start of inline data...
* .ascii "mov r0, r7" @ text title for test case
* .byte 0
* .align 2
* .align 2
, 0
*
* @ TEST_ARG_REG
* .byte ARG_TYPE_REG
...
...
@@ -1333,7 +1333,8 @@ static void test_case_failed(const char *message)
static
unsigned
long
next_instruction
(
unsigned
long
pc
)
{
#ifdef CONFIG_THUMB2_KERNEL
if
((
pc
&
1
)
&&
!
is_wide_instruction
(
*
(
u16
*
)(
pc
-
1
)))
if
((
pc
&
1
)
&&
!
is_wide_instruction
(
__mem_to_opcode_thumb16
(
*
(
u16
*
)(
pc
-
1
))))
return
pc
+
2
;
else
#endif
...
...
@@ -1378,13 +1379,13 @@ static uintptr_t __used kprobes_test_case_start(const char *title, void *stack)
if
(
test_case_is_thumb
)
{
u16
*
p
=
(
u16
*
)(
test_code
&
~
1
);
current_instruction
=
p
[
0
]
;
current_instruction
=
__mem_to_opcode_thumb16
(
p
[
0
])
;
if
(
is_wide_instruction
(
current_instruction
))
{
current_instruction
<<=
16
;
current_instruction
|=
p
[
1
]
;
u16
instr2
=
__mem_to_opcode_thumb16
(
p
[
1
])
;
current_instruction
=
__opcode_thumb32_compose
(
current_instruction
,
instr2
)
;
}
}
else
{
current_instruction
=
*
(
u32
*
)
test_code
;
current_instruction
=
__mem_to_opcode_arm
(
*
(
u32
*
)
test_code
)
;
}
if
(
current_title
[
0
]
==
'.'
)
...
...
arch/arm/kernel/kprobes-test.h
浏览文件 @
98f07013
...
...
@@ -115,7 +115,7 @@ struct test_arg_end {
/* multiple strings to be concatenated. */
\
".ascii "#title" \n\t" \
".byte 0 \n\t" \
".align 2 \n\t"
".align 2
, 0
\n\t"
#define TEST_ARG_REG(reg, val) \
".byte "__stringify(ARG_TYPE_REG)" \n\t" \
...
...
arch/arm/kernel/kprobes-thumb.c
浏览文件 @
98f07013
...
...
@@ -149,9 +149,9 @@ t32_decode_ldmstm(probes_opcode_t insn, struct arch_probes_insn *asi,
enum
probes_insn
ret
=
kprobe_decode_ldmstm
(
insn
,
asi
,
d
);
/* Fixup modified instruction to have halfwords in correct order...*/
insn
=
asi
->
insn
[
0
]
;
((
u16
*
)
asi
->
insn
)[
0
]
=
insn
>>
16
;
((
u16
*
)
asi
->
insn
)[
1
]
=
insn
&
0xffff
;
insn
=
__mem_to_opcode_arm
(
asi
->
insn
[
0
])
;
((
u16
*
)
asi
->
insn
)[
0
]
=
__opcode_to_mem_thumb16
(
insn
>>
16
)
;
((
u16
*
)
asi
->
insn
)[
1
]
=
__opcode_to_mem_thumb16
(
insn
&
0xffff
)
;
return
ret
;
}
...
...
@@ -516,7 +516,7 @@ t16_decode_hiregs(probes_opcode_t insn, struct arch_probes_insn *asi,
{
insn
&=
~
0x00ff
;
insn
|=
0x001
;
/* Set Rdn = R1 and Rm = R0 */
((
u16
*
)
asi
->
insn
)[
0
]
=
insn
;
((
u16
*
)
asi
->
insn
)[
0
]
=
__opcode_to_mem_thumb16
(
insn
)
;
asi
->
insn_handler
=
t16_emulate_hiregs
;
return
INSN_GOOD
;
}
...
...
@@ -547,8 +547,10 @@ t16_decode_push(probes_opcode_t insn, struct arch_probes_insn *asi,
* and call it with R9=SP and LR in the register list represented
* by R8.
*/
((
u16
*
)
asi
->
insn
)[
0
]
=
0xe929
;
/* 1st half STMDB R9!,{} */
((
u16
*
)
asi
->
insn
)[
1
]
=
insn
&
0x1ff
;
/* 2nd half (register list) */
/* 1st half STMDB R9!,{} */
((
u16
*
)
asi
->
insn
)[
0
]
=
__opcode_to_mem_thumb16
(
0xe929
);
/* 2nd half (register list) */
((
u16
*
)
asi
->
insn
)[
1
]
=
__opcode_to_mem_thumb16
(
insn
&
0x1ff
);
asi
->
insn_handler
=
t16_emulate_push
;
return
INSN_GOOD
;
}
...
...
@@ -600,8 +602,10 @@ t16_decode_pop(probes_opcode_t insn, struct arch_probes_insn *asi,
* and call it with R9=SP and PC in the register list represented
* by R8.
*/
((
u16
*
)
asi
->
insn
)[
0
]
=
0xe8b9
;
/* 1st half LDMIA R9!,{} */
((
u16
*
)
asi
->
insn
)[
1
]
=
insn
&
0x1ff
;
/* 2nd half (register list) */
/* 1st half LDMIA R9!,{} */
((
u16
*
)
asi
->
insn
)[
0
]
=
__opcode_to_mem_thumb16
(
0xe8b9
);
/* 2nd half (register list) */
((
u16
*
)
asi
->
insn
)[
1
]
=
__opcode_to_mem_thumb16
(
insn
&
0x1ff
);
asi
->
insn_handler
=
insn
&
0x100
?
t16_emulate_pop_pc
:
t16_emulate_pop_nopc
;
return
INSN_GOOD
;
...
...
arch/arm/kernel/kprobes.c
浏览文件 @
98f07013
...
...
@@ -26,6 +26,7 @@
#include <linux/stop_machine.h>
#include <linux/stringify.h>
#include <asm/traps.h>
#include <asm/opcodes.h>
#include <asm/cacheflush.h>
#include <linux/percpu.h>
#include <linux/bug.h>
...
...
@@ -67,10 +68,10 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
#ifdef CONFIG_THUMB2_KERNEL
thumb
=
true
;
addr
&=
~
1
;
/* Bit 0 would normally be set to indicate Thumb code */
insn
=
((
u16
*
)
addr
)[
0
]
;
insn
=
__mem_to_opcode_thumb16
(((
u16
*
)
addr
)[
0
])
;
if
(
is_wide_instruction
(
insn
))
{
insn
<<=
16
;
insn
|=
((
u16
*
)
addr
)[
1
]
;
u16
inst2
=
__mem_to_opcode_thumb16
(((
u16
*
)
addr
)[
1
])
;
insn
=
__opcode_thumb32_compose
(
insn
,
inst2
)
;
decode_insn
=
thumb32_probes_decode_insn
;
actions
=
kprobes_t32_actions
;
}
else
{
...
...
@@ -81,7 +82,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
thumb
=
false
;
if
(
addr
&
0x3
)
return
-
EINVAL
;
insn
=
*
p
->
addr
;
insn
=
__mem_to_opcode_arm
(
*
p
->
addr
)
;
decode_insn
=
arm_probes_decode_insn
;
actions
=
kprobes_arm_actions
;
#endif
...
...
arch/arm/kernel/probes.c
浏览文件 @
98f07013
...
...
@@ -202,13 +202,14 @@ prepare_emulated_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
#ifdef CONFIG_THUMB2_KERNEL
if
(
thumb
)
{
u16
*
thumb_insn
=
(
u16
*
)
asi
->
insn
;
thumb_insn
[
1
]
=
0x4770
;
/* Thumb bx lr */
thumb_insn
[
2
]
=
0x4770
;
/* Thumb bx lr */
/* Thumb bx lr */
thumb_insn
[
1
]
=
__opcode_to_mem_thumb16
(
0x4770
);
thumb_insn
[
2
]
=
__opcode_to_mem_thumb16
(
0x4770
);
return
insn
;
}
asi
->
insn
[
1
]
=
0xe12fff1e
;
/* ARM bx lr */
asi
->
insn
[
1
]
=
__opcode_to_mem_arm
(
0xe12fff1e
)
;
/* ARM bx lr */
#else
asi
->
insn
[
1
]
=
0xe1a0f00e
;
/* mov pc, lr */
asi
->
insn
[
1
]
=
__opcode_to_mem_arm
(
0xe1a0f00e
)
;
/* mov pc, lr */
#endif
/* Make an ARM instruction unconditional */
if
(
insn
<
0xe0000000
)
...
...
@@ -228,12 +229,12 @@ set_emulated_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
if
(
thumb
)
{
u16
*
ip
=
(
u16
*
)
asi
->
insn
;
if
(
is_wide_instruction
(
insn
))
*
ip
++
=
insn
>>
16
;
*
ip
++
=
insn
;
*
ip
++
=
__opcode_to_mem_thumb16
(
insn
>>
16
)
;
*
ip
++
=
__opcode_to_mem_thumb16
(
insn
)
;
return
;
}
#endif
asi
->
insn
[
0
]
=
insn
;
asi
->
insn
[
0
]
=
__opcode_to_mem_arm
(
insn
)
;
}
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录