mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: "Nhật Anh Nguyễn Duy" <neganhat@gmail.com>
Cc: akpm@linux-foundation.org, jgg@ziepe.ca, jhubbard@nvidia.com,
	peterx@redhat.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm/gup: document unlocked invariant in fixup_user_fault
Date: Wed, 7 Oct 2026 12:58:27 +0200	[thread overview]
Message-ID: <f0af8a33-fb19-45ec-9a52-4bb8579867e9@kernel.org> (raw)
In-Reply-To: <CAFJkwZx9zmz2sxMyByFbYgfCi9zMN+iLxKrypKBCZY9NsLQz1g@mail.gmail.com>

On 10/5/26 13:22, Nhật Anh Nguyễn Duy wrote:
> Hi David,
> 

Hi,

> Thanks for taking the time to review.
> 
> My motivation came from running Smatch over fixup_user_fault(), which flagged

just like the (at least) 2 previous reports. One from them from 2021 IIRC where
Linus even rejected a code change.

> the dereference as a potential NULL pointer issue. Because the relationship
> between FAULT_FLAG_ALLOW_RETRY and the unlocked pointer is subtle when
> first reading through the path, I initially misread it as an unguarded
> dereference in v1.
> 
> When Andrew pointed out the invariant, I thought documenting it might help
> future readers or newer contributors who hit the same static analysis warning.
> 
> If adding a comment isn't the right approach here, would you prefer leaving
> the implicit contract as-is, or is an explicit runtime check (such as
> VM_WARN_ON_ONCE) something more fitting?
We want to silence smatch. Either fix smatch or find a reasonable way to stop it
from reporting things that are simply not true.

-- 
Cheers,

David

      reply	other threads:[~2026-10-07 10:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-03 19:48 [PATCH] mm/gup: fix NULL pointer dereference in fixup_user_fault() Nguyen Duy Nhat Anh
2026-10-04 19:56 ` Andrew Morton
2026-10-05  2:19   ` Lance Yang
2026-10-05 10:27     ` David Hildenbrand (Arm)
2026-10-05  9:37   ` [PATCH v2] mm/gup: document unlocked invariant in fixup_user_fault Nguyen Duy Nhat Anh
2026-10-05 10:29     ` David Hildenbrand (Arm)
2026-10-05 11:22       ` Nhật Anh Nguyễn Duy
2026-10-07 10:58         ` David Hildenbrand (Arm) [this message]

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=f0af8a33-fb19-45ec-9a52-4bb8579867e9@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=neganhat@gmail.com \
    --cc=peterx@redhat.com \
    /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

all inboxes | Powered by JetHome®