Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-16893

Fix cfs_force_sig(sig, task) deadlock on 5.3 and later kernels.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.16.0
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      When HAVE_FORCE_SIG_WITH_TASK is not available cfs_force_sig() is used.

      However cfs_force_sig holds a spin lock on 'siglock':

      #define cfs_force_sig(sig, task) \
      do { \
      unsigned long flags;\
      \
      spin_lock_irqsave(&task->sighand->siglock, flags);\
      task->sighand->action[sig - 1].sa.sa_handler = SIG_DFL;\
      send_sig(sig, task, 1);\
      spin_unlock_irqrestore(&task->sighand->siglock, flags);         \
      } while (0)
      

      This causes a dead lock on 'siglock' as do_send_sig_info also takes the same lock.
       

      cfs_force_sig(sig, task)
        -> spin_lock_irqsave(&task->sighand->siglock, flags); \
          -> send_sig(.., task,..)
           -> send_sig_info(.., task)
             -> do_send_sig_info(..., task)
               -> lock_task_sighand(task)
                 -> __lock_task_sighand(task, flags)
                    {
                        sighand = rcu_dereference(task->sighand);
                        spin_lock_irqsave(&sighand->siglock, *flags);
                        ...
                    } 
      

      cfs_force_sig() should release the spin lock before calling send_sig()

      Attachments

        Activity

          People

            stancheff Shaun Tancheff
            stancheff Shaun Tancheff
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: