diff options
| author | Haren Myneni <haren@linux.ibm.com> | 2023-07-16 13:05:06 +0300 | 
|---|---|---|
| committer | Michael Ellerman <mpe@ellerman.id.au> | 2023-07-17 03:35:06 +0300 | 
| commit | b59c9dc4d9d47b3c4572d826603fde507055b656 (patch) | |
| tree | e4832bc89acb65302113a50f95894ab8b0405428 /scripts/patch-kernel | |
| parent | fdf0eaf11452d72945af31804e2a1048ee1b574c (diff) | |
| download | linux-b59c9dc4d9d47b3c4572d826603fde507055b656.tar.xz | |
powerpc/pseries/vas: Hold mmap_mutex after mmap lock during window close
Commit 8ef7b9e1765a ("powerpc/pseries/vas: Close windows with DLPAR
core removal") unmaps the window paste address and issues HCALL to
close window in the hypervisor for migration or DLPAR core removal
events. So holds mmap_mutex and then mmap lock before unmap the
paste address. But if the user space issue mmap paste address at
the same time with the migration event, coproc_mmap() is called
after holding the mmap lock which can trigger deadlock when trying
to acquire mmap_mutex in coproc_mmap().
t1: mmap() call to mmap              t2: Migration event
    window paste address
do_mmap2()                           migration_store()
 ksys_mmap_pgoff()                    pseries_migrate_partition()
  vm_mmap_pgoff()                      vas_migration_handler()
    Acquire mmap lock                   reconfig_close_windows()
    do_mmap()                             lock mmap_mutex
     mmap_region()                        Acquire mmap lock
      call_mmap()                         //Wait for mmap lock
       coproc_mmap()                        unmap vma
         lock mmap_mutex                    update window status
         //wait for mmap_mutex            Release mmap lock
          mmap vma                        unlock mmap_mutex
          update window status
         unlock mmap_mutex
    ...
    Release mmap lock
Fix this deadlock issue by holding mmap lock first before mmap_mutex
in reconfig_close_windows().
Fixes: 8ef7b9e1765a ("powerpc/pseries/vas: Close windows with DLPAR core removal")
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230716100506.7833-1-haren@linux.ibm.com
Diffstat (limited to 'scripts/patch-kernel')
0 files changed, 0 insertions, 0 deletions
