Skip to content

cgroup: bug fixes for eventfd

Li Zefan cgroups lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4eventfd: introduce eventfd_signal_hangup()fs/eventfd.c include/linux/eventfd.h+16 -06 replies
2/4cgroup: fix cgroup_rmdir() vs close(eventfd) racekernel/cgroup.c+19 -121 reply
3/4eventfd: make operations on eventfd return -EIDRM if it's hung upfs/eventfd.c kernel/cgroup.c+21 -32 replies
4/4cgroup: adapt to the new way of detecting cgroup removaltools/cgroup/cgroup_event_listener.c+5 -70 replies

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchKirill A. Shutemov
1/4A-b
2/4A-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] cgroup: bug fixes for eventfd

There're three bugs.

- If thread A is removing a cgroup, while thread B is closing an eventfd, the two threads might free the same cgroup event and thus crash the kernel.

This is fixed by patch #1 and patch #2.

- If there're multiple threads are blocking in read() on the same eventfd, and someone removes the cgroup, only one thread will be notified and unblocked, and others won't be unblocked until those threads are killed.

- If thread A is removing a cgroup, while thread B is registering a cgroup event and then read the eventfd, it might block until the thread is killed.

These two are fixed by patch #3.

0001-eventfd-Introduce-eventfd_signal_hangup.patch 0002-cgroup-fix-cgroup_rmdir-vs-close-eventfd-race.patch 0003-eventfd-make-operations-on-eventfd-return-EIDRM-if-i.patch 0004-cgroup-adapt-to-the-new-way-of-detecting-cgroup-remo.patch

--

 fs/eventfd.c                         | 30 ++++++++++++++++++++++++++++++
 include/linux/eventfd.h              |  5 +++++
 kernel/cgroup.c                      | 30 ++++++++++++++++++------------
 tools/cgroup/cgroup_event_listener.c | 12 +++++-------
 4 files changed, 58 insertions(+), 19 deletions(-)