arm64: kernel: Add module symbols _text, _etext.
diff mbox series

Message ID 1594283025-4166-1-git-send-email-sanggil2.kim@samsung.com
State New
Headers show
Series
  • arm64: kernel: Add module symbols _text, _etext.
Related show

Commit Message

sanggil2.kim@samsung.com July 9, 2020, 8:23 a.m. UTC
From: Sanggil Kim <sanggil2.kim@samsung.com>

We have a solution to protect kernel code section(autually from _text to
_etext) by not MMU. In order to do this, we have to know the addresses
of _text and _etext at runtime.

Signed-off-by: Sanggil Kim <sanggil2.kim@samsung.com>
---
 arch/arm64/kernel/head.S | 3 +++
 1 file changed, 3 insertions(+)

Comments

Will Deacon July 9, 2020, 9:49 a.m. UTC | #1
On Thu, Jul 09, 2020 at 05:23:45PM +0900, sanggil2.kim@samsung.com wrote:
> From: Sanggil Kim <sanggil2.kim@samsung.com>
> 
> We have a solution to protect kernel code section(autually from _text to
> _etext) by not MMU. In order to do this, we have to know the addresses
> of _text and _etext at runtime.

Interesting! Can you post patches so that we can implement this solution
upstream? Without an in-tree user, we won't be exporting these symbols.

Thanks,

Will
Christoph Hellwig July 9, 2020, 11:01 a.m. UTC | #2
On Thu, Jul 09, 2020 at 10:49:51AM +0100, Will Deacon wrote:
> On Thu, Jul 09, 2020 at 05:23:45PM +0900, sanggil2.kim@samsung.com wrote:
> > From: Sanggil Kim <sanggil2.kim@samsung.com>
> > 
> > We have a solution to protect kernel code section(autually from _text to
> > _etext) by not MMU. In order to do this, we have to know the addresses
> > of _text and _etext at runtime.
> 
> Interesting! Can you post patches so that we can implement this solution
> upstream? Without an in-tree user, we won't be exporting these symbols.

And even with that I'm pretty sure the code doing the 'protection'
should be built-in and not modular..

Patch
diff mbox series

diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 037421c..09b405e 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -1003,3 +1003,6 @@  SYM_FUNC_START_LOCAL(__primary_switch)
 	adrp	x0, __PHYS_OFFSET
 	br	x8
 SYM_FUNC_END(__primary_switch)
+
+EXPORT_SYMBOL(_text)
+EXPORT_SYMBOL(_etext)