All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-12 19:20 ` Dan Carpenter
  0 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-12 19:20 UTC (permalink / raw)
  To: Andrew Morton, Mike Kravetz
  Cc: Kirill A. Shutemov, Jan Kara, Ross Zwisler, Michal Hocko,
	Lorenzo Stoakes, Aneesh Kumar K.V, Dan Williams, linux-mm,
	kernel-janitors

kunmap_atomic() and kunmap() take different pointers.  People often get
these mixed up.

Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/mm/memory.c b/mm/memory.c
index 6012a05..dfd3604 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
 				(const void __user *)(src + i * PAGE_SIZE),
 				PAGE_SIZE);
 		if (allow_pagefault)
-			kunmap(page_kaddr);
+			kunmap(dst_page + 1);
 		else
 			kunmap_atomic(page_kaddr);
 

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

* [patch linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-12 19:20 ` Dan Carpenter
  0 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-12 19:20 UTC (permalink / raw)
  To: Andrew Morton, Mike Kravetz
  Cc: Kirill A. Shutemov, Jan Kara, Ross Zwisler, Michal Hocko,
	Lorenzo Stoakes, Aneesh Kumar K.V, Dan Williams, linux-mm,
	kernel-janitors

kunmap_atomic() and kunmap() take different pointers.  People often get
these mixed up.

Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/mm/memory.c b/mm/memory.c
index 6012a05..dfd3604 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
 				(const void __user *)(src + i * PAGE_SIZE),
 				PAGE_SIZE);
 		if (allow_pagefault)
-			kunmap(page_kaddr);
+			kunmap(dst_page + 1);
 		else
 			kunmap_atomic(page_kaddr);
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
  2017-01-12 19:20 ` Dan Carpenter
@ 2017-01-12 19:33   ` Michal Hocko
  -1 siblings, 0 replies; 24+ messages in thread
From: Michal Hocko @ 2017-01-12 19:33 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Lorenzo Stoakes, Aneesh Kumar K.V, Dan Williams,
	linux-mm, kernel-janitors

On Thu 12-01-17 22:20:52, Dan Carpenter wrote:
> kunmap_atomic() and kunmap() take different pointers.  People often get
> these mixed up.
> 
> Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")

This looks like a linux-next sha1. This is not stable and will change...

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 6012a05..dfd3604 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
>  				(const void __user *)(src + i * PAGE_SIZE),
>  				PAGE_SIZE);
>  		if (allow_pagefault)
> -			kunmap(page_kaddr);
> +			kunmap(dst_page + 1);

I guess you meant dst_page + i

>  		else
>  			kunmap_atomic(page_kaddr);
>  

-- 
Michal Hocko
SUSE Labs

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

* Re: [patch linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-12 19:33   ` Michal Hocko
  0 siblings, 0 replies; 24+ messages in thread
From: Michal Hocko @ 2017-01-12 19:33 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Lorenzo Stoakes, Aneesh Kumar K.V, Dan Williams,
	linux-mm, kernel-janitors

On Thu 12-01-17 22:20:52, Dan Carpenter wrote:
> kunmap_atomic() and kunmap() take different pointers.  People often get
> these mixed up.
> 
> Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")

This looks like a linux-next sha1. This is not stable and will change...

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 6012a05..dfd3604 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
>  				(const void __user *)(src + i * PAGE_SIZE),
>  				PAGE_SIZE);
>  		if (allow_pagefault)
> -			kunmap(page_kaddr);
> +			kunmap(dst_page + 1);

I guess you meant dst_page + i

>  		else
>  			kunmap_atomic(page_kaddr);
>  

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
  2017-01-12 19:33   ` Michal Hocko
@ 2017-01-13  8:16     ` Dan Carpenter
  -1 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-13  8:16 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Lorenzo Stoakes, Aneesh Kumar K.V, Dan Williams,
	linux-mm, kernel-janitors

On Thu, Jan 12, 2017 at 08:33:27PM +0100, Michal Hocko wrote:
> On Thu 12-01-17 22:20:52, Dan Carpenter wrote:
> > kunmap_atomic() and kunmap() take different pointers.  People often get
> > these mixed up.
> > 
> > Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> 
> This looks like a linux-next sha1. This is not stable and will change...
> 

Yeah.  But probably Andrew is just going to fold it into the original
anyway.  Probably most of linux-next trees don't rebase so the hash is
good and the people who rebase fold it in so it doesn't show up in the
released code.  It basically never hurts to have the Fixes tag.

> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 6012a05..dfd3604 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
> >  				(const void __user *)(src + i * PAGE_SIZE),
> >  				PAGE_SIZE);
> >  		if (allow_pagefault)
> > -			kunmap(page_kaddr);
> > +			kunmap(dst_page + 1);
> 
> I guess you meant dst_page + i

Huh.  I would have sworn I copy and pasted this.  Anyway, thanks for
catching this.  I will resend.

regards,
dan carpenter


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

* Re: [patch linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-13  8:16     ` Dan Carpenter
  0 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-13  8:16 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Lorenzo Stoakes, Aneesh Kumar K.V, Dan Williams,
	linux-mm, kernel-janitors

On Thu, Jan 12, 2017 at 08:33:27PM +0100, Michal Hocko wrote:
> On Thu 12-01-17 22:20:52, Dan Carpenter wrote:
> > kunmap_atomic() and kunmap() take different pointers.  People often get
> > these mixed up.
> > 
> > Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> 
> This looks like a linux-next sha1. This is not stable and will change...
> 

Yeah.  But probably Andrew is just going to fold it into the original
anyway.  Probably most of linux-next trees don't rebase so the hash is
good and the people who rebase fold it in so it doesn't show up in the
released code.  It basically never hurts to have the Fixes tag.

> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 6012a05..dfd3604 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
> >  				(const void __user *)(src + i * PAGE_SIZE),
> >  				PAGE_SIZE);
> >  		if (allow_pagefault)
> > -			kunmap(page_kaddr);
> > +			kunmap(dst_page + 1);
> 
> I guess you meant dst_page + i

Huh.  I would have sworn I copy and pasted this.  Anyway, thanks for
catching this.  I will resend.

regards,
dan carpenter

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
  2017-01-13  8:16     ` Dan Carpenter
@ 2017-01-13  8:26       ` Michal Hocko
  -1 siblings, 0 replies; 24+ messages in thread
From: Michal Hocko @ 2017-01-13  8:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Lorenzo Stoakes, Aneesh Kumar K.V, Dan Williams,
	linux-mm, kernel-janitors

On Fri 13-01-17 11:16:10, Dan Carpenter wrote:
> On Thu, Jan 12, 2017 at 08:33:27PM +0100, Michal Hocko wrote:
> > On Thu 12-01-17 22:20:52, Dan Carpenter wrote:
> > > kunmap_atomic() and kunmap() take different pointers.  People often get
> > > these mixed up.
> > > 
> > > Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> > 
> > This looks like a linux-next sha1. This is not stable and will change...
> > 
> 
> Yeah.  But probably Andrew is just going to fold it into the original
> anyway.  Probably most of linux-next trees don't rebase so the hash is
> good and the people who rebase fold it in so it doesn't show up in the
> released code.  It basically never hurts to have the Fixes tag.

Yeah, I have a vague recollection that some of those sha1 leaked to
Linus. Do not have any examples handy though. It is true that Andrew
folds those fixes into the original patch so it might be helpful to
have
Fixes: mmotm-patch-file-name.patch
instead.

-- 
Michal Hocko
SUSE Labs

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

* [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
  2017-01-12 19:33   ` Michal Hocko
@ 2017-01-13  8:26     ` Dan Carpenter
  -1 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-13  8:26 UTC (permalink / raw)
  To: Andrew Morton, Mike Kravetz
  Cc: Kirill A. Shutemov, Jan Kara, Ross Zwisler, Michal Hocko,
	Lorenzo Stoakes, Dan Williams, Aneesh Kumar K.V, linux-mm,
	kernel-janitors

kunmap_atomic() and kunmap() take different pointers.  People often get
these mixed up.

Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: I was also unmapping the wrong pointer because I had a typo.

diff --git a/mm/memory.c b/mm/memory.c
index 6012a05..aca8ef6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
 				(const void __user *)(src + i * PAGE_SIZE),
 				PAGE_SIZE);
 		if (allow_pagefault)
