diff options
author | Jessica Yu <jeyu@redhat.com> | 2016-08-17 20:58:30 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2016-08-18 17:41:56 -0400 |
commit | 5ad75fcdd712d18b393c3b3fe52ab4108703d337 (patch) | |
tree | b8d106e952ecb9b45e21b04d5ca436adeb12bd0f | |
parent | d4c3e6e1b193497da3a2ce495fb1db0243e41e37 (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.txt | 20 |
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 |
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 | 0. Background and motivation | 32 | 0. Background and motivation |
@@ -46,7 +47,7 @@ architecture. | |||
46 | 47 | ||
47 | Since apply_relocate_add() requires access to a module's section header | 48 | Since apply_relocate_add() requires access to a module's section header |
48 | table, symbol table, and relocation section indices, Elf information is | 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 | relocation sections and symbols, which are described in this document. The | 51 | relocation sections and symbols, which are described in this document. The |
51 | Elf constants used to mark livepatch symbols and relocation sections were | 52 | Elf constants used to mark livepatch symbols and relocation sections were |
52 | selected from OS-specific ranges according to the definitions from glibc. | 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 | sections, as in the case of the sample livepatch module (see | 118 | sections, as in the case of the sample livepatch module (see |
118 | samples/livepatch). | 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 | livepatch relocation section can be applied simply by passing in the | 122 | livepatch relocation section can be applied simply by passing in the |
122 | appropriate section index to apply_relocate_add(), which then uses it to | 123 | appropriate section index to apply_relocate_add(), which then uses it to |
123 | access the relocation section and apply the relocations. | 124 | access 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 | --------------------------------- | ||
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 | A livepatch module's symbol table is accessible through module->symtab. | 310 | A livepatch module's symbol table is accessible through module->symtab. |
299 | 311 | ||