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: <076a6867-20f5-4386-bc8e-2e7999b39431@suse.cz>
Date: Fri, 28 Feb 2025 11:12:48 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Brendan Jackman <jackmanb@...gle.com>,
 Andrew Morton <akpm@...ux-foundation.org>
Cc: David Hildenbrand <david@...hat.com>, Oscar Salvador <osalvador@...e.de>,
 Johannes Weiner <hannes@...xchg.org>, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/page_alloc: Add lockdep assertion for pageblock type
 change

On 2/28/25 10:20, Brendan Jackman wrote:
> On Thu, Feb 27, 2025 at 02:33:02PM -0800, Andrew Morton wrote:
>> On Thu, 27 Feb 2025 16:15:47 +0000 Brendan Jackman <jackmanb@...gle.com> wrote:
>> 
>> > Since the migratetype hygiene patches [0], the locking here is
>> > a bit more formalised, so write it down with an assert.
>> > 
>> > ...
>> >
>> > --- a/mm/page_alloc.c
>> > +++ b/mm/page_alloc.c
>> > @@ -417,6 +417,10 @@ void set_pfnblock_flags_mask(struct page *page, unsigned long flags,
>> >  
>> >  void set_pageblock_migratetype(struct page *page, int migratetype)
>> >  {
>> > +	lockdep_assert_once(system_state == SYSTEM_BOOTING ||
>> > +		in_mem_hotplug() ||
>> > +		lockdep_is_held(&page_zone(page)->lock));
>> > +
>> >  	if (unlikely(page_group_by_mobility_disabled &&
>> >  		     migratetype < MIGRATE_PCPTYPES))
>> >  		migratetype = MIGRATE_UNMOVABLE;
>> > 
>> 
>> We could add such assertions all over the place.  Why this place in
>> particular?
> 
> For the other stuff, it's pretty obvious that it would be protected by
> the zone lock (or, I don't know about it!). But it didn't seem totally
> self-evident to me that it should protect the pageblock type. So it
> seems particularly helpful to have it written in the code.

I guess that's a good addition to the changelog.

Acked-by: Vlastimil Babka <vbabka@...e.cz>

> 
> I may be heavily biased about this though, because of the code I'm
> working on for [0]. I use the pageblock type to remember whether it's
> mapped in the ASI restricted address space.
> 
> [0] https://lore.kernel.org/linux-mm/CA+i-1C1gOBLxRxE5YFGzeayYWBYyE_X6oH4D=9eVePt4=ehTig@mail.gmail.com/T/
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