ARM, xtensa: highmem: avoid clobbering non-page aligned memory reservations
Subsystems (2)
PATCH 1/1 ARM, xtensa: highmem: avoid clobbering non-page aligned memory reservations
From: Ard Biesheuvel <[email protected]>
free_highpages() iterates over the free memblock regions in high memory, and marks each page as available for the memory management system.
Until commit cddb5ddf2b76 ("arm, xtensa: simplify initialization of high memory pages") it rounded beginning of each region upwards and end of each region downwards.
However, after that commit free_highmem() rounds the beginning and end of each region downwards, and we may end up freeing a page that is memblock_reserve()d, resulting in memory corruption.
Restore the original rounding of the region boundaries to avoid freeing reserved pages.
---
Max, Russell,
Please let me know how do you prefer to take it upstream. If needed this can go via memblock tree.
v2: fix words order in the commit message
arch/arm/mm/init.c | 4 ++-- arch/xtensa/mm/init.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/mm/init.c +2 -2
@@ -354,8 +354,8 @@ static void __init free_highpages(void)/* set highmem page free */ for_each_free_mem_range (i,NUMA_NO_NODE ,MEMBLOCK_NONE , &range_start, &range_end,NULL ) { -unsigned long start =PHYS_PFN (range_start); -unsigned long end =PHYS_PFN (range_end); +unsigned long start =PFN_UP (range_start); +unsigned long end =PFN_DOWN (range_end);/* Ignore complete lowmem entries */ if (end <= max_low)
arch/xtensa/mm/init.c +2 -2
@@ -89,8 +89,8 @@ static void __init free_highpages(void)/* set highmem page free */ for_each_free_mem_range (i,NUMA_NO_NODE ,MEMBLOCK_NONE , &range_start, &range_end,NULL ) { -unsigned long start =PHYS_PFN (range_start); -unsigned long end =PHYS_PFN (range_end); +unsigned long start =PFN_UP (range_start); +unsigned long end =PFN_DOWN (range_end);/* Ignore complete lowmem entries */ if (end <= max_low)
Signature · 1 line
2.28.0
Russell King - ARM Linux admin
maintainerQuoted 22 lines · Mike Rapoport
From: Ard Biesheuvel <[email protected]>
free_highpages()iterates over the free memblock regions in high memory, and marks each page as available for the memory management system.Until commit
cddb5ddf2b76("arm, xtensa: simplify initialization of high memory pages") it rounded beginning of each region upwards and end of each region downwards.However, after that commit
free_highmem()rounds the beginning and end of each region downwards, and we may end up freeing a page that is memblock_reserve()d, resulting in memory corruption.Restore the original rounding of the region boundaries to avoid freeing reserved pages.
Fixes cddb5ddf2b76 ("arm, xtensa: simplify initialization of high memory pages")Signed-off-by Ard Biesheuvel <[email protected]>Co-developed-by Mike Rapoport <[email protected]>Signed-off-by Mike Rapoport <[email protected]>
Quoted 8 lines
---
Max, Russell,
Please let me know how do you prefer to take it upstream. If needed this can go via memblock tree.
v2: fix words order in the commit message
I really don't understand what is going on here; there seems to be a total disconnect of communication between yourself and Ard. Ard has already submitted a different patch for this to the patch system already, sent yesterday.
https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9021/1
Please discuss between yourselves how you want to solve the problem, and then submit an agreed and tested patch to those of us upstream; please don't make it for those upstream to pick one of your patches as you are at present.
Thanks.
Quoted 39 lines
arch/arm/mm/init.c | 4 ++-- arch/xtensa/mm/init.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)arch/arm/mm/init.c +2
-2@@ -354,8 +354,8 @@ static void __init free_highpages(void)/* set highmem page free */ for_each_free_mem_range (i,NUMA_NO_NODE ,MEMBLOCK_NONE , &range_start, &range_end,NULL ) { -unsigned long start =PHYS_PFN (range_start); -unsigned long end =PHYS_PFN (range_end); +unsigned long start =PFN_UP (range_start); +unsigned long end =PFN_DOWN (range_end);/* Ignore complete lowmem entries */ if (end <= max_low)arch/xtensa/mm/init.c +2
-2@@ -89,8 +89,8 @@ static void __init free_highpages(void)/* set highmem page free */ for_each_free_mem_range (i,NUMA_NO_NODE ,MEMBLOCK_NONE , &range_start, &range_end,NULL ) { -unsigned long start =PHYS_PFN (range_start); -unsigned long end =PHYS_PFN (range_end); +unsigned long start =PFN_UP (range_start); +unsigned long end =PFN_DOWN (range_end);/* Ignore complete lowmem entries */ if (end <= max_low)Signature · 1 line
2.28.0
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Quoted 38 lines · Russell King - ARM Linux admin
Quoted 22 lines · Mike Rapoport
From: Ard Biesheuvel <[email protected]>
free_highpages()iterates over the free memblock regions in high memory, and marks each page as available for the memory management system.Until commit
cddb5ddf2b76("arm, xtensa: simplify initialization of high memory pages") it rounded beginning of each region upwards and end of each region downwards.However, after that commit
free_highmem()rounds the beginning and end of each region downwards, and we may end up freeing a page that is memblock_reserve()d, resulting in memory corruption.Restore the original rounding of the region boundaries to avoid freeing reserved pages.
Fixes cddb5ddf2b76 ("arm, xtensa: simplify initialization of high memory pages")Signed-off-by Ard Biesheuvel <[email protected]>Co-developed-by Mike Rapoport <[email protected]>Signed-off-by Mike Rapoport <[email protected]>Quoted 8 lines
---
Max, Russell,
Please let me know how do you prefer to take it upstream. If needed this can go via memblock tree.
v2: fix words order in the commit message
I really don't understand what is going on here; there seems to be a total disconnect of communication between yourself and Ard. Ard has already submitted a different patch for this to the patch system already, sent yesterday.
Quoted 7 lines
https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9021/1
Please discuss between yourselves how you want to solve the problem, and then submit an agreed and tested patch to those of us upstream; please don't make it for those upstream to pick one of your patches as you are at present.
Apologies for creating this confusion. I posted a patch and dropped it into the patch system when I found the bug.
However, only when Florian asked about a 'fixes' tag, I went back to the history, and realized that the issue was introduced by Mike during the most recent merge window, and affects xtensa as well.
I don't have a preference which patch gets applied, though, so please indicate your preference, and we will adapt accordingly.
Quoted 43 lines
Quoted 36 lines
arch/arm/mm/init.c | 4 ++-- arch/xtensa/mm/init.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)arch/arm/mm/init.c +2
-2@@ -354,8 +354,8 @@ static void __init free_highpages(void)/* set highmem page free */ for_each_free_mem_range (i,NUMA_NO_NODE ,MEMBLOCK_NONE , &range_start, &range_end,NULL ) { -unsigned long start =PHYS_PFN (range_start); -unsigned long end =PHYS_PFN (range_end); +unsigned long start =PFN_UP (range_start); +unsigned long end =PFN_DOWN (range_end);/* Ignore complete lowmem entries */ if (end <= max_low)arch/xtensa/mm/init.c +2
-3@@ -89,8 +89,8 @@ static void __init free_highpages(void)/* set highmem page free */ for_each_free_mem_range (i,NUMA_NO_NODE ,MEMBLOCK_NONE , &range_start, &range_end,NULL ) { -unsigned long start =PHYS_PFN (range_start); -unsigned long end =PHYS_PFN (range_end); +unsigned long start =PFN_UP (range_start); +unsigned long end =PFN_DOWN (range_end);/* Ignore complete lowmem entries */ if (end <= max_low) --Quoted 3 lines
2.28.0
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Russell King - ARM Linux admin
maintainerQuoted 48 lines · Ard Biesheuvel
Quoted 38 lines · Russell King - ARM Linux admin
Quoted 22 lines · Mike Rapoport
From: Ard Biesheuvel <[email protected]>
free_highpages()iterates over the free memblock regions in high memory, and marks each page as available for the memory management system.Until commit
cddb5ddf2b76("arm, xtensa: simplify initialization of high memory pages") it rounded beginning of each region upwards and end of each region downwards.However, after that commit
free_highmem()rounds the beginning and end of each region downwards, and we may end up freeing a page that is memblock_reserve()d, resulting in memory corruption.Restore the original rounding of the region boundaries to avoid freeing reserved pages.
Fixes cddb5ddf2b76 ("arm, xtensa: simplify initialization of high memory pages")Signed-off-by Ard Biesheuvel <[email protected]>Co-developed-by Mike Rapoport <[email protected]>Signed-off-by Mike Rapoport <[email protected]>Quoted 8 lines
---
Max, Russell,
Please let me know how do you prefer to take it upstream. If needed this can go via memblock tree.
v2: fix words order in the commit message
I really don't understand what is going on here; there seems to be a total disconnect of communication between yourself and Ard. Ard has already submitted a different patch for this to the patch system already, sent yesterday.
Quoted 7 lines
https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9021/1
Please discuss between yourselves how you want to solve the problem, and then submit an agreed and tested patch to those of us upstream; please don't make it for those upstream to pick one of your patches as you are at present.
Quoted 6 lines
Apologies for creating this confusion. I posted a patch and dropped it into the patch system when I found the bug.
However, only when Florian asked about a 'fixes' tag, I went back to the history, and realized that the issue was introduced by Mike during the most recent merge window, and affects xtensa as well.
So why does Mike's patch have:
in it? It seems you haven't been directly involved in Mike's patch.
There's something /really/ not right with the process behind this patch.
Quoted 2 lines
I don't have a preference which patch gets applied, though, so please indicate your preference, and we will adapt accordingly.
I asked for you both to come to a concensus about how you want to proceed, and now you're throwing it back on to me to solve your(pl) mis-communication issue. We haven't heard from Mike yet.
Clearly, I wasn't blunt and stroppy enough to be properly understood. Sort it out between yourselves and tell me which patch you want me to apply.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Quoted 57 lines · Russell King - ARM Linux admin
Quoted 48 lines · Ard Biesheuvel
Quoted 38 lines · Russell King - ARM Linux admin
Quoted 22 lines · Mike Rapoport
From: Ard Biesheuvel <[email protected]>
free_highpages()iterates over the free memblock regions in high memory, and marks each page as available for the memory management system.Until commit
cddb5ddf2b76("arm, xtensa: simplify initialization of high memory pages") it rounded beginning of each region upwards and end of each region downwards.However, after that commit
free_highmem()rounds the beginning and end of each region downwards, and we may end up freeing a page that is memblock_reserve()d, resulting in memory corruption.Restore the original rounding of the region boundaries to avoid freeing reserved pages.
Fixes cddb5ddf2b76 ("arm, xtensa: simplify initialization of high memory pages")Signed-off-by Ard Biesheuvel <[email protected]>Co-developed-by Mike Rapoport <[email protected]>Signed-off-by Mike Rapoport <[email protected]>Quoted 8 lines
---
Max, Russell,
Please let me know how do you prefer to take it upstream. If needed this can go via memblock tree.
v2: fix words order in the commit message
I really don't understand what is going on here; there seems to be a total disconnect of communication between yourself and Ard. Ard has already submitted a different patch for this to the patch system already, sent yesterday.
Quoted 7 lines
https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9021/1
Please discuss between yourselves how you want to solve the problem, and then submit an agreed and tested patch to those of us upstream; please don't make it for those upstream to pick one of your patches as you are at present.
Quoted 6 lines
Apologies for creating this confusion. I posted a patch and dropped it into the patch system when I found the bug.
However, only when Florian asked about a 'fixes' tag, I went back to the history, and realized that the issue was introduced by Mike during the most recent merge window, and affects xtensa as well.
Quoted 6 lines
So why does Mike's patch have:
Signed-off-by Ard Biesheuvel <[email protected]>in it? It seems you haven't been directly involved in Mike's patch.
Because I cc'ed him on the discussion following the patch that is now in your patch system. So he took that patch and modified it, but retained the original S-o-b and authorship.
Quoted 10 lines
There's something /really/ not right with the process behind this patch.
Quoted 2 lines
I don't have a preference which patch gets applied, though, so please indicate your preference, and we will adapt accordingly.
I asked for you both to come to a concensus about how you want to proceed, and now you're throwing it back on to me to solve your(pl) mis-communication issue. We haven't heard from Mike yet.
I am not throwing it back to you. I merely indicated that I have no preference, and since Mike is the one who introduced this issue in the first place, I am expecting him to drive this. And indeed, we haven't heard from him yet.
Quoted 4 lines
Clearly, I wasn't blunt and stroppy enough to be properly understood. Sort it out between yourselves and tell me which patch you want me to apply.
I would like you to ack this version of the patch, and disregard the one in the patch system, so that Mike can take this one through the memblock tree where the issue originated in the first place.
Quoted 61 lines · Ard Biesheuvel
Quoted 59 lines · Russell King - ARM Linux admin
Quoted 48 lines · Ard Biesheuvel
Quoted 38 lines · Russell King - ARM Linux admin
Quoted 22 lines · Mike Rapoport
From: Ard Biesheuvel <[email protected]>
free_highpages()iterates over the free memblock regions in high memory, and marks each page as available for the memory management system.Until commit
cddb5ddf2b76("arm, xtensa: simplify initialization of high memory pages") it rounded beginning of each region upwards and end of each region downwards.However, after that commit
free_highmem()rounds the beginning and end of each region downwards, and we may end up freeing a page that is memblock_reserve()d, resulting in memory corruption.Restore the original rounding of the region boundaries to avoid freeing reserved pages.
Fixes cddb5ddf2b76 ("arm, xtensa: simplify initialization of high memory pages")Signed-off-by Ard Biesheuvel <[email protected]>Co-developed-by Mike Rapoport <[email protected]>Signed-off-by Mike Rapoport <[email protected]>Quoted 8 lines
---
Max, Russell,
Please let me know how do you prefer to take it upstream. If needed this can go via memblock tree.
v2: fix words order in the commit message
I really don't understand what is going on here; there seems to be a total disconnect of communication between yourself and Ard. Ard has already submitted a different patch for this to the patch system already, sent yesterday.
Quoted 7 lines
https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9021/1
Please discuss between yourselves how you want to solve the problem, and then submit an agreed and tested patch to those of us upstream; please don't make it for those upstream to pick one of your patches as you are at present.
Quoted 6 lines
Apologies for creating this confusion. I posted a patch and dropped it into the patch system when I found the bug.
However, only when Florian asked about a 'fixes' tag, I went back to the history, and realized that the issue was introduced by Mike during the most recent merge window, and affects xtensa as well.
So why does Mike's patch have:
Quoted 8 lines
Quoted 4 lines
Signed-off-by Ard Biesheuvel <[email protected]>in it? It seems you haven't been directly involved in Mike's patch.
Because I cc'ed him on the discussion following the patch that is now in your patch system. So he took that patch and modified it, but retained the original S-o-b and authorship.
Right, that's exactly what happened.
Quoted 11 lines
Quoted 10 lines
There's something /really/ not right with the process behind this patch.
Quoted 2 lines
I don't have a preference which patch gets applied, though, so please indicate your preference, and we will adapt accordingly.
I asked for you both to come to a concensus about how you want to proceed, and now you're throwing it back on to me to solve your(pl) mis-communication issue. We haven't heard from Mike yet.
Quoted 4 lines
I am not throwing it back to you. I merely indicated that I have no preference, and since Mike is the one who introduced this issue in the first place, I am expecting him to drive this. And indeed, we haven't heard from him yet.
I didn't know that Ard's patch was already in the patch system. I took the patch from the list, updated it, added a fix for xtensa and resend while retaining Ard's authourship and s-o-b.
Quoted 8 lines
Quoted 4 lines
Clearly, I wasn't blunt and stroppy enough to be properly understood. Sort it out between yourselves and tell me which patch you want me to apply.
I would like you to ack this version of the patch, and disregard the one in the patch system, so that Mike can take this one through the memblock tree where the issue originated in the first place.
Agree.
Signature · 2 lines
Sincerely yours, Mike.
Max Filippov
maintainerQuoted 2 lines · Mike Rapoport
Please let me know how do you prefer to take it upstream. If needed this can go via memblock tree.
Going through the memblock tree sounds right to me.
Signature · 2 lines
Thanks. -- Max
Quoted 5 lines · Max Filippov
Quoted 2 lines · Mike Rapoport
Please let me know how do you prefer to take it upstream. If needed this can go via memblock tree.
Going through the memblock tree sounds right to me.
Can I treat this as Ack?
Quoted 3 lines
Signature · 2 lines
Thanks. -- Max
Signature · 2 lines
Sincerely yours, Mike.
Quoted 9 lines · Mike Rapoport
Quoted 5 lines · Max Filippov
Quoted 2 lines · Mike Rapoport
Please let me know how do you prefer to take it upstream. If needed this can go via memblock tree.
Going through the memblock tree sounds right to me.
Can I treat this as Ack?
Sure, for the xtensa part:
Signature · 2 lines
Thanks. -- Max
Quoted 8 lines · Max Filippov
Quoted 6 lines · Mike Rapoport
Quoted 4 lines · Max Filippov
Quoted 2 lines · Mike Rapoport
Please let me know how do you prefer to take it upstream. If needed this can go via memblock tree.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Going through the memblock tree sounds right to me.
Can I treat this as Ack?
Sure, for the xtensa part:
Acked-by Max Filippov <[email protected]>
Could we get this queued up please?
Quoted 11 lines · Ard Biesheuvel
Quoted 10 lines · Max Filippov
Quoted 8 lines · Mike Rapoport
Quoted 5 lines · Max Filippov
Quoted 2 lines · Mike Rapoport
Please let me know how do you prefer to take it upstream. If needed this can go via memblock tree.
Going through the memblock tree sounds right to me.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Can I treat this as Ack?
Sure, for the xtensa part:
Acked-by Max Filippov <[email protected]>Could we get this queued up please?
It's in memblock/fixes now, I'd like to have it in next for day or two.
Signature · 2 lines
Sincerely yours, Mike.
Hi Russell,
Quoted 4 lines · Mike Rapoport
Quoted 3 lines · Ard Biesheuvel
Quoted 1 line · Russell King - ARM Linux admin
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Clearly, I wasn't blunt and stroppy enough to be properly understood. Sort it out between yourselves and tell me which patch you want me to apply.
I would like you to ack this version of the patch, and disregard the one in the patch system, so that Mike can take this one through the memblock tree where the issue originated in the first place.
Can I please have your ack and move forward with pushing this via memblock tree?
Signature · 2 lines
Sincerely yours, Mike.