kprobes: x86: mark 2 bytes NOP as boostable.
PATCH 1/1 kprobes: x86: mark 2 bytes NOP as boostable.
x86 kprobes is unable to probe at 2 bytes nop like:
nopl 0x0(%rax,%rax,1)
which is 0x0f 0x1f 0x44 0x00 0x00.
Such nops have exactly 5 bytes which is able to hold a relative jmp instruction. Boosting them should be obviously safe.
This patch enable boosting such nops by simply updating twobyte_is_boostable[] array.
--- arch/x86/kernel/kprobes/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/kprobes/core.c +1 -1
@@ -84,7 +84,7 @@ static volatile u32 twobyte_is_boostable[256 / 32] = {/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* ---------------------------------------------- */ W (0x00 ,0 ,0 ,1 ,1 ,0 ,0 ,1 ,0 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ) |/* 00 */ -W (0x10 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) ,/* 10 */ +W (0x10 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ) ,/* 10 */ W (0x20 ,1 ,1 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) |/* 20 */ W (0x30 ,0 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) ,/* 30 */ W(0x40, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 40 */
Signature · 1 line
1.8.4
Quoted 1 line · Wang Nan
x86 kprobes is unable to probe at 2 bytes nop like:
^^^^^ boost
Quoted 10 lines
nopl 0x0(%rax,%rax,1)
which is
0x0f0x1f0x440x000x00.Such nops have exactly 5 bytes which is able to hold a relative jmp instruction. Boosting them should be obviously safe.
This patch enable boosting such nops by simply updating twobyte_is_boostable[] array.
Anyway, this looks good to me.
Thank you!
Quoted 20 lines
Signed-off-by Wang Nan <[email protected]>--- arch/x86/kernel/kprobes/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/kernel/kprobes/core.c +1
-1@@ -84,7 +84,7 @@ static volatile u32 twobyte_is_boostable[256 / 32] = {/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* ---------------------------------------------- */ W (0x00 ,0 ,0 ,1 ,1 ,0 ,0 ,1 ,0 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ) |/* 00 */ -W (0x10 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) ,/* 10 */ +W (0x10 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ) ,/* 10 */ W (0x20 ,1 ,1 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) |/* 20 */ W (0x30 ,0 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) ,/* 30 */ W(0x40, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 40 */
Signature · 4 lines
Masami HIRAMATSU Software Platform Research Dept. Linux Technology Research Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: [email protected]
PATCH RESEND 1/1 kprobes: x86: mark 2 bytes NOP as boostable.
Currently, x86 kprobes is unable to boost 2 bytes nop like:
nopl 0x0(%rax,%rax,1)
which is 0x0f 0x1f 0x44 0x00 0x00.
Such nops have exactly 5 bytes to hold a relative jmp instruction. Boosting them should be obviously safe.
This patch enable boosting such nops by simply updating twobyte_is_boostable[] array.
--- arch/x86/kernel/kprobes/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/kprobes/core.c +1 -1
@@ -84,7 +84,7 @@ static volatile u32 twobyte_is_boostable[256 / 32] = {/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* ---------------------------------------------- */ W (0x00 ,0 ,0 ,1 ,1 ,0 ,0 ,1 ,0 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ) |/* 00 */ -W (0x10 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) ,/* 10 */ +W (0x10 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ) ,/* 10 */ W (0x20 ,1 ,1 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) |/* 20 */ W (0x30 ,0 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) ,/* 30 */ W(0x40, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 40 */
Signature · 1 line
1.8.4
Hi Andrew,
Could you please queue this patch onto your -mm tree? Masami has given an Acked-by already.
Thank you!
Quoted 32 lines · Wang Nan
Currently, x86 kprobes is unable to boost 2 bytes nop like:
nopl 0x0(%rax,%rax,1)
which is
0x0f0x1f0x440x000x00.Such nops have exactly 5 bytes to hold a relative jmp instruction. Boosting them should be obviously safe.
This patch enable boosting such nops by simply updating twobyte_is_boostable[] array.
Signed-off-by Wang Nan <[email protected]>Acked-by Masami Hiramatsu <[email protected]>--- arch/x86/kernel/kprobes/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/kernel/kprobes/core.c +1
-1@@ -84,7 +84,7 @@ static volatile u32 twobyte_is_boostable[256 / 32] = {/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* ---------------------------------------------- */ W (0x00 ,0 ,0 ,1 ,1 ,0 ,0 ,1 ,0 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ) |/* 00 */ -W (0x10 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) ,/* 10 */ +W (0x10 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ) ,/* 10 */ W (0x20 ,1 ,1 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) |/* 20 */ W (0x30 ,0 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) ,/* 30 */ W(0x40, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 40 */
tip-bot for Wang Nan
merge bot[tip:perf/urgent] kprobes/x86: Mark 2 bytes NOP as boostable
In reply to Wang Nankprobes/x86: Mark 2 bytes NOP as boostable
Commit-ID: b7e37567d080301d38a302bb93ba79d1ca446dca Gitweb: http://git.kernel.org/tip/b7e37567d080301d38a302bb93ba79d1ca446dca Author: Wang Nan <[email protected]> AuthorDate: Tue, 10 Feb 2015 09:34:05 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 18 Feb 2015 21:50:12 +0100
kprobes/x86: Mark 2 bytes NOP as boostable
Currently, x86 kprobes is unable to boost 2 bytes nop like:
nopl 0x0(%rax,%rax,1)
which is 0x0f 0x1f 0x44 0x00 0x00.
Such nops have exactly 5 bytes to hold a relative jmp instruction. Boosting them should be obviously safe.
This patch enable boosting such nops by simply updating twobyte_is_boostable[] array.
--- arch/x86/kernel/kprobes/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/kprobes/core.c +1 -1
@@ -84,7 +84,7 @@ static volatile u32 twobyte_is_boostable[256 / 32] = {/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* ---------------------------------------------- */ W (0x00 ,0 ,0 ,1 ,1 ,0 ,0 ,1 ,0 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ) |/* 00 */ -W (0x10 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) ,/* 10 */ +W (0x10 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ) ,/* 10 */ W (0x20 ,1 ,1 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) |/* 20 */ W (0x30 ,0 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) ,/* 30 */ W(0x40, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 40 */