[Bug 231926] ldd can't operate on a segfaulting binary

2022-10-12 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231926

--- Comment #9 from commit-h...@freebsd.org ---
A commit in branch stable/13 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=a763331899b4bb5502382ce1d5dfc8a35d857e27

commit a763331899b4bb5502382ce1d5dfc8a35d857e27
Author: Konstantin Belousov 
AuthorDate: 2022-09-21 13:55:44 +
Commit: Konstantin Belousov 
CommitDate: 2022-10-13 04:46:01 +

ldd: use direct exec mode unconditionally

PR: 127276, 175339, 231926

(cherry picked from commit 9cabef3d146e9a844813b6bc8952d6cf2e9d45e5)

 usr.bin/ldd/ldd.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.


[Bug 231926] ldd can't operate on a segfaulting binary

2022-10-06 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231926

--- Comment #8 from commit-h...@freebsd.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=9cabef3d146e9a844813b6bc8952d6cf2e9d45e5

commit 9cabef3d146e9a844813b6bc8952d6cf2e9d45e5
Author: Konstantin Belousov 
AuthorDate: 2022-09-21 13:55:44 +
Commit: Konstantin Belousov 
CommitDate: 2022-10-06 15:50:26 +

ldd: use direct exec mode unconditionally

Trying to exec malformed or unusual binary, for instance, a non-FreeBSD
ABI, or using a non-standard interpreter, might give unexpected outcome.

Reported by:The UK's National Cyber Security Centre (NCSC)
Reviewed by:emaste, markj, philip
Discussed with: jhb
Sponsored by:   The FreeBSD Foundation
admbug: 991
PR: 127276, 175339, 231926
MFC after:  1 week
Differential revision:  https://reviews.freebsd.org/D36650

 usr.bin/ldd/ldd.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.


[Bug 231926] ldd can't operate on a segfaulting binary

2018-11-22 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231926

--- Comment #7 from commit-h...@freebsd.org ---
A commit references this bug:

Author: markj
Date: Thu Nov 22 16:52:31 UTC 2018
New revision: 340769
URL: https://svnweb.freebsd.org/changeset/base/340769

Log:
  MFC r339653:
  Add an IMPLEMENTATION NOTES section to ldd.1.

  PR:   231926

Changes:
_U  stable/12/
  stable/12/usr.bin/ldd/ldd.1

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 231926] ldd can't operate on a segfaulting binary

2018-10-23 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231926

--- Comment #6 from commit-h...@freebsd.org ---
A commit references this bug:

Author: markj
Date: Tue Oct 23 13:49:53 UTC 2018
New revision: 339653
URL: https://svnweb.freebsd.org/changeset/base/339653

Log:
  Add an IMPLEMENTATION NOTES section to ldd.1.

  PR:   231926
  Reviewed by:  emaste
  MFC after:1 month

Changes:
  head/usr.bin/ldd/ldd.1

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 231926] ldd can't operate on a segfaulting binary

2018-10-04 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231926

--- Comment #5 from Ed Maste  ---
(In reply to Mark Johnston from comment #4)
Proposed man page addition looks good to me.

Maybe also .Xr readelf.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 231926] ldd can't operate on a segfaulting binary

2018-10-04 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231926

Mark Johnston  changed:

   What|Removed |Added

 Resolution|FIXED   |Not A Bug

--- Comment #4 from Mark Johnston  ---
(In reply to Gleb Popov from comment #2)
"Not a bug" makes more sense to me.

(In reply to Ed Maste from comment #3)
How about:

diff --git a/usr.bin/ldd/ldd.1 b/usr.bin/ldd/ldd.1
index 5a06515ebd87..beff8450fdb6 100644
--- a/usr.bin/ldd/ldd.1
+++ b/usr.bin/ldd/ldd.1
@@ -57,6 +57,14 @@ option displays a verbose listing of the dynamic linking
headers 
 encoded in the executable.
 See the source code and include
 files for the definitive meaning of all the fields.
+.Sh IMPLEMENTATION NOTES
+.Nm
+lists the dependencies of an executable by setting
+.Xr rtld 1
+environment variables and running the executable in a child process.
+If the executable is corrupt or invalid,
+.Nm
+may fail without providing any diagnostic error messages.
 .Sh EXAMPLES
 The following is an example of a shell pipeline which uses the
 .Fl f

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 231926] ldd can't operate on a segfaulting binary

2018-10-04 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231926

Ed Maste  changed:

   What|Removed |Added

 CC||ema...@freebsd.org

--- Comment #3 from Ed Maste  ---
(In reply to Gleb Popov from comment #2)
Perhaps we should have a note in ldd(1) though mentioning this issue, as it can
be surprising.

Aside, you can find first-level shared obj dependencies via readelf -d.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 231926] ldd can't operate on a segfaulting binary

2018-10-04 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231926

Gleb Popov  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|New |Closed

--- Comment #2 from Gleb Popov  ---
Given I see nothing sensible in the backtrace, it is highly likely that the
crash occurs before main. Should I close this PR with "Not a bug" then?

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 231926] ldd can't operate on a segfaulting binary

2018-10-03 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231926

Mark Johnston  changed:

   What|Removed |Added

 CC||ma...@freebsd.org

--- Comment #1 from Mark Johnston  ---
ldd is very simple: it sets some magic rtld flags and exec()s the specified
executable (or uses dlopen(RTLD_TRACE) for shared libs).  For an executable,
rtld will then print the dependencies and exit without actually calling into
the executable.  So a bug in the executable's code which causes a segfault
should not be triggered when run by ldd, but if the executable itself is
corrupted or invalid in some way, rtld may crash.  This may or may not be a bug
in rtld, depending on the nature of the corruption.

In other words, if the executable is segfaulting before main() gets invoked,
then the behaviour you're seeing is probably expected.  To say for sure, we
need to see exactly where the segfault is occurring.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 231926] ldd can't operate on a segfaulting binary

2018-10-03 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231926

Bug ID: 231926
   Summary: ldd can't operate on a segfaulting binary
   Product: Base System
   Version: CURRENT
  Hardware: Any
OS: Any
Status: New
  Severity: Affects Some People
  Priority: ---
 Component: bin
  Assignee: b...@freebsd.org
  Reporter: arr...@freebsd.org

When compiling lang/ghc port on FreeBSD 12, an executable named ghc-iserv-prof
gets corrupted by some unrelated bug and segfaults when being launched. During
`make stage-qa` the following command is called by qa.sh:

env LD_LIBMAP_DISABLE=1 ldd -a
/wrkdirs/usr/ports/lang/ghc/work/stage/usr/local/lib/ghc-8.4.3/bin/ghc-iserv-prof

This command also results in a segfault with the same message:

/wrkdirs/usr/ports/lang/ghc/work/stage/usr/local/lib/ghc-8.4.3/bin/ghc-iserv-prof:
signal 11

I'm not sure if this is a bug in ldd, but I've got an impression that it
shouldn't segfault even when given a broken executable.

To reproduce on FreeBSD 12:

# pkg install ghc
# env LD_LIBMAP_DISABLE=1 ldd -a /usr/local/lib/ghc-8.4.3/bin/ghc-iserv-prof

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"