]> rtime.felk.cvut.cz Git - linux-imx.git/commit
uprobes/x86: Xol should send SIGTRAP if X86_EFLAGS_TF was set
authorOleg Nesterov <oleg@redhat.com>
Mon, 3 Sep 2012 14:05:10 +0000 (16:05 +0200)
committerOleg Nesterov <oleg@redhat.com>
Sat, 15 Sep 2012 15:37:31 +0000 (17:37 +0200)
commit3a4664aa8362d9fa9110828f55afa9f9fcd7e484
treef2a4314a4e71b9273a15e7816197b38505c44092
parent9bd1190a11c9d2c59d35cb999b8d170ad52aab5f
uprobes/x86: Xol should send SIGTRAP if X86_EFLAGS_TF was set

arch_uprobe_disable_step() correctly preserves X86_EFLAGS_TF and
returns to user-mode. But this means the application gets SIGTRAP
only after the next insn.

This means that UPROBE_CLEAR_TF logic is not really right. _enable
should only record the state of X86_EFLAGS_TF, and _disable should
check it separately from UPROBE_FIX_SETF.

Remove arch_uprobe_task->restore_flags, add ->saved_tf instead, and
change enable/disable accordingly. This assumes that the probed insn
was not trapped, see the next patch.

arch_uprobe_skip_sstep() logic has the same problem, change it to
check X86_EFLAGS_TF and send SIGTRAP as well. We will cleanup this
all after we fold enable/disable_step into pre/post_hol hooks.

Note: send_sig(SIGTRAP) is not actually right, we need send_sigtrap().
But this needs more changes, handle_swbp() does the same and this is
equally wrong.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
arch/x86/include/asm/uprobes.h
arch/x86/kernel/uprobes.c