Commit Graph

2471 Commits

Author SHA1 Message Date
Anhad Singh 55ba8d8f6b misc(load_objs_recursive): do not add empty masters
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-05 15:00:35 +11:00
Anhad Singh d8f7590848 fix(__tls_get_addr): NULL check
Has to be done before adding the offsets.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-05 15:00:35 +11:00
Anhad Singh 1c846f8013 fix comment
x86 and x86_64 are below TP and others are above TP

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-05 15:00:35 +11:00
Anhad Singh 43301848b9 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Andrey Turkin <andrey.turkin+redox@gmail.com>
2024-12-05 02:55:34 +00:00
Anhad Singh 4b959776e0 feat(redox_rt): map PT_TLS
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-30 00:02:52 +11:00
Anhad Singh f6fa4e8246 feat(ld_so): setup sighandler
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-30 00:02:33 +11:00
Anhad Singh e9f3147e3b fix(tcb): do not use Vec::from_raw_parts
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-29 20:55:02 +11:00
Anhad Singh 1a7726541a fix TCB and TLS
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-29 18:40:16 +11:00
Anhad Singh c88eb3d5d0 Revert "fix(linker): deref uninit TCB"
This reverts commit 37dbf5cbb2.
2024-11-29 00:03:09 +11:00
Anhad Singh e8e6b8cbc5 fix(expected): dynamic bins
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-26 19:51:06 +11:00
Anhad Singh cdb4843164 fix(tests): fix UB in mk{fifo,nod,nodat}
Memory chunk is allocated with `malloc` and used as the `dest` buffer
for `strncat`. The `dest` argument in `strncat` has to be NUL terminated,
however it was not.

This commit fixes this issue in mk{fifo,nod,noat}.c.

Almost all dynamic tests pass now.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-26 16:56:05 +11:00
Anhad Singh 22bbdb025c misc(tests): fix compilation of dlfcn.c
From man dlopen(3)
> According to the ISO C standard, casting between function
> pointers and 'void *', as done above, produces undefined results.
> POSIX.1-2001 and POSIX.1-2008 accepted this state of affairs and
> proposed the following workaround:
>
>   *(void **) (&cosine) = dlsym(handle, "cos");
>
> This (clumsy) cast conforms with the ISO C standard and will
> avoid any compiler warnings.
>
> The 2013 Technical Corrigendum 1 to POSIX.1-2008 improved matters
> by requiring that conforming implementations support casting
> 'void *' to a function pointer.  Nevertheless, some compilers
> (e.g., gcc with the '-pedantic' option) may complain about the
> cast used in this program.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-25 18:00:03 +11:00
Anhad Singh 6020c54ce7 chore(test): add expected outputs for dynamic tests
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-25 16:16:07 +11:00
Anhad Singh 37dbf5cbb2 fix(linker): deref uninit TCB
The bug is described for `x86_64` and Linux but is the same for other architectures and on Redox.

`Tcb::current()` is used to retrieve the current TCB, which is done by by reading `fs:[0x10]`. The TCB layout describes that at offset `0x10`, there is `tcb_ptr: *mut GenericTcb<...>`, which is nothing more but a pointer to itself.

This is fine as otherwise a system call would be required to get the TCB (`arch_prctl(ARCH_GET_FS)` on Linux).

However, this is problematic as the function may be called when the FS base is not set, and in that case the expected output of the function should be [`None`], but we don't currently handle that.

To fix this, any code paths that maybe call this function on an uninitialized TCB are be switched to call `current_slow()`. Which just uses `arch_prctl(ARCH_GET_FS)` to get the FS base and check if it's non-zero.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-25 16:09:06 +11:00
Anhad Singh 00746c2566 misc(tests): disable dlfcn test for now
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-25 12:31:33 +11:00
Anhad Singh b9bef59d8a fix(libc.so): link with libgcc
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-25 12:20:32 +11:00
Anhad Singh 7aa340570f chore: enable dynamic tests
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-25 12:13:03 +11:00
Jeremy Soller a64a6a4cd0 Merge branch 'fix-failing-features-test' into 'master'
Temporarily disable `noreturn` attribute test

See merge request redox-os/relibc!568
2024-11-24 13:55:06 +00:00
Josh Megnauth daa77e7149 Temporarily disable noreturn attribute test 2024-11-24 13:55:05 +00:00
Jeremy Soller 3c79fd759a Merge branch 'exit-return-never' into 'master'
Exit should return never (`!`)

See merge request redox-os/relibc!567
2024-11-23 19:55:38 +00:00
Jeremy Soller b95bd0dfa6 Merge branch 'fix-socket-set-edom-timeout-overflow' into 'master'
fix: Multiplication overflow in setsockopt

Closes #201

See merge request redox-os/relibc!566
2024-11-23 19:53:33 +00:00
Josh Megnauth a709dd47bf fix: Multiplication overflow in setsockopt 2024-11-23 19:53:33 +00:00
Josh Megnauth 90f934c769 Exit should return never (!)
`_Exit`, `exit`, and related functions should return `!` because they
don't return. This also signals to cbindgen that it should emit
`[[noreturn]]` for those functions.
2024-11-23 03:33:00 -05:00
Jeremy Soller a430a7861d Merge branch 'pwd-docs' into 'master'
Add docs for pwd.h

