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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 6 Jun 2022 09:11:57 +0800
From:   Yu Kuai <yukuai3@...wei.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
CC:     <willy@...radead.org>, <kent.overstreet@...il.com>,
        <axboe@...nel.dk>, <linux-fsdevel@...r.kernel.org>,
        <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
        <yi.zhang@...wei.com>
Subject: Re: [PATCH -next] mm/filemap: fix that first page is not mark
 accessed in filemap_read()

On 2022/06/03 2:22, Andrew Morton wrote:
> On Thu, 2 Jun 2022 16:21:29 +0800 Yu Kuai <yukuai3@...wei.com> wrote:
> 
>> In filemap_read(), 'ra->prev_pos' is set to 'iocb->ki_pos + copied',
>> while it should be 'iocb->ki_ops'. For consequence,
>> folio_mark_accessed() will not be called for 'fbatch.folios[0]' since
>> 'iocb->ki_pos' is always equal to 'ra->prev_pos'.
>>
>> ...
>>
>> --- a/mm/filemap.c
>> +++ b/mm/filemap.c
>> @@ -2728,10 +2728,11 @@ ssize_t filemap_read(struct kiocb *iocb, struct iov_iter *iter,
>>   				flush_dcache_folio(folio);
>>   
>>   			copied = copy_folio_to_iter(folio, offset, bytes, iter);
>> -
>> -			already_read += copied;
>> -			iocb->ki_pos += copied;
>> -			ra->prev_pos = iocb->ki_pos;
>> +			if (copied) {
>> +				ra->prev_pos = iocb->ki_pos;
>> +				already_read += copied;
>> +				iocb->ki_pos += copied;
>> +			}
>>   
>>   			if (copied < bytes) {
>>   				error = -EFAULT;
> 
> It seems tidier, but does it matter?  If copied==0 we're going to break
> out and return -EFAULT anyway?
Hi,

Please notice that I set 'prev_ops' to 'ki_pos' first here, instead of
'ki_pos + copied'.

Thanks,
Kuai
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