userfaultfd: hugetlbfs: unmap the correct pointer
Subsystems (3)
PATCH 1/1 userfaultfd: hugetlbfs: unmap the correct pointer
kunmap_atomic() and kunmap() take different pointers. People often get these mixed up.
mm/memory.c +1 -1
@@ -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);
Quoted 4 lines · Dan Carpenter
kunmap_atomic()andkunmap()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...
mm/memory.c long copy_huge_page_from_user(struct page *dst_page, · line 4175
Quoted 12 lines
Signed-off-by Dan Carpenter <[email protected]>mm/memory.c +1
-1@@ -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
Quoted 3 lines
mm/memory.c +0
-0else kunmap_atomic (page_kaddr);
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 8 lines · Michal Hocko
Quoted 4 lines · Dan Carpenter
kunmap_atomic()andkunmap()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.
Quoted 14 lines
mm/memory.c long copy_huge_page_from_user(struct page *dst_page, · line 4175
Quoted 12 lines
Signed-off-by Dan Carpenter <[email protected]>mm/memory.c +1
-1@@ -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
Quoted 7 lines · Dan Carpenter
Quoted 6 lines · Michal Hocko
Quoted 4 lines · Dan Carpenter
kunmap_atomic()andkunmap()take different pointers. People often get these mixed up.Fixes 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")
Quoted 7 lines
Quoted 2 lines
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.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 16 lines · Michal Hocko
Quoted 7 lines · Dan Carpenter
Quoted 6 lines · Michal Hocko
Quoted 4 lines · Dan Carpenter
kunmap_atomic()andkunmap()take different pointers. People often get these mixed up.Fixes 16374db2e9a0 ("userfaultfd: hugetlbfs: fix __mcopy_atomic_hugetlb retry/error processing")Quoted 7 lines
Quoted 2 lines
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.
Quoted 5 lines
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
PATCH v2 1/1 userfaultfd: hugetlbfs: unmap the correct pointer
In reply to Michal Hockokunmap_atomic() and kunmap() take different pointers. People often get these mixed up.
---
v2: I was also unmapping the wrong pointer because I had a typo.
mm/memory.c +1 -1
@@ -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);
Quoted 5 lines · Dan Carpenter
kunmap_atomic()andkunmap()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 <[email protected]>
Quoted 16 lines
---
v2: I was also unmapping the wrong pointer because I had a typo.mm/memory.c +1
-1@@ -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);
Signature · 2 lines
Michal Hocko SUSE Labs
Mike Kravetz
Reviewed-byQuoted 8 lines · Michal Hocko
Quoted 5 lines · Dan Carpenter
kunmap_atomic()andkunmap()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 <[email protected]>Acked-by Michal Hocko <[email protected]>
Thanks for catching this!
Signature · 1 line
Mike Kravetz
Quoted 18 lines
Quoted 17 lines
---
v2: I was also unmapping the wrong pointer because I had a typo.mm/memory.c +1
-1@@ -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);
Quoted 13 lines · Dan Carpenter
kunmap_atomic()andkunmap()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 <[email protected]>---
v2: I was also unmapping the wrong pointer because I had a typo.mm/memory.c +0
-0
mm/memory.c long copy_huge_page_from_user(struct page *dst_page, · line 4177
Quoted 7 lines
mm/memory.c +1
-1@@ -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
Andrew Morton
maintainerQuoted 10 lines · On Fri, 13 Jan 2017 16:02:37 -0800 (PST) Hugh Dickins <[email protected]> wrote:
Quoted 8 lines · Dan Carpenter
kunmap_atomic()andkunmap()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 <[email protected]>---
v2: I was also unmapping the wrong pointer because I had a typo.
Quoted 15 lines
mm/memory.c long copy_huge_page_from_user(struct page *dst_page, · line 4177
Quoted 12 lines
mm/memory.c +1
-1@@ -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.
mm/memory.c renamed from mm/memory.c~userfaultfd-hugetlbfs-fix-__mcopy_atomic_hugetlb-retry-error-processing-fix-fix +1 -1
@@ -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);
_
Thanks, Andrew.
regards,
dan carpenter
Quoted 10 lines · Hugh Dickins
Quoted 8 lines · Dan Carpenter
kunmap_atomic()andkunmap()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 <[email protected]>---
v2: I was also unmapping the wrong pointer because I had a typo.
Quoted 14 lines
mm/memory.c long copy_huge_page_from_user(struct page *dst_page, · line 4177
Quoted 12 lines
mm/memory.c +1
-1@@ -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