Andrei Tatar [Wed, 28 Jun 2023 16:09:33 +0000 (18:09 +0200)]
Makefile.uk: Silence warnings
This commit changes several warning flags:
-Wno-error=sign-compare removed
-Wno-unused-value relegated to the glue code
-Wno-cast-function-type is sent to clang as well as GCC
-Wno-macro-redefined and -Wno-string-plus-int added for clang
-Wno-unused added for the entire library
-K&R-style declaration warnings silenced by -Wno-old-style-declaration
(GCC) or -Wno-deprecated-non-prototype (clang)
-Wno-unused-command-line-argument to silence assembler
Signed-off-by: Andrei Tatar <andrei@unikraft.io> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #61
patches: Delete patching of `ioctl` call in `isatty`
Application such as `python3` use `isatty()`, which does an
`ioctl()` with `TIOCGWINSZ` as an argument for checking whether it
should invoke the interactive interpretor or just start interpreting
a given file.
Therefore, we may want to allow such function call to return an error
if called upon a file from a non-pseudo filesystem such as
`ramfs` or `9pfs`.
Furthermore, since this patch is the middle one among the existing
patches from an order standpoint, rename the starting index of the
other patches to reflect the removal.
Signed-off-by: Sergiu Moga <sergiu@unikraft.io> Reviewed-by: Radu Nichita <radunichita99@gmail.com> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #62
Miguel Rodrigues [Thu, 11 May 2023 13:18:14 +0000 (14:18 +0100)]
Makefile.uk: Fix gcc specific warnings
-Wno-restrict, Wno-unused-but-set-variable, -Wno-maybe-unitialized and
-Wno-format-contains-nul are gcc-specific flags, so include them only when
compiling with gcc and not with clang.
Signed-off-by: Miguel Rodrigues <migb.rodrigues@gmail.com> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #51
Andrei Tatar [Thu, 4 May 2023 08:34:06 +0000 (10:34 +0200)]
Fix typo in macro definition
Previously we defined the macro `UK_LIBC_SYSCALL`, however this is not
used anywhere in unikraft; `UK_LIBC_SYSCALLS` is most likely what was
meant. This commit fixes the typo.
Signed-off-by: Andrei Tatar <andrei@unikraft.io> Reviewed-by: Rares Miculescu <miculescur@gmail.com> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Eduard Vintilă <eduard.vintila47@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #45
The contents of the README.md file are not up-to-date. Replace them with
a short description of Musl, and point out that Musl is the default
Unikraft libc.
Signed-off-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com> Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Approved-by: Eduard Vintilă <eduard.vintila47@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #49
__muldc3 is implemented by lib-compiler-rt for clang, and emitting calls
to it is normal. While -ffast-math prevents these calls, it also enables
unsafe optimizations that might result in wrong results from math
functions.
Signed-off-by: Andrei Tatar <andrei@unikraft.io> Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #46
When using Clang to build Musl with complex numbers support, a linking
error appears: `__muldc3` symbol is undefined. For Clang, the `__muldc3`
symbol is implemented by `libcompiler-rt`.
As complex number support is not typically required by applications
(that use Musl), this commit disable it by setting the `LIBMUSL_COMPLEX`
option to `n`. If required, the application will enable
`LIBMUSL_COMPLEX` (set it to `y`) and, in the case of Clang, add
`libcompiler-rt`.
Signed-off-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Andrei Tatar <andrei@unikraft.io> Approved-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #47
Simon Kuenzer [Tue, 14 Mar 2023 16:38:49 +0000 (17:38 +0100)]
Environment variables with `lib/posix-environ`
Commit 980bf211 enabled code for managing environment variables with musl,
however they were never populated during boot. With PR ???, `posix-environ`
envrionment variables are officially supported by Unikraft. This commit
enables and integrates this implementation with musl.
Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #43
Marco Schlumpp [Fri, 3 Feb 2023 14:52:34 +0000 (15:52 +0100)]
Apply -ffreestanding for the musl source code
This is the corresponding commit for unikraft/unikraft#740. This
prevents a self dependency caused by compiler optimizations, because the
libc implementation cannot rely on underlying presence of a libc.
Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #35
Stefan Jumarea [Sat, 29 Apr 2023 18:53:22 +0000 (21:53 +0300)]
patches: Fix ioctl signature in function definition
The `ioctl()` function signature was changed to use an unsigned long as
a second argument, in order to match the definition in Linux, glibc and
our own implementation.
The function definition however was not changed, leading to build errors
due to function signature conflict.
Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Radu Nichita <radunichita99@gmail.com> Reviewed-by: Rares Miculescu <miculescur@gmail.com> Approved-by: Eduard Vintilă <eduard.vintila47@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #44
Marco Schlumpp [Tue, 18 Apr 2023 12:55:18 +0000 (14:55 +0200)]
Initialize pthread structure fields for non-pthread threads
If these fields are not initialized as expected by musl, then calls
to pthread functions such `pthread_getspecific` can return unexpected
values or even crash.
Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #41
Marco Schlumpp [Tue, 18 Apr 2023 12:55:03 +0000 (14:55 +0200)]
Fix the definition of the prlimit64 syscall
The `sys/resource.h` header adds #define-based redirection from
`prlimit64` to `prlimit` when `_GNU_SOURCE` is set. This causes our
`provided_syscalls` to incorrectly define `uk_syscall_r_prlimit` instead
of `uk_syscall_r_prlimit64`. By reordering, the headers we can side-step
this problem.
Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #41
Marco Schlumpp [Tue, 18 Apr 2023 12:54:52 +0000 (14:54 +0200)]
Forward abort calls to Unikraft's UK_CRASH
The signals are currently ignored and that causes musl to `exit` the
thread, which doesn't cause any output. Therefore, it's very unclear
what happened. By calling `UK_CRASH` there is a clear indication that
something went wrong.
Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #41
Marco Schlumpp [Tue, 18 Apr 2023 12:54:06 +0000 (14:54 +0200)]
Include ucontext header files
While musl doesn't provide an actual implementation for the legacy
ucontext API, the header is still useful to compile software against
musl. Also, some software only relies on the definitions in the header.
Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #41
Marco Schlumpp [Tue, 18 Apr 2023 12:53:56 +0000 (14:53 +0200)]
Fix dependency on fetch step
Because `fetch` was not really a file, make always tried to remake the
version file. Therefore, it also needed to recompile the file as the
mtime of the version file was updated.
Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #41
Marc Rittinghaus [Thu, 20 Apr 2023 10:20:56 +0000 (12:20 +0200)]
Fix ioctl signature
The signature of ioctl uses a signed int as second argument. This,
however, differs from the definition in Linux, glibc, and our own
implementation in Unikraft, which use an unsigned long. Since using
int has lead to all sorts of problems (e.g., overflow into sign bit),
this commit adopts unsigned long also for the musl imported
header.
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #42
Marco Schlumpp [Fri, 9 Dec 2022 12:36:22 +0000 (13:36 +0100)]
Move _XOPEN_SOURCE define to library CFLAGS
Putting it into CFLAGS changes the behavior for all sources files in a
Unikraft build and changes them from the implicit _DEFAULT_SOURCE to
_XOPEN_SOURCE, which can break applications/libraries.
Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #33
When defining `getdents64` as a macro aliasing `getdents`, the
syscall shim layer complains.
This patch uses a typical C-style declaration of `getdents64()`. This,
combined with the `LFS64(getdents)`, aliasing used in
`src/dirent/__getdents.c` solves the issue with the syscall shim layer.
Signed-off-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #31
The patch properly defines `environ` as an array of pointers, the last
of which is NULL. In the previous definition, `environ` was NULL, which
is not OK. The definition is now replaced to an array of a single NULL
element.
Signed-off-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #30
Avoid `uk_syscall_set_tid_address()` for main thread
The uk_syscall_set_tid_address call should be used
to set the main thread's tid address within some
internal structures. At the moment, because it is
called before the initialization of the scheduler,
it fails causing the program to crash. A workaround
for this behavior is to set the tid to 0 if the
`__uk_sched_thread_current` variable is NULL, which
means that the scheduler is not initialized.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #29
Eduard Vintilă [Fri, 25 Nov 2022 11:22:20 +0000 (13:22 +0200)]
uk_init_tls: Change `uk_thread_tcb_fini` to `uk_thread_uktcb_fini`
This commit fixes a typo in which the function`uk_thread_uktcb_fini()`,
as declared in uksched's `tcb_impl.h`, was incorrectly referred to as
`uk_thread_tcb_fini()`.
Signed-off-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #26
Razvan Virtan [Thu, 6 Oct 2022 12:52:29 +0000 (15:52 +0300)]
Enable FPSIMD support on ARM64
Some of the functions implemented in musl can't work without the
ARM64 FPSIMD registers. This will fail unikraft build with musl
when FPSIMD is not enabled.
Enable FPSIMD by default when lib-musl is selected in menuconfig.
Signed-off-by: Razvan Virtan <virtanrazvan@gmail.com> Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #14
Stefan Jumarea [Thu, 27 Oct 2022 12:01:57 +0000 (15:01 +0300)]
Makefile.uk/misc: Always include the uname sources
When `LIB_POSIX_SYSINFO` is selected, the build fails
when using musl with an undefined reference to `uname`.
This commit removes the uname sources dependency of
the selection of `LIB_POSIX_SYSINFO`.
Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #18
Robert Kuban [Mon, 15 Aug 2022 13:43:34 +0000 (15:43 +0200)]
Add patch to replace open with openat with AT_FDCWD
This patch replaces calls to the open systemcall with the openat systemcall
with the AT_FDCWD argument if SYS_open is not defined, similar to the
original musl code.
This is necessary as the open systemcall is not available on aarch64.
Signed-off-by: Robert Kuban <robert.kuban@opensynergy.com> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #6
Add tgmath.h header when both complex and math sublibs are enabled.
This header unites all types of math trigonometric functions for all
types(float, double, long double and complex) under one definition.
The header is not needed by musl source files but could be required
by applications.
Signed-off-by: Florin Postolache <florin.postolache80@gmail.com> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #24
This commit ads in the Config.uk the following default selection:
`LIBPOSIX_PROCESS_INIT_PIDS`, which allows pid,tid assignation
However, there is a bug in the assignment of tids that
makes the tid of the main thread not available when the
LIBC TCB (i.e. pthread structure) is initialized. The
currently adopted solution is to hardcode the tid to 0.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Signed-off-by: Robert Kuban <robert.kuban@opensynergy.com> Reviewed-by: Florin Postolache <florin.postolache80@gmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9
This patch replaces 2 function calls from musl with
2 custom ones and introduces an additional size
when allocating the map for a thread, `libc.tls_align`.
It is needed because Unikraft demands that the tls be aligned.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Florin Postolache <florin.postolache80@gmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9
The clone wrapper is an assembly source file which will
invoke a `syscall` instruction. Since we want just a
function call, we need to change it accordingly.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Florin Postolache <florin.postolache80@gmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9
The functions related to the TLS layout (like copying content)
are implemented in the unikraft core libraries.
To use them, we need to add glue source code.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Florin Postolache <florin.postolache80@gmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9
`unmapself()` provides a detached thread the ability
to free the memory region allocated for the stack and
TLS. In the original version, this function does
`munmap()', which will deallocate the thread's stack,
after which it executes exit() (NB: SYS_exit). This
works because there is another stack in the Kernel.
Since this does not exist in Unikraft, we implement
our version of unmapself.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Florin Postolache <florin.postolache80@gmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9
`__set_thread_area()` is a function that is usually
architecture dependent, it sets the tls pointer in the
fs register. An `arch_prctl` system call is used. We
are replacing this call with a custom version because
`arch_prctl()` is not implemented in Unikraft at the
moment.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Florin Postolache <florin.postolache80@gmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9
Comment the sources corresponding to the functions
__unmapself() (for detached threads) and
__set_thread_area() (for setting the fs register
to the tls pointer) because they will be reintroduced
as glue code.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Florin Postolache <florin.postolache80@gmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9
This commit adds a call in Makefile.uk to reserve the space
needed for the LIBC TCB (e.g. `pthread` structure)
and adds 3 glue code files:
`__uk_init_tls.c` - initialize an Unikraft TLS
`__uk_unmapself.c` - allows unmapping for detached threads
`__set_thread_area.c` - bypass for arch_prctl() syscall for
setting the tls pointer
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Florin Postolache <florin.postolache80@gmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9
This patch was introduced to modify the prototype of the
`ioctl()` function when it was exported directly from vfscore.
Now, since we want to keep the wrapper in musl, we leave the
function prototype unchanged. The patch is no longer needed.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #5
Musl wrappers use a binary system call, e.g. for x86_64 the `syscall`
instruction is used which is a trap. In a single-address-space OS as an Unikraft
unikernel this is just overhead. Hence, we changed the way musl deals with
syscall handling by using some syscall shim layer macros.
Those will replace binary system calls with function calls.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #5
In the previous version, wrappers over system calls (e.g. `read ()`)
were defined in syscall shim layer. Since we want to maintain musl as
vanilla as possible, we have re-introduced these wrappers.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #5
We need to set the LIBSYSCALL_SHIM_NOWRAPPER field in the configuration
file to prevent syscall shim layer from creating system call wrappers.
These wrappers are already defined in musl.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #5
Robert Kuban [Tue, 25 Oct 2022 16:41:24 +0000 (18:41 +0200)]
Remove include directory from clean list
The current clean rule in the Unikraft build system can not remove
directories and terminates with an error if there is a directory in
the list of files to clean.
This commit removes the include directory inside the lib-musl build
directory from the clean list.
Since each sublibrary has a separate subdirectories in the include
directory, this change will not make headers accessible which would have
been deleted by the clean rule.
Alternatives considered:
1. Enable the build rule to remove directories.
This would lead to the uk_clean_list not containing a complete
lists of files to remove anymore and makes the potential damage
of errors in the clean list much higher.
2. Add every header file into the `LIBMUSL_CLEAN` variable.
This could be done in `_libmusl_import_lib` and would remove the
linked headers, but would still leave the directory tree.
3. Do not create the links, but include from the origin directory.
This would remove the ability to filter header files in the
sublibrary makefile.
The VDSO is responsible for the virtual system calls in a basic
linux application and makes so that some system calls will be faster
because the transition between kernel mode and user mode is eliminated.
Therefore, it shouldn't be used in Unikraft. At the moment, in musl
this feature is enabled and functions like __clock_gettime will generate
a segfault.
Signed-off-by: Florin Postolache <florin.postolache80@gmail.com> Reviewed-by: Dragos Iulian Argint <dragosargint21@gmail.com> Approved-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #10
The musl libc provides its own wrappers around syscalls, which we prefer
to the shim-layer-generated ones as they often do additional
bookkeeping. And we can't have both as it would lead to conflicts.
Signed-off-by: Cyril Soldani <cyril.soldani@uliege.be> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3
Simon Kuenzer [Tue, 13 Jul 2021 19:24:08 +0000 (21:24 +0200)]
Correct license headers introduced by NEC Laboratories Europe GmbH
This commit removes the additional clause
"THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY"
from BSD license headers that got introduced by mistake
with the following commits: 60a1108 - Initial port (Felipe Huici)
On the one hand, this additional clause is redundant because
the BSD license already states that it must remain and the
copyright notice must be kept.
On the other hand, the clause freezes the file header
and prohibits future contributors from extending the
copyright notice for their contributions. This additional
clause is not part of the official BSD 3-clause.
The original author(s) or an authorized representative from
the author's affiliation consents to the change with a
`Reviewed-by` tag to this commit.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #2
gaulthier gain [Tue, 3 Mar 2020 10:23:24 +0000 (10:23 +0000)]
Update __stdout_write to allow flushing on stdout
This patch fixes the issue where printing on stdout does nothing
since stdout was not flushed. In that case, we found that the problem
was related to __stdout_write. Indeed f->lbf must be set to '\n' for
line-buffered mode nevertheless, the condition "(!(f->flags & F_SVB)
&& __syscall(SYS_ioctl, f->fd, TIOCGWINSZ, &wsz))" fails on Unikraft.
The variable f->lbf is thus reset to -1 which prevents a correct
display on stdout. With this patch, we "force" f->lbf to be set in
line-buffered mode.
Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
gaulthier gain [Tue, 3 Mar 2020 10:23:23 +0000 (10:23 +0000)]
Add patch to update mount.h to avoid conflicts with vfscore
This patch updates "mount.h" in order to avoid ioctl redefinition
error with vfscore. Basically, the musl "mount.h" file includes
<sys/ioctl.h> only if _VFSCORE_SYS_MOUNT_H_ was not defined.
Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>