Commit Graph

482 Commits

Author SHA1 Message Date
Panu Matilainen ee5a500fee Filter out garbage sonames from dependencies (ticket #158)
- The original case of empty string ending up in a dependency is already
  taken care of by commit 66a01c977e 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.
2014-01-24 15:02:39 +02:00
Panu Matilainen 0f2a4640de Doh, its .debug_gdb_scripts, not _script (really fix SuseBug:818502) 2013-08-01 16:35:57 +03:00
Florian Festi f6771b6722 Do not filter ld64.* and ld64-* provides and requires
Fixes #988373
2013-07-30 16:35:21 +02:00
Panu Matilainen b9ce1c4d7a Teach debugedit about .debug_gdb_script section (SuseBug:818502) 2013-06-17 15:41:45 +03:00
Panu Matilainen 606749c3b5 Avoid breaking build on older systems which dont know AArch64 2013-06-17 10:17:07 +03:00
Kyle McMartin 389d260ca4 debugedit: handle aarch64 debug_info relocations (RhBug:974860)
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>
2013-06-17 10:06:23 +03:00
Panu Matilainen ea47e7a816 Plug segfault on NULL pointer dereference in debugedit (RhBug:929365)
- Not sure what the right thing to do would be here, ignoring seems
  like a better option than crashing though...
2013-05-22 07:25:41 +03:00
Panu Matilainen e83cc97792 Revert "make "canonicalization(...)shrank by one character" error message 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 1eea433d99
2013-01-09 14:06:56 +02:00
Panu Matilainen 6941d51e7e Alternatively accept files from command line arguments in elfdeps
- Nothing actually needs this, but for testing & debugging command line
  args are often nicer than having to pass stuff via stdin.
2013-01-08 13:57:41 +02:00
Panu Matilainen 39fa042c9e Extract (and optionally require) interpreter from ELF files
- 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.
2013-01-08 11:51:31 +02:00
Panu Matilainen 73bd9636d0 Filter ELF dependencies by name
- 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.
2013-01-07 16:31:52 +02:00
Panu Matilainen b6f159a34c Fake ELF sonames by default (again)
- (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 :-/
2013-01-07 15:27:22 +02:00
Panu Matilainen 8e3ce7417a Centralize elf soname provide addition, comment
- 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.
2013-01-03 17:21:10 +02:00
Panu Matilainen 6c0bdc393d Only fake ELF soname's if requested
- 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.
2013-01-03 14:16:20 +02:00
Panu Matilainen f84a71cdc7 Move elf class marker figuring to helper function, generalize a bit
- 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).
2013-01-03 13:08:03 +02:00
Panu Matilainen e7489abd66 Consolidate elf dependency string generation to helper function
- Figure out the elf class marker early and handle the rest in helper
  to avoid copy-slop code. No functional changes.
2013-01-03 12:11:26 +02:00
thierry.vignaud@gmail.com 1eea433d99 make "canonicalization(...)shrank by one character" error message more usefull
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2012-11-01 11:14:54 +02:00
Panu Matilainen fe252f21b3 Accept files as command line arguments again in rpmdeps (RhBug:807767)
- Commit a25c3c7bac 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.
2012-03-29 11:26:57 +03:00
Panu Matilainen 1684b69611 Warn but dont fail the build on STABS debuginfo (RhBug:725378, others)
- 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.
2012-03-07 13:47:09 +02:00
Panu Matilainen 7c463c32fc Teach debugedit about .debug_macro dwarf section (RhBug:759272) 2011-12-02 12:11:48 +02:00
Panu Matilainen 9958e535ff Eliminate the last two fpio uses in rpm codebase
- 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..
2011-07-08 10:20:02 +03:00
Jakub Jelinek 9d440c488b Add DWARF-4 support to debugedit (RhBug:707677)
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2011-06-17 16:40:20 +03:00
Panu Matilainen f67c47b856 Eliminate bunch of dead assignments on ts vsflags
- 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.
2011-05-30 15:50:29 +03:00
Panu Matilainen b296ddb840 Eliminate a few dead NULL-assignment eliminations in rpmgraph
- There are more but leaving the rest as a reminder to clean
  up rpmGraph() someday when bored enough...
2011-05-30 11:00:31 +03:00
Panu Matilainen a25c3c7bac Spring-cleaning for rpmdeps
- 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
2011-05-30 10:44:43 +03:00
Panu Matilainen fe2167ead9 Bail out of debuginfo if stabs format encountered (RhBug:453506)
- 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.
2011-05-24 17:23:37 +03:00
Panu Matilainen f6579c0ac3 Reflect file classifier errors in rpmdeps exit code
- 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
2011-04-18 12:25:43 +03:00
Panu Matilainen b098c17348 Drop the unused + unmaintained javadeps helper
- 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...
2011-03-25 15:20:26 +02:00
Panu Matilainen b925a084ed Remove unused variable in debugedit 2011-03-04 14:50:30 +02:00
Panu Matilainen fe68483d1b Add switch to allow printing only soname dependencies to elfdeps helper 2011-01-13 10:14:25 +02:00
Panu Matilainen c77f1c6522 Make rpmdeps honor RPM_BUILD_ROOT if set
- 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.
2010-12-01 11:41:28 +02:00
Alexey Gladkov d874afb5cd elfdeps: Fix version definitions processing
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>
2010-10-28 13:25:38 +03:00
Panu Matilainen 7e53dc6ee1 Avoid stepping on toes of relatives, part 2
- Eliminate uses of "class" which is a reserved keyword in C++
2010-09-21 15:02:43 +03:00
Panu Matilainen a68bcb383e Use the common rpmcliQueryFlags for signature verify options in rpm cli too
- 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)
2010-09-03 10:50:37 +03:00
Anssi Hannula 7e7ca4b366 debugedit: fix incorrect error messages regarding -b and -d 2010-09-01 10:01:13 +03:00
Panu Matilainen 1e1a56ee74 Send the mostly broken rpminject and rpmsort "test programs" to shredder 2010-08-24 13:15:29 +03:00
Panu Matilainen 51a05e7a9f Remove signing support from (lib)rpmbuild
- 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
2010-08-20 18:04:11 +03:00
Panu Matilainen d4d87cca0e Yet another unused copy of identifyDepend() hiding inline 2010-08-20 16:00:38 +03:00
Panu Matilainen e951c42146 Remove unused code, hidden away from compiler warnings via inlining 2010-08-20 14:48:44 +03:00
Roland McGrath e6a0b0e566 Make debugedit -i recompute build ID only when any DWARF was actually changed. 2010-05-11 15:09:53 +03:00
Roland McGrath c4b6362353 Whitespace fixups for tools/debugedit.c 2010-05-11 15:09:52 +03:00
Panu Matilainen 40b275b4a7 Fix a few uninitialized variable cases found by clang-analyzer 2010-04-29 10:30:43 +03:00
Panu Matilainen d71964bda5 Lose the useless rpmio refcounting debug junk
- the rpmio API always had this goo, should've gotten rid of it
  back in commit dbdbe8010c but .. oh well
