Commit Graph

542 Commits

Author SHA1 Message Date
Jeremy Soller 0dd6e27597 Merge branch 'dynamic_linker' into 'master'
fix(ld_so): for Linux

See merge request redox-os/relibc!570
2024-12-09 12:56:04 +00:00
Anhad Singh c286ad2868 fix(ld.so): do not depend on TLS at all
In the next big refactor (next PR), all of the platform functionality
used by both relibc and ld.so will be moved into a `platform`/`sysdeps`
crate and then ld.so would be moved out of relibc and not link with it.

I think doing it in a seperate PR would make it more managable, as when
I did half of it, the diff was pretty huge and that way it would be
easier to review too :)

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-05 23:11:59 +11:00
Josh Megnauth 6ec03b6f4a fix: round_up_to_page_size overflow
Closes: #200

The spec doesn't define which error code to set if `len` is too large.
`ENOMEM` is the closest defined condition that fits:

>> [...] the range [addr,addr+len) exceeds that allowed for the address
space of a process [...]

Logically, `len` would lead to `addr` exceeding the address space of a
process if rounding it up to the next page size causes an overflow.
2024-11-26 00:37:12 -05:00
Josh Megnauth a709dd47bf fix: Multiplication overflow in setsockopt 2024-11-23 19:53:33 +00:00
Josh Megnauth d6ac5f8947 Avoid over allocations & reallocations
As we know, vectors amortize the cost of adding new elements by reserving
space for multiple elements when full. This is useful but may lead to
allocating more memory than necessary.

`relibc` generally avoids over allocations by reserving the exact amount
of space when possible. I fixed a few areas that still over allocated or
reallocated unnecessarily by leveraging iterators that are more likely
to know sizes.
2024-11-14 22:53:12 -05:00
Peter Limkilde Svendsen 06fec0b843 Add various basic docstrings 2024-10-27 23:25:57 +01:00
Andrey Turkin a4122753e6 Initial RISC-V64 support 2024-10-11 06:44:54 +03:00
4lDO2 57f098931a Remove ld.so's now unnecessary access() wrapper. 2024-09-30 16:55:27 +02:00
4lDO2 07af4e49f7 Add sigaltstack test. 2024-09-28 16:51:17 +02:00
4lDO2 eee603efa8 Remove the "-1 errno" e() function. 2024-09-27 15:35:04 +02:00
4lDO2 070b4cd05c Switch PalPtrace to Rusty error handling. 2024-09-27 15:35:04 +02:00
4lDO2 d474163e0e Switch to Rusty error handling in PalSocket. 2024-09-27 15:35:01 +02:00
4lDO2 4da5ad37d1 Convert PalEpoll to Rusty error handling. 2024-09-27 11:22:36 +02:00
4lDO2 1a46a24c70 Rustify PalSignal error handling. 2024-09-27 11:12:19 +02:00
4lDO2 8b8b00da01 Use unsigned return values in read()-like Pal fns.
Returning a negative number of bytes makes absolutely no sense, besides
the "-1 and errno" pattern, which is now converted to Result<_, Errno>.
2024-09-27 10:39:26 +02:00
4lDO2 986754e7b3 Remove all remaining errno interfaces from Pal. 2024-09-27 10:29:32 +02:00
4lDO2 313b32c815 Switch almost all of Pal to Rusty error handling. 2024-09-27 10:19:44 +02:00
4lDO2 4b687c25d2 Convert more Pal methods to Result. 2024-09-26 16:24:01 +02:00
4lDO2 6e5959b3fa Convert a bunch of c_int to Result<(), Errno>. 2024-09-26 16:21:34 +02:00
4lDO2 ec216e56e2 Preserve umask across execv. 2024-09-25 20:28:50 +02:00
4lDO2 7fa5b679cc Move umask to a regular global variable.
The umask value is per-process, so because all POSIX open-like functions
now occur via relibc, this is valid.
2024-09-25 19:39:41 +02:00
4lDO2 fed49a29af Properly deallocate thread stack on pthread_exit. 2024-09-24 19:34:53 +02:00
4lDO2 2b7a1ea94b Fix sigsuspend and add it to the sigqueue test. 2024-09-24 19:34:53 +02:00
4lDO2 9701e9c544 Add sigtimedwait to test, and various fixes. 2024-09-24 19:34:53 +02:00
4lDO2 5c78356290 Implement sigtimedwait on Redox. 2024-09-24 19:34:52 +02:00
4lDO2 8e5ddbd654 Implement sigsuspend. 2024-09-24 19:34:52 +02:00
4lDO2 09108634cf Set uc_stack properly.
POSIX does not appear to explicitly mention that this should be the
sigaltstack, but other Linux appears to treat it as the sigaltstack.
2024-09-24 19:34:52 +02:00
4lDO2 30caf55429 Set siginfo_t.si_{pid,uid} from kill signals too. 2024-09-24 19:34:51 +02:00
4lDO2 d0db6a1ce0 Fix i686. 2024-09-24 19:34:51 +02:00
4lDO2 f6761407e5 Pass si_pid to all realtime signals. 2024-09-24 19:34:51 +02:00
4lDO2 abc2ec7bb5 Add prototype ucontext_t support. 2024-09-24 19:34:51 +02:00
4lDO2 13e7b77643 Implement basic support for (kernel) rt signals. 2024-09-24 19:34:50 +02:00
4lDO2 75b2dcaa45 WIP: implement sigqueue 2024-09-24 19:34:23 +02:00
Kamil Koczurek 408a7b2ab6 Add capability to set the default scheme 2024-09-23 14:36:45 +00:00
4lDO2 7e38bb1476 Fix Linux compilation. 2024-09-21 13:42:43 +02:00
Jeremy Soller 4d29614ea8 Better stub for sigsuspend on redox 2024-09-19 21:01:07 -06:00
Jeremy Soller 1ac8c4834b Format 2024-09-19 16:09:11 -06:00
Jeremy Soller 1b7d059707 Add getrusage 2024-09-19 16:08:54 -06:00
4lDO2 a9f05d3c3c Add trailing NUL byte check on Redox. 2024-09-12 16:10:25 +02:00
Jeremy Soller 4935b98180 Make ino_t be c_ulonglong 2024-09-11 16:14:03 -06:00
4lDO2 c0e7af5289 Backwards-compatibly rewrite getdents to use special syscall. 2024-09-11 23:32:19 +02:00
4lDO2 198caa3bc5 Rustify Sys::open and some fs:: error handling. 2024-09-11 23:22:32 +02:00
4lDO2 4bd0d2a1ef Move pthread::Errno to separate module. 2024-09-11 23:22:29 +02:00
Peter Limkilde Svendsen 3193656f22 Put random() state behind mutex 2024-08-15 23:26:16 +00:00
bjorn3 49c708f537 Remove all uses of the legacy scheme syntax" 2024-08-04 13:49:10 +02:00
4lDO2 d458b6cdcd Handle waitpid WUNTRACED stop signals properly. 2024-07-18 23:59:48 +02:00
4lDO2 ac5ac928f2 Implement raise() using pthread_kill. 2024-07-18 23:59:48 +02:00
4lDO2 15cdc4e0aa Fix (modified) audiod. 2024-07-18 23:59:47 +02:00
4lDO2 4cb6644181 Implement exit_this_thread on Redox. 2024-07-18 23:59:47 +02:00
4lDO2 c286dd6d33 Use new-thread proc API 2024-07-18 23:59:47 +02:00