-			kunmap(page_kaddr);
+			kunmap(page_kaddr + i);
 		else
 			kunmap_atomic(page_kaddr);
 

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

* Re: [patch linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-13  8:26       ` Michal Hocko
  0 siblings, 0 replies; 24+ messages in thread
From: Michal Hocko @ 2017-01-13  8:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Lorenzo Stoakes, Aneesh Kumar K.V, Dan Williams,
	linux-mm, kernel-janitors

On Fri 13-01-17 11:16:10, Dan Carpenter wrote:
> On Thu, Jan 12, 2017 at 08:33:27PM +0100, Michal Hocko wrote:
> > On Thu 12-01-17 22:20:52, Dan Carpenter wrote:
> > > kunmap_atomic() and kunmap() take different pointers.  People often get
> > > these mixed up.
> > > 
> > > Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> > 
> > This looks like a linux-next sha1. This is not stable and will change...
> > 
> 
> Yeah.  But probably Andrew is just going to fold it into the original
> anyway.  Probably most of linux-next trees don't rebase so the hash is
> good and the people who rebase fold it in so it doesn't show up in the
> released code.  It basically never hurts to have the Fixes tag.

Yeah, I have a vague recollection that some of those sha1 leaked to
Linus. Do not have any examples handy though. It is true that Andrew
folds those fixes into the original patch so it might be helpful to
have
Fixes: mmotm-patch-file-name.patch
instead.

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-13  8:26     ` Dan Carpenter
  0 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-13  8:26 UTC (permalink / raw)
  To: Andrew Morton, Mike Kravetz
  Cc: Kirill A. Shutemov, Jan Kara, Ross Zwisler, Michal Hocko,
	Lorenzo Stoakes, Dan Williams, Aneesh Kumar K.V, linux-mm,
	kernel-janitors

kunmap_atomic() and kunmap() take different pointers.  People often get
these mixed up.

Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: I was also unmapping the wrong pointer because I had a typo.

diff --git a/mm/memory.c b/mm/memory.c
index 6012a05..aca8ef6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
 				(const void __user *)(src + i * PAGE_SIZE),
 				PAGE_SIZE);
 		if (allow_pagefault)
-			kunmap(page_kaddr);
+			kunmap(page_kaddr + i);
 		else
 			kunmap_atomic(page_kaddr);
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
  2017-01-13  8:26       ` Michal Hocko
@ 2017-01-13  8:40         ` Dan Carpenter
  -1 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-13  8:40 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Lorenzo Stoakes, Aneesh Kumar K.V, Dan Williams,
	linux-mm, kernel-janitors

On Fri, Jan 13, 2017 at 09:26:08AM +0100, Michal Hocko wrote:
> On Fri 13-01-17 11:16:10, Dan Carpenter wrote:
> > On Thu, Jan 12, 2017 at 08:33:27PM +0100, Michal Hocko wrote:
> > > On Thu 12-01-17 22:20:52, Dan Carpenter wrote:
> > > > kunmap_atomic() and kunmap() take different pointers.  People often get
> > > > these mixed up.
> > > > 
> > > > Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> > > 
> > > This looks like a linux-next sha1. This is not stable and will change...
> > > 
> > 
> > Yeah.  But probably Andrew is just going to fold it into the original
> > anyway.  Probably most of linux-next trees don't rebase so the hash is
> > good and the people who rebase fold it in so it doesn't show up in the
> > released code.  It basically never hurts to have the Fixes tag.
> 
> Yeah, I have a vague recollection that some of those sha1 leaked to
> Linus. Do not have any examples handy though. It is true that Andrew
> folds those fixes into the original patch so it might be helpful to
> have
> Fixes: mmotm-patch-file-name.patch

I have no idea how to do that.  I'm always just working on linux-next
and not the individual trees...  I'm interested to hear from Andrew
what's easiest because I don't know at all how quilt works.

My work flow is that I have scripts to generate patches from within vim.
Most of the time I'm just working on one file but occasionally I will
combine two patches together in mutt.

For Dave's networking patches I have a separate git tree where I try to
apply them to net and then net-next to see which tree it should go into.
Otherwise, I generally assume the maintainer knows which tree they
belong in.

