auronandace
ac0a7e71f4
apply clippy::borrow-as-ptr lint
2026-02-03 12:02:26 +00:00
Wildan M
7b9402783d
Add log crate, use it to all trace cmd
2026-01-24 22:39:05 +07:00
Jeremy Soller
3a8f64aa14
Merge branch 'namespace-improvement' into 'master'
...
Introduce namespace fd and related features
See merge request redox-os/relibc!797
2026-01-20 20:43:06 -07:00
Ibuki Omatsu
1bcb6dff78
Introduce namespace fd and related features
2026-01-20 20:43:05 -07:00
Jeremy Soller
4a50c8f313
Merge branch 'p12' into 'master'
...
fix(libc): use `ld.so`'s allocator
See merge request redox-os/relibc!882
2026-01-20 20:35:12 -07:00
sourceturner
defd2ce7c3
Deny deny-unsafe_op_in_unsafe_fn on the crate level
2026-01-21 00:41:57 +01:00
Anhad Singh
bbc86d8027
fix(libc): use ld.so's allocator
...
Previously, this was implemented incorrectly because `tcb.mspace` was
set just *before* jumping to the program's entry point. However,
`alloc_init` is called when the init functions are run for `libc.so`, so
`tcb.mspace` must be initialized *before* the init functions are
run.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2026-01-20 14:00:29 +11:00
Anhad Singh
df647941c5
misc(pthread): remove the need for tid_mutex
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2026-01-09 22:55:58 +11:00
Anhad Singh
79c0df3dda
fix(ld_so/dso): TPOFF with undefined symbol index
...
Fixes random `rustc` errors/page fault:
```
Dump of assembler code for function _RNvYNCNkNvNtNtCskfd1poFMNVt_21rustc_data_structures4sync12worker_local8REGISTRY00INtNtNtCs713rKgAoQ4g_4core3ops8function6FnOnceTINtNtB1o_6option6OptionQIB23_INtNtNtB1o_4cell4once8OnceCellNtB8_8RegistryEEEEE9call_onceBc_:
0x0000000007651e50 <+0>: 41 56 push r14
0x0000000007651e52 <+2>: 53 push rbx
0x0000000007651e53 <+3>: 50 push rax
0x0000000007651e54 <+4>: 48 8b 1d 6d 9c 46 02 mov rbx,QWORD PTR [rip+0x2469c6d] # 0x9abbac8
0x0000000007651e5b <+11>: 64 48 8b 04 25 00 00 00 00 mov rax,QWORD PTR fs:0x0
0x0000000007651e64 <+20>: 0f b6 4c 18 08 movzx ecx,BYTE PTR [rax+rbx*1+0x8]
0x0000000007651e69 <+25>: 48 01 d8 add rax,rbx
0x0000000007651e6c <+28>: 83 f9 01 cmp ecx,0x1
0x0000000007651e6f <+31>: 74 07 je 0x7651e78 <_RNvYNCNkNvNtNtCskfd1poFMNVt_21rustc_data_structures4sync12worker_local8REGISTRY00INtNtNtCs713rKgAoQ4g_4core3ops8function6FnOnceTINtNtB1o_6option6OptionQIB23_INtNtNtB1o_4cell4once8OnceCellNtB8_8RegistryEEEEE9call_onceBc_+40>
0x0000000007651e71 <+33>: 83 f9 02 cmp ecx,0x2
0x0000000007651e74 <+36>: 75 0a jne 0x7651e80 <_RNvYNCNkNvNtNtCskfd1poFMNVt_21rustc_data_structures4sync12worker_local8REGISTRY00INtNtNtCs713rKgAoQ4g_4core3ops8function6FnOnceTINtNtB1o_6option6OptionQIB23_INtNtNtB1o_4cell4once8OnceCellNtB8_8RegistryEEEEE9call_onceBc_+48>
0x0000000007651e76 <+38>: 31 c0 xor eax,eax
0x0000000007651e78 <+40>: 48 83 c4 08 add rsp,0x8
0x0000000007651e7c <+44>: 5b pop rbx
0x0000000007651e7d <+45>: 41 5e pop r14
0x0000000007651e7f <+47>: c3 ret
0x0000000007651e80 <+48>: 48 8d 35 69 11 00 00 lea rsi,[rip+0x1169] # 0x7652ff0 <_RINvNtNtNtNtCs7Gz96wxcBnT_3std3sys12thread_local6native5eager7destroyINtNtNtCs713rKgAoQ4g_4core4cell4once8OnceCellNtNtNtCskfd1poFMNVt_21rustc_data_structures4sync12worker_local8RegistryEEB1U_.llvm.5183627946997663933>
0x0000000007651e87 <+55>: 48 89 c7 mov rdi,rax
0x0000000007651e8a <+58>: 49 89 c6 mov r14,rax
0x0000000007651e8d <+61>: ff 15 c5 6b 47 02 call QWORD PTR [rip+0x2476bc5] # 0x9ac8a58
0x0000000007651e93 <+67>: 4c 89 f0 mov rax,r14
0x0000000007651e96 <+70>: 64 48 8b 0c 25 00 00 00 00 mov rcx,QWORD PTR fs:0x0
# rcx = 0x20aeb000 [FSBASE]
# rbx = 0x2b40
0x0000000007651e9f <+79>: c6 44 19 08 01 mov BYTE PTR [rcx+rbx*1+0x8],0x1 # <--- PAGE FAULT
0x0000000007651ea4 <+84>: 48 83 c4 08 add rsp,0x8
0x0000000007651ea8 <+88>: 5b pop rbx
0x0000000007651ea9 <+89>: 41 5e pop r14
0x0000000007651eab <+91>: c3 ret
```
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2026-01-08 11:45:36 +11:00
Anhad Singh
75f6b9d64e
fix(dl-tls): TLS overallocation
...
* `offset` is the offset in TLS to copy initial data to NOT the segment
size
* Only zero the region which is required to be zeroed
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-12-29 17:13:23 +11:00
Anhad Singh
4245e9148e
fix(load_objects_recursive): TLS overallocation
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-12-27 01:12:07 +11:00
Anhad Singh
a7918b108d
misc(ld_so/start): consistent log formatting
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-12-22 19:06:10 +11:00
Anhad Singh
aa86e9e027
fix(riscv64/x86): build
...
Stub `__tlsdesc_dynamic` for riscv64/x86 for now.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-12-10 13:52:37 +11:00
Anhad Singh
64d3793190
fix(ld_so): page faulting when library not found
...
The error handling was already in place. The reason it was page faulting
is that, on failure, the function exits as soon as it encounters an
`Err` variant. When that happens, the DSO object for which the
dependency was being loaded is dropped. Dropping it calls `munmap` to
unload the executable and also runs the functions in `.fini`. However,
`run_fini` should only be called if the `DSO` is being unloaded after it
has been successfully loaded (i.e. all dependencies were satisfied and
all init functions had run).
Closes #1599
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-12-10 13:24:53 +11:00
Anhad Singh
8572c855fc
feat(ld_so/dso): TLSDESC
...
The dynamic linker now works on aarch64. You can also try it on Linux by
setting `TEST_RUNNER` to `qemu-aarch64` when running `make test
TARGET=aarch64-unknown-linux-gnu`
Co-authored-by: @willnode
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-12-09 22:28:39 +11:00
Anhad Singh
4f1920ab96
feat(ld_so/tcb): implement os_arch_activate for aarch64 linux
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-12-01 14:46:07 +11:00
Anhad Singh
6262c4ae50
fix(ld_so): getting TP on linux
...
`ARCH_GET_FS` is x86_64 specific. On aarch64 it is not platform
specific and just need to read out the TP from `TPIDR_EL0`
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-12-01 14:46:07 +11:00
Jeremy Soller
0844e6fc90
WIP: use upper fd table
2025-11-15 07:55:37 -07:00
Jeremy Soller
74e3ad1c2c
Do TLS alignment in reliable way
2025-11-13 12:07:06 -07:00
Jeremy Soller
c4050203e8
Revert "Align TLS to 16 bytes again"
...
This reverts commit 860a8e6e4b .
2025-11-13 08:16:22 -07:00
Jeremy Soller
860a8e6e4b
Align TLS to 16 bytes again
2025-11-10 17:05:57 -07:00
Jeremy Soller
cb0acf3e57
Revert "Make sure TLS modules are aligned to 16 bytes for SSE"
...
This reverts commit d39fe6c9fb .
2025-11-01 10:44:34 -06:00
Wildan M
abdfd3d0ac
Fix ld_so multiple objects loading the same object
2025-10-29 15:46:35 +07:00
Wildan M
ab8021fdbe
Expose PIE information with LD_DEBUG
2025-10-06 12:53:22 +07:00
bjorn3
70487a2555
Fix compilation on arm64
2025-10-05 19:42:21 +02:00
Josh Megnauth
e39b27664f
unsafe_op_in_unsafe_fn: ld_so, generic/redox-rt
...
There are a few functions where I allowed the lint. The lower level and
FFI nature of relibc means that there are areas with a lot of unsafe.
Some functions are basically long blocks of unsafe or contain lots of
small blocks of unsafe. unsafe_op_in_unsafe_fn doesn't add clarity to
these functions. Instead, it reduces readability by adding an indent or
small "unsafe { .. }" clutter.
2025-10-04 21:36:51 -04:00
Jeremy Soller
ced734c162
Add RawCell::unsafe_set
2025-10-04 07:50:16 -06:00
Jeremy Soller
82084440ad
Support nightly-2025-10-03
2025-10-03 21:51:10 -06:00
Jeremy Soller
d39fe6c9fb
Make sure TLS modules are aligned to 16 bytes for SSE
2025-09-29 17:08:51 -06:00
Jacob Lorentzon
9c5f11fbc8
Add Out<T> wrapper
2025-09-21 14:36:12 +02:00
Wildan M
b541ee43be
Change PATH separator to double colon
2025-09-19 21:48:38 +07:00
elle
a5c41f77d0
ld_so: remove access dead code
2025-09-08 21:03:27 +00:00
elle
5d77f617f5
ld_so: use mutex for _r_debug
...
Uses a `spin::Mutex` for the global static `_r_debug` instance to remove
warning about a global mutable static.
Guarantees exclusive mutable access to the `_r_debug` variable.
2025-09-08 20:23:36 +00:00
elle
09015a218e
ld_so: remove unsafe transmute in mmap_and_copy
...
Refactors casting the `raw` address as a byte array to use idiomatic
Rust APIs instead of the unsafe call to `transmute`.
2025-09-08 20:23:36 +00:00
Wildan Mubarok
c7a1966a67
Fix trace feature
2025-08-08 23:41:07 +00:00
Jeremy Soller
84bbf90ce1
Fix ___tls_get_addr on x86
2025-07-03 10:52:46 -06:00
Jeremy Soller
0bd38ac2ad
Fix DTPMOD relocation
2025-05-09 10:06:06 -06:00
Jeremy Soller
b887ad1ce6
Fix DTPOFF relocation
2025-05-07 21:04:31 -06:00
Jeremy Soller
0b1133a965
ld_so: do relocations before TLS
2025-05-07 16:27:00 -06:00
Jeremy Soller
4daade9721
log where unresolved symbol was required
2025-05-07 10:38:21 -06:00
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