All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: disable support for relative ksymtab references
@ 2018-08-29  6:47 ` Ard Biesheuvel
  0 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2018-08-29  6:47 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: linux-arch, Ard Biesheuvel, will.deacon, nicholas.piggin, schwab,
	jeyu, akpm, mingo

The newly added code that emits ksymtab entries as pairs of 32-bit
relative references interacts poorly with the way powerpc lays out
its address space: when a module exports a per-CPU variable, the
primary module region covering the ksymtab entry -and thus the 32-bit
relative reference- is too far away from the actual per-CPU variable's
base address (to which the per-CPU offsets are applied to obtain the
respective address of each CPU's copy), resulting in corruption when
the module loader attempts to resolve symbol references of modules
that are loaded on top and link to the exported per-CPU symbol.

So let's disable this feature on powerpc. Even though it implements
CONFIG_RELOCATABLE, it does not implement CONFIG_RANDOMIZE_BASE and
so KASLR kernels (which are the main target of the feature) do not
exist on powerpc anyway.

Reported-by: Andreas Schwab <schwab@linux-m68k.org>
Suggested-by: Nicholas Piggin <nicholas.piggin@gmail.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/powerpc/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index db0b6eebbfa5..a80669209155 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -177,7 +177,6 @@ config PPC
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_MMAP_RND_BITS
 	select HAVE_ARCH_MMAP_RND_COMPAT_BITS	if COMPAT
-	select HAVE_ARCH_PREL32_RELOCATIONS
 	select HAVE_ARCH_SECCOMP_FILTER
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_CBPF_JIT			if !PPC64
-- 
2.17.1

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

* [PATCH] powerpc: disable support for relative ksymtab references
@ 2018-08-29  6:47 ` Ard Biesheuvel
  0 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2018-08-29  6:47 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: nicholas.piggin, schwab, jeyu, mpe, will.deacon, mingo, akpm,
	linux-arch, Ard Biesheuvel

