189e33ea7SMauro Carvalho Chehab=========================== 2*6486a57fSAlexey DobriyanLivepatch module ELF format 389e33ea7SMauro Carvalho Chehab=========================== 489e33ea7SMauro Carvalho Chehab 5*6486a57fSAlexey DobriyanThis document outlines the ELF format requirements that livepatch modules must follow. 689e33ea7SMauro Carvalho Chehab 789e33ea7SMauro Carvalho Chehab 889e33ea7SMauro Carvalho Chehab.. Table of Contents 989e33ea7SMauro Carvalho Chehab 107af6fbddSMark Brown.. contents:: :local: 117af6fbddSMark Brown 1289e33ea7SMauro Carvalho Chehab 13d9defe44SPetr Mladek1. Background and motivation 14d9defe44SPetr Mladek============================ 1589e33ea7SMauro Carvalho Chehab 1689e33ea7SMauro Carvalho ChehabFormerly, livepatch required separate architecture-specific code to write 1789e33ea7SMauro Carvalho Chehabrelocations. However, arch-specific code to write relocations already 1889e33ea7SMauro Carvalho Chehabexists in the module loader, so this former approach produced redundant 1989e33ea7SMauro Carvalho Chehabcode. So, instead of duplicating code and re-implementing what the module 2089e33ea7SMauro Carvalho Chehabloader can already do, livepatch leverages existing code in the module 2189e33ea7SMauro Carvalho Chehabloader to perform the all the arch-specific relocation work. Specifically, 2289e33ea7SMauro Carvalho Chehablivepatch reuses the apply_relocate_add() function in the module loader to 23*6486a57fSAlexey Dobriyanwrite relocations. The patch module ELF format described in this document 2489e33ea7SMauro Carvalho Chehabenables livepatch to be able to do this. The hope is that this will make 2589e33ea7SMauro Carvalho Chehablivepatch more easily portable to other architectures and reduce the amount 2689e33ea7SMauro Carvalho Chehabof arch-specific code required to port livepatch to a particular 2789e33ea7SMauro Carvalho Chehabarchitecture. 2889e33ea7SMauro Carvalho Chehab 2989e33ea7SMauro Carvalho ChehabSince apply_relocate_add() requires access to a module's section header 30*6486a57fSAlexey Dobriyantable, symbol table, and relocation section indices, ELF information is 3189e33ea7SMauro Carvalho Chehabpreserved for livepatch modules (see section 5). Livepatch manages its own 3289e33ea7SMauro Carvalho Chehabrelocation sections and symbols, which are described in this document. The 33*6486a57fSAlexey DobriyanELF constants used to mark livepatch symbols and relocation sections were 3489e33ea7SMauro Carvalho Chehabselected from OS-specific ranges according to the definitions from glibc. 3589e33ea7SMauro Carvalho Chehab 36d9defe44SPetr MladekWhy does livepatch need to write its own relocations? 37d9defe44SPetr Mladek----------------------------------------------------- 3889e33ea7SMauro Carvalho ChehabA typical livepatch module contains patched versions of functions that can 3989e33ea7SMauro Carvalho Chehabreference non-exported global symbols and non-included local symbols. 4089e33ea7SMauro Carvalho ChehabRelocations referencing these types of symbols cannot be left in as-is 4189e33ea7SMauro Carvalho Chehabsince the kernel module loader cannot resolve them and will therefore 4289e33ea7SMauro Carvalho Chehabreject the livepatch module. Furthermore, we cannot apply relocations that 4389e33ea7SMauro Carvalho Chehabaffect modules not yet loaded at patch module load time (e.g. a patch to a 4489e33ea7SMauro Carvalho Chehabdriver that is not loaded). Formerly, livepatch solved this problem by 4589e33ea7SMauro Carvalho Chehabembedding special "dynrela" (dynamic rela) sections in the resulting patch 46*6486a57fSAlexey Dobriyanmodule ELF output. Using these dynrela sections, livepatch could resolve 4789e33ea7SMauro Carvalho Chehabsymbols while taking into account its scope and what module the symbol 4889e33ea7SMauro Carvalho Chehabbelongs to, and then manually apply the dynamic relocations. However this 4989e33ea7SMauro Carvalho Chehabapproach required livepatch to supply arch-specific code in order to write 5089e33ea7SMauro Carvalho Chehabthese relocations. In the new format, livepatch manages its own SHT_RELA 5189e33ea7SMauro Carvalho Chehabrelocation sections in place of dynrela sections, and the symbols that the 5289e33ea7SMauro Carvalho Chehabrelas reference are special livepatch symbols (see section 2 and 3). The 5389e33ea7SMauro Carvalho Chehabarch-specific livepatch relocation code is replaced by a call to 5489e33ea7SMauro Carvalho Chehabapply_relocate_add(). 5589e33ea7SMauro Carvalho Chehab 56d9defe44SPetr Mladek2. Livepatch modinfo field 57d9defe44SPetr Mladek========================== 5889e33ea7SMauro Carvalho Chehab 5989e33ea7SMauro Carvalho ChehabLivepatch modules are required to have the "livepatch" modinfo attribute. 6089e33ea7SMauro Carvalho ChehabSee the sample livepatch module in samples/livepatch/ for how this is done. 6189e33ea7SMauro Carvalho Chehab 6289e33ea7SMauro Carvalho ChehabLivepatch modules can be identified by users by using the 'modinfo' command 6389e33ea7SMauro Carvalho Chehaband looking for the presence of the "livepatch" field. This field is also 6489e33ea7SMauro Carvalho Chehabused by the kernel module loader to identify livepatch modules. 6589e33ea7SMauro Carvalho Chehab 66d9defe44SPetr MladekExample: 67d9defe44SPetr Mladek-------- 68d9defe44SPetr Mladek 69d9defe44SPetr Mladek**Modinfo output:** 7089e33ea7SMauro Carvalho Chehab 7189e33ea7SMauro Carvalho Chehab:: 7289e33ea7SMauro Carvalho Chehab 7389e33ea7SMauro Carvalho Chehab % modinfo livepatch-meminfo.ko 7489e33ea7SMauro Carvalho Chehab filename: livepatch-meminfo.ko 7589e33ea7SMauro Carvalho Chehab livepatch: Y 7689e33ea7SMauro Carvalho Chehab license: GPL 7789e33ea7SMauro Carvalho Chehab depends: 7889e33ea7SMauro Carvalho Chehab vermagic: 4.3.0+ SMP mod_unload 7989e33ea7SMauro Carvalho Chehab 80d9defe44SPetr Mladek3. Livepatch relocation sections 81d9defe44SPetr Mladek================================ 8289e33ea7SMauro Carvalho Chehab 83*6486a57fSAlexey DobriyanA livepatch module manages its own ELF relocation sections to apply 8489e33ea7SMauro Carvalho Chehabrelocations to modules as well as to the kernel (vmlinux) at the 8589e33ea7SMauro Carvalho Chehabappropriate time. For example, if a patch module patches a driver that is 8689e33ea7SMauro Carvalho Chehabnot currently loaded, livepatch will apply the corresponding livepatch 8789e33ea7SMauro Carvalho Chehabrelocation section(s) to the driver once it loads. 8889e33ea7SMauro Carvalho Chehab 8989e33ea7SMauro Carvalho ChehabEach "object" (e.g. vmlinux, or a module) within a patch module may have 9089e33ea7SMauro Carvalho Chehabmultiple livepatch relocation sections associated with it (e.g. patches to 9189e33ea7SMauro Carvalho Chehabmultiple functions within the same object). There is a 1-1 correspondence 9289e33ea7SMauro Carvalho Chehabbetween a livepatch relocation section and the target section (usually the 9389e33ea7SMauro Carvalho Chehabtext section of a function) to which the relocation(s) apply. It is 9489e33ea7SMauro Carvalho Chehabalso possible for a livepatch module to have no livepatch relocation 9589e33ea7SMauro Carvalho Chehabsections, as in the case of the sample livepatch module (see 9689e33ea7SMauro Carvalho Chehabsamples/livepatch). 9789e33ea7SMauro Carvalho Chehab 98*6486a57fSAlexey DobriyanSince ELF information is preserved for livepatch modules (see Section 5), a 9989e33ea7SMauro Carvalho Chehablivepatch relocation section can be applied simply by passing in the 10089e33ea7SMauro Carvalho Chehabappropriate section index to apply_relocate_add(), which then uses it to 10189e33ea7SMauro Carvalho Chehabaccess the relocation section and apply the relocations. 10289e33ea7SMauro Carvalho Chehab 10389e33ea7SMauro Carvalho ChehabEvery symbol referenced by a rela in a livepatch relocation section is a 10489e33ea7SMauro Carvalho Chehablivepatch symbol. These must be resolved before livepatch can call 10589e33ea7SMauro Carvalho Chehabapply_relocate_add(). See Section 3 for more information. 10689e33ea7SMauro Carvalho Chehab 107d9defe44SPetr Mladek3.1 Livepatch relocation section format 108d9defe44SPetr Mladek======================================= 10989e33ea7SMauro Carvalho Chehab 11089e33ea7SMauro Carvalho ChehabLivepatch relocation sections must be marked with the SHF_RELA_LIVEPATCH 11189e33ea7SMauro Carvalho Chehabsection flag. See include/uapi/linux/elf.h for the definition. The module 11289e33ea7SMauro Carvalho Chehabloader recognizes this flag and will avoid applying those relocation sections 11389e33ea7SMauro Carvalho Chehabat patch module load time. These sections must also be marked with SHF_ALLOC, 11489e33ea7SMauro Carvalho Chehabso that the module loader doesn't discard them on module load (i.e. they will 11589e33ea7SMauro Carvalho Chehabbe copied into memory along with the other SHF_ALLOC sections). 11689e33ea7SMauro Carvalho Chehab 11789e33ea7SMauro Carvalho ChehabThe name of a livepatch relocation section must conform to the following 11889e33ea7SMauro Carvalho Chehabformat:: 11989e33ea7SMauro Carvalho Chehab 12089e33ea7SMauro Carvalho Chehab .klp.rela.objname.section_name 12189e33ea7SMauro Carvalho Chehab ^ ^^ ^ ^ ^ 12289e33ea7SMauro Carvalho Chehab |________||_____| |__________| 12389e33ea7SMauro Carvalho Chehab [A] [B] [C] 12489e33ea7SMauro Carvalho Chehab 125d9defe44SPetr Mladek[A] 126d9defe44SPetr Mladek The relocation section name is prefixed with the string ".klp.rela." 12789e33ea7SMauro Carvalho Chehab 128d9defe44SPetr Mladek[B] 129d9defe44SPetr Mladek The name of the object (i.e. "vmlinux" or name of module) to 130d9defe44SPetr Mladek which the relocation section belongs follows immediately after the prefix. 131d9defe44SPetr Mladek 132d9defe44SPetr Mladek[C] 133d9defe44SPetr Mladek The actual name of the section to which this relocation section applies. 134d9defe44SPetr Mladek 135d9defe44SPetr MladekExamples: 136d9defe44SPetr Mladek--------- 137d9defe44SPetr Mladek 138d9defe44SPetr Mladek**Livepatch relocation section names:** 139d9defe44SPetr Mladek 140d9defe44SPetr Mladek:: 141d9defe44SPetr Mladek 14289e33ea7SMauro Carvalho Chehab .klp.rela.ext4.text.ext4_attr_store 14389e33ea7SMauro Carvalho Chehab .klp.rela.vmlinux.text.cmdline_proc_show 14489e33ea7SMauro Carvalho Chehab 145d9defe44SPetr Mladek**`readelf --sections` output for a patch 146d9defe44SPetr Mladekmodule that patches vmlinux and modules 9p, btrfs, ext4:** 14789e33ea7SMauro Carvalho Chehab 14889e33ea7SMauro Carvalho Chehab:: 14989e33ea7SMauro Carvalho Chehab 15089e33ea7SMauro Carvalho Chehab Section Headers: 15189e33ea7SMauro Carvalho Chehab [Nr] Name Type Address Off Size ES Flg Lk Inf Al 15289e33ea7SMauro Carvalho Chehab [ snip ] 15389e33ea7SMauro Carvalho Chehab [29] .klp.rela.9p.text.caches.show RELA 0000000000000000 002d58 0000c0 18 AIo 64 9 8 15489e33ea7SMauro Carvalho Chehab [30] .klp.rela.btrfs.text.btrfs.feature.attr.show RELA 0000000000000000 002e18 000060 18 AIo 64 11 8 15589e33ea7SMauro Carvalho Chehab [ snip ] 15689e33ea7SMauro Carvalho Chehab [34] .klp.rela.ext4.text.ext4.attr.store RELA 0000000000000000 002fd8 0000d8 18 AIo 64 13 8 15789e33ea7SMauro Carvalho Chehab [35] .klp.rela.ext4.text.ext4.attr.show RELA 0000000000000000 0030b0 000150 18 AIo 64 15 8 15889e33ea7SMauro Carvalho Chehab [36] .klp.rela.vmlinux.text.cmdline.proc.show RELA 0000000000000000 003200 000018 18 AIo 64 17 8 15989e33ea7SMauro Carvalho Chehab [37] .klp.rela.vmlinux.text.meminfo.proc.show RELA 0000000000000000 003218 0000f0 18 AIo 64 19 8 16089e33ea7SMauro Carvalho Chehab [ snip ] ^ ^ 16189e33ea7SMauro Carvalho Chehab | | 16289e33ea7SMauro Carvalho Chehab [*] [*] 163d9defe44SPetr Mladek 164d9defe44SPetr Mladek[*] 165d9defe44SPetr Mladek Livepatch relocation sections are SHT_RELA sections but with a few special 16689e33ea7SMauro Carvalho Chehab characteristics. Notice that they are marked SHF_ALLOC ("A") so that they will 16789e33ea7SMauro Carvalho Chehab not be discarded when the module is loaded into memory, as well as with the 16889e33ea7SMauro Carvalho Chehab SHF_RELA_LIVEPATCH flag ("o" - for OS-specific). 16989e33ea7SMauro Carvalho Chehab 170d9defe44SPetr Mladek**`readelf --relocs` output for a patch module:** 17189e33ea7SMauro Carvalho Chehab 17289e33ea7SMauro Carvalho Chehab:: 17389e33ea7SMauro Carvalho Chehab 17489e33ea7SMauro Carvalho Chehab Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries: 17589e33ea7SMauro Carvalho Chehab Offset Info Type Symbol's Value Symbol's Name + Addend 17689e33ea7SMauro Carvalho Chehab 000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4 17789e33ea7SMauro Carvalho Chehab 0000000000000028 0000003d0000000b R_X86_64_32S 0000000000000000 .klp.sym.btrfs.btrfs_ktype,0 + 0 17889e33ea7SMauro Carvalho Chehab 0000000000000036 0000003b00000002 R_X86_64_PC32 0000000000000000 .klp.sym.btrfs.can_modify_feature.isra.3,0 - 4 17989e33ea7SMauro Carvalho Chehab 000000000000004c 0000004900000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.snprintf,0 - 4 18089e33ea7SMauro Carvalho Chehab [ snip ] ^ 18189e33ea7SMauro Carvalho Chehab | 18289e33ea7SMauro Carvalho Chehab [*] 18389e33ea7SMauro Carvalho Chehab 184d9defe44SPetr Mladek[*] 185d9defe44SPetr Mladek Every symbol referenced by a relocation is a livepatch symbol. 18689e33ea7SMauro Carvalho Chehab 187d9defe44SPetr Mladek4. Livepatch symbols 188d9defe44SPetr Mladek==================== 189d9defe44SPetr Mladek 19089e33ea7SMauro Carvalho ChehabLivepatch symbols are symbols referred to by livepatch relocation sections. 19189e33ea7SMauro Carvalho ChehabThese are symbols accessed from new versions of functions for patched 19289e33ea7SMauro Carvalho Chehabobjects, whose addresses cannot be resolved by the module loader (because 19389e33ea7SMauro Carvalho Chehabthey are local or unexported global syms). Since the module loader only 19489e33ea7SMauro Carvalho Chehabresolves exported syms, and not every symbol referenced by the new patched 19589e33ea7SMauro Carvalho Chehabfunctions is exported, livepatch symbols were introduced. They are used 19689e33ea7SMauro Carvalho Chehabalso in cases where we cannot immediately know the address of a symbol when 19789e33ea7SMauro Carvalho Chehaba patch module loads. For example, this is the case when livepatch patches 19889e33ea7SMauro Carvalho Chehaba module that is not loaded yet. In this case, the relevant livepatch 19989e33ea7SMauro Carvalho Chehabsymbols are resolved simply when the target module loads. In any case, for 20089e33ea7SMauro Carvalho Chehabany livepatch relocation section, all livepatch symbols referenced by that 20189e33ea7SMauro Carvalho Chehabsection must be resolved before livepatch can call apply_relocate_add() for 20289e33ea7SMauro Carvalho Chehabthat reloc section. 20389e33ea7SMauro Carvalho Chehab 20489e33ea7SMauro Carvalho ChehabLivepatch symbols must be marked with SHN_LIVEPATCH so that the module 20589e33ea7SMauro Carvalho Chehabloader can identify and ignore them. Livepatch modules keep these symbols 20689e33ea7SMauro Carvalho Chehabin their symbol tables, and the symbol table is made accessible through 20789e33ea7SMauro Carvalho Chehabmodule->symtab. 20889e33ea7SMauro Carvalho Chehab 209d9defe44SPetr Mladek4.1 A livepatch module's symbol table 210d9defe44SPetr Mladek===================================== 21189e33ea7SMauro Carvalho ChehabNormally, a stripped down copy of a module's symbol table (containing only 21289e33ea7SMauro Carvalho Chehab"core" symbols) is made available through module->symtab (See layout_symtab() 2132cc39179SMasahiro Yamadain kernel/module/kallsyms.c). For livepatch modules, the symbol table copied 2142cc39179SMasahiro Yamadainto memory on module load must be exactly the same as the symbol table produced 2152cc39179SMasahiro Yamadawhen the patch module was compiled. This is because the relocations in each 2162cc39179SMasahiro Yamadalivepatch relocation section refer to their respective symbols with their symbol 2172cc39179SMasahiro Yamadaindices, and the original symbol indices (and thus the symtab ordering) must be 21889e33ea7SMauro Carvalho Chehabpreserved in order for apply_relocate_add() to find the right symbol. 21989e33ea7SMauro Carvalho Chehab 22089e33ea7SMauro Carvalho ChehabFor example, take this particular rela from a livepatch module::: 22189e33ea7SMauro Carvalho Chehab 22289e33ea7SMauro Carvalho Chehab Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries: 22389e33ea7SMauro Carvalho Chehab Offset Info Type Symbol's Value Symbol's Name + Addend 22489e33ea7SMauro Carvalho Chehab 000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4 22589e33ea7SMauro Carvalho Chehab 22689e33ea7SMauro Carvalho Chehab This rela refers to the symbol '.klp.sym.vmlinux.printk,0', and the symbol index is encoded 22789e33ea7SMauro Carvalho Chehab in 'Info'. Here its symbol index is 0x5e, which is 94 in decimal, which refers to the 22889e33ea7SMauro Carvalho Chehab symbol index 94. 22989e33ea7SMauro Carvalho Chehab And in this patch module's corresponding symbol table, symbol index 94 refers to that very symbol: 23089e33ea7SMauro Carvalho Chehab [ snip ] 23189e33ea7SMauro Carvalho Chehab 94: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.printk,0 23289e33ea7SMauro Carvalho Chehab [ snip ] 23389e33ea7SMauro Carvalho Chehab 234d9defe44SPetr Mladek4.2 Livepatch symbol format 235d9defe44SPetr Mladek=========================== 23689e33ea7SMauro Carvalho Chehab 23789e33ea7SMauro Carvalho ChehabLivepatch symbols must have their section index marked as SHN_LIVEPATCH, so 23889e33ea7SMauro Carvalho Chehabthat the module loader can identify them and not attempt to resolve them. 23989e33ea7SMauro Carvalho ChehabSee include/uapi/linux/elf.h for the actual definitions. 24089e33ea7SMauro Carvalho Chehab 24189e33ea7SMauro Carvalho ChehabLivepatch symbol names must conform to the following format:: 24289e33ea7SMauro Carvalho Chehab 24389e33ea7SMauro Carvalho Chehab .klp.sym.objname.symbol_name,sympos 24489e33ea7SMauro Carvalho Chehab ^ ^^ ^ ^ ^ ^ 24589e33ea7SMauro Carvalho Chehab |_______||_____| |_________| | 24689e33ea7SMauro Carvalho Chehab [A] [B] [C] [D] 24789e33ea7SMauro Carvalho Chehab 248d9defe44SPetr Mladek[A] 249d9defe44SPetr Mladek The symbol name is prefixed with the string ".klp.sym." 250d9defe44SPetr Mladek 251d9defe44SPetr Mladek[B] 252d9defe44SPetr Mladek The name of the object (i.e. "vmlinux" or name of module) to 25389e33ea7SMauro Carvalho Chehab which the symbol belongs follows immediately after the prefix. 254d9defe44SPetr Mladek 255d9defe44SPetr Mladek[C] 256d9defe44SPetr Mladek The actual name of the symbol. 257d9defe44SPetr Mladek 258d9defe44SPetr Mladek[D] 259d9defe44SPetr Mladek The position of the symbol in the object (as according to kallsyms) 26089e33ea7SMauro Carvalho Chehab This is used to differentiate duplicate symbols within the same 26189e33ea7SMauro Carvalho Chehab object. The symbol position is expressed numerically (0, 1, 2...). 26289e33ea7SMauro Carvalho Chehab The symbol position of a unique symbol is 0. 26389e33ea7SMauro Carvalho Chehab 264d9defe44SPetr MladekExamples: 265d9defe44SPetr Mladek--------- 266d9defe44SPetr Mladek 267d9defe44SPetr Mladek**Livepatch symbol names:** 26889e33ea7SMauro Carvalho Chehab 26989e33ea7SMauro Carvalho Chehab:: 27089e33ea7SMauro Carvalho Chehab 27189e33ea7SMauro Carvalho Chehab .klp.sym.vmlinux.snprintf,0 27289e33ea7SMauro Carvalho Chehab .klp.sym.vmlinux.printk,0 27389e33ea7SMauro Carvalho Chehab .klp.sym.btrfs.btrfs_ktype,0 27489e33ea7SMauro Carvalho Chehab 275d9defe44SPetr Mladek**`readelf --symbols` output for a patch module:** 27689e33ea7SMauro Carvalho Chehab 27789e33ea7SMauro Carvalho Chehab:: 27889e33ea7SMauro Carvalho Chehab 27989e33ea7SMauro Carvalho Chehab Symbol table '.symtab' contains 127 entries: 28089e33ea7SMauro Carvalho Chehab Num: Value Size Type Bind Vis Ndx Name 28189e33ea7SMauro Carvalho Chehab [ snip ] 28289e33ea7SMauro Carvalho Chehab 73: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.snprintf,0 28389e33ea7SMauro Carvalho Chehab 74: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.capable,0 28489e33ea7SMauro Carvalho Chehab 75: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.find_next_bit,0 28589e33ea7SMauro Carvalho Chehab 76: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.si_swapinfo,0 28689e33ea7SMauro Carvalho Chehab [ snip ] ^ 28789e33ea7SMauro Carvalho Chehab | 28889e33ea7SMauro Carvalho Chehab [*] 289d9defe44SPetr Mladek 290d9defe44SPetr Mladek[*] 291d9defe44SPetr Mladek Note that the 'Ndx' (Section index) for these symbols is SHN_LIVEPATCH (0xff20). 29289e33ea7SMauro Carvalho Chehab "OS" means OS-specific. 29389e33ea7SMauro Carvalho Chehab 294*6486a57fSAlexey Dobriyan5. Symbol table and ELF section access 295d9defe44SPetr Mladek====================================== 29689e33ea7SMauro Carvalho ChehabA livepatch module's symbol table is accessible through module->symtab. 29789e33ea7SMauro Carvalho Chehab 29889e33ea7SMauro Carvalho ChehabSince apply_relocate_add() requires access to a module's section headers, 299*6486a57fSAlexey Dobriyansymbol table, and relocation section indices, ELF information is preserved for 30089e33ea7SMauro Carvalho Chehablivepatch modules and is made accessible by the module loader through 301f412eef0SMarcos Paulo de Souzamodule->klp_info, which is a :c:type:`klp_modinfo` struct. When a livepatch module 302f412eef0SMarcos Paulo de Souzaloads, this struct is filled in by the module loader. 303