regards,
dan carpenter


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

* Re: [patch linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-13  8:40         ` Dan Carpenter
  0 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-13  8:40 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Lorenzo Stoakes, Aneesh Kumar K.V, Dan Williams,
	linux-mm, kernel-janitors

On Fri, Jan 13, 2017 at 09:26:08AM +0100, Michal Hocko wrote:
> On Fri 13-01-17 11:16:10, Dan Carpenter wrote:
> > On Thu, Jan 12, 2017 at 08:33:27PM +0100, Michal Hocko wrote:
> > > On Thu 12-01-17 22:20:52, Dan Carpenter wrote:
> > > > kunmap_atomic() and kunmap() take different pointers.  People often get
> > > > these mixed up.
> > > > 
> > > > Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> > > 
> > > This looks like a linux-next sha1. This is not stable and will change...
> > > 
> > 
> > Yeah.  But probably Andrew is just going to fold it into the original
> > anyway.  Probably most of linux-next trees don't rebase so the hash is
> > good and the people who rebase fold it in so it doesn't show up in the
> > released code.  It basically never hurts to have the Fixes tag.
> 
> Yeah, I have a vague recollection that some of those sha1 leaked to
> Linus. Do not have any examples handy though. It is true that Andrew
> folds those fixes into the original patch so it might be helpful to
> have
> Fixes: mmotm-patch-file-name.patch

I have no idea how to do that.  I'm always just working on linux-next
and not the individual trees...  I'm interested to hear from Andrew
what's easiest because I don't know at all how quilt works.

My work flow is that I have scripts to generate patches from within vim.
Most of the time I'm just working on one file but occasionally I will
combine two patches together in mutt.

For Dave's networking patches I have a separate git tree where I try to
apply them to net and then net-next to see which tree it should go into.
Otherwise, I generally assume the maintainer knows which tree they
belong in.

regards,
dan carpenter

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
  2017-01-13  8:26     ` Dan Carpenter
@ 2017-01-13  8:40       ` Michal Hocko
  -1 siblings, 0 replies; 24+ messages in thread
From: Michal Hocko @ 2017-01-13  8:40 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Lorenzo Stoakes, Dan Williams, Aneesh Kumar K.V,
	linux-mm, kernel-janitors

On Fri 13-01-17 11:26:08, Dan Carpenter wrote:
> kunmap_atomic() and kunmap() take different pointers.  People often get
> these mixed up.
> 
> Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
> v2: I was also unmapping the wrong pointer because I had a typo.
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 6012a05..aca8ef6 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
>  				(const void __user *)(src + i * PAGE_SIZE),
>  				PAGE_SIZE);
>  		if (allow_pagefault)
> -			kunmap(page_kaddr);
> +			kunmap(page_kaddr + i);
>  		else
>  			kunmap_atomic(page_kaddr);
>  

-- 
Michal Hocko
SUSE Labs

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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-13  8:40       ` Michal Hocko
  0 siblings, 0 replies; 24+ messages in thread
From: Michal Hocko @ 2017-01-13  8:40 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Lorenzo Stoakes, Dan Williams, Aneesh Kumar K.V,
	linux-mm, kernel-janitors

On Fri 13-01-17 11:26:08, Dan Carpenter wrote:
> kunmap_atomic() and kunmap() take different pointers.  People often get
> these mixed up.
> 
> Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
> v2: I was also unmapping the wrong pointer because I had a typo.
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 6012a05..aca8ef6 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
>  				(const void __user *)(src + i * PAGE_SIZE),
>  				PAGE_SIZE);
>  		if (allow_pagefault)
> -			kunmap(page_kaddr);
> +			kunmap(page_kaddr + i);
>  		else
>  			kunmap_atomic(page_kaddr);
>  

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
  2017-01-13  8:40       ` Michal Hocko
@ 2017-01-13 16:29         ` Mike Kravetz
  -1 siblings, 0 replies; 24+ messages in thread
