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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260105164036.32a22c2e@gandalf.local.home>
Date: Mon, 5 Jan 2026 16:40:36 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Andrew Morton <akpm@...ux-foundation.org>, Suren Baghdasaryan
 <surenb@...gle.com>, Michal Hocko <mhocko@...e.com>, Brendan Jackman
 <jackmanb@...gle.com>, Johannes Weiner <hannes@...xchg.org>, Zi Yan
 <ziy@...dia.com>, Sebastian Andrzej Siewior <bigeasy@...utronix.de>, Clark
 Williams <clrkwllms@...nel.org>, Mel Gorman <mgorman@...hsingularity.net>,
 linux-mm@...ck.org, linux-kernel@...r.kernel.org,
 linux-rt-devel@...ts.linux.dev, stable@...r.kernel.org, kernel test robot
 <oliver.sang@...el.com>, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH mm-hotfixes] mm/page_alloc: prevent pcp corruption with
 SMP=n

On Mon, 05 Jan 2026 16:08:56 +0100
Vlastimil Babka <vbabka@...e.cz> wrote:

> +++ b/mm/page_alloc.c
> @@ -167,6 +167,31 @@ static inline void __pcp_trylock_noop(unsigned long *flags) { }
>  	pcp_trylock_finish(UP_flags);					\
>  })
>  
> +/*
> + * With the UP spinlock implementation, when we spin_lock(&pcp->lock) (for i.e.
> + * a potentially remote cpu drain) and get interrupted by an operation that
> + * attempts pcp_spin_trylock(), we can't rely on the trylock failure due to UP
> + * spinlock assumptions making the trylock a no-op. So we have to turn that
> + * spin_lock() to a spin_lock_irqsave(). This works because on UP there are no
> + * remote cpu's so we can only be locking the only existing local one.
> + */
> +#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)
> +static inline void __flags_noop(unsigned long *flags) { }
> +#define spin_lock_maybe_irqsave(lock, flags)		\
> +({							\
> +	 __flags_noop(&(flags));			\
> +	 spin_lock(lock);				\
> +})
> +#define spin_unlock_maybe_irqrestore(lock, flags)	\
> +({							\
> +	 spin_unlock(lock);				\
> +	 __flags_noop(&(flags));			\
> +})
> +#else
> +#define spin_lock_maybe_irqsave(lock, flags)		spin_lock_irqsave(lock, flags)
> +#define spin_unlock_maybe_irqrestore(lock, flags)	spin_unlock_irqrestore(lock, flags)
> +#endif
> +

These are very generic looking names for something specific for
page_alloc.c. Could you add a prefix of some kind to make it easy to see
that these are specific to the mm code?

 mm_spin_lock_maybe_irqsave() ?

Thanks,

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