Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f55e82b authored by Oleg Nesterov's avatar Oleg Nesterov
Browse files

uprobes/x86: Kill the "autask" arg of riprel_pre_xol()



default_pre_xol_op() passes &current->utask->autask to riprel_pre_xol()
and this is just ugly because it still needs to load current->utask to
read ->vaddr.

Remove this argument, change riprel_pre_xol() to use current->utask.

Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Acked-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
parent 1475ee7f
Loading
Loading
Loading
Loading
+9 −9
Original line number Original line Diff line number Diff line
@@ -330,16 +330,17 @@ static void riprel_analyze(struct arch_uprobe *auprobe, struct insn *insn)
 * If we're emulating a rip-relative instruction, save the contents
 * If we're emulating a rip-relative instruction, save the contents
 * of the scratch register and store the target address in that register.
 * of the scratch register and store the target address in that register.
 */
 */
static void riprel_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs,
static void riprel_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
				struct arch_uprobe_task *autask)
{
{
	struct uprobe_task *utask = current->utask;

	if (auprobe->def.fixups & UPROBE_FIX_RIP_AX) {
	if (auprobe->def.fixups & UPROBE_FIX_RIP_AX) {
		autask->saved_scratch_register = regs->ax;
		utask->autask.saved_scratch_register = regs->ax;
		regs->ax = current->utask->vaddr;
		regs->ax = utask->vaddr;
		regs->ax += auprobe->def.riprel_target;
		regs->ax += auprobe->def.riprel_target;
	} else if (auprobe->def.fixups & UPROBE_FIX_RIP_CX) {
	} else if (auprobe->def.fixups & UPROBE_FIX_RIP_CX) {
		autask->saved_scratch_register = regs->cx;
		utask->autask.saved_scratch_register = regs->cx;
		regs->cx = current->utask->vaddr;
		regs->cx = utask->vaddr;
		regs->cx += auprobe->def.riprel_target;
		regs->cx += auprobe->def.riprel_target;
	}
	}
}
}
@@ -377,8 +378,7 @@ static inline bool is_64bit_mm(struct mm_struct *mm)
static void riprel_analyze(struct arch_uprobe *auprobe, struct insn *insn)
static void riprel_analyze(struct arch_uprobe *auprobe, struct insn *insn)
{
{
}
}
static void riprel_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs,
static void riprel_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
				struct arch_uprobe_task *autask)
{
{
}
}
static void riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs,
static void riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs,
@@ -401,7 +401,7 @@ static inline int sizeof_long(void)


static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs)
static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs)
{
{
	riprel_pre_xol(auprobe, regs, &current->utask->autask);
	riprel_pre_xol(auprobe, regs);
	return 0;
	return 0;
}
}