From: Ryan Roberts <ryan.roberts@arm.com>
To: Kiryl Shutsemau <kirill@shutemov.name>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Amir Goldstein <amir73il@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm()
Date: Fri, 3 Oct 2025 17:36:23 +0100 [thread overview]
Message-ID: <76cd6212-c85f-4337-99cf-67824c3abee7@arm.com> (raw)
In-Reply-To: <nf7khbu44jzcmyx7wz3ala6ukc2iimf4vej7ffgnezpiosvxal@celav5yumfgw>
On 03/10/2025 17:00, Kiryl Shutsemau wrote:
> On Fri, Oct 03, 2025 at 04:52:36PM +0100, Ryan Roberts wrote:
>> fsnotify_mmap_perm() requires a byte offset for the file about to be
>> mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset.
>> Previously the conversion was done incorrectly so let's fix it, being
>> careful not to overflow on 32-bit platforms.
>>
>> Discovered during code review.
>
> Heh. Just submitted fix for the same issue:
>
> https://lore.kernel.org/all/20251003155804.1571242-1-kirill@shutemov.name/T/#u
>
Ha... great minds...
I notice that for your version you're just doing "pgoff << PAGE_SHIFT" without
casting pgoff.
I'm not sure if that is safe?
pgoff is unsigned long (so 32 bits on 32 bit systems). loff_t is unsigned long
long (so always 64 bits). So is it possible that you shift off the end of 32
bits and lose those bits without a cast to loff_t first?
TBH my knowledge of the exact rules is shaky...
next prev parent reply other threads:[~2025-10-03 16:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-03 15:52 Ryan Roberts
2025-10-03 16:00 ` Kiryl Shutsemau
2025-10-03 16:36 ` Ryan Roberts [this message]
2025-10-03 16:54 ` Kiryl Shutsemau
2025-10-06 11:36 ` David Hildenbrand
2025-10-06 12:14 ` Ryan Roberts
2025-10-06 13:53 ` David Hildenbrand
2025-10-06 14:40 ` Amir Goldstein
2025-10-07 11:08 ` Amir Goldstein
2025-10-06 14:55 ` Jan Kara
2025-10-06 15:04 ` Ryan Roberts
2025-10-06 15:16 ` Jan Kara
2025-10-14 13:38 ` Lorenzo Stoakes
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=76cd6212-c85f-4337-99cf-67824c3abee7@arm.com \
--to=ryan.roberts@arm.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=amir73il@gmail.com \
--cc=david@redhat.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
/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