linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] userfaultfd: fix return error if mmap_changing is non-zero in MOVE ioctl
@ 2024-01-17 22:39 Lokesh Gidra
  2024-01-17 22:46 ` Suren Baghdasaryan
  2024-01-25  9:37 ` Mike Rapoport
  0 siblings, 2 replies; 3+ messages in thread
From: Lokesh Gidra @ 2024-01-17 22:39 UTC (permalink / raw)
  To: akpm
  Cc: lokeshgidra, linux-fsdevel, linux-mm, linux-kernel, selinux,
	surenb, kernel-team, aarcange, peterx, david, axelrasmussen,
	bgeffon, willy, jannh, kaleshsingh, ngeoffray

To be consistent with other uffd ioctl's returning EAGAIN when
mmap_changing is detected, we should change UFFDIO_MOVE to do the same.

Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
---
 fs/userfaultfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 959551ff9a95..05c8e8a05427 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -2047,7 +2047,7 @@ static int userfaultfd_move(struct userfaultfd_ctx *ctx,
 			ret = move_pages(ctx, mm, uffdio_move.dst, uffdio_move.src,
 					 uffdio_move.len, uffdio_move.mode);
 		else
-			ret = -EINVAL;
+			ret = -EAGAIN;
 
 		mmap_read_unlock(mm);
 		mmput(mm);
-- 
2.43.0.429.g432eaa2c6b-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] userfaultfd: fix return error if mmap_changing is non-zero in MOVE ioctl
  2024-01-17 22:39 [PATCH] userfaultfd: fix return error if mmap_changing is non-zero in MOVE ioctl Lokesh Gidra
@ 2024-01-17 22:46 ` Suren Baghdasaryan
  2024-01-25  9:37 ` Mike Rapoport
  1 sibling, 0 replies; 3+ messages in thread
From: Suren Baghdasaryan @ 2024-01-17 22:46 UTC (permalink / raw)
  To: Lokesh Gidra
  Cc: akpm, linux-fsdevel, linux-mm, linux-kernel, selinux, kernel-team,
	aarcange, peterx, david, axelrasmussen, bgeffon, willy, jannh,
	kaleshsingh, ngeoffray

On Wed, Jan 17, 2024 at 2:39 PM Lokesh Gidra <lokeshgidra@google.com> wrote:
>
> To be consistent with other uffd ioctl's returning EAGAIN when
> mmap_changing is detected, we should change UFFDIO_MOVE to do the same.
>
> Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>

Looks correct. Thanks for catching it!

Acked-by: Suren Baghdasaryan <surenb@google.com>

> ---
>  fs/userfaultfd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
> index 959551ff9a95..05c8e8a05427 100644
> --- a/fs/userfaultfd.c
> +++ b/fs/userfaultfd.c
> @@ -2047,7 +2047,7 @@ static int userfaultfd_move(struct userfaultfd_ctx *ctx,
>                         ret = move_pages(ctx, mm, uffdio_move.dst, uffdio_move.src,
>                                          uffdio_move.len, uffdio_move.mode);
>                 else
> -                       ret = -EINVAL;
> +                       ret = -EAGAIN;
>
>                 mmap_read_unlock(mm);
>                 mmput(mm);
> --
> 2.43.0.429.g432eaa2c6b-goog
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] userfaultfd: fix return error if mmap_changing is non-zero in MOVE ioctl
  2024-01-17 22:39 [PATCH] userfaultfd: fix return error if mmap_changing is non-zero in MOVE ioctl Lokesh Gidra
  2024-01-17 22:46 ` Suren Baghdasaryan
@ 2024-01-25  9:37 ` Mike Rapoport
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Rapoport @ 2024-01-25  9:37 UTC (permalink / raw)
  To: Lokesh Gidra
  Cc: akpm, linux-fsdevel, linux-mm, linux-kernel, selinux, surenb,
	kernel-team, aarcange, peterx, david, axelrasmussen, bgeffon,
	willy, jannh, kaleshsingh, ngeoffray

On Wed, Jan 17, 2024 at 02:39:21PM -0800, Lokesh Gidra wrote:
> To be consistent with other uffd ioctl's returning EAGAIN when
> mmap_changing is detected, we should change UFFDIO_MOVE to do the same.
> 
> Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>

Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>

> ---
>  fs/userfaultfd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
> index 959551ff9a95..05c8e8a05427 100644
> --- a/fs/userfaultfd.c
> +++ b/fs/userfaultfd.c
> @@ -2047,7 +2047,7 @@ static int userfaultfd_move(struct userfaultfd_ctx *ctx,
>  			ret = move_pages(ctx, mm, uffdio_move.dst, uffdio_move.src,
>  					 uffdio_move.len, uffdio_move.mode);
>  		else
> -			ret = -EINVAL;
> +			ret = -EAGAIN;
>  
>  		mmap_read_unlock(mm);
>  		mmput(mm);
> -- 
> 2.43.0.429.g432eaa2c6b-goog
> 
> 

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-25  9:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-17 22:39 [PATCH] userfaultfd: fix return error if mmap_changing is non-zero in MOVE ioctl Lokesh Gidra
2024-01-17 22:46 ` Suren Baghdasaryan
2024-01-25  9:37 ` Mike Rapoport

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).