linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org
Subject: Re: [PATCH v2 3/7] mm/gup: remove vmas parameter from get_user_pages_remote()
Date: Sat, 15 Apr 2023 20:40:44 +0900	[thread overview]
Message-ID: <ba0be6a6-8b31-453c-5895-d502ba4d0f64@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <64ae6557-0e46-48a8-badd-af8993645330@lucifer.local>

On 2023/04/15 20:27, Lorenzo Stoakes wrote:
>>> @@ -5617,11 +5618,11 @@ int __access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf,
>>>  				bytes = PAGE_SIZE-offset;
>>>  
>>>  			maddr = kmap(page);
>>> -			if (write) {
>>> +			if (write && vma) {
>>>  				copy_to_user_page(vma, page, addr,
>>>  						  maddr + offset, buf, bytes);
>>>  				set_page_dirty_lock(page);
>>> -			} else {
>>> +			} else if (vma) {
>>>  				copy_from_user_page(vma, page, addr,
>>>  						    buf, maddr + offset, bytes);
>>>  			}
>>
>> not calling copy_{from,to}_user_page() if vma == NULL is not sufficient for
>> propagating an error to caller.
>>
> 
> This is a product of wanting to avoid churn, again this condition is simply
> impossible. Also as a pedantic side note - the loop explicitly indicates no
> errors are propagated, so there is no need to do so.

Since __access_remote_vm() implicitly indicates an error via "return buf - old_buf;",
"buf += bytes;" must not be executed if copy_{to,from}_user_page(bytes) was not called.



  reply	other threads:[~2023-04-15 11:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-15  9:06 [PATCH v2 0/7] remove the vmas parameter from GUP APIs Lorenzo Stoakes
2023-04-15  9:07 ` [PATCH v2 1/7] mm/gup: remove unused vmas parameter from get_user_pages() Lorenzo Stoakes
2023-04-15  9:08 ` [PATCH v2 2/7] mm/gup: remove unused vmas parameter from pin_user_pages_remote() Lorenzo Stoakes
2023-04-15  9:08 ` [PATCH v2 3/7] mm/gup: remove vmas parameter from get_user_pages_remote() Lorenzo Stoakes
2023-04-15  9:52   ` Tetsuo Handa
2023-04-15 10:14     ` Lorenzo Stoakes
2023-04-15 10:36       ` Tetsuo Handa
2023-04-15 11:27         ` Lorenzo Stoakes
2023-04-15 11:40           ` Tetsuo Handa [this message]
2023-04-15 11:48             ` Lorenzo Stoakes
2023-04-15  9:08 ` [PATCH v2 4/7] mm/gup: introduce the FOLL_SAME_FILE GUP flag Lorenzo Stoakes
2023-04-15  9:08 ` [PATCH v2 5/7] io_uring: rsrc: use FOLL_SAME_FILE on pin_user_pages() Lorenzo Stoakes
2023-04-15  9:08 ` [PATCH v2 6/7] mm/gup: remove vmas parameter from pin_user_pages() Lorenzo Stoakes
2023-04-15  9:09 ` [PATCH v2 7/7] mm/gup: remove vmas array from internal GUP functions 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=ba0be6a6-8b31-453c-5895-d502ba4d0f64@I-love.SAKURA.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.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;
as well as URLs for NNTP newsgroup(s).