• Frederic Riss's avatar
    ARM: 5715/1: Make kprobes unregistration SMP safe · 2003b7af
    Frederic Riss authored
    ARM kprobes use an illegal instruction to trigger kprobes. In the
    current implementation, there's a race between the unregistration of a
    kprobe and the illegal instruction exception handler if they run at the
    same time on different cores.
    
    When reading the value of the undefined instruction, the exception
    handler might get the original legal instruction as just patched
    concurrently by arch_disarm_kprobe(). When this happen the kprobe
    handler won't run, and thus the exception handler will oops because it
    believe it just hit an undefined instruction in kernel space.
    
    The following patch synchronizes the code patching in the kprobes
    unregistration using stop_machine and thus avoids the above race.
    Signed-off-by: default avatarFrederic RISS <frederic.riss@gmail.com>
    Acked-by: default avatarNicolas Pitre <nico@fluxnic.net>
    Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    2003b7af
kprobes.c 12.6 KB