Re: [PATCH v3 bpf-next 04/11] cgroup: Add annotation for holding namespace_sem in current_cgns_cgroup_from_root()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 29, 2023 at 06:14:31AM +0000, Yafang Shao wrote:
> When I initially examined the function current_cgns_cgroup_from_root(), I
> was perplexed by its lack of holding cgroup_mutex. However, after Michal
> explained the reason[0] to me, I realized that it already holds the
> namespace_sem. I believe this intricacy could also confuse others, so it
> would be advisable to include an annotation for clarification.
> 
> After we replace the cgroup_mutex with RCU read lock, if current doesn't
> hold the namespace_sem, the root cgroup will be NULL. So let's add a
> WARN_ON_ONCE() for it.
> 
> [0]. https://lore.kernel.org/bpf/afdnpo3jz2ic2ampud7swd6so5carkilts2mkygcaw67vbw6yh@5b5mncf7qyet
> 
> Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
> Cc: Michal Koutný <mkoutny@xxxxxxxx>

Acked-by: Tejun Heo <tj@xxxxxxxxxx>

Thanks.

-- 
tejun




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux