Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

livepatch: fix ELF typos

ELF is acronym.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/Y/3vWjQ/SBA5a0i5@p183

authored by

Alexey Dobriyan and committed by
Petr Mladek
6486a57f c538944d

+18 -18
+10 -10
Documentation/livepatch/module-elf-format.rst
··· 1 1 =========================== 2 - Livepatch module Elf format 2 + Livepatch module ELF format 3 3 =========================== 4 4 5 - This document outlines the Elf format requirements that livepatch modules must follow. 5 + This document outlines the ELF format requirements that livepatch modules must follow. 6 6 7 7 8 8 .. Table of Contents ··· 20 20 loader can already do, livepatch leverages existing code in the module 21 21 loader to perform the all the arch-specific relocation work. Specifically, 22 22 livepatch reuses the apply_relocate_add() function in the module loader to 23 - write relocations. The patch module Elf format described in this document 23 + write relocations. The patch module ELF format described in this document 24 24 enables livepatch to be able to do this. The hope is that this will make 25 25 livepatch more easily portable to other architectures and reduce the amount 26 26 of arch-specific code required to port livepatch to a particular 27 27 architecture. 28 28 29 29 Since apply_relocate_add() requires access to a module's section header 30 - table, symbol table, and relocation section indices, Elf information is 30 + table, symbol table, and relocation section indices, ELF information is 31 31 preserved for livepatch modules (see section 5). Livepatch manages its own 32 32 relocation sections and symbols, which are described in this document. The 33 - Elf constants used to mark livepatch symbols and relocation sections were 33 + ELF constants used to mark livepatch symbols and relocation sections were 34 34 selected from OS-specific ranges according to the definitions from glibc. 35 35 36 36 Why does livepatch need to write its own relocations? ··· 43 43 affect modules not yet loaded at patch module load time (e.g. a patch to a 44 44 driver that is not loaded). Formerly, livepatch solved this problem by 45 45 embedding special "dynrela" (dynamic rela) sections in the resulting patch 46 - module Elf output. Using these dynrela sections, livepatch could resolve 46 + module ELF output. Using these dynrela sections, livepatch could resolve 47 47 symbols while taking into account its scope and what module the symbol 48 48 belongs to, and then manually apply the dynamic relocations. However this 49 49 approach required livepatch to supply arch-specific code in order to write ··· 80 80 3. Livepatch relocation sections 81 81 ================================ 82 82 83 - A livepatch module manages its own Elf relocation sections to apply 83 + A livepatch module manages its own ELF relocation sections to apply 84 84 relocations to modules as well as to the kernel (vmlinux) at the 85 85 appropriate time. For example, if a patch module patches a driver that is 86 86 not currently loaded, livepatch will apply the corresponding livepatch ··· 95 95 sections, as in the case of the sample livepatch module (see 96 96 samples/livepatch). 97 97 98 - Since Elf information is preserved for livepatch modules (see Section 5), a 98 + Since ELF information is preserved for livepatch modules (see Section 5), a 99 99 livepatch relocation section can be applied simply by passing in the 100 100 appropriate section index to apply_relocate_add(), which then uses it to 101 101 access the relocation section and apply the relocations. ··· 291 291 Note that the 'Ndx' (Section index) for these symbols is SHN_LIVEPATCH (0xff20). 292 292 "OS" means OS-specific. 293 293 294 - 5. Symbol table and Elf section access 294 + 5. Symbol table and ELF section access 295 295 ====================================== 296 296 A livepatch module's symbol table is accessible through module->symtab. 297 297 298 298 Since apply_relocate_add() requires access to a module's section headers, 299 - symbol table, and relocation section indices, Elf information is preserved for 299 + symbol table, and relocation section indices, ELF information is preserved for 300 300 livepatch modules and is made accessible by the module loader through 301 301 module->klp_info, which is a :c:type:`klp_modinfo` struct. When a livepatch module 302 302 loads, this struct is filled in by the module loader.
+3 -3
include/linux/module.h
··· 353 353 354 354 #ifdef CONFIG_LIVEPATCH 355 355 /** 356 - * struct klp_modinfo - Elf information preserved from the livepatch module 356 + * struct klp_modinfo - ELF information preserved from the livepatch module 357 357 * 358 - * @hdr: Elf header 358 + * @hdr: ELF header 359 359 * @sechdrs: Section header table 360 360 * @secstrings: String table for the section headers 361 361 * @symndx: The symbol table section index ··· 523 523 bool klp; /* Is this a livepatch module? */ 524 524 bool klp_alive; 525 525 526 - /* Elf information */ 526 + /* ELF information */ 527 527 struct klp_modinfo *klp_info; 528 528 #endif 529 529
+5 -5
kernel/module/livepatch.c
··· 11 11 #include "internal.h" 12 12 13 13 /* 14 - * Persist Elf information about a module. Copy the Elf header, 14 + * Persist ELF information about a module. Copy the ELF header, 15 15 * section header table, section string table, and symtab section 16 16 * index from info to mod->klp_info. 17 17 */ ··· 25 25 if (!mod->klp_info) 26 26 return -ENOMEM; 27 27 28 - /* Elf header */ 28 + /* ELF header */ 29 29 size = sizeof(mod->klp_info->hdr); 30 30 memcpy(&mod->klp_info->hdr, info->hdr, size); 31 31 32 - /* Elf section header table */ 32 + /* ELF section header table */ 33 33 size = sizeof(*info->sechdrs) * info->hdr->e_shnum; 34 34 mod->klp_info->sechdrs = kmemdup(info->sechdrs, size, GFP_KERNEL); 35 35 if (!mod->klp_info->sechdrs) { ··· 37 37 goto free_info; 38 38 } 39 39 40 - /* Elf section name string table */ 40 + /* ELF section name string table */ 41 41 size = info->sechdrs[info->hdr->e_shstrndx].sh_size; 42 42 mod->klp_info->secstrings = kmemdup(info->secstrings, size, GFP_KERNEL); 43 43 if (!mod->klp_info->secstrings) { ··· 45 45 goto free_sechdrs; 46 46 } 47 47 48 - /* Elf symbol section index */ 48 + /* ELF symbol section index */ 49 49 symndx = info->index.sym; 50 50 mod->klp_info->symndx = symndx; 51 51