Commit Graph

1089 Commits

Author SHA1 Message Date
Christian Helmuth
15d1beca1b Fix use-after-free warnings in test-libc 2023-10-04 13:22:05 +02:00
Benjamin Lamowski
37a6669e71 libc: add support for FreeBSDs KERN_ARND sysctl
Provide FreeBSDs KERN_ARND systemctl by calling getentropy().

To use it, configure an RNG via the `rng` libc runtime parameter.

Ref #4997
2023-09-29 12:21:04 +02:00
Benjamin Lamowski
aa5751b7fc libc: add more dummies for the Rust libc crate
Add dummies for pthread_set_name_np(),
posix_spawn_file_actions_addchdir_np() and
cpuset_getaffinity().

Ref #4997
2023-09-29 12:21:04 +02:00
Benjamin Lamowski
159c3d0606 compat_libc: add versioned symbols for lstat and readdir_r
Ref #4997
2023-09-29 12:21:04 +02:00
Christian Helmuth
41adf8d196 jitterentropy: clear memory in jent_zalloc() 2023-09-29 12:15:05 +02:00
Benjamin Lamowski
9f7e47368f libports: transform compat-libc into a static library
Dynamically loading the `compat-libc` breaks `fork(2)` on Genode.

Switch `compat-libc` to a special api package that provides a source
file for statically linking the library, analogous to the `blit`
package. This also requires a quirk in Goa but should prevent breaking
`fork()` and removes the runtime and archive dependencies for Rust
packages using `compat-libc`.

Ref genodelabs/goa#61
2023-08-23 13:46:37 +02:00
Sebastian Sumpf
0a85964f91 libports: add 'compat-libc'
Implement FBSD_1.0 versions of libc functions ('stat', 'fstat'). The
functions are versioned with @FBSD_1.0, and therefore, will not clash
with libc during linking. However, to be called by our dynamic linker,
the library must be before libc in the NEEDED section of the binary
using it. This requires the lib to be in front of libc in the LIBS
variable. The library currently will call libc 'stat' and 'fstat' by
looking up the symbols via 'dlsym'.

Ref genodelabs/goa#61
2023-08-23 13:46:37 +02:00
Christian Prochaska
8a279855ff cleanup file permissions
Fixes #4983
2023-08-23 13:46:37 +02:00
Sebastian Sumpf
3e0e86f720 mesa: remove 'printf' from 'iris_bufmgr_tmp.patch'
also rename it to 'iris_bufmgr_fd.patch'

issue #4916
2023-06-16 11:24:26 +02:00
Christian Helmuth
4a15621dc8 libc: warn about unsupported RTLD_GLOBAL in dlopen()
Fixes #3779
2023-06-16 11:24:25 +02:00
Norman Feske
823349fffb libc: make libc-plugin headers private to libc
Fixes #4904
2023-05-30 12:03:33 +02:00
Christian Prochaska
b1be660c7b libusb: remove use of obsolete libc-plugin interface
Fixes #4854
2023-05-30 12:03:33 +02:00
Sebastian Sumpf
40f31a9050 libc: add message for corrupted allocation on 'free'
In case the meta data (or more) got zeroed upon 'free', print error
message. The offset in the meta data can never be zero. This does not
help on other memory corruptions, but at least gives a hint in the too
much zeroed out case.

issue #4675
2023-05-30 12:03:32 +02:00
Sebastian Sumpf
ccc04a7082 qemu-usb: support read/write of unused IO ranges
The XHCI model reserves 0x4000 of IO memory but uses only 0x530.
Implement read (0) and write (nop) for these regions as real hardware
does.

fixes #4902
2023-05-30 12:03:31 +02:00
Norman Feske
a12fcfea0d libc: replace enum by static constexpr (C++20)
Related to issue #4869
2023-05-30 12:03:29 +02:00
Sebastian Sumpf
cc5d476fb1 libc/riscv: fix link errors with GCC 12
Dynamically linked functions can not be called directly with jump ("j",
"jal") and friends. Calls must go through the PLT.

issue #4827
2023-05-30 12:03:28 +02:00
Christian Prochaska
9e021422c7 sanitizer: update to version 12.2.0
Issue #4827
2023-05-30 12:03:27 +02:00
Christian Prochaska
106e322f82 gcov: update to version 12.2.0
Issue #4827
2023-05-30 12:03:27 +02:00
Benjamin Lamowski
29238498b6 libc: implement signal(3)
Fixes #4824
2023-05-30 12:03:27 +02:00
Benjamin Lamowski
70644186c1 libc: add dummy symbols for the Rust std library
Add dummies for sigaltstack(3) and FreeBSD's _umtx_op(2).

Ref #4824
2023-05-30 12:03:27 +02:00
Norman Feske
2a49eee50f libc: improve diagnistics on initialization errors
This change helps to draw the connection between warnings during the
initialization of file descriptors and the libc configuration.
2023-05-30 12:03:26 +02:00
Christian Prochaska
1edde7c1bc fetchurl: fix build errors with gcc 12
Fixes #4840
2023-05-30 12:03:25 +02:00
Norman Feske
0e3a9bfe1f libc: fix cached ioctl info file access
This patch solves the false-negative error message "failed to open file"
referring to an ioctl info file during an ioctl call. The message is
now avoided by checking for the existence of the file before reading it.

However, the observed symptom uncovered an actual bug that was
introduced in commit "libc vfs: open OSS 'info' file only once" with
the attempt to cache the content of ioctl info files. When called
multiple time for different paths, 'Vfs_plugin::_with_info' would
wrongly return the info from the first call as cached in a local
static variable.

The patch fixes the problem by a new added 'Cached_ioctl_info'
implementation in the scope of the 'Vfs_plugin'.

Issue #4372
Fixes #4852
2023-05-04 11:59:14 +02:00
Christian Helmuth
091db48843 vfs_block: warn only once if sync is not supported
Issue #4825
Issue #4820
2023-04-27 14:24:29 +02:00
Sebastian Sumpf
c7c9542262 libc: add 'wakeup_remote_peers' to 'with_libc'
Libc components using 'with_libc' should wakeup peers in case a libc function
makes I/O progress.

issue #4820
2023-04-26 11:58:15 +02:00
Sebastian Sumpf
f91aba873e test/qt5/qpluginwidget: add dummy 'main'
issue #4794
2023-04-17 14:48:30 +02:00
Christian Helmuth
3c45f5c7ab usb: support 32 in-flight packets
- move metadata specific to isochronous transfers from the descriptor
  into the content of USB-session packets
- restore support for 32 in-flight packets in the USB C API

Fixes #4749
2023-04-17 14:48:23 +02:00
Christian Helmuth
6884e6b1ec fatfs: cleanup synchronous use of block connection 2023-04-17 14:48:22 +02:00
Norman Feske
bd3936c7ed Test for combining select with a pipe
The test exercises the VFS's read-ready mechanism when using the
vfs_pipe plugin.

Issue #4785
2023-04-17 14:48:22 +02:00
Pirmin Duss
d5051c439d test-libc_fifo_pipe: increase buffer size
Issue #4785
2023-03-15 17:02:51 +01:00
Christian Helmuth
188a214a29 libusb: fix constructor order in vfs_libusb 2023-03-13 14:32:53 +01:00
Norman Feske
e9b249b709 Replace use of base/snprintf.h by format library
Issue #2064
2023-03-13 14:32:53 +01:00
Norman Feske
9ef0f1b6cb libports: freestanding 'format' string library
This little library implements rudimentary format-string support. It is
useful for porting 3rd-party code that ought not depend on a full libc.

