LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: ppc64 address space capped at 32TB, mmap randomisation disabled
@ 2013-11-18  3:55 Anton Blanchard
  2013-11-18  3:57 ` Michel Lespinasse
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Blanchard @ 2013-11-18  3:55 UTC (permalink / raw)
  To: benh, paulus, walken, aneesh.kumar; +Cc: linuxppc-dev


Commit fba2369e6ceb (mm: use vm_unmapped_area() on powerpc architecture)
has a bug in slice_scan_available() where we compare an unsigned long
(high_slices) against a shifted int. As a result, comparisons against
the top 32 bits of high_slices (representing the top 32TB) always
returns 0 and the top of our mmap region is clamped at 32TB

This also breaks mmap randomisation since the randomised address is
always up near the top of the address space and it gets clamped down
to 32TB.

Cc: stable@vger.kernel.org # v3.10+
Signed-off-by: Anton Blanchard <anton@samba.org>
---

diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 3e99c14..7ce9cf3 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -258,7 +258,7 @@ static bool slice_scan_available(unsigned long addr,
 		slice = GET_HIGH_SLICE_INDEX(addr);
 		*boundary_addr = (slice + end) ?
 			((slice + end) << SLICE_HIGH_SHIFT) : SLICE_LOW_TOP;
-		return !!(available.high_slices & (1u << slice));
+		return !!(available.high_slices & (1ul << slice));
 	}
 }
 

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

* Re: [PATCH] powerpc: ppc64 address space capped at 32TB, mmap randomisation disabled
  2013-11-18  3:55 [PATCH] powerpc: ppc64 address space capped at 32TB, mmap randomisation disabled Anton Blanchard
@ 2013-11-18  3:57 ` Michel Lespinasse
  0 siblings, 0 replies; 2+ messages in thread
From: Michel Lespinasse @ 2013-11-18  3:57 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: linuxppc-dev, paulus, aneesh.kumar

On Sun, Nov 17, 2013 at 7:55 PM, Anton Blanchard <anton@samba.org> wrote:
>
> Commit fba2369e6ceb (mm: use vm_unmapped_area() on powerpc architecture)
> has a bug in slice_scan_available() where we compare an unsigned long
> (high_slices) against a shifted int. As a result, comparisons against
> the top 32 bits of high_slices (representing the top 32TB) always
> returns 0 and the top of our mmap region is clamped at 32TB
>
> This also breaks mmap randomisation since the randomised address is
> always up near the top of the address space and it gets clamped down
> to 32TB.
>
> Cc: stable@vger.kernel.org # v3.10+
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
> index 3e99c14..7ce9cf3 100644
> --- a/arch/powerpc/mm/slice.c
> +++ b/arch/powerpc/mm/slice.c
> @@ -258,7 +258,7 @@ static bool slice_scan_available(unsigned long addr,
>                 slice = GET_HIGH_SLICE_INDEX(addr);
>                 *boundary_addr = (slice + end) ?
>                         ((slice + end) << SLICE_HIGH_SHIFT) : SLICE_LOW_TOP;
> -               return !!(available.high_slices & (1u << slice));
> +               return !!(available.high_slices & (1ul << slice));
>         }
>  }
>

Good catch, sorry about that...

Acked-by: Michel Lespinasse <walken@google.com>

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

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

end of thread, other threads:[~2013-11-18  3:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-18  3:55 [PATCH] powerpc: ppc64 address space capped at 32TB, mmap randomisation disabled Anton Blanchard
2013-11-18  3:57 ` Michel Lespinasse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox