• Haren Myneni's avatar
    powerpc/vas: Take reference to PID and mm for user space windows · db1c08a7
    Haren Myneni authored
    When process opens a window, its pid and tgid will be saved in the
    vas_window struct. This window will be closed when the process exits.
    The kernel handles NX faults by updating CSB or send SEGV signal to pid
    of the process if the userspace csb addr is invalid.
    
    In multi-thread applications, a window can be opened by a child thread,
    but it will not be closed when this thread exits. It is expected that
    the parent will clean up all resources including NX windows opened by
    child threads. A child thread can send NX requests using this window
    and could be killed before completion is reported. If the pid assigned
    to this thread is reused while requests are pending, a failure SEGV
    would be directed to the wrong place.
    
    To prevent reusing the pid, take references to pid and mm when the window
    is opened and release them when when the window is closed. Then if child
    thread is not running, SEGV signal will be sent to thread group leader
    (tgid).
    Signed-off-by: default avatarHaren Myneni <haren@linux.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/1587016936.2275.1057.camel@hbabu-laptop
    db1c08a7
vas-window.c 35.8 KB