All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] powerpc/64: Fix flush_(d|i)cache_range() called from modules
@ 2017-04-05 11:49 Michael Ellerman
  2017-04-06 13:09 ` [v2] " Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Ellerman @ 2017-04-05 11:49 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: benh, oohall

From: Oliver O'Halloran <oohall@gmail.com>

When the kernel is compiled to use 64bit ABIv2 the _GLOBAL() macro does
not include a global entry point. A function's global entry point is
used when the function is called from a different TOC context and in the
kernel this typically means a call from a module into the vmlinux (or
vice-versa).

There are a few exported asm functions declared with _GLOBAL() and
calling them from a module will likely crash the kernel since any TOC
relative load will yield garbage.

flush_icache_range() and flush_dcache_range() are both exported to
modules, and use the TOC, so must use _GLOBAL_TOC().

Fixes: 721aeaa9fdf3 ("powerpc: Build little endian ppc64 kernel with ABIv2")
Cc: stable@vger.kernel.org # v3.16+
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/misc_64.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

v2: mpe: Drop the big comment, for easier backporting, and because we'll fix
this differently in the medium term to avoid using _GLOBAL_TOC() entirely.

diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index ae179cb1bb3c..c119044cad0d 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -67,7 +67,7 @@ PPC64_CACHES:
  *   flush all bytes from start through stop-1 inclusive
  */
 
-_GLOBAL(flush_icache_range)
+_GLOBAL_TOC(flush_icache_range)
 BEGIN_FTR_SECTION
 	PURGE_PREFETCHED_INS
 	blr
@@ -120,7 +120,7 @@ EXPORT_SYMBOL(flush_icache_range)
  *
  *    flush all bytes from start to stop-1 inclusive
  */
-_GLOBAL(flush_dcache_range)
+_GLOBAL_TOC(flush_dcache_range)
 
 /*
  * Flush the data cache to memory 
-- 
2.7.4

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

* Re: [v2] powerpc/64: Fix flush_(d|i)cache_range() called from modules
  2017-04-05 11:49 [PATCH v2] powerpc/64: Fix flush_(d|i)cache_range() called from modules Michael Ellerman
@ 2017-04-06 13:09 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2017-04-06 13:09 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: oohall

On Wed, 2017-04-05 at 11:49:09 UTC, Michael Ellerman wrote:
> From: Oliver O'Halloran <oohall@gmail.com>
> 
> When the kernel is compiled to use 64bit ABIv2 the _GLOBAL() macro does
> not include a global entry point. A function's global entry point is
> used when the function is called from a different TOC context and in the
> kernel this typically means a call from a module into the vmlinux (or
> vice-versa).
> 
> There are a few exported asm functions declared with _GLOBAL() and
> calling them from a module will likely crash the kernel since any TOC
> relative load will yield garbage.
> 
> flush_icache_range() and flush_dcache_range() are both exported to
> modules, and use the TOC, so must use _GLOBAL_TOC().
> 
> Fixes: 721aeaa9fdf3 ("powerpc: Build little endian ppc64 kernel with ABIv2")
> Cc: stable@vger.kernel.org # v3.16+
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Applied to powerpc fixes.

https://git.kernel.org/powerpc/c/8f5f525d5b83f7d76a6baf9c4e94d4

cheers

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

end of thread, other threads:[~2017-04-06 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05 11:49 [PATCH v2] powerpc/64: Fix flush_(d|i)cache_range() called from modules Michael Ellerman
2017-04-06 13:09 ` [v2] " Michael Ellerman

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.