linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Barry Song <21cnbao@gmail.com>,
	akpm@linux-foundation.org, linux-mm@kvack.org
Cc: 42.hyeyoo@gmail.com, cl@linux.com, hailong.liu@oppo.com,
	hch@infradead.org, iamjoonsoo.kim@lge.com, lstoakes@gmail.com,
	mhocko@suse.com, penberg@kernel.org, rientjes@google.com,
	roman.gushchin@linux.dev, torvalds@linux-foundation.org,
	urezki@gmail.com, v-songbaohua@oppo.com,
	virtualization@lists.linux.dev, Kees Cook <kees@kernel.org>
Subject: Re: [PATCH v2 3/4] mm: BUG_ON to avoid NULL deference while __GFP_NOFAIL fails
Date: Wed, 31 Jul 2024 12:48:29 +0200	[thread overview]
Message-ID: <c20ea16c-e717-4bf1-92f4-cb5338d4406a@suse.cz> (raw)
In-Reply-To: <9f1d0f2b-ee22-48b7-ba60-d7b886572670@I-love.SAKURA.ne.jp>

On 7/31/24 12:44 PM, Tetsuo Handa wrote:
> On 2024/07/31 19:29, Vlastimil Babka wrote:
>>> @@ -827,8 +827,10 @@ kvmalloc_array_node_noprof(size_t n, size_t size, gfp_t flags, int node)
>>>  {
>>>  	size_t bytes;
>>>  
>>> -	if (unlikely(check_mul_overflow(n, size, &bytes)))
>>> +	if (unlikely(check_mul_overflow(n, size, &bytes))) {
>>> +		BUG_ON(flags & __GFP_NOFAIL);
>> 
>> Shouldn't we produce some kind of warning also in the no-NOFAIL case?
>> Returning a NULL completely silently feels wrong.
> 
> Doesn't embedding macros like BUG_ON() into inline functions needlessly bloat
> the kernel size? I think we can call a non-inlined function (that is marked
> as EXPORT_SYMBOL()) for emitting warning.

Hm yeah we could probably make the whole function non-inline as it results
in a call anyway.


  reply	other threads:[~2024-07-31 10:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31  0:01 [PATCH v2 0/4] mm: clarify nofail memory allocation Barry Song
2024-07-31  0:01 ` [PATCH RFT v2 1/4] vpda: try to fix the potential crash due to misusing __GFP_NOFAIL Barry Song
2024-07-31  3:09   ` Jason Wang
2024-07-31  3:15     ` Barry Song
2024-07-31  3:58       ` Jason Wang
2024-07-31  4:11         ` Barry Song
2024-07-31  4:13           ` Jason Wang
2024-07-31  5:05             ` Barry Song
2024-07-31 10:20               ` Tetsuo Handa
2024-08-01  2:37                 ` Jason Wang
2024-08-05  1:32                   ` Barry Song
2024-08-05  8:19                     ` Jason Wang
2024-08-01  2:30               ` Jason Wang
2024-07-31  0:01 ` [PATCH v2 2/4] mm: Document __GFP_NOFAIL must be blockable Barry Song
2024-07-31 10:18   ` Vlastimil Babka
2024-07-31 16:26   ` Christoph Hellwig
2024-07-31  0:01 ` [PATCH v2 3/4] mm: BUG_ON to avoid NULL deference while __GFP_NOFAIL fails Barry Song
2024-07-31  7:11   ` Michal Hocko
2024-07-31 10:29   ` Vlastimil Babka
2024-07-31 10:44     ` Tetsuo Handa
2024-07-31 10:48       ` Vlastimil Babka [this message]
2024-07-31 10:57         ` Barry Song
2024-07-31 16:28   ` Christoph Hellwig
2024-07-31  0:01 ` [PATCH v2 4/4] mm: prohibit NULL deference exposed for unsupported non-blockable __GFP_NOFAIL Barry Song
2024-07-31  7:15   ` Michal Hocko
2024-07-31 10:55   ` Vlastimil Babka
2024-07-31 11:08     ` Barry Song
2024-07-31 11:31       ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c20ea16c-e717-4bf1-92f4-cb5338d4406a@suse.cz \
    --to=vbabka@suse.cz \
    --cc=21cnbao@gmail.com \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=hailong.liu@oppo.com \
    --cc=hch@infradead.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kees@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=mhocko@suse.com \
    --cc=penberg@kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=torvalds@linux-foundation.org \
    --cc=urezki@gmail.com \
    --cc=v-songbaohua@oppo.com \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).