diff mbox series

riscv: export flush_icache_all

Message ID mvm7e9spggv.fsf@suse.de (mailing list archive)
State New, archived
Headers show
Series riscv: export flush_icache_all | expand

Commit Message

Andreas Schwab June 11, 2019, 10:24 a.m. UTC
Before 58de77545e53 ("riscv: move flush_icache_{all,mm} to cacheflush.c"),
flush_icache_all was a macro, but it is used by a module:

  ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!

Signed-off-by: Andreas Schwab <schwab@suse.de>
---
 arch/riscv/mm/cacheflush.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Christoph Hellwig June 11, 2019, 1:49 p.m. UTC | #1
NAK.  There is no point to export a symbol that should not generally
exported just for a tester.

I think the right answer is to just don't allow a modular build of
lkdtm.

On Tue, Jun 11, 2019 at 12:24:32PM +0200, Andreas Schwab wrote:
> Before 58de77545e53 ("riscv: move flush_icache_{all,mm} to cacheflush.c"),
> flush_icache_all was a macro, but it is used by a module:
> 
>   ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!
> 
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> ---
>  arch/riscv/mm/cacheflush.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c
> index 9ebcff8ba263..4a2e5bf8b21a 100644
> --- a/arch/riscv/mm/cacheflush.c
> +++ b/arch/riscv/mm/cacheflush.c
> @@ -14,6 +14,7 @@ void flush_icache_all(void)
>  {
>  	sbi_remote_fence_i(NULL);
>  }
> +EXPORT_SYMBOL(flush_icache_all);
>  
>  /*
>   * Performs an icache flush for the given MM context.  RISC-V has no direct
> -- 
> 2.22.0
---end quoted text---
Paul Walmsley June 11, 2019, 1:53 p.m. UTC | #2
On Tue, 11 Jun 2019, Andreas Schwab wrote:

> Before 58de77545e53 ("riscv: move flush_icache_{all,mm} to cacheflush.c"),
> flush_icache_all was a macro, but it is used by a module:
> 
>   ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!
> 
> Signed-off-by: Andreas Schwab <schwab@suse.de>

Thanks, queued for v5.2-rc.  Added a "Fixes" line:

Fixes: 58de77545e53 ("riscv: move flush_icache_{all,mm} to cacheflush.c")


- Paul
Paul Walmsley June 11, 2019, 2:02 p.m. UTC | #3
On Tue, 11 Jun 2019, Paul Walmsley wrote:

> On Tue, 11 Jun 2019, Andreas Schwab wrote:
> 
> > Before 58de77545e53 ("riscv: move flush_icache_{all,mm} to cacheflush.c"),
> > flush_icache_all was a macro, but it is used by a module:
> > 
> >   ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!
> > 
> > Signed-off-by: Andreas Schwab <schwab@suse.de>
> 
> Thanks, queued for v5.2-rc.  Added a "Fixes" line:
> 
> Fixes: 58de77545e53 ("riscv: move flush_icache_{all,mm} to 
> cacheflush.c")

Just discussing with Christoph now.  Agree with him that the lkdtm module 
is too niche, and in general we don't want modules calling 
flush_icache_all(), so dropping this patch for now.


- Paul
Andreas Schwab June 11, 2019, 2:12 p.m. UTC | #4
On Jun 11 2019, Paul Walmsley <paul.walmsley@sifive.com> wrote:

> Just discussing with Christoph now.  Agree with him that the lkdtm module 
> is too niche, and in general we don't want modules calling 
> flush_icache_all(), so dropping this patch for now.

Fair enough.  I'll remove the module from the openSUSE kernel.

Andreas.
Kees Cook June 11, 2019, 6:51 p.m. UTC | #5
On Tue, Jun 11, 2019 at 03:49:45PM +0200, Christoph Hellwig wrote:
> NAK.  There is no point to export a symbol that should not generally
> exported just for a tester.

flush_icache_range() is what LKDTM uses (and has done so for years).

> 
> I think the right answer is to just don't allow a modular build of
> lkdtm.

No -- several system builders use a modular build of lkdtm to allow
for testing of "production" kernels, and then do not include lkdtm.ko
in the final image (and that image is either protected by LoadPin or
module signing to keep stray modules from appearing).

-Kees

> On Tue, Jun 11, 2019 at 12:24:32PM +0200, Andreas Schwab wrote:
> > Before 58de77545e53 ("riscv: move flush_icache_{all,mm} to cacheflush.c"),
> > flush_icache_all was a macro, but it is used by a module:
> > 
> >   ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!
> > 
> > Signed-off-by: Andreas Schwab <schwab@suse.de>
> > ---
> >  arch/riscv/mm/cacheflush.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c
> > index 9ebcff8ba263..4a2e5bf8b21a 100644
> > --- a/arch/riscv/mm/cacheflush.c
> > +++ b/arch/riscv/mm/cacheflush.c
> > @@ -14,6 +14,7 @@ void flush_icache_all(void)
> >  {
> >  	sbi_remote_fence_i(NULL);
> >  }
> > +EXPORT_SYMBOL(flush_icache_all);
> >  
> >  /*
> >   * Performs an icache flush for the given MM context.  RISC-V has no direct
> > -- 
> > 2.22.0
> ---end quoted text---
diff mbox series

Patch

diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c
index 9ebcff8ba263..4a2e5bf8b21a 100644
--- a/arch/riscv/mm/cacheflush.c
+++ b/arch/riscv/mm/cacheflush.c
@@ -14,6 +14,7 @@  void flush_icache_all(void)
 {
 	sbi_remote_fence_i(NULL);
 }
+EXPORT_SYMBOL(flush_icache_all);
 
 /*
  * Performs an icache flush for the given MM context.  RISC-V has no direct