mips: export icache_flush_range
PATCH 1/1 mips: export icache_flush_range
The lkdtm module performs tests against executable memory ranges, so it needs to flush the icache for proper behaviors. Other architectures already export this, so do the same for MIPS.
---
This is currently untested! I'm building a MIPS cross-compiler now... If someone can validate this fixes the build when lkdtm is a module, that would be appreciated. :)
--- arch/mips/mm/cache.c | 1 + 1 file changed, 1 insertion(+)
arch/mips/mm/cache.c +1 -0
@@ -38,6 +38,7 @@ void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);void (*__invalidate_kernel_vmap_range)(unsigned long vaddr,int size);EXPORT_SYMBOL_GPL (__flush_kernel_vmap_range); +EXPORT_SYMBOL_GPL (flush_icache_range);/* MIPS specific cache operations */ void (*flush_cache_sigtramp)(unsigned long addr);
Signature · 6 lines
1.7.9.5 -- Kees Cook Chrome OS Security
Quoted 9 lines · Kees Cook
The lkdtm module performs tests against executable memory ranges, so it needs to flush the icache for proper behaviors. Other architectures already export this, so do the same for MIPS.
Signed-off-by Kees Cook <[email protected]>---
This is currently untested! I'm building a MIPS cross-compiler now... If someone can validate this fixes the build when lkdtm is a module, that would be appreciated. :)
Okay, now tested. I reproduced the failure and this patch fixes it. :)
-Kees
Quoted 23 lines
--- arch/mips/mm/cache.c | 1 + 1 file changed, 1 insertion(+)arch/mips/mm/cache.c +1
-1@@ -38,6 +38,7 @@ void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);void (*__invalidate_kernel_vmap_range)(unsigned long vaddr,int size);EXPORT_SYMBOL_GPL (__flush_kernel_vmap_range); +EXPORT_SYMBOL_GPL (flush_icache_range);/* MIPS specific cache operations */ void (*flush_cache_sigtramp)(unsigned long addr); --1.7.9.5
--
Kees Cook
Chrome OS Security
Signature · 2 lines
Kees Cook Chrome OS Security
Hello.
Quoted 18 lines · Kees Cook
The lkdtm module performs tests against executable memory ranges, so it needs to flush the icache for proper behaviors. Other architectures already export this, so do the same for MIPS.
Signed-off-by Kees Cook <[email protected]>---
This is currently untested! I'm building a MIPS cross-compiler now... If someone can validate this fixes the build when lkdtm is a module, that would be appreciated. :)--- arch/mips/mm/cache.c | 1 + 1 file changed, 1 insertion(+)arch/mips/mm/cache.c +0
-0
arch/mips/mm/cache.c void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size); · line 41
Quoted 4 lines
arch/mips/mm/cache.c +1
-0@@ -38,6 +38,7 @@ void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);void (*__invalidate_kernel_vmap_range)(unsigned long vaddr,int size);EXPORT_SYMBOL_GPL (__flush_kernel_vmap_range); +EXPORT_SYMBOL_GPL (flush_icache_range);
Have you run this thru scripts/checkpatch.pl? It would have told you that
an export should immediately follow the corresponding function body, AFAIK.
WBR, Sergei
Quoted 21 lines · Sergei Shtylyov
Quoted 21 lines
The lkdtm module performs tests against executable memory ranges, so it needs to flush the icache for proper behaviors. Other architectures already export this, so do the same for MIPS.
Signed-off-by Kees Cook <[email protected]>---
This is currently untested! I'm building a MIPS cross-compiler now... If someone can validate this fixes the build when lkdtm is a module, that would be appreciated. :)--- arch/mips/mm/cache.c | 1 + 1 file changed, 1 insertion(+)arch/mips/mm/cache.c +0
-0@@ -38,6 +38,7 @@ void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);void (*__invalidate_kernel_vmap_range)(unsigned long vaddr,int size);
Quoted 5 lines
arch/mips/mm/cache.c void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size); · line 41
Quoted 2 lines
arch/mips/mm/cache.c +1
-0EXPORT_SYMBOL_GPL (__flush_kernel_vmap_range); +EXPORT_SYMBOL_GPL (flush_icache_range);Have you run this thru
scripts/checkpatch.pl? It would have told you that
an export should immediately follow the corresponding function body, AFAIK.
Hm, it doesn't now but definitely used to...
WBR, Sergei
Quoted 21 lines · Sergei Shtylyov
Quoted 21 lines
Quoted 21 lines
The lkdtm module performs tests against executable memory ranges, so it needs to flush the icache for proper behaviors. Other architectures already export this, so do the same for MIPS.
Signed-off-by Kees Cook <[email protected]>---
This is currently untested! I'm building a MIPS cross-compiler now... If someone can validate this fixes the build when lkdtm is a module, that would be appreciated. :)--- arch/mips/mm/cache.c | 1 + 1 file changed, 1 insertion(+)arch/mips/mm/cache.c +0
-0@@ -38,6 +38,7 @@ void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);void (*__invalidate_kernel_vmap_range)(unsigned long vaddr,int size);
Quoted 7 lines
Quoted 5 lines
arch/mips/mm/cache.c void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size); · line 41
Quoted 2 lines
arch/mips/mm/cache.c +1
-0EXPORT_SYMBOL_GPL (__flush_kernel_vmap_range); +EXPORT_SYMBOL_GPL (flush_icache_range);Have you run this thru
scripts/checkpatch.pl? It would have told you that
an export should immediately follow the corresponding function body, AFAIK.Hm, it doesn't now but definitely used to...
Decided to check Documentation/CodingStyle, and it still codifies this:
In source files, separate functions with one blank line. If the function is exported, the EXPORT* macro for it should follow immediately after the closing function brace line. E.g.:
int system_is_up(void)
{
return system_state == SYSTEM_RUNNING;
}EXPORT_SYMBOL(system_is_up);
WBR, Sergei
Quoted 46 lines · Sergei Shtylyov
Quoted 34 lines · Sergei Shtylyov
Quoted 24 lines
Quoted 24 lines
The lkdtm module performs tests against executable memory ranges, so it needs to flush the icache for proper behaviors. Other architectures already export this, so do the same for MIPS.
Signed-off-by Kees Cook <[email protected]>---
This is currently untested! I'm building a MIPS cross-compiler now... If someone can validate this fixes the build when lkdtm is a module, that would be appreciated. :)--- arch/mips/mm/cache.c | 1 + 1 file changed, 1 insertion(+)arch/mips/mm/cache.c +0
-0@@ -38,6 +38,7 @@ void (*__flush_kernel_vmap_range)(unsigned long vaddr,int
size);
void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size);Quoted 8 lines
Quoted 2 lines
EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range);
+EXPORT_SYMBOL_GPL(flush_icache_range);Have you run this thru
scripts/checkpatch.pl? It would have told you
that
an export should immediately follow the corresponding function body, AFAIK.Quoted 1 line
Hm, it doesn't now but definitely used to...
Decided to check
Documentation/CodingStyle, and it still codifies this:In source files, separate functions with one blank line. If the function is exported, the EXPORT* macro for it should follow immediately after the closing
function brace line. E.g.:
Quoted 7 lines
int
system_is_up(void){ return system_state == SYSTEM_RUNNING; }
EXPORT_SYMBOL(system_is_up);WBR, Sergei
Yup, thanks. I know the style, but it seemed from the source file that the style was to declare the function pointers in bulk, and then explicitly export them in the next section, so I continued that style. For example:
void (*flush_cache_sigtramp)(unsigned long addr); void (*local_flush_data_cache_page)(void * addr); void (*flush_data_cache_page)(unsigned long addr); void (*flush_icache_all)(void);
EXPORT_SYMBOL_GPL(local_flush_data_cache_page);EXPORT_SYMBOL(flush_data_cache_page);EXPORT_SYMBOL(flush_icache_all);
Regardless, I'm happy to stick it in the middle of the function pointers if that's preferred.
-Kees
Signature · 2 lines
Kees Cook Chrome OS Security
Quoted 55 lines · Kees Cook
Quoted 39 lines
Quoted 30 lines
Quoted 22 lines
Quoted 22 lines
The lkdtm module performs tests against executable memory ranges, so it needs to flush the icache for proper behaviors. Other architectures already export this, so do the same for MIPS.
Signed-off-by Kees Cook <[email protected]>---
This is currently untested! I'm building a MIPS cross-compiler now... If someone can validate this fixes the build when lkdtm is a module, that would be appreciated. :)--- arch/mips/mm/cache.c | 1 + 1 file changed, 1 insertion(+)arch/mips/mm/cache.c +0
-0@@ -38,6 +38,7 @@ void (*__flush_kernel_vmap_range)(unsigned long vaddr,int
size); void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size);Quoted 7 lines
Quoted 2 lines
EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range);+EXPORT_SYMBOL_GPL(flush_icache_range);
Have you run this thru
scripts/checkpatch.pl? It would have told you
that
an export should immediately follow the corresponding function body, AFAIK.Quoted 1 line
Hm, it doesn't now but definitely used to...
Decided to check
Documentation/CodingStyle, and it still codifies this:In source files, separate functions with one blank line. If the function is exported, the EXPORT* macro for it should follow immediately after the closing
function brace line. E.g.:Quoted 5 lines
int
system_is_up(void){ return system_state == SYSTEM_RUNNING; }
EXPORT_SYMBOL(system_is_up);Yup, thanks. I know the style, but it seemed from the source file that the style was to declare the function pointers in bulk, and then explicitly export them in the next section, so I continued that style. For example:
void (*flush_cache_sigtramp)(unsigned long addr); void (*local_flush_data_cache_page)(void * addr); void (*flush_data_cache_page)(unsigned long addr); void (*flush_icache_all)(void);
Quoted 6 lines
EXPORT_SYMBOL_GPL(local_flush_data_cache_page);EXPORT_SYMBOL(flush_data_cache_page);EXPORT_SYMBOL(flush_icache_all);Regardless, I'm happy to stick it in the middle of the function pointers if that's preferred.
Ah, that's a variable! I didn't realize that. Looking into checkpatch.pl,
it should warn about variables as well though... but it doesn't.
Quoted 1 line
-Kees
WBR, Sergei
Quoted 5 lines · Kees Cook
Quoted 4 lines · Kees Cook
The lkdtm module performs tests against executable memory ranges, so it needs to flush the icache for proper behaviors. Other architectures already export this, so do the same for MIPS.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Kees Cook <[email protected]>---
This is currently untested! I'm building a MIPS cross-compiler now... If someone can validate this fixes the build when lkdtm is a module, that would be appreciated. :)Okay, now tested. I reproduced the failure and this patch fixes it. :)
Just checking if this happened to fall through the cracks. The most recent (Apr4) linux-next build for mips still fails with this error.
http://kisskb.ellerman.id.au/kisskb/buildresult/10877159/
Paul.
--
Quoted 29 lines
-Kees
Quoted 23 lines
--- arch/mips/mm/cache.c | 1 + 1 file changed, 1 insertion(+)arch/mips/mm/cache.c +1
-1@@ -38,6 +38,7 @@ void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);void (*__invalidate_kernel_vmap_range)(unsigned long vaddr,int size);EXPORT_SYMBOL_GPL (__flush_kernel_vmap_range); +EXPORT_SYMBOL_GPL (flush_icache_range);/* MIPS specific cache operations */ void (*flush_cache_sigtramp)(unsigned long addr); --1.7.9.5
--
Kees Cook
Chrome OS Security
Quoted 12 lines · Paul Gortmaker
Quoted 11 lines · Kees Cook
Quoted 9 lines · Kees Cook
The lkdtm module performs tests against executable memory ranges, so it needs to flush the icache for proper behaviors. Other architectures already export this, so do the same for MIPS.
Signed-off-by Kees Cook <[email protected]>---
This is currently untested! I'm building a MIPS cross-compiler now... If someone can validate this fixes the build when lkdtm is a module, that would be appreciated. :)
Quoted 7 lines
Quoted 1 line
Okay, now tested. I reproduced the failure and this patch fixes it. :)
Just checking if this happened to fall through the cracks. The most recent (Apr4) linux-next build for mips still fails with this error.
Ralf, you acked this offlist, but someone needs to pull this into the tree?
Quoted 1 line · Ralf Baechle
Acked-by Ralf Baechle <[email protected]>
Thanks!
-Kees
Quoted 33 lines
Paul.
--Quoted 29 lines
-Kees
Quoted 23 lines
--- arch/mips/mm/cache.c | 1 + 1 file changed, 1 insertion(+)arch/mips/mm/cache.c +1
-1@@ -38,6 +38,7 @@ void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);void (*__invalidate_kernel_vmap_range)(unsigned long vaddr,int size);EXPORT_SYMBOL_GPL (__flush_kernel_vmap_range); +EXPORT_SYMBOL_GPL (flush_icache_range);/* MIPS specific cache operations */ void (*flush_cache_sigtramp)(unsigned long addr); --1.7.9.5
--
Kees Cook
Chrome OS Security
Signature · 2 lines
Kees Cook Chrome OS Security