diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-09-29 21:56:57 +0200 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2012-10-07 21:19:41 +0200 |
commit | 142b18ddc81439acda4bc4231b291e99fe67d507 (patch) | |
tree | 2189191c456f93551d58b0f3afc4b53bb3b8949a /net/phonet/af_phonet.c | |
parent | 076a365b3da99b68c5d58e394714d0611f1fa002 (diff) | |
download | talos-obmc-linux-142b18ddc81439acda4bc4231b291e99fe67d507.tar.gz talos-obmc-linux-142b18ddc81439acda4bc4231b291e99fe67d507.zip |
uprobes: Fix handle_swbp() vs unregister() + register() race
Strictly speaking this race was added by me in 56bb4cf6. However
I think that this bug is just another indication that we should
move copy_insn/uprobe_analyze_insn code from install_breakpoint()
to uprobe_register(), there are a lot of other reasons for that.
Until then, add a hack to close the race.
A task can hit uprobe U1, but before it calls find_uprobe() this
uprobe can be unregistered *AND* another uprobe U2 can be added to
uprobes_tree at the same inode/offset. In this case handle_swbp()
will use the not-fully-initialized U2, in particular its arch.insn
for xol.
Add the additional !UPROBE_COPY_INSN check into handle_swbp(),
if this flag is not set we simply restart as if the new uprobe was
not inserted yet. This is not very nice, we need barriers, but we
will remove this hack when we change uprobe_register().
Note: with or without this patch install_breakpoint() can race with
itself, yet another reson to kill UPROBE_COPY_INSN altogether. And
even the usage of uprobe->flags is not safe. See the next patches.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Diffstat (limited to 'net/phonet/af_phonet.c')
0 files changed, 0 insertions, 0 deletions