• Oleg Nesterov's avatar
    uprobes: introduce the global struct vm_special_mapping xol_mapping · 6d27a31e
    Oleg Nesterov authored
    Currently each xol_area has its own instance of vm_special_mapping, this
    is suboptimal and ugly.  Kill xol_area->xol_mapping and add a single
    global instance of vm_special_mapping, the ->fault() method can use
    area->pages rather than xol_mapping->pages.
    
    As a side effect this fixes the problem introduced by the recent commit
    223febc6 ("mm: add optional close() to struct vm_special_mapping"), if
    special_mapping_close() is called from the __mmput() paths, it will use
    vma->vm_private_data = &area->xol_mapping freed by uprobe_clear_state().
    
    Link: https://lkml.kernel.org/r/20240911131407.GB3448@redhat.com
    Fixes: 223febc6
    
     ("mm: add optional close() to struct vm_special_mapping")
    Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
    Reported-by: default avatarSven Schnelle <svens@linux.ibm.com>
    Closes: https://lore.kernel.org/all/yt9dy149vprr.fsf@linux.ibm.com/
    
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andrii Nakryiko <andrii@kernel.org>
    Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    6d27a31e
uprobes.c 57.9 KB