Issue #2064
2023-03-13 14:32:53 +01:00
Norman Feske
50ee8dfaf8 Remove obsolete includes of base/snprint.h
Issue #2064
2023-03-13 14:32:53 +01:00
Norman Feske
94b8c61e32 libc: remove internal use of base/snprintf.h
Issue #2064
2023-03-13 14:32:52 +01:00
Norman Feske
9debad4e91 Remove format strings from connection types
Issue #2064
2023-03-13 14:32:37 +01:00
Christian Helmuth
a4d45921c6 Document event handling in acpi_event 2023-02-27 08:22:50 +01:00
Josef Söntgen
8145ff6303 qemu-usb: only copy data when packet succeeded
In case the packet is erronous the value of 'actual_size' can be
invalid and using it may lead to a page-fault due to out-of-bounce
access.

With this commit access is only performed on successful packets.

Fixes #4763.
2023-02-27 08:22:50 +01:00
Norman Feske
e09941f310 Remove base/debug.h
Fixes #4765
2023-02-27 08:22:49 +01:00
Norman Feske
bdf47785b8 vfs: remove 'file_size' from read/write interfaces
The 'file_size' type denotes the size of files on disk in bytes. On
32-bit architectures it is larger than the size_t, which refers to
in-memory object sizes.

Whereas the use of 'file_size' is appropriate for ftruncate and seek, it
is not a suitable type for the parameters of read/write operations
because those operations refer to in-memory buffers.

This patch replaces the use of 'file_size' by size_t. However, since it
affects all sites where the read/write interface is uses, it takes the
opportunity to replace the C-style (pointer, size) arguments by
'Byte_range_ptr' and 'Const_byte_range_ptr'.

Issue #4706
2023-02-27 08:22:49 +01:00
Josef Söntgen
6e1517ca3c libdrm/lima: introduce disjunct contexts
Prior to this change the libdrm Lima implementation supported the
creation of multiple contexts where each context, however, was
treated as the same client like it was done in the Lima driver
itself.

With this commit each context becomes its own client while the
main context always performs all buffer object related allocation
and the other context import each needed BO before submitting.

Fixes #4760.
2023-02-27 08:22:49 +01:00
Josef Söntgen
89f99df44d libdrm/lima: check buffer id in WAIT
Issue #4760.
2023-02-27 08:22:49 +01:00
Josef Söntgen
66fedecf34 libdrm/lima: handle unknown buffer ids gracefully
Issue #4760.
2023-02-27 08:22:49 +01:00
Josef Söntgen
46fc41ba50 libdrm/lima: rename Syncobj_space
Align the naming with the 'Gpu_context_space'.

Issue #4760.
2023-02-27 08:22:49 +01:00
Josef Söntgen
909b25db57 libdrm/lima: refactor session and context handling
Merge 'Gpu_session' and 'Gpu_context' and create the main session
as context.

Issue #4760.
2023-02-27 08:22:49 +01:00
Josef Söntgen
da32849ac2 libdrm/lima: move sync fd handling into DRM object
Converting from the sync-fd to the actual handle is internal
implementation detail.

Issue #4760.
2023-02-27 08:22:49 +01:00
Josef Söntgen
401da72a86 libdrm/lima: remove try-catch from ioctl call
Remove the exception handling as at this point all exceptions should
have been handled internally already.

Issue #4760.
2023-02-27 08:22:49 +01:00
Josef Söntgen
b8d8ff6d4d libdrm/lima: use sync-fd range beyond libc's reach
Sync file-descriptors a purely virtual and are not known by the libc and
should be only accessed by 'drm_poll'. To prevent accidental access move
them to range never used by the libc fd allocator.

Issue #4760.
2023-02-27 08:22:48 +01:00
Sebastian Sumpf
f1bc791c22 gpu_session: rename Gpu::Virtual_address:va
rename 'va' into 'value' to stay consistent with other types.

issue #4713
2023-02-27 08:22:48 +01:00
Sebastian Sumpf
56e7e2ad53 libdrm/lima+etnaviv: adjust to VRAM GPU session interface
Keep buffer abstraction by mapping one buffer to one VRAM object.

issue #4713
2023-02-27 08:22:48 +01:00