From: Mike Kravetz @ 2017-01-13 16:29 UTC (permalink / raw)
  To: Michal Hocko, Dan Carpenter
  Cc: Andrew Morton, Kirill A. Shutemov, Jan Kara, Ross Zwisler,
	Lorenzo Stoakes, Dan Williams, Aneesh Kumar K.V, linux-mm,
	kernel-janitors

On 01/13/2017 12:40 AM, Michal Hocko wrote:
> On Fri 13-01-17 11:26:08, Dan Carpenter wrote:
>> kunmap_atomic() and kunmap() take different pointers.  People often get
>> these mixed up.
>>
>> Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Acked-by: Michal Hocko <mhocko@suse.com>

Thanks for catching this!

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>

-- 
Mike Kravetz

> 
>> ---
>> v2: I was also unmapping the wrong pointer because I had a typo.
>>
>> diff --git a/mm/memory.c b/mm/memory.c
>> index 6012a05..aca8ef6 100644
>> --- a/mm/memory.c
>> +++ b/mm/memory.c
>> @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
>>  				(const void __user *)(src + i * PAGE_SIZE),
>>  				PAGE_SIZE);
>>  		if (allow_pagefault)
>> -			kunmap(page_kaddr);
>> +			kunmap(page_kaddr + i);
>>  		else
>>  			kunmap_atomic(page_kaddr);
>>  
> 

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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-13 16:29         ` Mike Kravetz
  0 siblings, 0 replies; 24+ messages in thread
From: Mike Kravetz @ 2017-01-13 16:29 UTC (permalink / raw)
  To: Michal Hocko, Dan Carpenter
  Cc: Andrew Morton, Kirill A. Shutemov, Jan Kara, Ross Zwisler,
	Lorenzo Stoakes, Dan Williams, Aneesh Kumar K.V, linux-mm,
	kernel-janitors

On 01/13/2017 12:40 AM, Michal Hocko wrote:
> On Fri 13-01-17 11:26:08, Dan Carpenter wrote:
>> kunmap_atomic() and kunmap() take different pointers.  People often get
>> these mixed up.
>>
>> Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Acked-by: Michal Hocko <mhocko@suse.com>

Thanks for catching this!

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>

-- 
Mike Kravetz

> 
>> ---
>> v2: I was also unmapping the wrong pointer because I had a typo.
>>
>> diff --git a/mm/memory.c b/mm/memory.c
>> index 6012a05..aca8ef6 100644
>> --- a/mm/memory.c
>> +++ b/mm/memory.c
>> @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
>>  				(const void __user *)(src + i * PAGE_SIZE),
>>  				PAGE_SIZE);
>>  		if (allow_pagefault)
>> -			kunmap(page_kaddr);
>> +			kunmap(page_kaddr + i);
>>  		else
>>  			kunmap_atomic(page_kaddr);
>>  
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
  2017-01-13  8:26     ` Dan Carpenter
@ 2017-01-14  0:02       ` Hugh Dickins
  -1 siblings, 0 replies; 24+ messages in thread
From: Hugh Dickins @ 2017-01-14  0:02 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Michal Hocko, Lorenzo Stoakes, Dan Williams,
	Aneesh Kumar K.V, linux-mm, kernel-janitors

On Fri, 13 Jan 2017, Dan Carpenter wrote:

> kunmap_atomic() and kunmap() take different pointers.  People often get
> these mixed up.
> 
> Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: I was also unmapping the wrong pointer because I had a typo.
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 6012a05..aca8ef6 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
>  				(const void __user *)(src + i * PAGE_SIZE),
>  				PAGE_SIZE);
>  		if (allow_pagefault)
> -			kunmap(page_kaddr);
> +			kunmap(page_kaddr + i);
>  		else
>  			kunmap_atomic(page_kaddr);

I think you need to look at that again.

Hugh

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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-14  0:02       ` Hugh Dickins
  0 siblings, 0 replies; 24+ messages in thread
From: Hugh Dickins @ 2017-01-14  0:02 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Michal Hocko, Lorenzo Stoakes, Dan Williams,
	Aneesh Kumar K.V, linux-mm, kernel-janitors

On Fri, 13 Jan 2017, Dan Carpenter wrote:

> kunmap_atomic() and kunmap() take different pointers.  People often get
> these mixed up.
> 
> Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: I was also unmapping the wrong pointer because I had a typo.
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 6012a05..aca8ef6 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
>  				(const void __user *)(src + i * PAGE_SIZE),
>  				PAGE_SIZE);
>  		if (allow_pagefault)
> -			kunmap(page_kaddr);
> +			kunmap(page_kaddr + i);
>  		else
>  			kunmap_atomic(page_kaddr);

I think you need to look at that again.

Hugh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
  2017-01-14  0:02       ` Hugh Dickins
@ 2017-01-14  0:13         ` Andrew Morton
  -1 siblings, 0 replies; 24+ messages in thread
From: Andrew Morton @ 2017-01-14  0:13 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Dan Carpenter, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Michal Hocko, Lorenzo Stoakes, Dan Williams,
	Aneesh Kumar K.V, linux-mm, kernel-janitors

On Fri, 13 Jan 2017 16:02:37 -0800 (PST) Hugh Dickins <hughd@google.com> wrote:

> On Fri, 13 Jan 2017, Dan Carpenter wrote:
> 
> > kunmap_atomic() and kunmap() take different pointers.  People often get
> > these mixed up.
> > 
> > Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > v2: I was also unmapping the wrong pointer because I had a typo.
> > 
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 6012a05..aca8ef6 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
> >  				(const void __user *)(src + i * PAGE_SIZE),
> >  				PAGE_SIZE);
> >  		if (allow_pagefault)
> > -			kunmap(page_kaddr);
> > +			kunmap(page_kaddr + i);
> >  		else
> >  			kunmap_atomic(page_kaddr);
> 
> I think you need to look at that again.
> 

um, yup.

--- a/mm/memory.c~userfaultfd-hugetlbfs-fix-__mcopy_atomic_hugetlb-retry-error-processing-fix-fix
+++ a/mm/memory.c
@@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct pag
 				(const void __user *)(src + i * PAGE_SIZE),
 				PAGE_SIZE);
 		if (allow_pagefault)
-			kunmap(page_kaddr + i);
+			kunmap(dst_page + i);
 		else
 			kunmap_atomic(page_kaddr);
 
_


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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-14  0:13         ` Andrew Morton
  0 siblings, 0 replies; 24+ messages in thread
From: Andrew Morton @ 2017-01-14  0:13 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Dan Carpenter, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Michal Hocko, Lorenzo Stoakes, Dan Williams,
	Aneesh Kumar K.V, linux-mm, kernel-janitors

On Fri, 13 Jan 2017 16:02:37 -0800 (PST) Hugh Dickins <hughd@google.com> wrote:

> On Fri, 13 Jan 2017, Dan Carpenter wrote:
> 
> > kunmap_atomic() and kunmap() take different pointers.  People often get
> > these mixed up.
> > 
> > Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > v2: I was also unmapping the wrong pointer because I had a typo.
> > 
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 6012a05..aca8ef6 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
> >  				(const void __user *)(src + i * PAGE_SIZE),
> >  				PAGE_SIZE);
> >  		if (allow_pagefault)
> > -			kunmap(page_kaddr);
> > +			kunmap(page_kaddr + i);
> >  		else
> >  			kunmap_atomic(page_kaddr);
> 
> I think you need to look at that again.
> 

um, yup.

--- a/mm/memory.c~userfaultfd-hugetlbfs-fix-__mcopy_atomic_hugetlb-retry-error-processing-fix-fix
+++ a/mm/memory.c
@@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct pag
 				(const void __user *)(src + i * PAGE_SIZE),
 				PAGE_SIZE);
 		if (allow_pagefault)
-			kunmap(page_kaddr + i);
+			kunmap(dst_page + i);
 		else
 			kunmap_atomic(page_kaddr);
 
_

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
  2017-01-14  0:02       ` Hugh Dickins
