lkml.org 
[lkml]   [2017]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] uprobes/x86: emulate push insns for uprobe on x86
On 11/09, Yonghong Song wrote:
>
> + if (insn_class == UPROBE_PUSH_INSN) {
> + src_ptr = get_push_reg_ptr(auprobe, regs);
> + reg_width = sizeof_long();
> + sp = regs->sp;
> + if (copy_to_user((void __user *)(sp - reg_width), src_ptr, reg_width))
> + return false;
> +
> + regs->sp = sp - reg_width;
> + regs->ip += 1 + (auprobe->push.rex_prefix != 0);
> + return true;

Another nit... You can rename push_ret_address() and use it here

src_ptr = ...;
if (push_ret_address(regs, *src_ptr))
return false;

regs->ip += ...;
return true;

and I think get_push_reg_ptr() should just return "unsigned long", not the
pointer.

And again, please make a separate method for this code. Let me repeat, the
main reason for branch_xol_ops/etc is that we simply can not execute these
insns out-of-line, we have to emulate them. "push" differs, the only reason
why we may want to emulate it is optimization.

Oleg.

\
 
 \ /
  Last update: 2017-11-09 15:50    [W:0.379 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site