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

Commit 746a9e6b authored by Oleg Nesterov's avatar Oleg Nesterov
Browse files

uprobes: Do not setup ->active_uprobe/state prematurely



handle_swbp() sets utask->active_uprobe before handler_chain(),
and UTASK_SSTEP before pre_ssout(). This complicates the code
for no reason,  arch_ hooks or consumer->handler() should not
(and can't) use this info.

Change handle_swbp() to initialize them after pre_ssout(), and
remove the no longer needed cleanup-utask code.

Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
cked-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
parent 79d54b24
Loading
Loading
Loading
Loading
+3 −6
Original line number Original line Diff line number Diff line
@@ -1496,22 +1496,19 @@ static void handle_swbp(struct pt_regs *regs)
		if (!utask)
		if (!utask)
			goto cleanup_ret;
			goto cleanup_ret;
	}
	}
	utask->active_uprobe = uprobe;

	handler_chain(uprobe, regs);
	handler_chain(uprobe, regs);
	if (uprobe->flags & UPROBE_SKIP_SSTEP && can_skip_sstep(uprobe, regs))
	if (uprobe->flags & UPROBE_SKIP_SSTEP && can_skip_sstep(uprobe, regs))
		goto cleanup_ret;
		goto cleanup_ret;


	utask->state = UTASK_SSTEP;
	if (!pre_ssout(uprobe, regs, bp_vaddr)) {
	if (!pre_ssout(uprobe, regs, bp_vaddr)) {
		arch_uprobe_enable_step(&uprobe->arch);
		arch_uprobe_enable_step(&uprobe->arch);
		utask->active_uprobe = uprobe;
		utask->state = UTASK_SSTEP;
		return;
		return;
	}
	}


cleanup_ret:
cleanup_ret:
	if (utask) {
		utask->active_uprobe = NULL;
		utask->state = UTASK_RUNNING;
	}
	if (!(uprobe->flags & UPROBE_SKIP_SSTEP))
	if (!(uprobe->flags & UPROBE_SKIP_SSTEP))


		/*
		/*