@@ -25,7 +25,8 @@ Table of Contents
25
25
3.3.2 Required name format
26
26
3.3.3 Example livepatch symbol names
27
27
3.3.4 Example `readelf --symbols` output
28
- 4. Symbol table and Elf section access
28
+ 4. Architecture-specific sections
29
+ 5. Symbol table and Elf section access
29
30
30
31
----------------------------
31
32
0. Background and motivation
@@ -46,7 +47,7 @@ architecture.
46
47
47
48
Since apply_relocate_add() requires access to a module's section header
48
49
table, symbol table, and relocation section indices, Elf information is
49
- preserved for livepatch modules (see section 4 ). Livepatch manages its own
50
+ preserved for livepatch modules (see section 5 ). Livepatch manages its own
50
51
relocation sections and symbols, which are described in this document. The
51
52
Elf constants used to mark livepatch symbols and relocation sections were
52
53
selected from OS-specific ranges according to the definitions from glibc.
@@ -117,7 +118,7 @@ also possible for a livepatch module to have no livepatch relocation
117
118
sections, as in the case of the sample livepatch module (see
118
119
samples/livepatch).
119
120
120
- Since Elf information is preserved for livepatch modules (see Section 4 ), a
121
+ Since Elf information is preserved for livepatch modules (see Section 5 ), a
121
122
livepatch relocation section can be applied simply by passing in the
122
123
appropriate section index to apply_relocate_add(), which then uses it to
123
124
access the relocation section and apply the relocations.
@@ -292,8 +293,19 @@ Symbol table '.symtab' contains 127 entries:
292
293
[*] Note that the 'Ndx' (Section index) for these symbols is SHN_LIVEPATCH (0xff20).
293
294
"OS" means OS-specific.
294
295
296
+ ---------------------------------
297
+ 4. Architecture-specific sections
298
+ ---------------------------------
299
+ Architectures may override arch_klp_init_object_loaded() to perform
300
+ additional arch-specific tasks when a target module loads, such as applying
301
+ arch-specific sections. On x86 for example, we must apply per-object
302
+ .altinstructions and .parainstructions sections when a target module loads.
303
+ These sections must be prefixed with ".klp.arch.$objname." so that they can
304
+ be easily identified when iterating through a patch module's Elf sections
305
+ (See arch/x86/kernel/livepatch.c for a complete example).
306
+
295
307
--------------------------------------
296
- 4 . Symbol table and Elf section access
308
+ 5 . Symbol table and Elf section access
297
309
--------------------------------------
298
310
A livepatch module's symbol table is accessible through module->symtab.
299
311
0 commit comments