summaryrefslogtreecommitdiff
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* debugedit: Support String/Line table rewriting for larger/smaller paths.Mark Wielaard2017-03-061-252/+1317
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | debugedit --base to --dest rewriting of debug source file paths only supported dest paths that were smaller or equal than the base path (and the size should differ more than 1 character for correct debug lines). All paths were changed "in place". Which could in theory mess up debug str sharing. This rewrite supports base and dest strings of any size (some limitations, see below). This is done by reconstructing the debug_str and debug_line tables and updating the references in the debug_info attributes pointing to these tables. Plus, if necessary (only for ET_REL kernel modules), updating any relocations for the debug_info and debug_line sections. This has the nice benefit of merging any duplicate strings in the debug_str table which might resulting on slightly smaller files. kernel modules are ET_REL files that often contain a lot of duplicate strings. The rewrite uses elfutils (either libebl or libdw) to reconstruct the debug_str table. Since we are changing some section sizes now we cannot just use mmap and rawdata to poke the values, but need to read in and write out the changed sections. This does take a bit more memory because we now also need to keep track of all string/line references. There are still some limitations (already in the original debugedit) not fixed by this rewrite: - DW_AT_comp_dir in .debug_info using DW_FORM_string can not be made larger. We only warn about that now instead of failing. The only producer of DW_FORM_string comp_dirs is binutils gas. It seems simpler to fix gas than to try to support resizing the debug_info section. - A DW_AT_name on a DW_TAG_compile_unit is only rewritten for DW_FORM_strp not for DW_FORM_string. Probably no problem in practice since this wasn't supported originally either. - The debug_line program isn't scanned for DW_LNE_define_file which could in theory define an absolute path that might need rewriting. Again probably not a problem because this wasn't supported before and there are no know producers for this construct. To support the upcoming DWARFv5 in gcc 7 (not on by default), we will need to add support for the new debug_line format and scan the new debug_macro section that can have references to the debug_str table. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Eliminate unnecessary dependency on bfd.h from sepdebugcrcfixMark Wielaard2016-12-091-2/+2
| | | | | | | I think the reliance on bfd.h was a mistake. The code was lifted from bfd, but should be totally independent (it just calculates a CRC). Fix the type to be a normal size_t and include sys/stat.h (which was included through bfd.h) to get the definitions of stat and chmod.
* Make it possible to have unique build-ids across build versions/releases.Mark Wielaard2016-07-291-2/+22
| | | | | | | | | | | Introduce a new macro _unique_build_ids that when set will pass the version and release to find-debuginfo.sh and debugedit to recalculate the build-id of ELF files. Includes two new testcases to make sure the new setting works as expected both when set and unset. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Add sepdebugcrcfix to fixup old style gnu_debuglink CRC checksum.Mark Wielaard2016-07-291-0/+361
| | | | | | | | | | | | | | | | | Some old tools might still use the .gnu_debuglink section to find separate debuginfo files instead of build-id style lookups. When dwz has compresses the .debug files the original CRC in the main ELF file will no longer match. Make sure to run sepdebugcrcfix after dwz to recalculate the CRC. The original fix was created by Jan Kratochvil based on code from GNU binutils BFD. https://bugzilla.redhat.com/show_bug.cgi?id=971119 I added a testcase to make sure the CRCs were all correctly updated after dwz has run to compress a debuginfo package. And a change (plus testcase) to make sure implicit suid binaries didn't accidentially got their suid flag bit. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Remove some unnecessary assignments flagged by cppcheckVille Skyttä2016-07-291-1/+1
|
* Reimplement setprogname() and getprogname() to be generic and portableKamil Rytarowski2016-02-113-8/+6
| | | | | | | | | | | | | | | | | The RPM code contains setprogname()/getprogname() support implemented through compatiblity layer with very old GLIBC (internals supported back to '95 and earlier), before stabilization of the GNU C library. This compatiblity layer (__progname, __assert_progname, setprogname()) is supposed to support well archaic GLIBC, but on the other hand it pollutes the library namespace and introduces unpredicable compillation errors on BSD systems. The functions setprogname() and getprogname() are natively supported in NetBSD and work the same way as __progname from the GNU C library (they are even implemented in the same way - but with a slightly changed logic). The support for very old (20 years and older) GNU C Library is obfuscating the code, because it uses defines over defines without a word of explaination why to do so. It's important to note that the setprogname()/getprogname() was inconstiently implemented in the codebase, duplicating the code and/or functionality. Add new generic functions getprogname() and setprogname() and bind it to: - the current and for two decades stable GNU LIB C implementation, - the current NetBSD implementation (introduces to NetBSD in 2002), - fallback reimplementation functions of the setprogname() and getprogname() functionality for other systems. Don't support anymore old GNU Lib C internals and don't support older NetBSD systems, as they aren't supported for many years. Add to the codebase comments explaining the relevant codeparts.
* Add support for various types of dependencies to rpmdeps toolLubos Kardos2015-09-211-0/+36
| | | | | | | | | | Options added to rpmdeps tool: --recommends --suggests --supplements --enhances --conflicts --obsoletes
* Make sure references to go sources in debuginfo packages go to the installed ↵Jan Kratochvil2015-04-151-2/+2
| | | | | | path and not the source file in the build environment. - Resolves: rhbz#1184221
* Ensure clean paths are used for matching in debugedit (RhBug:1077148)Panu Matilainen2014-03-251-0/+6
| | | | | - Things like extra slashes can cause sources not to be found at all due to path prefix matching, canonicalize the argument paths first.
* Add support for m68kAndreas Schwab2014-03-241-0/+4
| | | | | | Tested on m68k-suse-linux. Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
* Filter out garbage sonames from dependencies (ticket #158)Panu Matilainen2014-01-241-0/+13
| | | | | | | | | | | | - The original case of empty string ending up in a dependency is already taken care of by commit 66a01c977ea198fb05c5df22013884a6973485c5 and soname filtering. However if filtering is disabled, an an empty (or all-whitespace) soname will produce gems like "()(64bit)" on multilib arches, so we need to sanity check the soname itself in elfdeps. - The linker doesn't seem to care what kind of junk the soname contains, we care just a little bit more as eg empty strings and whitespace messes up other things.
* Doh, its .debug_gdb_scripts, not _script (really fix SuseBug:818502)Panu Matilainen2013-08-011-1/+1
|
* Do not filter ld64.* and ld64-* provides and requiresFlorian Festi2013-07-301-1/+2
| | | | Fixes #988373
* Teach debugedit about .debug_gdb_script section (SuseBug:818502)Panu Matilainen2013-06-171-0/+2
|
* Avoid breaking build on older systems which dont know AArch64Panu Matilainen2013-06-171-0/+2
|
* debugedit: handle aarch64 debug_info relocations (RhBug:974860)Kyle McMartin2013-06-171-0/+4
| | | | | | | | AArch64 generates a relocation which must be handled similar to other architectures. Adding this patch allows debugedit to run against the kernel debuginfo. Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
* Plug segfault on NULL pointer dereference in debugedit (RhBug:929365)Panu Matilainen2013-05-221-0/+4
| | | | | - Not sure what the right thing to do would be here, ignoring seems like a better option than crashing though...
* Revert "make "canonicalization(...)shrank by one character" error message ↵Panu Matilainen2013-01-091-1/+1
| | | | | | | | | | more usefull" - The message is not about basedir and destdir, and printing them here only makes the message even more confusing than it was, eg: canonicalization unexpectedly shrank by one character \ ('/home/pmatilai/rpmbuild/BUILD/' vs '/usr/src/debug/') - This reverts commit 1eea433d9961d74dbc797cea7f9bfceab8c16a3e
* Alternatively accept files from command line arguments in elfdepsPanu Matilainen2013-01-081-4/+12
| | | | | - Nothing actually needs this, but for testing & debugging command line args are often nicer than having to pass stuff via stdin.
* Extract (and optionally require) interpreter from ELF filesPanu Matilainen2013-01-081-0/+27
| | | | | | | | | | | | - A dependency on the interpreter is likely to be redundant, but presence of PT_INTERP is a useful indication of whether a file is executable or not: all normal dynamically linked executables have it whether PIE DSO or "plain" executable. Some libraries also have it but they are supposed to be really executable: for example glibc's libc.so and libQtCore.so have it and print out config, version etc information when executed. - For now, we dont actually use the PT_INTERP information for anything apart from the optional require.
* Filter ELF dependencies by namePanu Matilainen2013-01-071-0/+31
| | | | | | | | | | | | | - Instead of vain heuristics on DT_SONAME presence, filter out irregular sonames from all dependencies: linkable library names generally must contain ".so" and start with "lib" for the linker to find it at all, anything else is an exception of one kind or another (the prime exception of ld.so variants we handle here). This weeds out provides for most dlopen()'ed modules etc, and filtering both provides and requires by the same rules means we wont generate requires for things that wont be provided. Of course this also means we can omit things that are in DT_NEEDED, but these should be rare exceptions which the new --no-filter-soname switch is for.
* Fake ELF sonames by default (again)Panu Matilainen2013-01-071-2/+2
| | | | | | | | | | | | - (Private) libraries which might intentionally not have DT_SONAME are still recorded as requires from DT_NEEDED, and there's no way of knowing what's an internal library when generating requires. Not faking the soname in these cases will only result in broken requires in cases that always used to "just work". - Change the switch to --no-fake-soname disabler instead to allow tweaking in special cases but by default we gotta match linker (and ELF specification) behavior, no matter how much we'd like to use this for our own heuristics :-/
* Centralize elf soname provide addition, commentPanu Matilainen2013-01-031-15/+18
| | | | | | | | | - Remember DT_SONAME in the elfInfo struct if encountered and only add it after everything else has been processed. This doesn't change any actual functionality for now, but gives us a single place where to control the addition. - Additionally document what the related DT_DEBUG test is for and clean up the processDynamic() loop and switch-case a bit.
* Only fake ELF soname's if requestedPanu Matilainen2013-01-031-1/+3
| | | | | | | | | | - This helps cutting down the number of bogus provides from dlopen()'ed plugins and internal libraries which preferrably shouldn't have a soname at all. Unfortunately libtool always puts in a soname even if -module -avoid-version is used :-/ - OTOH there are broken libraries which dont have a soname even though they should, so (we need to) allow falling back to the former behavior of faking up a soname from the basename.
* Move elf class marker figuring to helper function, generalize a bitPanu Matilainen2013-01-031-5/+19
| | | | | | | | | | - Determine arch-specific issues by looking at the elf header instead of compile-time #ifdefs, so we'll generate correct dependencies for non-native elf binaries too. Currently this is just alpha which despite being a 64bit system, never had the (64bit) markers in its dependencies. Of course alpha has pretty much already met its mark^H^H er maker by now, but doing the right thing is cheap... Also we'll need similar special cases sooner or later for other archs (such as x32).
* Consolidate elf dependency string generation to helper functionPanu Matilainen2013-01-031-24/+19
| | | | | - Figure out the elf class marker early and handle the rest in helper to avoid copy-slop code. No functional changes.
* make "canonicalization(...)shrank by one character" error message more usefullthierry.vignaud@gmail.com2012-11-011-1/+1
| | | | Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
* Accept files as command line arguments again in rpmdeps (RhBug:807767)Panu Matilainen2012-03-291-5/+13
| | | | | | | | | | - Commit a25c3c7bac95ab7eb55f0ecf0b8793d8da341611 removed what was supposedly a non-supported method of passing files as arguments (instead of the normal stdin method) to rpmdeps. Turns out rpmdeps is even documented to take files as cli args, and that's how Fedora's %filter_setup macros are calling it... - Allow files as arguments again, but in a way that doesn't cause argvFoo() vs popt crash-n-burn.
* Warn but dont fail the build on STABS debuginfo (RhBug:725378, others)Panu Matilainen2012-03-071-1/+1
| | | | | | | | - debugedit doesn't support STABS but there are some crazy cases like PPC Linux kernel which contains both STABS and DWARF debuginfo sections, manually added. A better fix would be erroring out if we didn't find any usable debuginfo and warning otherwise but this at least folks get their kernels built.
* Teach debugedit about .debug_macro dwarf section (RhBug:759272)Panu Matilainen2011-12-021-0/+2
|
* Eliminate the last two fpio uses in rpm codebasePanu Matilainen2011-07-081-1/+1
| | | | | | | - Both relate to reading manifests and it doesn't make the damnest difference what io mode these use as rpmReadPackageManifest() opens its own stream on the fd with fdopen() which works on any io type, not just fpio..
* Add DWARF-4 support to debugedit (RhBug:707677)Jakub Jelinek2011-06-171-7/+20
| | | | Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
* Eliminate bunch of dead assignments on ts vsflagsPanu Matilainen2011-05-301-1/+1
| | | | | | | - The common pattern here is grabbing current flags to a local variable, modifying them for an operation and then restoring, which is fine... but we dont care about the previous flags when we're restoring them.
* Eliminate a few dead NULL-assignment eliminations in rpmgraphPanu Matilainen2011-05-301-5/+5
| | | | | - There are more but leaving the rest as a reminder to clean up rpmGraph() someday when bored enough...
* Spring-cleaning for rpmdepsPanu Matilainen2011-05-301-26/+13
| | | | | | | | | | | - Depgen helpers take nno args, their input comes from stdin. Eliminates popt vs ARGV_t mismatch which would've caused us to blow up if it weren't for a memleak on the generated argv. - Another memleak on the file classifier in case rpmfcClassify() or rpmfcApply() fails - just free all allocated resources at exit. - Remove fluff: fgets() is guaranteed to \0-terminate non-NULL returns, eliminate unused/useless variables - Fixup indentation where busted
* Bail out of debuginfo if stabs format encountered (RhBug:453506)Panu Matilainen2011-05-241-3/+4
| | | | | | | - The previous "silently ignore" policy produces bogus debuginfo packages on some architectures and fails with other mysterious errors on others, better just fail hard until (if ever) somebody adds stabs support.
* Reflect file classifier errors in rpmdeps exit codePanu Matilainen2011-04-181-8/+6
| | | | | | | - rpmfcClassify() or rpmfcApply() failing is pretty fatal to rpmdeps, exit with error code - OTOH argvAdd() and argvSort() can't really fail, ignore their return codes, shutting up another set-but-not-used whine
* Drop the unused + unmaintained javadeps helperPanu Matilainen2011-03-251-1288/+0
| | | | | | | - It contains piles of buffer overflow etc material and AFAIK this has been unused for its entire lifespan of > 10 years, fixing an unused piece of code seems like a waste of time. If somebody shows interest later on it can be resurrected, but in the meanwhile...
* Remove unused variable in debugeditPanu Matilainen2011-03-041-2/+0
|
* Add switch to allow printing only soname dependencies to elfdeps helperPanu Matilainen2011-01-131-3/+5
|
* Make rpmdeps honor RPM_BUILD_ROOT if setPanu Matilainen2010-12-011-1/+1
| | | | | | | - rpmdeps calls the internal dependency generator as an external dependency generator (yes its more than a bit wacky), and the internal generator needs to know the buildroot as path patterns expect non-buildroot paths for accuracy.
* elfdeps: Fix version definitions processingAlexey Gladkov2010-10-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The elfdeps doesn't parse the whole .gnu.version_d section. For example: $ readelf -V /lib/libbz2.so.1 | grep -A3 .gnu.version_d Version definition section '.gnu.version_d' contains 2 entries: Addr: 0x0000000000000884 Offset: 0x000884 Link: 4 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: libbz2.so.1 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: BZLIB_1.0 Before changes: $ echo /lib/libbz2.so.1.0.6 | /usr/lib/rpm/elfdeps -P libbz2.so.1 After changes: $ echo /lib/libbz2.so.1.0.6 | /usr/lib/rpm/elfdeps -P libbz2.so.1(BZLIB_1.0) libbz2.so.1 Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
* Avoid stepping on toes of relatives, part 2Panu Matilainen2010-09-211-6/+6
| | | | - Eliminate uses of "class" which is a reserved keyword in C++
* Use the common rpmcliQueryFlags for signature verify options in rpm cli tooPanu Matilainen2010-09-031-6/+0
| | | | | | | | | | | | - Technically this changes the rpmcliQuery() and rpmcliVerify() API in the sense that we no longer honor the qva->qva_flags for the --nosignature and others, but we assume anybody using these (as if anybody was using the "cli" API) uses rpmcliInit() which takes care of these common bits... shrug. - Ditch ancient and hidden --nopgp --nogpg switches along with the dishwater which are simply alias to --nosignature. - Eliminate now unused qva_flags from rpmInstallArguments (along with a double vsflags goo from rpmgraph)
* debugedit: fix incorrect error messages regarding -b and -dAnssi Hannula2010-09-011-2/+2
|
* Send the mostly broken rpminject and rpmsort "test programs" to shredderPanu Matilainen2010-08-242-802/+0
|
* Remove signing support from (lib)rpmbuildPanu Matilainen2010-08-201-4/+2
| | | | | | | | | | | | | | | | - Signing is better done in an environment completely separated from the process of actually building packages. This is how its generally done anyway by distros, this change just forces the issue. - While signing on build seems handy and saves some io-churn, this is very insecure as your precious secret passphrase remains unencrypted in memory for the entire duration of the build where it's accessible to whatever happens to be building. This change doesn't affect fix the issue of unencrypted passphrase residing in memory and potentially getting swapped out, it only limits the exposure to the actual signing process which isn't subject to unknown scripts poking around. - Minimally preserve rpmbuild's --sign functionality via popt --pipe hack to call rpm --addsign when build completes
* Yet another unused copy of identifyDepend() hiding inlinePanu Matilainen2010-08-201-20/+0
|
* Remove unused code, hidden away from compiler warnings via inliningPanu Matilainen2010-08-201-20/+0
|
* Make debugedit -i recompute build ID only when any DWARF was actually changed.Roland McGrath2010-05-111-11/+21
|