2010-03-22 13:25:57 +02:00
Panu Matilainen 62a60d8716 Gah, stupid thinko in elfdeps
- for DSO's without a soname, we should be adding a *provide* of the
  basename, not require
- dumb regression from commit 87c237bebf
2010-02-25 15:16:39 +02:00
Panu Matilainen 87c237bebf Split elf dependency extraction out of librpmbuild to external helper
- Elf dependency extraction code code lifted from rpmfcELF() and refactored
  to saner pieces. Having it in separate executable also frees librpmbuild
  of libelf dependency, clean up the unnecessary linkage etc from
  autofoo
- This lets internal dependency generator for elf files be
  overridden without losing file coloring (which is required for
  correct multilib handling). It also permits non-native elf files
  (eg when cross-building) to be handled by providing a custom
  elf dependency helper
- On the flip side, this inevitably slows down builds somewhat as
  two fork-exec's are needed for every elf file, but unlike invoking
  something like the python interpreter, this is a slim helper...
- All dependency extractors of the internal dependency generator are now
  external helpers (how twisted is that, huh? :) and thus can be customized
  and filtered through %__foo_provides|requires macros
2010-02-10 11:20:51 +02:00
Panu Matilainen 05b2d979e8 Move <stdio.h> includes out of system.h to the places that need it 2010-01-05 16:06:02 +02:00
Panu Matilainen 8fe27d49e1 Move <ctype.h> include out of system.h to the places that need it 2010-01-05 15:33:47 +02:00
Panu Matilainen e3638c2c86 Remove <string.h> include from system.h into the few places that still need
- most of the places get it through <rpm/rpmstring.h> already
2010-01-05 15:17:34 +02:00
Panu Matilainen 0c15e5feb3 Include <stdlib.h> as necessary instead of system.h
- also loose the related ancient compatibility goo
2010-01-05 15:04:20 +02:00
Panu Matilainen e10e807ce9 Move <mcheck.h> include out of system.h to the couple of places that care
- only two real users inside rpm
- remove mcheck foo from rpminject and rpmsort, we're not interested...
2010-01-05 12:36:37 +02:00