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: <7weonxk3sdq4ysipns5mnv2lmqlb5froca3cblv7ndkv3gzsf7@ncs2qp22tg55>
Date: Tue, 15 Jul 2025 00:48:50 +0200
From: Klara Modin <klarasmodin@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Youling Tang <youling.tang@...ux.dev>, 
	Matthew Wilcox <willy@...radead.org>, Jan Kara <jack@...e.cz>, linux-fsdevel@...r.kernel.org, 
	linux-mm@...ck.org, linux-kernel@...r.kernel.org, chizhiling@....com, 
	Youling Tang <tangyouling@...inos.cn>, Chi Zhiling <chizhiling@...inos.cn>
Subject: Re: [PATCH] mm/filemap: Align last_index to folio size

On 2025-07-14 15:43:55 -0700, Andrew Morton wrote:
> On Tue, 15 Jul 2025 00:34:12 +0200 Klara Modin <klarasmodin@...il.com> wrote:
> 
> > iocb->ki_pos is loff_t (long long) while pgoff_t is unsigned long and
> > this overflow seems to happen in practice, resulting in last_index being
> > before index.
> > 
> > The following diff resolves the issue for me:
> > 
> > diff --git a/mm/filemap.c b/mm/filemap.c
> > index 3c071307f40e..d2902be0b845 100644
> > --- a/mm/filemap.c
> > +++ b/mm/filemap.c
> > @@ -2585,8 +2585,8 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count,
> >  	int err = 0;
> >  
> >  	/* "last_index" is the index of the folio beyond the end of the read */
> > -	last_index = round_up(iocb->ki_pos + count, mapping_min_folio_nrbytes(mapping));
> > -	last_index >>= PAGE_SHIFT;
> > +	last_index = round_up(iocb->ki_pos + count,
> > +			mapping_min_folio_nrbytes(mapping)) >> PAGE_SHIFT;
> >  retry:
> >  	if (fatal_signal_pending(current))
> >  		return -EINTR;
> 
> Looks good, thanks.  I added your signed-off-by (which I trust is OK?)
> and queued this up.

Thanks, that's fine:
Signed-off-by: Klara Modin <klarasmodin@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