summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf
Commit message (Collapse)AuthorAgeFilesLines
* MFC r310025:bdrewery2017-01-031-2/+2
| | | | Take write lock for rtld_bind before modifying obj_list in dl_iterate_phdr().
* MFC r305148:bdrewery2017-01-032-0/+36
| | | | DIRDEPS_BUILD: Add some missing dirctories to the build.
* MFC r309411: Retire long-broken/unused static rtld supportemaste2017-01-034-19/+11
| | | | | | | | | | | | | | | | | | | rtld-elf has some vestigial support for building as a static executable. r45501 introduced a partial implementation with a prescient note that it "might never be enabled." r153515 introduced ELF symbol versioning support, and removed part of the unused build infrastructure for static rtld. GNU ld populates rela relocation addends and GOT entries with the same values, and rtld's run-time dynamic executable check relied on this. Alternate toolchains may not populate the GOT entries, which caused RTLD_IS_DYNAMIC to return false. Simplify rtld by just removing the unused check. If we want to restore static rtld support later on we ought to introduce a build-time #ifdef flag. PR: 214972
* MFC r310155:kib2016-12-191-1/+1
| | | | Fix typo.
* MFC 308456: Pass the correct flag to find_symdef() from _rtld_bind().jhb2016-12-012-3/+3
| | | | | | | | When symbol versioning was added to rtld, the boolean 'in_plt' argument to find_symdef() was converted to a bitmask of flags. The first flag added was 'SYMLOOK_IN_PLT' which replaced the 'in_plt' bool. This happened to still work by accident as SYMLOOK_IN_PLT had the value of 1 which is the same as 'true', so there should be no functional change.
* MFC r308689:kib2016-11-2320-5/+151
| | | | | | | | | | Pass CPUID[1] %edx (cpu_feature), %ecx (cpu_feature2) and CPUID[7].%ebx (cpu_stdext_feature), %ecx (cpu_stdext_feature2) to the ifunc resolvers on x86. MFC r308925: Adjust r308689 to make rtld compilable with either in-tree or (hopefully) stock gcc 4.2.1 on i386 and other arches.
* MFC r308688:kib2016-11-221-1/+1
| | | | Assert that there is no unresolved symbols during rtld linking.
* MFC r308687:kib2016-11-221-1/+1
| | | | Update hint to utilize user variable.
* MFC r304016:kib2016-08-192-27/+65
| | | | Move defines common between rtld and libsysdecode into the header.
* MFC r304012:kib2016-08-191-0/+4
| | | | Fill phdr and phsize for rtld object.
* MFC r304011:kib2016-08-191-10/+6
| | | | Remove all remaining uses of TAILQ_FOREACH_FROM() from rtld-elf.
* MFC r302908:bdrewery2016-07-221-1/+1
| | | | | | | Fix dlsym(RTLD_NEXT) handling to only return the next library in last library cases. Approved by: re (gjb)
* Fix race for incrementally rebuilding VERSION_MAP.bdrewery2016-07-031-2/+1
| | | | | | | | | | | | | | The dependency is needed in PROG_FULL since only the build of PROG_FULL is using the LDFLAGS and depending on VERSION_MAP. This was not a problem with MK_DEBUG_FILES==no since it only builds PROG. This should probably be using bsd.lib.mk instead [1] Reported by: swills, gjb Reviewed by: emaste Noted by: rgrimes [1] Sponsored by: EMC / Isilon Storage Division Approved by: re (kib)
* Fix issues found by Coverity in the rtld-elf.c:gethints().kib2016-05-251-7/+28
| | | | | | | | | | | | | | | | Check that the dirlist path string specification does not cause overflow and is fully contained in the hints file. Check that the dirlist string is nul-terminated. Make 'hdr' static variable, so that hdr.dirlistlen is available when hints cached value is used on next function calls. Reset hdr.dirlistlen to zero if error was detected, so that allocations use reasonable size. Use 'hints', and not 'p' in the body, since p is only initialized on the first call. Reported and reviewed by: truckman (previous version) Sponsored by: The FreeBSD Foundation CIDs: 1006503, 1006504, 1006676, 1008488, 1007263 MFC after: 2 weeks
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedngie2016-05-043-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division
* libexec: minor spelling fixes in comments.pfg2016-05-012-2/+2
| | | | No functional change.
* rtld-elf: use our roundup2() macro when param.h is available.pfg2016-04-191-2/+2
|
* rtld-elf: use NULL instead of zero for pointers.pfg2016-04-195-5/+5
|
* MFHgjb2016-04-041-0/+3
|\ | | | | | | Sponsored by: The FreeBSD Foundation
| * WITHOUT_TOOLCHAIN: Fix build of rtld.bdrewery2016-03-311-0/+3
| | | | | | | | | | | | | | | | | | | | MK_TOOLCHAIN==no disables building and installing of pic archives. c_pic.a is still needed for rtld though so force it to build in lib/libc and link directly to the objdir version of it for rtld. Somehow this has been broken since r148725. Sponsored by: EMC / Isilon Storage Division
* | MFHgjb2016-03-101-0/+19
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * DIRDEPS_BUILD: Connect MK_TESTS.bdrewery2016-03-091-0/+19
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
| * Fix handling of DT_TEXTREL for an object with more than one read-onlykib2016-03-023-19/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | segment. According to gABI spec, presence of the tag indicates that dynamic linker must be prepared to handle relocations against any read-only segment, not only the segment which we, somewhat arbitrary, declared the text. For each read-only segment, add write permission before relocs are processed, and return to the mapping mode requested by the phdr, after relocs are done. Reported, tested, and reviewed by: emaste PR: 207631 Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* | MFHgjb2016-03-023-19/+42
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | MFHgjb2016-03-021-1/+1
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Convert casperd(8) daemon to the libcasper.oshogbo2016-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After calling the cap_init(3) function Casper will fork from it's original process, using pdfork(2). Forking from a process has a lot of advantages: 1. We have the same cwd as the original process. 2. The same uid, gid and groups. 3. The same MAC labels. 4. The same descriptor table. 5. The same routing table. 6. The same umask. 7. The same cpuset(1). From now services are also in form of libraries. We also removed libcapsicum at all and converts existing program using Casper to new architecture. Discussed with: pjd, jonathan, ed, drysdale@google.com, emaste Partially reviewed by: drysdale@google.com, bdrewery Approved by: pjd (mentor) Differential Revision: https://reviews.freebsd.org/D4277
* | MFHgjb2016-02-181-0/+1
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Fix build race after r295643.bdrewery2016-02-171-0/+1
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
* | Remove libc, librtld_db, libthr packages, and further increasegjb2016-02-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | the constraints on what needs to be installed in a specific to maintain consistency during upgrades. Create a new clibs package containing libraries that are needed as a bare minimum for consistency. With much help and input from: kib Sponsored by: The FreeBSD Foundation
* | Include ld-elf.so and ld-elf32.so in the librtld_dbgjb2016-02-051-0/+1
| | | | | | | | | | | | package. Sponsored by: The FreeBSD Foundation
* | MFHgjb2016-02-021-3/+9
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * This seems like a very trivial bug that should have been squashed a longsobomax2016-01-301-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | time ago, but for some reason it was not. Basically, without this change dlopen(3)'ing an empty .so file would just cause application to dump core with SIGSEGV. Make sure the file has enough data for at least the ELF header before mmap'ing it. Add a test case to check that dlopen an empty file return an error. There were a separate discussion as to whether it should be SIGBUS instead when you try to access region mapped from an empty file, but it's definitely SIGSEGV now, so if anyone want to check that please be my guest. Reviewed by: mjg, cem MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D5112
* | First pass to fix the 'tests' packages.gjb2016-02-023-0/+11
|/ | | | Sponsored by: The FreeBSD Foundation
* Do not unlock rtld_phdr_lock over callback invocations.kan2016-01-271-3/+1
| | | | | | The dl_iterate_phdr consumer code in libgcc does not expect multiple callbacks running concurrently. This was fixed once already in r178807, but accidentally got reverted in r294373.
* Follow r293066 adding a generalized exec hook for RISC-V as well.br2016-01-231-0/+2
|
* Fix initlist_add_object invocation parameters.kan2016-01-201-3/+3
| | | | | | The tail parameter should point to the last object for which dependencies should be processed. In most cases, this is the object itself.
* Do not call callbacks for dl_iterate_phdr(3) with the rtld bind andkib2016-01-2011-105/+182
| | | | | | | | | | | | | | | | | | phdr locks locked. This allows to call rtld services from the callback, which is only reasonable for dlopen(path, RTLD_NOLOAD) to test existence of the library in the image, and for dlsym(). The later might still be not quite safe, due to the lazy resolution of filters. To allow dropping the locks around iteration in dl_iterate_phdr(3), we insert markers to track current position between relocks. The global objects list is converted to tailq and all iterators skip markers, globallist_next() and globallist_curr() helpers are added. Reported and tested by: davide Reviewed by: kan Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
* Restore ABI variants now that ldconfig groks -soft. In addition, as aimp2016-01-183-7/+16
| | | | | | | transition mechanism, if we don't have /usr/libsoft, assume that soft float ABI binaries are the default, so treat them as default binaries. When we've fully transitioned, it will make no sense to do this stat, and it will be removed.
* Remove the compat code to handle the kernel passing us an unalingedandrew2016-01-131-7/+1
| | | | | | | | stackpointer. Userland expects the kernel to pass it an aligned sp and pass a pointer to the arguments in x0. The kernel side was updated in r289502, 3 months ago. Sponsored by: ABT Systems Ltd
* Revert r293201, r293202 (rtld: populate DT_DEBUG iff DYNAMIC segment is ↵emaste2016-01-082-5/+2
| | | | | | | | | | writable) It turns out MIPS binaries may have other oddities that can trigger a fault at startup. PR: 206017 Reported by: ray
* Disable abi variant hook until strangeness with packages can be sortedimp2016-01-051-1/+1
| | | | out.
* rtld: populate DT_DEBUG iff DYNAMIC segment is writableemaste2016-01-051-0/+1
| | | | rtld.h was accidentally missed in r293201
* rtld: populate DT_DEBUG iff DYNAMIC segment is writableemaste2016-01-051-2/+4
| | | | | | | | | | | | | | | | | MIPS has/had a read-only DYNAMIC segment, and uses an extra level of indirection (through MIPS_RLD_MAP) to locate the debugger rendezvous data. Some linkers (e.g. LLVM's lld) may produce MIPS binaries with a writable DYNAMIC segment, which would allow us to eventually drop a special case. Therefore, instead of hardcoding knowledge that DYNAMIC is not writable on MIPS just check the permissions on the segment. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D4791
* rtld: wrap a comment to 80 columnsemaste2016-01-051-2/+2
|
* If md_exec_hook is defined, provide a way to create the stringsimp2016-01-031-2/+18
| | | | | | | for the environment variables we look up at runtime. Otherwise, there's no way they will change, optimize it at compile time. Differential Review: https://reviews.freebsd.org/D2718
* Create a generalized exec hook that different architectures can hookimp2016-01-0311-3/+63
| | | | | | into if they need to, but default to no action. Differential Review: https://reviews.freebsd.org/D2718
* Unify the ELFv1 and ELFv2 code paths and make ELFv1 (the normal ABI) morenwhitehorn2016-01-012-39/+33
| | | | | | correct in the process. MFC after: 2 weeks
* Use a macro to create the names for the library path names. This willimp2015-12-272-23/+26
| | | | | | | allow later substitution at run time instead of compile time of the environment variable name prefix. Differential Review: https://reviews.freebsd.org/D2718
* rtld: remove old XXX comment missed in r35529emaste2015-12-241-1/+0
| | | | Sponsored by: The FreeBSD Foundation
* Add support for RISC-V architecture.br2015-12-244-1/+641
| | | | | | | Reviewed by: andrew, kib Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D4679
OpenPOWER on IntegriCloud