Skip to contentSkip to conversation

livepatch: Let compiler put module initialized function to section ".init.text"

PATCH In review Minfei Huang 3 participants 3 messages May 22, 2015 Live patching

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 livepatch: Let compiler put module initialized function to section ".init.text"

From: Minfei Huang <[email protected]>

Usually we prefer to let compiler put the module initialized function to section ".init.text". Thus this text in memory will be freed in future.

Once we add the "__init" preceding function name, we can use following command to find it in specfied section.

  $ objdump -t -j .init.text built-in.o

built-in.o: file format elf64-x86-64

SYMBOL TABLE:
0000000000000000 l d .init.text 0000000000000000 .init.text
0000000000000000 l F .init.text 000000000000004e klp_init

---
 kernel/livepatch/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/livepatch/core.c +1 -1
index 284e269..86e40b9 100644
@@ -973,7 +973,7 @@ static struct notifier_block klp_module_nb = {
 	.priority = INT_MIN+1, /* called late but before ftrace notifier */
 };
 
-static int klp_init(void)
+static int __init klp_init(void)
 {
 	int ret;
 
Signature · 1 line
2.2.2
#1 lore raw
Quoted 10 lines · Minfei Huang

From: Minfei Huang <[email protected]>

Usually we prefer to let compiler put the module initialized function to section ".init.text". Thus this text in memory will be freed in future.

Once we add the "__init" preceding function name, we can use following command to find it in specfied section.

  $ objdump -t -j .init.text built-in.o
Quoted 7 lines

built-in.o: file format elf64-x86-64

SYMBOL TABLE:
0000000000000000 l d .init.text 0000000000000000 .init.text
0000000000000000 l F .init.text 000000000000004e klp_init

The patch looks good but can you make the subject more concise? Maybe something like:

livepatch: annotate klp_init() with __init

Thanks.

Signature · 1 line
Josh
#2 lore raw
Quoted 17 lines · Josh Poimboeuf
Quoted 16 lines · Minfei Huang

From: Minfei Huang <[email protected]>

Usually we prefer to let compiler put the module initialized function to section ".init.text". Thus this text in memory will be freed in future.

Once we add the "__init" preceding function name, we can use following command to find it in specfied section.

  $ objdump -t -j .init.text built-in.o

built-in.o: file format elf64-x86-64

SYMBOL TABLE:
0000000000000000 l d .init.text 0000000000000000 .init.text
0000000000000000 l F .init.text 000000000000004e klp_init

Quoted 6 lines
Quoted 1 line

The patch looks good but can you make the subject more concise? Maybe something like:

livepatch: annotate klp_init() with __init

Sure. Will modify the subject.

Thanks
Minfei

Quoted 5 lines

Thanks.

Signature · 1 line
Josh