[PATCH net-next v3 0/3] af_unix: Fix priority inversion issue

Nam Cao posted 3 patches 2 days, 13 hours ago
include/net/af_unix.h |  5 +++++
kernel/exit.c         |  7 +++++++
net/unix/af_unix.c    |  2 +-
net/unix/af_unix.h    |  1 -
net/unix/garbage.c    | 16 +---------------
5 files changed, 14 insertions(+), 17 deletions(-)
[PATCH net-next v3 0/3] af_unix: Fix priority inversion issue
Posted by Nam Cao 2 days, 13 hours ago
Hi,

While auditing AF_UNIX sockets, I noticed that the sendmsg() code paths may
block on the garbage collector running as workqueue. This can cause
priority inversion and latency for real-time users.

The implementation does kindly avoid blocking "sane users". However, it is
impossible to tell whether the kernel's definition of "sane users"
accurately describes all users out there.

Digging into history and figuring out the reasons why sendmsg() needs to
wait for garbage collector, it is determined that those reasons no longer
apply.

The first patch resolves another issue reported by Sashiko in v1, paves the
way for the second patch to remove the block. The last one is a simple
post-cleanup.

v3:
  - Move unix_schedule_gc() to be after exit_task_work()

v2:
  - Add patch [1/3]
  - Rebase the other two patches onto the new patch
  - Change commit message to be more precise

Nam Cao (3):
  af_unix: Schedule the garbage collector at task exit
  af_unix: Do not wait for garbage collector in sendmsg()
  af_unix: Clean up unix_schedule_gc()

 include/net/af_unix.h |  5 +++++
 kernel/exit.c         |  7 +++++++
 net/unix/af_unix.c    |  2 +-
 net/unix/af_unix.h    |  1 -
 net/unix/garbage.c    | 16 +---------------
 5 files changed, 14 insertions(+), 17 deletions(-)

-- 
2.47.3