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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z4DzwbhsjtD6DjZN@kernel.org>
Date: Fri, 10 Jan 2025 12:17:37 +0200
From: Mike Rapoport <rppt@...nel.org>
To: Weikang Guo <guoweikang.kernel@...il.com>
Cc: Christophe Leroy <christophe.leroy@...roup.eu>,
	Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] mm/memblock: Modify the default failure behavior of
 memblock_alloc to panic

On Mon, Jan 06, 2025 at 11:03:38AM +0800, Weikang Guo wrote:
> Hi,Christophe, Andrew
> 
> Weikang Guo <guoweikang.kernel@...il.com> 于2025年1月6日周一 10:17写道:
> >
> > Hi,Christophe
> >
> > Christophe Leroy <christophe.leroy@...roup.eu> wrote on Saturday, 4
> > January 2025 03:58:
> > >
> > >
> > >
> > > Le 03/01/2025 à 11:51, Guo Weikang a écrit :
> > > > After analyzing the usage of memblock_alloc, it was found that approximately
> > > > 4/5 (120/155) of the calls expect a panic behavior on allocation failure.
> > > > To reflect this common usage pattern, the default failure behavior of
> > > > memblock_alloc is now modified to trigger a panic when allocation fails.
> > > >
> > > > Additionally, a new interface, memblock_alloc_no_panic, has been introduced
> > > > to handle cases where panic behavior is not desired.
> > >
> > > Isn't that going in the opposite direction ?
> > >
> > > 5 years ago we did the exact reverse, see commit c0dbe825a9f1
> > > ("memblock: memblock_alloc_try_nid: don't panic")
> 
> Thank you for providing the historical context. I did notice the
> existence of a nopanic
> version before. In my earlier patch, I introduced
> memblock_alloc_or_panic, which offers
> a more explicit interface to clearly indicate to callers that they
> don't need to handle panic
> separately.
> 
> Andrew pointed out that in most scenarios, panic is the expected
> behavior, while no_panic
> represents an exceptional case. This feedback led to the current
> patch, aiming to adjust the
> default behavior and open it up for discussion within the community.
> 
> However, after reviewing Mike's previous changes, I now believe that
> further adjustment to
> the default behavior might not be necessary, as it could lead to
> confusion for many users.
> In fact, the interface that is widely used externally is
> memblock_alloc(), and I think providing memblock_alloc_or_panic
> explicitly might already be sufficient.

Agree
 
> - memblock_alloc_or_panic:
> https://lore.kernel.org/lkml/20250102150835.776fe72f565cc3232d83e6a7@linux-foundation.org/
> - Drop memblock_alloc_nopanic:
> https://lore.kernel.org/lkml/1548057848-15136-1-git-send-email-rppt@linux.ibm.com/
> 
> > >
> > > Christophe
> > >
> > > >

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