See merge request redox-os/relibc!563
2024-11-21 15:07:30 +00:00
Peter Limkilde Svendsen 864f4306ce Add docs for pwd.h 2024-11-21 15:07:30 +00:00
Jeremy Soller 7a729571ec Merge branch 'sys-auxv-docs' into 'master'
Add docs for sys/auxv.h

See merge request redox-os/relibc!564
2024-11-21 15:07:25 +00:00
Jeremy Soller 8381218ab1 Merge branch 'sys-file-docs' into 'master'
Add docs for sys/file.h

See merge request redox-os/relibc!565
2024-11-21 15:07:21 +00:00
Peter Limkilde Svendsen 5591eeacb3 Add docs for sys/file.h 2024-11-20 23:21:48 +01:00
Peter Limkilde Svendsen 399b0ad81f Add docs for sys/auxv.h 2024-11-20 23:17:10 +01:00
Jeremy Soller e528eae801 Merge branch 'string-docs' into 'master'
Add docs for string.h, add missing functions

See merge request redox-os/relibc!562
2024-11-19 00:20:40 +00:00
Peter Limkilde Svendsen 2a7d01f02d Add docs for string.h, add missing functions 2024-11-19 00:20:40 +00:00
Jeremy Soller 46c2d36193 Merge branch 'fix-dns-extra-output' into 'master'
fix(netdb): Buffer overrun when parsing DNS

See merge request redox-os/relibc!559
2024-11-18 13:43:23 +00:00
Josh Megnauth fc1e220a99 fix(netdb): Buffer overrun when parsing DNS 2024-11-18 13:43:22 +00:00
Jeremy Soller 32fca670ea Merge branch 'memmem-cast-mut' into 'master'
Use only one .cast_mut() in memmem()

See merge request redox-os/relibc!561
2024-11-17 20:09:46 +00:00
Peter Limkilde Svendsen 864d5e4795 Use only one .cast_mut() in memmem() 2024-11-17 20:19:52 +01:00
Jeremy Soller 2c73cc947c Merge branch 'memmem' into 'master'
Implement memmem()

See merge request redox-os/relibc!560
2024-11-17 16:18:15 +00:00
Peter Limkilde Svendsen 6a765ed88f Implement memmem() 2024-11-17 16:18:14 +00:00
Jeremy Soller ce7b85b0df Merge branch 'dont-overallocate-cstrings' into 'master'
Avoid over allocations & reallocations

See merge request redox-os/relibc!558
2024-11-17 16:17:22 +00:00
Jeremy Soller 88987eb000 Merge branch 'pty-utmp-docs' into 'master'
Add docs for pty.h and utmp.h

See merge request redox-os/relibc!557
2024-11-17 16:17:04 +00:00
Jeremy Soller 09bcfd0711 Merge branch 'errno-const-macros' into 'master'
Test errno constant macros, make ENOTSUP available in Rust

See merge request redox-os/relibc!556
2024-11-17 16:16:47 +00:00
Peter Limkilde Svendsen 42011f28d8 Test errno constant macros, make ENOTSUP available in Rust 2024-11-17 16:16:47 +00:00
Jeremy Soller caac784caa Merge branch 'iso646' into 'master'
Add iso646.h and corresponding tests

See merge request redox-os/relibc!555
2024-11-17 16:16:11 +00:00
Jeremy Soller 7b2e315c17 Merge branch 'cbindgen-use-attributes' into 'master'
Emit C attributes via cbindgen

See merge request redox-os/relibc!548
2024-11-17 16:15:07 +00:00
Josh Megnauth 5348273ccc Emit C attributes via cbindgen 2024-11-17 16:15:07 +00:00
Jeremy Soller dbe5c85411 Merge branch 'inttypes-docs' into 'master'
Add docs for inttypes.h

See merge request redox-os/relibc!554
2024-11-17 16:13:32 +00:00
Jeremy Soller 693769da1e Merge branch 'sys-random-docs' into 'master'
Add docs for sys/random.h

See merge request redox-os/relibc!553
2024-11-17 16:13:17 +00:00
Jeremy Soller 093d11c451 Merge branch 'elf-docs' into 'master'
Add basic docs for elf.h

See merge request redox-os/relibc!552
2024-11-17 16:13:01 +00:00
Jeremy Soller c57022894b Merge branch 'crypt-docs' into 'master'
Add docs for crypt.h

See merge request redox-os/relibc!551
2024-11-17 16:12:44 +00:00
Peter Limkilde Svendsen b8ad113a84 Add docs for crypt.h 2024-11-17 16:12:43 +00:00
Jeremy Soller 63cb0401e5 Merge branch 'calloc-no-intrinsics' into 'master'
Avoid unnecessary intrinsic in calloc

See merge request redox-os/relibc!550
2024-11-17 16:12:27 +00:00