mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 09:10:28 +00:00
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
This commit is contained in:
parent
4f756295e0
commit
9cabef3d14
|
@ -233,18 +233,19 @@ main(int argc, char *argv[])
|
|||
}
|
||||
break;
|
||||
case 0:
|
||||
rtld = _PATH_RTLD;
|
||||
#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED)
|
||||
if (type == TYPE_ELF32)
|
||||
rtld = _COMPAT32_PATH_RTLD;
|
||||
#endif
|
||||
if (is_shlib == 0) {
|
||||
execl(*argv, *argv, (char *)NULL);
|
||||
execl(rtld, rtld, "--",
|
||||
*argv, (char *)NULL);
|
||||
warn("%s", *argv);
|
||||
} else if (fmt1 == NULL && fmt2 == NULL && !aflag) {
|
||||
dlopen(*argv, RTLD_TRACE);
|
||||
warnx("%s: %s", *argv, dlerror());
|
||||
} else {
|
||||
rtld = _PATH_RTLD;
|
||||
#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED)
|
||||
if (type == TYPE_ELF32)
|
||||
rtld = _COMPAT32_PATH_RTLD;
|
||||
#endif
|
||||
execl(rtld, rtld, "-d", "--",
|
||||
*argv, (char *)NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue