lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0a79501b-ff60-4122-840f-fc0095ae05fd@redhat.com>
Date:   Thu, 7 Dec 2023 08:21:21 -0500
From:   Waiman Long <longman@...hat.com>
To:     Yosry Ahmed <yosryahmed@...gle.com>
Cc:     Tejun Heo <tj@...nel.org>, Zefan Li <lizefan.x@...edance.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Yafang Shao <laoar.shao@...il.com>, cgroups@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH-cgroup] cgroup: Move rcu_head up near the top of
 cgroup_root

On 12/6/23 23:51, Yosry Ahmed wrote:
> On Wed, Dec 6, 2023 at 8:38 PM Waiman Long <longman@...hat.com> wrote:
>> Commit d23b5c577715 ("cgroup: Make operations on the cgroup root_list RCU
>> safe") adds a new rcu_head to the cgroup_root structure and kvfree_rcu()
>> for freeing the cgroup_root.
>>
>> The use of kvfree_rcu(), however, has the limitation that the offset of
>> the rcu_head structure within the larger data structure cannot exceed
>> 4096 or the compilation will fail. By putting rcu_head below the cgroup
>> structure, any change to the cgroup structure that makes it larger has
>> the risk of build failure. Commit 77070eeb8821 ("cgroup: Avoid false
>> cacheline sharing of read mostly rstat_cpu") happens to be the commit
>> that breaks it even though it is not its fault. Fix it by moving the
>> rcu_head structure up before the cgroup structure.
>>
>> Fixes: d23b5c577715 ("cgroup: Make operations on the cgroup root_list RCU safe")
>> Signed-off-by: Waiman Long <longman@...hat.com>
>> ---
>>   include/linux/cgroup-defs.h | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
>> index 5a97ea95b564..45359969d8cf 100644
>> --- a/include/linux/cgroup-defs.h
>> +++ b/include/linux/cgroup-defs.h
>> @@ -562,6 +562,10 @@ struct cgroup_root {
>>          /* Unique id for this hierarchy. */
>>          int hierarchy_id;
>>
>> +       /* A list running through the active hierarchies */
>> +       struct list_head root_list;
>> +       struct rcu_head rcu;
>> +
> Perhaps the comment should mention the placement requirements, and
> maybe a pointer to wherever it is specified that the offset of struct
> rcu_head should not exceed 4096?

Fair. I will update the patch description to give more details about 
that. It is new to me too before I got a compilation failure report in 
linux-next.

Cheers,
Longman

>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