summaryrefslogtreecommitdiff
path: root/libkmod/libkmod-elf.c
Commit message (Collapse)AuthorAgeFilesLines
* libkmod-elf: Fix check by class in get_modversions()Lucas De Marchi2014-03-071-1/+1
| | | | | | | | | | | | | | Commit 51c409b ("Cache the offset of crc") unintentinally changed the comparison "if (elf->class & KMOD_ELF_32)" to "if (elf->class == KMOD_ELF_32)". This has been reported by Serge Voilokov <serge0x76@gmail.com>: On Raspberry PI elf->class equals KMOD_ELF_32|KMOD_ELF_LSB so valid condition should be (elf->class & KMOD_ELF_32) instead of (elf->class == KMOD_ELF_32). This fixes "modprobe --dump-modversions" failing on 32b systems.
* Use "-internal" suffix instead of "-private"Lucas De Marchi2013-07-041-1/+1
|
* Use static assertions for sizeof checksLucas De Marchi2013-04-151-5/+5
|
* Update copyright noticesLucas De Marchi2013-01-161-1/+1
|
* libkmod-module: mangle the section header, not the sectionLucas De Marchi2012-11-211-13/+41
| | | | | When we are told to remove the "__versions" section we were mangling that section instead of tweaking the SHF_ALLOC flag in its header.
* libkmod-module: Remove key+value vermagic from .modinfo sectionLucas De Marchi2012-11-211-1/+0
| | | | | | | | | | | | | When told to force load a module, we were removing only the value of vermagic instead of the complete entry. Philippe De Swert (philippe.deswert@jollamobile.com) sent a patch that was additionally mangling also the last two chars of the key ("vermagic="). Instead of creating an invalid entry in .modinfo section like this, this patch removes the complete entry, key + value, by zeroing the entire string. Much thanks to Philippe who found the issue and pointed to the fix.
* Silence clang warnings with __unused__ attributeLucas De Marchi2012-05-231-6/+6
| | | | | | | | I hate this kind of READV and WRITEV macros that Gustavo seems to love. clang-analyzer hates them as well. I'm not motivated enough to refactor this, but I want a clean clang report, so just shut it up.
* Remove dead incrementLucas De Marchi2012-04-261-1/+0
|
* elf: privately export kmod_elf_get_section()Lucas De Marchi2012-01-261-1/+1
| | | | | This function is used to find a certain section in ELF file. It will be used to get the modname from an ELF file.
* Update copyrightLucas De Marchi2012-01-091-1/+1
|
* elf: zero *array when count is zero.Gustavo Sverzut Barbieri2012-01-031-0/+1
|
* elf: implement kmod_module_get_dependency_symbols()Gustavo Sverzut Barbieri2011-12-241-18/+335
| | | | | | | | | Uses kmod_elf_get_dependency_symbols() that looks into ".symtab" for UNDEF symbols and matches the name from ".strtab" to "__versions" to get crc. Likely the public API should unify the symbol information getters and list release, they are almost the same.
* elf: add bind type to kmod_modversion.Gustavo Sverzut Barbieri2011-12-241-0/+26
| | | | will be used to share this structure with get_dependency_symbols()
* elf: add get_symbols()Gustavo Sverzut Barbieri2011-12-241-0/+192
| | | | | | | | Similar to module-init-tools load_symbols(), it will try .symtab and .strtab for symbols starting with __crc_, if they are found their crc is read from ELF's Elf_Sym::st_value. If not found, then it will fallback to __ksymtab_strings.
* elf: minimum size is enough.Gustavo Sverzut Barbieri2011-12-241-1/+1
|
* libkmod: use C99 __func__ over GNU-specific __FUNCTION__Jan Engelhardt2011-12-201-1/+1
|
* Removing warnings when compiling on i686 platform.Luis Felipe Strano Moraes2011-12-201-3/+5
|
* elf: fix regression with empty stringsLucas De Marchi2011-12-201-5/+15
| | | | | | | | | Commit "b20dc17 Remove unneeded reference to last string" reverted the fix in "47a0ef6 elf: do not output empty strings." and empty strings are appearing again in kmod-modinfo. With this commit we do a bit different and instead of keeping the reference to last string we skip the '\0' inside the loop.
* Cache the offset of crcLucas De Marchi2011-12-201-20/+14
| | | | | | This way we don't need to check every time in loop. Indeed compiler could already optimize out that checks, but this ways is cleaner and shorter.
* Make section size constant since it's always the sameLucas De Marchi2011-12-201-10/+11
|
* Optimize kmod_elf_get_strings() by reducing calls to memcpyLucas De Marchi2011-12-201-27/+14
| | | | | Copy the entire string only once and then scan it, setting up the pointers of the vector.
* Remove unneeded reference to last stringLucas De Marchi2011-12-201-7/+0
|
* Put blank lines where it's dueLucas De Marchi2011-12-201-0/+6
| | | | See CODING-STYLE for reference
* Terminate strv with NULLLucas De Marchi2011-12-201-1/+2
|
* Reduce ident by continuing earlyLucas De Marchi2011-12-201-6/+7
|
* elf: skip leading symbol dot in modversion.Gustavo Sverzut Barbieri2011-12-191-0/+4
| | | | | Mimics module-init-tools's dump_modversions() that calls skip_dot() to skip leading dots. This is required for PPC64.
* elf: fix typo that resulted in invalid uint reads for big-endian platforms.Gustavo Sverzut Barbieri2011-12-191-1/+1
|
* elf: do not output empty strings.Gustavo Sverzut Barbieri2011-12-191-1/+12
|
* elf: fix minimum file size calculation.Gustavo Sverzut Barbieri2011-12-191-1/+1
| | | | there is only a single file header, multiple sections.
* ELF: initial support for modinfo and strip of modversions and vermagic.Gustavo Sverzut Barbieri2011-12-191-0/+619
Needs testing, but should work.