aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJessica Yu <jeyu@redhat.com>2016-08-17 20:58:30 -0400
committerJiri Kosina <jkosina@suse.cz>2016-08-18 17:41:56 -0400
commit5ad75fcdd712d18b393c3b3fe52ab4108703d337 (patch)
treeb8d106e952ecb9b45e21b04d5ca436adeb12bd0f
parentd4c3e6e1b193497da3a2ce495fb1db0243e41e37 (diff)
Documentation: livepatch: add section about arch-specific code
Document usage of arch-specific elf sections in livepatch as well as implementation of arch-specific code. [jkosina@suse.cz: fix wording as suggested by Petr Mladek] Signed-off-by: Jessica Yu <jeyu@redhat.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--Documentation/livepatch/module-elf-format.txt20
1 files changed, 16 insertions, 4 deletions
diff --git a/Documentation/livepatch/module-elf-format.txt b/Documentation/livepatch/module-elf-format.txt
index eedbdcf8ba50..f21a5289a09c 100644
--- a/Documentation/livepatch/module-elf-format.txt
+++ b/Documentation/livepatch/module-elf-format.txt
@@ -25,7 +25,8 @@ Table of Contents
25 3.3.2 Required name format 25 3.3.2 Required name format
26 3.3.3 Example livepatch symbol names 26 3.3.3 Example livepatch symbol names
27 3.3.4 Example `readelf --symbols` output 27 3.3.4 Example `readelf --symbols` output
284. Symbol table and Elf section access 284. Architecture-specific sections
295. Symbol table and Elf section access
29 30
30---------------------------- 31----------------------------
310. Background and motivation 320. Background and motivation
@@ -46,7 +47,7 @@ architecture.
46 47
47Since apply_relocate_add() requires access to a module's section header 48Since apply_relocate_add() requires access to a module's section header
48table, symbol table, and relocation section indices, Elf information is 49table, symbol table, and relocation section indices, Elf information is
49preserved for livepatch modules (see section 4). Livepatch manages its own 50preserved for livepatch modules (see section 5). Livepatch manages its own
50relocation sections and symbols, which are described in this document. The 51relocation sections and symbols, which are described in this document. The
51Elf constants used to mark livepatch symbols and relocation sections were 52Elf constants used to mark livepatch symbols and relocation sections were
52selected from OS-specific ranges according to the definitions from glibc. 53selected 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
117sections, as in the case of the sample livepatch module (see 118sections, as in the case of the sample livepatch module (see
118samples/livepatch). 119samples/livepatch).
119 120
120Since Elf information is preserved for livepatch modules (see Section 4), a 121Since Elf information is preserved for livepatch modules (see Section 5), a
121livepatch relocation section can be applied simply by passing in the 122livepatch relocation section can be applied simply by passing in the
122appropriate section index to apply_relocate_add(), which then uses it to 123appropriate section index to apply_relocate_add(), which then uses it to
123access the relocation section and apply the relocations. 124access the relocation section and apply the relocations.
@@ -292,8 +293,19 @@ Symbol table '.symtab' contains 127 entries:
292[*] Note that the 'Ndx' (Section index) for these symbols is SHN_LIVEPATCH (0xff20). 293[*] Note that the 'Ndx' (Section index) for these symbols is SHN_LIVEPATCH (0xff20).
293 "OS" means OS-specific. 294 "OS" means OS-specific.
294 295
296---------------------------------
2974. Architecture-specific sections
298---------------------------------
299Architectures may override arch_klp_init_object_loaded() to perform
300additional arch-specific tasks when a target module loads, such as applying
301arch-specific sections. On x86 for example, we must apply per-object
302.altinstructions and .parainstructions sections when a target module loads.
303These sections must be prefixed with ".klp.arch.$objname." so that they can
304be 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--------------------------------------
2964. Symbol table and Elf section access 3085. Symbol table and Elf section access
297-------------------------------------- 309--------------------------------------
298A livepatch module's symbol table is accessible through module->symtab. 310A livepatch module's symbol table is accessible through module->symtab.
299 311