Re: [RFC PATCH v2 5/6] uprobes/x86: Emulate rip-relative conditional "short" jmp's

From: Oleg Nesterov
Date: Mon Apr 07 2014 - 12:41:59 EST


On 04/07, Oleg Nesterov wrote:
>
> > Incomplete, lacks "jcxz". Simple to fix. Anything else?
>
> Please see v2 below. Simplify the preprocessor hacks.

Finally some testing. This all even seems to work... Although so far
I only tested jz/jnz 8/32bit with this test-case:

asm (
".text\n"
".globl test_0\n"
"test_0:\n"

"movq $0, %rax\n"
"cmpq $0, %rax\n"

".globl t_0_n; t_0_n:\n"
"jnz 1f\n"

".globl t_0_y; t_0_y:\n"
"jz 2f\n"

"1: ud2\n"
"2: retq\n"
);

asm (
".text\n"
".globl test_1\n"
"test_1:\n"

"movq $1, %rax\n"
"cmpq $0, %rax\n"

".globl t_1_y; t_1_y:\n"
"jz 1f\n"

".globl t_1_n; t_1_n:\n"
"jnz 2f\n"

".org . + 1024\n"

"1: ud2\n"
"2: retq\n"
);

extern void test_0(void), test_1(void);

int main(void)
{
test_0();
test_1();
return 0;
}

it runs fine with t_{0,1}_{y,} probed.

As for "jcxz" support, it must be simple but I am still googling for
"jcxz for dummies". Will do tomorrow, probably I'll make a separate patch
for this to simlify the review.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/