Jeremy Soller
2b06118d5f
Fix deadlock when logging scopes
2025-05-06 21:50:38 -06:00
Jeremy Soller
78bab94ee0
Add end of dynamic library mapping to debug messages
2025-05-06 20:45:39 -06:00
4lDO2
e6c06a7cf7
Fix signals for spawned threads, and async signal waiting.
2025-04-19 19:27:03 +02:00
4lDO2
59090a83f4
Fix thread+proc fd init in ld.so
2025-04-19 19:26:59 +02:00
4lDO2
779c1e60c5
Add todo!() to fix compilation.
2025-04-19 19:26:58 +02:00
4lDO2
ad5efd0f11
Reach init fork
2025-04-19 19:26:57 +02:00
Anhad Singh
c64058c8b7
tcb: aarch64
2025-04-20 02:41:35 +10:00
Jeremy Soller
228d53dcd5
More improvements for relocation handling
2025-04-18 16:03:09 -06:00
Jeremy Soller
03f863d742
ld_so: better support for other arches
2025-04-18 14:26:39 -06:00
Jeremy Soller
310b097da6
Fix check for Sym size
2025-04-18 12:39:27 -06:00
Josh Megnauth
51c04d2470
Use C string literals & deprecate c_str!
2025-03-14 21:17:53 -04:00
Jeremy Soller
da174f9626
Fixes for 32-bit builds
2025-02-07 09:18:56 -07:00
Anhad Singh
d3073fdad4
feat(ld.so): more debug info for scopes
...
When scopes is set for `LD_DEBUG`, more debug information is displayed
now,
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-19 00:11:51 +11:00
Anhad Singh
99449094d4
chore: formatting
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-19 00:03:07 +11:00
Anhad Singh
4a08220664
fix(ld.so): copy relocations
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-18 23:51:53 +11:00
Anhad Singh
e3dc5d0617
chore(dso): remove unused members
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-18 21:20:10 +11:00
Anhad Singh
3440985729
fix(dso): 32-bit
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-15 21:32:40 +11:00
Anhad Singh
07ff79069e
feat(ld.so): add support for DT_RELR
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-15 13:49:27 +11:00
Jeremy Soller
a3c12e27e4
Fix build for i686
2025-01-14 18:01:26 -07:00
Anhad Singh
b9e0505715
fix(ld.so): less locks
...
Acquire the global scope lock at the start of relocate.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-13 23:48:03 +11:00
Jeremy Soller
af50d18d16
Return error instead of panic when load_library cannot find root DSO
2025-01-09 13:33:29 -07:00
Jeremy Soller
02520b194e
Fix compilation with trace feature
2025-01-09 12:23:23 -07:00
Anhad Singh
aae27c5e0c
feat(ld.so): switch to object crate
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-08 16:50:47 +11:00
Anhad Singh
e49072655c
feat(ld.so): partially switch to object
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-08 16:50:10 +11:00
Anhad Singh
e219f9768e
feat(ld.so): GNU hash table
...
Note that the ELF specification mandates the presence of either the GNU
hash table or SysV hash table. See Figure 2-7. Dynamic Array Tags.
Also both can be present, though that is not currently handled.
BLAZINGLY FAST!
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-08 16:48:26 +11:00
Anhad Singh
bfe1c0b545
fix(ld.so): redox build
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 19:30:37 +11:00
Anhad Singh
01e6eda258
misc(dlfcn): cleanup
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 19:03:05 +11:00
Anhad Singh
42d884c6a3
fix(ld.so): errors UB
...
Currently, how ld.so errors are handled by functions in dlfcn is wrong.
dlopen calls `linker.load_library` which returns a
`Result<ObjectHandler, goblin::Error>`. Now `goblin::Error` may have
variants that are heap allocated. For example:
`Error::Malformed(format!("invalid path: '{}': {}", path, err))`. The
error string would be allocated by ld.so's allocator but will be dropped
inside libc. This is UB.
After this patch, we now return a custom `DlError` instead. To get more
information about the error, `LD_DEBUG=all` can be set.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 18:35:20 +11:00
Anhad Singh
9cf72fd0b2
feat(ld.so): add all option for LD_DEBUG
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 18:00:45 +11:00
Anhad Singh
60f700fb50
chore(linker): remove todo
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 15:26:23 +11:00
Anhad Singh
c25292ae21
misc(ld.so): clippy fixes
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 15:25:40 +11:00
Anhad Singh
cfe89f828a
feat: rwlock instead of mutex for global scope
...
* Rwlock -> InnerRwLock
* RwLock makes use of InnerRwLock.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 00:54:52 +11:00
Anhad Singh
2be4316aec
feat(dlfcn): return DSO as the handle
...
Fine because:
> The value of this handle should not be interpreted in any way by the
> caller.
From: https://pubs.opengroup.org/onlinepubs/009696599/functions/dlopen.html
* Add tests for unload
* Implement NOLOAD so we can test that the loaded object has been
destroyed.
* Minor cleanup.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-25 16:17:51 +11:00
Anhad Singh
1612c78774
fix(ld.so): disable lazy binding on non-x86_64
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
023a005688
fix(ld.so): non-pie lazy
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
1db68ab978
feat(ld.so): scopes
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
13d819ac89
misc(ld.so: __plt_resolve_inner): println -> trace
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
e3587017f6
fix(ld.so): stub plt stub for non-x86_64
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
0a0ecb018f
fix(ld.so: adjust_stack): remove dead code
...
Does not do anything.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
c6fd0517ac
feat(ld.so: config): handle LD_BIND_NOW
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
5ae1b8e974
feat(ld.so): lazy binding
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
30970e111a
feat(ld.so): enable warnings just for ld.so
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
959982b8a4
fix(ld.so): use Strtab::get_at()
...
> use of deprecated method `goblin::strtab::Strtab::<'a>::get`: Bad performance, use get_at() instead
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
cc5e0ceebc
fix(ld.so): function signature
...
No longer expects a self TLS.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
eb82f9afeb
misc(lint): unused variables and imports
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
500848bc76
fix(ld.so): remove unreachable loop {}
...
_exit() is noreturn
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
39c8cc864d
fix(ci): formatting
...
Was my fault.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-17 03:14:33 +11:00
Anhad Singh
de9e8a6177
feat(ld.so): config
...
Currently supported options are `LD_DEBUG` and `LD_LIBRARY_PATH`.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-17 01:07:17 +11:00
Anhad Singh
9928091aad
fix(ci)
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-12 16:11:42 +11:00
Anhad Singh
d3bab6eeee
fix(redox: ld.so): unmap old TCB
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-12 16:00:11 +11:00