• Steven Rostedt's avatar
    x86/mm/kmmio: Switch to arch_spin_lock() · 4994e387
    Steven Rostedt authored
    The mmiotrace tracer is "special". The purpose is to help reverse engineer
    binary drivers by removing the memory allocated by the driver and when the
    driver goes to access it, a fault occurs, the mmiotracer will record what
    the driver was doing and then do the work on its behalf by single stepping
    through the process.
    
    But to achieve this ability, it must do some special things. One is it
    needs to grab a lock while in the breakpoint handler. This is considered
    an NMI state, and then lockdep warns that the lock is being held in both
    an NMI state (really a breakpoint handler) and also in normal context.
    
    As the breakpoint/NMI state only happens when the driver is accessing
    memory, there's no concern of a race condition against the setup and
    tear-down of mmiotracer.
    
    To make lockdep and mmiotrace work together, convert the locks used in the
    breakpoint handler into arch_spin_lock().
    
    Link: https://lkml.kernel.org/r/20221206191229.656244029@goodmis.org
    Link: https://lore.kernel.org/lkml/20221201213126.620b7dd3@gandalf.local.home/
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Karol Herbst <karolherbst@gmail.com>
    Cc: Pekka Paalanen <ppaalanen@gmail.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Suggested-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
    4994e387
kmmio.c 16.6 KB