The newly added code that emits ksymtab entries as pairs of 32-bit
relative references interacts poorly with the way powerpc lays out
its address space: when a module exports a per-CPU variable, the
primary module region covering the ksymtab entry -and thus the 32-bit
relative reference- is too far away from the actual per-CPU variable's
base address (to which the per-CPU offsets are applied to obtain the
respective address of each CPU's copy), resulting in corruption when
the module loader attempts to resolve symbol references of modules
that are loaded on top and link to the exported per-CPU symbol.

So let's disable this feature on powerpc. Even though it implements
CONFIG_RELOCATABLE, it does not implement CONFIG_RANDOMIZE_BASE and
so KASLR kernels (which are the main target of the feature) do not
exist on powerpc anyway.

Reported-by: Andreas Schwab <schwab@linux-m68k.org>
Suggested-by: Nicholas Piggin <nicholas.piggin@gmail.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/powerpc/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index db0b6eebbfa5..a80669209155 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -177,7 +177,6 @@ config PPC
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_MMAP_RND_BITS
 	select HAVE_ARCH_MMAP_RND_COMPAT_BITS	if COMPAT
-	select HAVE_ARCH_PREL32_RELOCATIONS
 	select HAVE_ARCH_SECCOMP_FILTER
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_CBPF_JIT			if !PPC64
-- 
2.17.1

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

* Re: [PATCH] powerpc: disable support for relative ksymtab references
@ 2018-08-29  8:09   ` Nicholas Piggin
  0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Piggin @ 2018-08-29  8:09 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-arch, will.deacon, linuxppc-dev, schwab, jeyu, akpm,
	Linus Torvalds, mingo

On Wed, 29 Aug 2018 08:47:53 +0200
Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

> The newly added code that emits ksymtab entries as pairs of 32-bit
> relative references interacts poorly with the way powerpc lays out
> its address space: when a module exports a per-CPU variable, the
> primary module region covering the ksymtab entry -and thus the 32-bit
> relative reference- is too far away from the actual per-CPU variable's
> base address (to which the per-CPU offsets are applied to obtain the
> respective address of each CPU's copy), resulting in corruption when
> the module loader attempts to resolve symbol references of modules
> that are loaded on top and link to the exported per-CPU symbol.
> 
> So let's disable this feature on powerpc. Even though it implements
> CONFIG_RELOCATABLE, it does not implement CONFIG_RANDOMIZE_BASE and
> so KASLR kernels (which are the main target of the feature) do not
> exist on powerpc anyway.

Let's go with this for now. We have a bit more work to do with module
loader, linker, percpu, or all of the above. Thanks everyone.

Linus can you merge this? I think Michael is on vacation this week and
things are pretty crashy without it here. Don't need to call him off
the beach for it.

Thanks,
Nick

> 
> Reported-by: Andreas Schwab <schwab@linux-m68k.org>
> Suggested-by: Nicholas Piggin <nicholas.piggin@gmail.com>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  arch/powerpc/Kconfig | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index db0b6eebbfa5..a80669209155 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -177,7 +177,6 @@ config PPC
>  	select HAVE_ARCH_KGDB
>  	select HAVE_ARCH_MMAP_RND_BITS
>  	select HAVE_ARCH_MMAP_RND_COMPAT_BITS	if COMPAT
> -	select HAVE_ARCH_PREL32_RELOCATIONS
>  	select HAVE_ARCH_SECCOMP_FILTER
>  	select HAVE_ARCH_TRACEHOOK
>  	select HAVE_CBPF_JIT			if !PPC64
> -- 
> 2.17.1
> 

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

* Re: [PATCH] powerpc: disable support for relative ksymtab references
@ 2018-08-29  8:09   ` Nicholas Piggin
  0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Piggin @ 2018-08-29  8:09 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linuxppc-dev, schwab, jeyu, mpe, will.deacon, mingo, akpm,
	linux-arch, Linus Torvalds

On Wed, 29 Aug 2018 08:47:53 +0200
Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

> The newly added code that emits ksymtab entries as pairs of 32-bit
> relative references interacts poorly with the way powerpc lays out
> its address space: when a module exports a per-CPU variable, the
> primary module region covering the ksymtab entry -and thus the 32-bit
> relative reference- is too far away from the actual per-CPU variable's
> base address (to which the per-CPU offsets are applied to obtain the
> respective address of each CPU's copy), resulting in corruption when
> the module loader attempts to resolve symbol references of modules
> that are loaded on top and link to the exported per-CPU symbol.
> 
> So let's disable this feature on powerpc. Even though it implements
> CONFIG_RELOCATABLE, it does not implement CONFIG_RANDOMIZE_BASE and
> so KASLR kernels (which are the main target of the feature) do not
> exist on powerpc anyway.

Let's go with this for now. We have a bit more work to do with module
loader, linker, percpu, or all of the above. Thanks everyone.

Linus can you merge this? I think Michael is on vacation this week and
things are pretty crashy without it here. Don't need to call him off
the beach for it.

Thanks,
Nick

> 
> Reported-by: Andreas Schwab <schwab@linux-m68k.org>
> Suggested-by: Nicholas Piggin <nicholas.piggin@gmail.com>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  arch/powerpc/Kconfig | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index db0b6eebbfa5..a80669209155 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -177,7 +177,6 @@ config PPC
>  	select HAVE_ARCH_KGDB
>  	select HAVE_ARCH_MMAP_RND_BITS
>  	select HAVE_ARCH_MMAP_RND_COMPAT_BITS	if COMPAT
> -	select HAVE_ARCH_PREL32_RELOCATIONS
>  	select HAVE_ARCH_SECCOMP_FILTER
>  	select HAVE_ARCH_TRACEHOOK
>  	select HAVE_CBPF_JIT			if !PPC64
> -- 
> 2.17.1
> 

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

end of thread, other threads:[~2018-08-29 12:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-29  6:47 [PATCH] powerpc: disable support for relative ksymtab references Ard Biesheuvel
2018-08-29  6:47 ` Ard Biesheuvel
2018-08-29  8:09 ` Nicholas Piggin
2018-08-29  8:09   ` Nicholas Piggin

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.