@ 2017-01-14  6:55         ` Dan Carpenter
  -1 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-14  6:55 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Michal Hocko, Lorenzo Stoakes, Dan Williams,
	Aneesh Kumar K.V, linux-mm, kernel-janitors

On Fri, Jan 13, 2017 at 04:02:37PM -0800, Hugh Dickins wrote:
> On Fri, 13 Jan 2017, Dan Carpenter wrote:
> 
> > kunmap_atomic() and kunmap() take different pointers.  People often get
> > these mixed up.
> > 
> > Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > v2: I was also unmapping the wrong pointer because I had a typo.
> > 
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 6012a05..aca8ef6 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
> >  				(const void __user *)(src + i * PAGE_SIZE),
> >  				PAGE_SIZE);
> >  		if (allow_pagefault)
> > -			kunmap(page_kaddr);
> > +			kunmap(page_kaddr + i);
> >  		else
> >  			kunmap_atomic(page_kaddr);
> 
> I think you need to look at that again.

Oh wow...  What absolute heck!  I can't believe how badly I'm messing
up on this.

regards,
dan carpenter


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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-14  6:55         ` Dan Carpenter
  0 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-14  6:55 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Andrew Morton, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Michal Hocko, Lorenzo Stoakes, Dan Williams,
	Aneesh Kumar K.V, linux-mm, kernel-janitors

On Fri, Jan 13, 2017 at 04:02:37PM -0800, Hugh Dickins wrote:
> On Fri, 13 Jan 2017, Dan Carpenter wrote:
> 
> > kunmap_atomic() and kunmap() take different pointers.  People often get
> > these mixed up.
> > 
> > Fixes: 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > v2: I was also unmapping the wrong pointer because I had a typo.
> > 
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 6012a05..aca8ef6 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -4172,7 +4172,7 @@ long copy_huge_page_from_user(struct page *dst_page,
> >  				(const void __user *)(src + i * PAGE_SIZE),
> >  				PAGE_SIZE);
> >  		if (allow_pagefault)
> > -			kunmap(page_kaddr);
> > +			kunmap(page_kaddr + i);
> >  		else
> >  			kunmap_atomic(page_kaddr);
> 
> I think you need to look at that again.

Oh wow...  What absolute heck!  I can't believe how badly I'm messing
up on this.

regards,
dan carpenter

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
  2017-01-14  0:13         ` Andrew Morton
@ 2017-01-14  6:56           ` Dan Carpenter
  -1 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-14  6:56 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Hugh Dickins, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Michal Hocko, Lorenzo Stoakes, Dan Williams,
	Aneesh Kumar K.V, linux-mm, kernel-janitors

Thanks, Andrew.

regards,
dan carpenter


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

* Re: [patch v2 linux-next] userfaultfd: hugetlbfs: unmap the correct pointer
@ 2017-01-14  6:56           ` Dan Carpenter
  0 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-01-14  6:56 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Hugh Dickins, Mike Kravetz, Kirill A. Shutemov, Jan Kara,
	Ross Zwisler, Michal Hocko, Lorenzo Stoakes, Dan Williams,
	Aneesh Kumar K.V, linux-mm, kernel-janitors

Thanks, Andrew.

regards,
dan carpenter

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2017-01-14  6:57 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12 19:20 [patch linux-next] userfaultfd: hugetlbfs: unmap the correct pointer Dan Carpenter
2017-01-12 19:20 ` Dan Carpenter
2017-01-12 19:33 ` Michal Hocko
2017-01-12 19:33   ` Michal Hocko
2017-01-13  8:16   ` Dan Carpenter
2017-01-13  8:16     ` Dan Carpenter
2017-01-13  8:26     ` Michal Hocko
2017-01-13  8:26       ` Michal Hocko
2017-01-13  8:40       ` Dan Carpenter
2017-01-13  8:40         ` Dan Carpenter
2017-01-13  8:26   ` [patch v2 " Dan Carpenter
2017-01-13  8:26     ` Dan Carpenter
2017-01-13  8:40     ` Michal Hocko
2017-01-13  8:40       ` Michal Hocko
2017-01-13 16:29       ` Mike Kravetz
2017-01-13 16:29         ` Mike Kravetz
2017-01-14  0:02     ` Hugh Dickins
2017-01-14  0:02       ` Hugh Dickins
2017-01-14  0:13       ` Andrew Morton
2017-01-14  0:13         ` Andrew Morton
2017-01-14  6:56         ` Dan Carpenter
2017-01-14  6:56           ` Dan Carpenter
2017-01-14  6:55       ` Dan Carpenter
2017-01-14  6:55         ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.