#
729d2b16 |
| 22-Aug-2024 |
Jessica Clarke <jrtc27@FreeBSD.org> |
rtld-elf: Support IFUNCs on riscv
GNU/Linux has historically had the following two resolver prototypes:
1. Elf_Addr(uint64_t, void *) 2. Elf_Addr(uint64_t, void *, void *)
For the former, AT_H
rtld-elf: Support IFUNCs on riscv
GNU/Linux has historically had the following two resolver prototypes:
1. Elf_Addr(uint64_t, void *) 2. Elf_Addr(uint64_t, void *, void *)
For the former, AT_HWCAP is passed in the first argument, and NULL in the second. For the latter, AT_HWCAP is still passed, and the second argument is a pointer to their home-grown __riscv_hwprobe function. Should they want to use the third argument in future, they'll have to introduce yet another prototype to allow for later expansion, and then all users will have to check whether the second argument is NULL to know if the third argument really exists. This is all rather silly and will surely prove fun in the face of type-checking CFI.
Instead, be like arm64 and just define all 8 possible general purpose register arguments up front. To naive source code that forgets non-Linux OSes exist this will be compatible with prototype 1 above, since the second argument will be 0 and it won't look further (though should we start using the second argument for something that wouldn't be true any more and it might think it's __riscv_hwprobe, but that incompatibility is one we can defer committing to, and can choose to never adopt).
Until the standard interface for querying extension information[1] is settled and implemented in FreeBSD there's not much you can do in a resolver other than use HWCAP_ISA_B, but this gets the infrastructure in place for when that day comes.
[1] https://github.com/riscv-non-isa/riscv-c-api-doc/pull/74
Reviewed by: kib, mhorne MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D46278
show more ...
|
Revision tags: release/14.1.0 |
|
#
dd4155be |
| 07-May-2024 |
Andrew Turner <andrew@FreeBSD.org> |
rtld: Add arch_digest_dynamic
This will be used to handle the DT_AARCH64_VARIANT_PCS tag.
Reviewed by: kib Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45117
|
#
06db20ff |
| 07-May-2024 |
Andrew Turner <andrew@FreeBSD.org> |
rtld: Add MD_OBJ_ENTRY to extend Struct_Obj_Entry
Add a macro the architectures can use to add per-arch fields to Struct_Obj_Entry.
Reviewed by: kib Sponsored by: Arm Ltd Differential Revision: htt
rtld: Add MD_OBJ_ENTRY to extend Struct_Obj_Entry
Add a macro the architectures can use to add per-arch fields to Struct_Obj_Entry.
Reviewed by: kib Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45116
show more ...
|
Revision tags: release/13.3.0, release/14.0.0, release/13.2.0 |
|
#
d8925a5f |
| 05-Apr-2023 |
Andrew Turner <andrew@FreeBSD.org> |
Support BTI in rtld
Read the elf note to decide when to set the guard page on arm64.
Reviewed by: kib Sponsored by: Arm Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://revie
Support BTI in rtld
Read the elf note to decide when to set the guard page on arm64.
Reviewed by: kib Sponsored by: Arm Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39452
show more ...
|
#
b3e76948 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
#
b069d3e0 |
| 04-Jan-2023 |
John Baldwin <jhb@FreeBSD.org> |
rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call"
After the removal of ia64 and sparc64, all current architectures support executable stacks at an architectural level.
This rever
rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call"
After the removal of ia64 and sparc64, all current architectures support executable stacks at an architectural level.
This reverts commit 1290d38ac50b3afa7e5781d9d97346a1042c736c.
Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D37904
show more ...
|
Revision tags: release/12.4.0, release/13.1.0 |
|
#
8bcdb144 |
| 09-Dec-2021 |
John Baldwin <jhb@FreeBSD.org> |
TLS: Use <machine/tls.h> for libc and rtld.
- Include <machine/tls.h> in MD rtld_machdep.h headers.
- Remove local definitions of TLS_* constants from rtld_machdep.h headers and libc using the va
TLS: Use <machine/tls.h> for libc and rtld.
- Include <machine/tls.h> in MD rtld_machdep.h headers.
- Remove local definitions of TLS_* constants from rtld_machdep.h headers and libc using the values from <machine/tls.h> instead.
- Use _tcb_set() instead of inlined versions in MD allocate_initial_tls() routines in rtld. The one exception is amd64 whose _tcb_set() invokes the amd64_set_fsbase ifunc. rtld cannot use ifuncs, so amd64 inlines the logic to optionally write to fsbase directly.
- Use _tcb_set() instead of _set_tp() in libc.
- Use '&_tcb_get()->tcb_dtv' instead of _get_tp() in both rtld and libc. This permits removing _get_tp.c from rtld.
- Use TLS_TCB_SIZE and TLS_TCB_ALIGN with allocate_tls() in MD allocate_initial_tls() routines in rtld.
Reviewed by: kib, jrtc27 (earlier version) Differential Revision: https://reviews.freebsd.org/D33353
show more ...
|
Revision tags: release/12.3.0 |
|
#
8f63fa78 |
| 14-Aug-2021 |
Fangrui Song <i@maskray.me> |
rtld: Remove calculate_tls_end
Variant I architectures use off and Variant II ones use size + off. Define TLS_VARIANT_I/TLS_VARIANT_II symbols similarly to how libc handles it.
Reviewed by: kib MFC
rtld: Remove calculate_tls_end
Variant I architectures use off and Variant II ones use size + off. Define TLS_VARIANT_I/TLS_VARIANT_II symbols similarly to how libc handles it.
Reviewed by: kib MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31539 Differential revision: https://reviews.freebsd.org/D31541
show more ...
|
Revision tags: release/13.0.0, release/12.2.0, release/11.4.0 |
|
#
e5c3405c |
| 19-Apr-2020 |
Konstantin Belousov <kib@FreeBSD.org> |
Align initial-exec TLS segments to the p_vaddr % align.
This is continuation of D21163/r359634, which handled the alignment for global mode.
Non-x86 arches are not handled, maintainers are welcomed
Align initial-exec TLS segments to the p_vaddr % align.
This is continuation of D21163/r359634, which handled the alignment for global mode.
Non-x86 arches are not handled, maintainers are welcomed.
Tested by: emaste Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D24366
show more ...
|
Revision tags: release/12.1.0, release/11.3.0, release/12.0.0 |
|
#
3af64f03 |
| 11-Sep-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r338392 through r338594.
|
#
17fb2856 |
| 06-Sep-2018 |
Brooks Davis <brooks@FreeBSD.org> |
Rework rtld's TLS Variant I implementation to match r326794
The above commit fixed handling overaligned TLS segments in libc's TLS Variant I implementation, but rtld provides its own implementation
Rework rtld's TLS Variant I implementation to match r326794
The above commit fixed handling overaligned TLS segments in libc's TLS Variant I implementation, but rtld provides its own implementation for dynamically-linked executables which lacks these fixes. Thus, port these changes to rtld.
This was previously commited as r337978 and reverted in r338149 due to exposing a bug the ARM rtld. This bug was fixed in r338317 by mmel.
Submitted by: James Clarke Approved by: re (kib) Reviewed by: kbowling Testing by: kbowling (powerpc64), br (riscv), kevans (armv7) Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16510
show more ...
|
#
7847e041 |
| 24-Aug-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r338026 through r338297, and resolve conflicts.
|
#
a5207d3e |
| 21-Aug-2018 |
Brooks Davis <brooks@FreeBSD.org> |
Revert r337978: Rework rtld's TLS Variant I implementation to match r326794
Michal Meloun reports that it breaks ctype (isspace()..) related functions on armv7 so back out while we diagnose the issu
Revert r337978: Rework rtld's TLS Variant I implementation to match r326794
Michal Meloun reports that it breaks ctype (isspace()..) related functions on armv7 so back out while we diagnose the issue.
Reported by: Michal Meloun <melounmichal@gmail.com>
show more ...
|
#
3611ec60 |
| 18-Aug-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r337646 through r338014.
|
#
9b50d816 |
| 17-Aug-2018 |
Brooks Davis <brooks@FreeBSD.org> |
Rework rtld's TLS Variant I implementation to match r326794
The above commit fixed handling overaligned TLS segments in libc's TLS Variant I implementation, but rtld provides its own implementation
Rework rtld's TLS Variant I implementation to match r326794
The above commit fixed handling overaligned TLS segments in libc's TLS Variant I implementation, but rtld provides its own implementation for dynamically-linked executables which lacks these fixes. Thus, port these changes to rtld.
Submitted by: James Clarke Reviewed by: kbowling Testing byL kbowling (powerpc64), br (riscv), kevans (armv7) Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16510
show more ...
|
Revision tags: release/11.2.0, release/10.4.0, release/11.1.0 |
|
#
d02c951f |
| 26-May-2017 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r318658 through r318963.
|
#
7fb37371 |
| 26-May-2017 |
Eric van Gyzen <vangyzen@FreeBSD.org> |
rtld: fix warnings about redundant declarations
Fix warnings about redundant declarations in rtld when libthr in increased to WARNS=6.
Reviewed by: kib MFC after: 3 days Sponsored by: Dell EMC Diff
rtld: fix warnings about redundant declarations
Fix warnings about redundant declarations in rtld when libthr in increased to WARNS=6.
Reviewed by: kib MFC after: 3 days Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10934
show more ...
|
#
e35ddbe4 |
| 15-Mar-2017 |
Konstantin Belousov <kib@FreeBSD.org> |
Implement LD_BIND_NOT knob for rtld.
From the manpage: When set to a nonempty string, prevents modifications of the PLT slots when doing bindings. As result, each call of the PLT-resolved function
Implement LD_BIND_NOT knob for rtld.
From the manpage: When set to a nonempty string, prevents modifications of the PLT slots when doing bindings. As result, each call of the PLT-resolved function is resolved. In combination with debug output, this provides complete account of all bind actions at runtime.
Same feature exists on Linux and Solaris.
Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
show more ...
|
#
4f9d94bf |
| 04-Dec-2016 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r309263 through r309518.
|
#
eeef1833 |
| 02-Dec-2016 |
Ed Maste <emaste@FreeBSD.org> |
Retire long-broken/unused static rtld support
rtld-elf has some vestigial support for building as a static executable. r45501 introduced a partial implementation with a prescient note that it "might
Retire long-broken/unused static rtld support
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 Reviewed by: kan MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8687
show more ...
|
#
67bc8c8b |
| 19-Nov-2016 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r308491 through r308841.
|
#
4352999e |
| 15-Nov-2016 |
Konstantin Belousov <kib@FreeBSD.org> |
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.
It is much more clean to use CPUID instruction
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.
It is much more clean to use CPUID instruction in usermode to retrieve this information than to pass AT_HWCAP aux vector from kernel, on x86. Still, the change does allow for use of AT_HWCAP on arches where it is needed, by passing aux array to ifunc_init() initializer which should prepare arguments for ifunc resolvers.
Current signature for resolvers on x86 is func_t iresolve(uint32_t cpu_feature, uint32_t cpu_feature2, uint32_t cpu_stdext_feature, uint32_t cpu_stdext_feature2); where arguments have identical meaning as the kernel variables of the same name. The ABIs allow to use resolvers with the void or shortened list of arguments.
Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D8448
show more ...
|
Revision tags: release/11.0.1, release/11.0.0, release/10.3.0 |
|
#
2414e864 |
| 03-Feb-2016 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
MfH @r295202
Expect to see panics in routing code at least now.
|
#
14d5c08b |
| 26-Jan-2016 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r294599 through r294776.
|
#
f9421853 |
| 25-Jan-2016 |
Glen Barber <gjb@FreeBSD.org> |
MFH
Sponsored by: The FreeBSD Foundation
|