]> xenbits.xensource.com Git - unikraft/libs/musl.git/log
unikraft/libs/musl.git
6 days agoAdapt to updated libposix-process config options staging
Michalis Pappas [Wed, 2 Apr 2025 15:08:10 +0000 (17:08 +0200)]
Adapt to updated libposix-process config options

Following the consolidation of CONFIG_LIBPOSIX_PROCESS_PIDS and
CONFIG_LIBPOSIX_PROCESS_CLONE into LIBPOSIX_PROCESS_MULTITHREADING,
update to the new config.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #87

12 days agoMakefile.uk.musl.signal: Fix arm64 architecture test stable
Samuel Hym [Mon, 27 Jan 2025 16:30:41 +0000 (17:30 +0100)]
Makefile.uk.musl.signal: Fix arm64 architecture test

Signed-off-by: Samuel Hym <samuel@tarides.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #83

2 weeks agoRemove `musl`'s `vfork` functionality and use our own asm wrappers
Sergiu Moga [Mon, 24 Mar 2025 17:27:26 +0000 (19:27 +0200)]
Remove `musl`'s `vfork` functionality and use our own asm wrappers

We are now using our own `vfork` assembly wrappers in the unikernel
so drop current `vfork` assembly functions that we cannot use anyway
for native syscalls and instead copy/reuse those defined by
us in the core repository.

Do this copy-paste so that in case if int the future there will appear
differences between what we do in the core in those wrappers and what
we need for musl, the musl wrappers stay the same.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #86

2 weeks agoRemove clone patches and use our own defined clone assembly wrappers
Sergiu Moga [Mon, 24 Mar 2025 17:26:12 +0000 (19:26 +0200)]
Remove clone patches and use our own defined clone assembly wrappers

We are now using our own `__clone` assembly wrappers in the unikernel
so drop current `__clone` assembly functions that translate libc wrapper
arguments to syscall arguments and instead copy/reuse those defined by
us in the core repository.

Do this copy-paste so that in case if int the future there will appear
differences between what we do in the core in those wrappers and what
we need for musl, the musl wrappers stay the same.

WARNING: There is, however, a very notable difference.

There is a bug in our current native/musl glue code where there is
a mismatch between what we do with TLS size/alignment and what musl
does.

To avoid it (and possibly unknowingly break other things) we have to
keep the forced alignment of the child stack.

This bug has always existed, including in the clone wrapper we are
replacing which also did this alignment. The wrapper claimed something
about `movaps` that is not entirely true. Essentially, because of an
old clone patch (part of the same series that ported musl clone
to Unikraft) that also patches `pthread_create` claiming Unikraft needs
an aligned TLS (for some reason we do not yet know), the clone child
stack ends up misaligned by 8, which causes a `movaps` that somewhere
along the line tries to store something at `some_aligned_offset(%rbp)`
to generate a #GP because rbp itself is not aligned.
To workaround this, back then this was the solution: a forced child
stack alignment. So keep this workaround for now, and debug this ASAP.

As for why we have this alignment for ARM64 as well, I can not be
sure, but I guess it simply aligned itself with the implementation of
x86 since it was introduced afterwards. Besides, it also makes use
of the same pthread_create code. Thus, keep aligning stuff for ARM64
as well.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #86

2 months agoConfig.uk: Add posix-tty as dependency to stdio
Andrei Tatar [Mon, 24 Feb 2025 11:18:16 +0000 (12:18 +0100)]
Config.uk: Add posix-tty as dependency to stdio

This change adds an explicit dependency on posix-tty and its STDIO
option for when the libstdio sub-lib of musl is enabled.
This makes musl's assumption that fds 0, 1, 2 be opened to something
meaningful an explicit configuration requirement on the kernel.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #85

4 months ago.github/workflows: Introduce catalog tests RELEASE-0.18.0
Cezar Craciunoiu [Fri, 12 Apr 2024 14:30:03 +0000 (17:30 +0300)]
.github/workflows: Introduce catalog tests

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #77

11 months agoRename LIBUKSWRAND to LIBUKRANDOM RELEASE-0.17.0
Alex Apostolescu [Sun, 2 Jun 2024 20:03:30 +0000 (23:03 +0300)]
Rename LIBUKSWRAND to LIBUKRANDOM

Signed-off-by: Alex Apostolescu <alexx.apostolescu@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #78

13 months agoAdd sys/membarrier.h to the headers list RELEASE-0.16.3
Stefan Jumarea [Mon, 25 Mar 2024 20:45:31 +0000 (22:45 +0200)]
Add sys/membarrier.h to the headers list

Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #76

14 months agolibsched: Add sys/membarrier.h to provided headers
Andrei Tatar [Mon, 12 Feb 2024 21:11:15 +0000 (22:11 +0100)]
libsched: Add sys/membarrier.h to provided headers

Add sys/membarrier.h to the headers provided by libsched.
This header is used by uksched, which libsched pulls in.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #75

14 months agogethostbyname: Option to use lwIPs `gethostbyname()` RELEASE-0.16.2
Simon Kuenzer [Tue, 6 Feb 2024 11:54:56 +0000 (12:54 +0100)]
gethostbyname: Option to use lwIPs `gethostbyname()`

This commit introduces redirecting `gethostbyname()` (and family) calls
to lwIP's implementation. This is only enabled if musl is configured to
forward DNS related requests to lwIP.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #74

14 months agogetnameinfo: Copy lwip adapter code from `lib/newlib`
Simon Kuenzer [Tue, 6 Feb 2024 10:11:18 +0000 (11:11 +0100)]
getnameinfo: Copy lwip adapter code from `lib/newlib`

This commit copies the lwip glue code for `getnameinfo()` from `lib/newlib`
(https://github.com/unikraft/lib-newlib/commit/727d5eabd48f329df179be4a37dd40dd5d71151b,
 Commit 727d5ea) to musl. It is only enabled if musl is configured to
forward DNS related requests to lwIP.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #74

14 months agogetaddrinfo: Option to use lwIPs `getaddrinfo()`
Simon Kuenzer [Wed, 31 Jan 2024 01:36:26 +0000 (02:36 +0100)]
getaddrinfo: Option to use lwIPs `getaddrinfo()`

This commit introduces an option to use lwIP's implementation of getaddrinfo.
It can be enabled if lwip is available. It will enable lwIP's DNS and socket
interfaces.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #74

18 months agoIntroduce `Library.uk` RELEASE-0.15.0 RELEASE-0.16.0
Alexander Jung [Tue, 11 Jul 2023 21:25:56 +0000 (21:25 +0000)]
Introduce `Library.uk`

This new file represents the first step towards proper versioning support of
external microlibrary in Unikraft.  The file itself acts as mechanism for
holding metadata-only values about the microlibrary.  This metadata is designed
to be compatible with GNU Make whilst simultaneously being human-readable and
readable by programs that are not GNU Make (e.g. tools such as KraftKit).

An important feature of this file is the inclusion of microlibrary versions.
In a later step, once relevant integrations have been made to Unikrat's core
build system and to relevant tools such as KraftKit, the user will be able to
see and select from different versions of the microlibrary.

In this initial commit, the relevant metadata is absorbed from both Makefile.uk,
Config.uk, but also includes new information such as SPDX License identifier.

Signed-off-by: Alexander Jung <alex@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #60

20 months agoMakefile.uk.musl.exit: Patch for case insensitive file systems RELEASE-0.14.0
Eduard-Florin Mihailescu [Sat, 5 Aug 2023 16:24:11 +0000 (19:24 +0300)]
Makefile.uk.musl.exit: Patch for case insensitive file systems

Add `exit` variant to _Exit.c to prevent symbol conflicts. This
is necessary since some file systems are case insensitive, and it could
otherwise lead to a conflict with the object resulted from _exit.c

Signed-off-by: Eduard-Florin Mihailescu <mihailescu.eduard@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #70

20 months agoMakefile.uk.musl.misc: Add missing ar.h
Marc Rittinghaus [Thu, 10 Aug 2023 12:20:14 +0000 (14:20 +0200)]
Makefile.uk.musl.misc: Add missing ar.h

This commit adds the ar.h header which is necessary for libelf to the
musl header file list.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #72

20 months agoInitialize main thread pthread structure
Aleksandr Iashchenko [Thu, 29 Jun 2023 15:31:59 +0000 (17:31 +0200)]
Initialize main thread pthread structure

It seems some steps were missing in pthread structure initialization.
This patch does the following:
- zeroes pthread memory (previously potentially contained garbage after
uk_mem_align allocation)
- initializes tsd
- sets detach_state to joinable

Signed-off-by: Aleksandr Iashchenko <Aleksandr.Iashchenko@opensynergy.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #59

20 months agoConfig.uk: Allow deselection of ukmmap
Marc Rittinghaus [Wed, 17 May 2023 13:17:45 +0000 (15:17 +0200)]
Config.uk: Allow deselection of ukmmap

With posix-mmap we have an alternative implementation of the memory
management functions such as mmap, mprotect, etc. To be able to select
posix-mmap, we must deselect ukmmap. Thus, this commit removes the
hard dependency.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #52

20 months agoMakefile.uk: Condition header inclusion on Kconfig
Andrei Tatar [Wed, 19 Jul 2023 08:05:35 +0000 (10:05 +0200)]
Makefile.uk: Condition header inclusion on Kconfig

Previously musl would add its headers to the include path
unconditionally when its Makefile would be included.
This change conditions this inclusion on whether musl is enabled via
Kconfig.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
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: #54

20 months agoCondition AARCH64 TCB unreservation on Kconfig
Andrei Tatar [Wed, 19 Jul 2023 07:57:14 +0000 (09:57 +0200)]
Condition AARCH64 TCB unreservation on Kconfig

Previously musl would unconditionally call
`aarch64_no_reserved_tcb_overlap` when building under aarch64.
This change makes this call happen only when musl is selected.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
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: #54

20 months agoMakefile.uk: Condition TCB reserve on Kconfig
Andrei Tatar [Wed, 7 Jun 2023 09:10:30 +0000 (11:10 +0200)]
Makefile.uk: Condition TCB reserve on Kconfig

Previously musl's Makefile would unconditionally reserve a TCB size,
regardless of whether musl was selected for build in Kconfig.
This change makes this reservation happen only when musl is selected.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
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: #54

20 months agopatches: Add syscall function prototype
Eduard Vintilă [Wed, 26 Jul 2023 09:28:00 +0000 (12:28 +0300)]
patches: Add syscall function prototype

The `sys/syscall.h` header is missing a declaration for the `syscall()`
function, which may lead to `implicit declaration` warnings that could
be treated as errors (i.e. by the GO runtime)
We also include Unikraft's `syscall_nrs2.h` header which provides
definitions for the `__NR_` macros needed by some libraries.

Signed-off-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #67

20 months agoConfig.uk: Select libcompiler-rt for libcomplex
Andrei Tatar [Tue, 8 Aug 2023 10:20:07 +0000 (12:20 +0200)]
Config.uk: Select libcompiler-rt for libcomplex

The cpow* functions provided by libcomplex make use of the `__mul?c3`
functions, implemented by libcompiler-rt, when building with either
Clang or GCC.
Therefore, this change makes musl unconditionally select libcompiler-rt
when building libcomplex.

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: #64

20 months agoMakefile.uk: Include missing cpow* functions
Andrei Tatar [Mon, 10 Jul 2023 14:33:17 +0000 (16:33 +0200)]
Makefile.uk: Include missing cpow* functions

The complex number library was previously missing the implementation of
cpow* functions. This change corrects this omission.

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: #64

20 months agoMakefile.uk: Condition flags on clang version
Andrei Tatar [Wed, 19 Jul 2023 08:27:11 +0000 (10:27 +0200)]
Makefile.uk: Condition flags on clang version

Set warning flags only if the current clang version supports them.

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

20 months agoMakefile.uk: Silence warnings
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

20 months agoMakefile.uk: Include missing gettid implementation
Andrei Tatar [Mon, 10 Jul 2023 14:35:09 +0000 (16:35 +0200)]
Makefile.uk: Include missing gettid implementation

The linux library was missing the implementation of gettid().
This change corrects this omission.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unkraft.io>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@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: #65

20 months agoConfig.uk: Add `uksignal` dependency for `LIBMUSL_SIGNAL`
Eduard Vintilă [Fri, 28 Jul 2023 06:41:50 +0000 (09:41 +0300)]
Config.uk: Add `uksignal` dependency for `LIBMUSL_SIGNAL`

`uksignal`  should be selected automatically when `LIBMUSL_SIGNAL` is
enabled, since it relies on underlying syscalls to be implemented by the
kernel.

Signed-off-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #68

20 months agoInclude missing parts of the string library
Andrei Tatar [Wed, 7 Jun 2023 09:07:17 +0000 (11:07 +0200)]
Include missing parts of the string library

The string part of libc was previously missing <memory.h> and
explicit_bzero.c, which this change fixes.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
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: #55

21 months agopatches: Delete patching of `ioctl` call in `isatty`
Sergiu Moga [Thu, 13 Jul 2023 16:17:59 +0000 (19:17 +0300)]
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

22 months agoglue: Init libc.auxv to point to a zero value
Stefan Jumarea [Wed, 31 May 2023 17:14:41 +0000 (20:14 +0300)]
glue: Init libc.auxv to point to a zero value

The `libc.auxv` is not supposed to be 0, since it will be dereferenced
by any call to `getauxval`. It should point to a 0 value instead.

Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #53

22 months agoMakefile.uk: Fix gcc specific warnings
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

23 months agoInclude musl's own headers when building
Andrei Tatar [Thu, 4 May 2023 08:41:57 +0000 (10:41 +0200)]
Include musl's own headers when building

This fixes a build error where an internal use of `prctl` fails due to a
missing prototype declaration.

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

23 months agoFix typo in macro definition
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

23 months agoREADME: Update description of Musl support RELEASE-0.13.0 RELEASE-0.13.1
Razvan Deaconescu [Thu, 11 May 2023 11:38:19 +0000 (14:38 +0300)]
README: Update description of Musl support

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

23 months agoRevert "Makefile.uk: Add flag to avoid gcc specifc symbol"
Andrei Tatar [Thu, 4 May 2023 22:03:13 +0000 (00:03 +0200)]
Revert "Makefile.uk: Add flag to avoid gcc specifc symbol"

This reverts commit 4912487a42ec9ab1f7ab7bcca698c50a849eafa8.

__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

23 months agoConfig.uk: Disable default LIBMUSL_COMPLEX
Razvan Deaconescu [Wed, 10 May 2023 16:00:33 +0000 (19:00 +0300)]
Config.uk: Disable default LIBMUSL_COMPLEX

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

23 months agoFix dependency to `lib/uksched`
Simon Kuenzer [Thu, 16 Mar 2023 10:01:40 +0000 (11:01 +0100)]
Fix dependency to `lib/uksched`

We currently require `lib/uksched` to be enabled as part of the build.
The dependency was not correctly stated with `Config.uk`.

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

23 months agoEnvironment variables with `lib/posix-environ`
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

23 months agoApply -ffreestanding for the musl source code
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

23 months agopatches: Add option to disable character maps
Tu Dinh Ngoc [Tue, 4 Apr 2023 18:55:10 +0000 (18:55 +0000)]
patches: Add option to disable character maps

Musl's `iconv` includes lots of character sets by default. Provide an
option to disable most of them to save on binary size.

Signed-off-by: Tu Dinh Ngoc <dinhngoc.tu@irit.fr>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.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: #40

2 years agopatches: Fix ioctl signature in function definition
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

2 years agoInitialize pthread structure fields for non-pthread threads
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

2 years agoRemove mprotect stub
Marco Schlumpp [Tue, 18 Apr 2023 12:55:07 +0000 (14:55 +0200)]
Remove mprotect stub

The real one provided in `mprotect.c` works with the `mprotect` system
call introduced with the posix-mmap library.

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

2 years agoFix the definition of the prlimit64 syscall
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

2 years agoProperly cast the system call input and outputs
Marco Schlumpp [Tue, 18 Apr 2023 12:54:56 +0000 (14:54 +0200)]
Properly cast the system call input and outputs

On clang, this statement caused compiler errors instead of only
warnings.

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

2 years agoForward abort calls to Unikraft's UK_CRASH
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

2 years agoInclude stdalign.h header
Marco Schlumpp [Tue, 18 Apr 2023 12:54:14 +0000 (14:54 +0200)]
Include stdalign.h header

This header is deprecated but sometimes still used by software.

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

2 years agoInclude ucontext header files
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

2 years agoFix dependency on fetch step
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

2 years agoMakefile.uk: Add flag to avoid gcc specifc symbol
Maria Sfiraiala [Sat, 11 Mar 2023 15:30:19 +0000 (17:30 +0200)]
Makefile.uk: Add flag to avoid gcc specifc symbol

When building apps with `clang` for `x86`, an asm specific symbol,
`__muldc3`, appears, which results in a undefined reference error, at
link time.

This commit adds the `-ffast-math` flag, when `clang` is used in order
to fix this issue.

Signed-off-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: #38

2 years agoFix ioctl signature
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

2 years agoUpgrade musl to latest version (1.2.3) RELEASE-0.12.0
Eduard Vintilă [Sun, 11 Dec 2022 11:04:19 +0000 (13:04 +0200)]
Upgrade musl to latest version (1.2.3)

Signed-off-by: Eduard Vintilă <eduard.vintila47@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: #34

2 years agoRemove outdated vendored features.h
Marco Schlumpp [Thu, 8 Dec 2022 10:37:06 +0000 (11:37 +0100)]
Remove outdated vendored features.h

The features.h was incomplete and did not include the necessary feature
test macro definitions

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: #32

2 years agoMove _XOPEN_SOURCE define to library CFLAGS
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

2 years agoUse function declaration for getdents64 RELEASE-0.11.0
Razvan Deaconescu [Tue, 29 Nov 2022 22:26:52 +0000 (00:26 +0200)]
Use function declaration for getdents64

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

2 years agoAdd patch to fix definition of environ variable
Razvan Deaconescu [Tue, 29 Nov 2022 20:34:46 +0000 (22:34 +0200)]
Add patch to fix definition of environ variable

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

2 years agoAvoid `uk_syscall_set_tid_address()` for main thread
Dragos Iulian Argint [Mon, 28 Nov 2022 20:19:24 +0000 (22:19 +0200)]
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

2 years agoMakefile.uk: Use -Wno-cast-function-type for GCC >= 8
Razvan Deaconescu [Sun, 27 Nov 2022 12:16:32 +0000 (14:16 +0200)]
Makefile.uk: Use -Wno-cast-function-type for GCC >= 8

The build option `-Wno-cast-function-type`, used in `Makefile.uk` is
available from GCC >= 8. When used in GCC <= 7, it issues a warning.

This commit updates the build flags to enable `-Wno-cast-function-type`
only when using GCC >= 8.

GitHub-Fixes: #27

Signed-off-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #28

2 years agouk_init_tls: Change `uk_thread_tcb_fini` to `uk_thread_uktcb_fini`
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

2 years agolinux: Add syscall wrapper for getrandom
Michalis Pappas [Thu, 24 Nov 2022 17:51:50 +0000 (18:51 +0100)]
linux: Add syscall wrapper for getrandom

Import e20658209177667e490c661dfd35b976749ef3f7 from
git://git.musl-libc.org/musl into patches.

This patch adds a syscall wrapper for getrandom, which
is not supported by musl v1.1.19.

Update the Makefile to compile getrandom() conditionally
to UKSWRAND.

Signed-off-by: Michalis Pappas <michalis.pappas@opensynergy.com>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #25

2 years agoEnable FPSIMD support on ARM64
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

2 years agoMakefile.uk/misc: Always include the uname sources
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

2 years agoMakefile.uk: Add sources for POSIX_USER functions
Stefan Jumarea [Wed, 2 Nov 2022 10:53:35 +0000 (12:53 +0200)]
Makefile.uk: Add sources for POSIX_USER functions

Since libc style syscall stubs are disabled when using musl, many of the
sources should be always included to avoid `undefined refrence` errors.

Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Eduard Vintilă <eduard.vintila47@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: #20

2 years agoMakefile.uk: make 'version.h' depend on fetch.
Ulrich Meis [Wed, 31 Aug 2022 11:38:14 +0000 (13:38 +0200)]
Makefile.uk: make 'version.h' depend on fetch.

This becomes necessary when running 'make -jN'.

Signed-off-by: Ulrich Meis <Ulrich.Meis@opensynergy.com>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #15

2 years agoInclude internal headers only for building musl.
Robert Kuban [Fri, 19 Aug 2022 14:58:26 +0000 (16:58 +0200)]
Include internal headers only for building musl.

Before, musl has exposed internal headers to other code,
now the include paths are added to the appropriate variable.

Signed-off-by: Robert Kuban <robert.kuban@opensynergy.com>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #13

2 years agoAdd patch for CVE-2020-28928
Robert Kuban [Thu, 18 Aug 2022 16:40:34 +0000 (18:40 +0200)]
Add patch for CVE-2020-28928

This commit patches CVE-2020-28928, which is fixed in v1.2.2 of musl.

Imported from: https://www.openwall.com/lists/musl/2020/11/19/1/1

Signed-off-by: Robert Kuban <robert.kuban@opensynergy.com>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #11

2 years agoAdd aarch64 configurations
Robert Kuban [Tue, 25 Oct 2022 14:00:20 +0000 (16:00 +0200)]
Add aarch64 configurations

This updates the sublibrary makefiles to use the appropiate
sourcefiles for aarch64.

It also removes the aarch64 source file for `__set_thread_area` from
the thread sublibrary makefile, as it is provided by lib-muslglue.

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: #7

2 years agoAdd translation from arm64 to aarch64
Marc Rittinghaus [Mon, 11 Jul 2022 13:27:21 +0000 (15:27 +0200)]
Add translation from arm64 to aarch64

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
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: #7

2 years agoRemove files that depend on fork
Marc Rittinghaus [Mon, 11 Jul 2022 13:26:53 +0000 (15:26 +0200)]
Remove files that depend on fork

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
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: #7

2 years agouk_init_tls: Return tcb pointer in __uk_copy_tls
Robert Kuban [Tue, 16 Aug 2022 18:53:21 +0000 (20:53 +0200)]
uk_init_tls: Return tcb pointer in __uk_copy_tls

Translate the tlsp to the tcb pointer before using as TCB.

On x86_64 both pointer are identical, but in aarch64 the tlsp
points into the last 16 bytes of the TCB.

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

2 years agoAdd patch to replace open with openat with AT_FDCWD
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

2 years agoAdd patch to modify clone wrapper.
Robert Kuban [Wed, 27 Jul 2022 11:31:44 +0000 (13:31 +0200)]
Add patch to modify clone wrapper.

This patches substitutes the syscalls in the clone wrapper
with normal function calls.

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

2 years agoAdd patch to avoid conflict with __unused macro
Robert Kuban [Mon, 18 Jul 2022 17:20:47 +0000 (19:20 +0200)]
Add patch to avoid conflict with __unused macro

The added patch renames `__unused` to `_pad` in `aarch64/bits/stat.h`,
following the pattern of patch 0003.

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

2 years agoMakefile.uk: Use Musl-build compatible build rule
Razvan Deaconescu [Sun, 6 Nov 2022 16:11:19 +0000 (18:11 +0200)]
Makefile.uk: Use Musl-build compatible build rule

Use `_XOPEN_SOURCE=700` for `LIBMUSL_HDRS_FLAGS-y`, similar to the
original Musl build rule.

Signed-off-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #19

2 years agoMakefile: Make Makefile.uk.musl.network compatible with LWIP
Razvan Deaconescu [Sat, 29 Oct 2022 09:27:25 +0000 (12:27 +0300)]
Makefile: Make Makefile.uk.musl.network compatible with LWIP

Remove the lack of presence of `posix-driver`. `posix-driver` needs to
be enabled for Musl to work with networking support.

Signed-off-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #19

2 years agoMakefile.uk.musl.complex: Include tgmath.h header 12/head
Florin Postolache [Fri, 11 Nov 2022 10:37:17 +0000 (12:37 +0200)]
Makefile.uk.musl.complex: Include tgmath.h header

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

2 years agoSet tid to 0 for the main thread
Dragos Iulian Argint [Wed, 26 Oct 2022 21:05:59 +0000 (00:05 +0300)]
Set tid to 0 for the main thread

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

2 years agoRemove obsolete patches
Dragos Iulian Argint [Sun, 14 Aug 2022 22:39:58 +0000 (01:39 +0300)]
Remove obsolete patches

This commit reorders the patch numbers used for
musl and deletes those that are not needed as a
result of the changes made in this PR.

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

2 years agopthread_create: TLS alignment and cleanup
Dragos Iulian Argint [Sun, 14 Aug 2022 22:13:29 +0000 (01:13 +0300)]
pthread_create: TLS alignment and cleanup

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

2 years agoAdd patch for the `clone()` wrapper for x86_64
Dragos Iulian Argint [Sun, 14 Aug 2022 22:12:03 +0000 (01:12 +0300)]
Add patch for the `clone()` wrapper for x86_64

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

2 years agoAdd custom TLS related functions as glue code
Dragos Iulian Argint [Sun, 14 Aug 2022 22:07:58 +0000 (01:07 +0300)]
Add custom TLS related functions as glue code

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

2 years agoAdd custom `unmapself` function as glue code
Dragos Iulian Argint [Sun, 14 Aug 2022 22:01:17 +0000 (01:01 +0300)]
Add custom `unmapself` function as glue code

`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

2 years agoProvide `__set_thread_area()` as glue code
Dragos Iulian Argint [Sun, 14 Aug 2022 21:50:22 +0000 (00:50 +0300)]
Provide `__set_thread_area()` as glue code

`__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

2 years agoRemove `__unmapself` and `set_thread_area`
Dragos Iulian Argint [Sun, 14 Aug 2022 21:49:00 +0000 (00:49 +0300)]
Remove `__unmapself` and `set_thread_area`

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

2 years agoInitialize TLS and reserve TCB space
Dragos Iulian Argint [Sun, 14 Aug 2022 21:44:54 +0000 (00:44 +0300)]
Initialize TLS and reserve TCB space

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

2 years agoAdd library dependencies for thread support
Dragos Iulian Argint [Sun, 14 Aug 2022 21:42:48 +0000 (00:42 +0300)]
Add library dependencies for thread support

Select (by default) the core libraries used by musl:
`LIBUKMMAP` - provides mmap() syscall
`LIBPOSIX_PROCESS_PIDS` - provides pid,tid implementation
`LIBPOSIX_PROCESS_CLONE` - provides the clone() syscall
`LIBPOSIX_FUTEX` - provides futex() syscall
`LIBUKSCHED_TCB_INIT` - allows setting the size for the LIBC TCB

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

2 years agoAdd script for generating Makefile.uk.musl.* entries
Robert Kuban [Tue, 19 Jul 2022 14:29:41 +0000 (16:29 +0200)]
Add script for generating Makefile.uk.musl.* entries

Adds a script that can find the source files for a given architecture and
sublibrary by emulating the mechanism in the original musl makefile.

Signed-off-by: Robert Kuban <robert.kuban@opensynergy.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: #8

2 years agoRemove patch for 'ioctl'
Dragos Iulian Argint [Sat, 7 May 2022 09:05:35 +0000 (12:05 +0300)]
Remove patch for 'ioctl'

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

2 years agoAdd patches for system call handling
Dragos Iulian Argint [Sat, 7 May 2022 08:54:09 +0000 (11:54 +0300)]
Add patches for system call handling

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

2 years agoRe-enable musl-defined wrappers
Dragos Iulian Argint [Sat, 7 May 2022 08:48:18 +0000 (11:48 +0300)]
Re-enable musl-defined wrappers

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

2 years agoSet `LIBSYSCALL_SHIM_NOWRAPPER` for musl
Dragos Iulian Argint [Sat, 7 May 2022 08:45:29 +0000 (11:45 +0300)]
Set `LIBSYSCALL_SHIM_NOWRAPPER` for musl

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

2 years agoMakefile.uk.musl.process: Add wait.c build dependency
Razvan Deaconescu [Wed, 9 Nov 2022 07:11:59 +0000 (09:11 +0200)]
Makefile.uk.musl.process: Add wait.c build dependency

This is required for Python3.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #23

2 years agoRemove include directory from clean list
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.

Signed-off-by: Robert Kuban <robert.kuban@opensynergy.com>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #17

2 years agoMakefile.uk: Add sysexits.h include dependency
Razvan Deaconescu [Wed, 9 Nov 2022 07:09:59 +0000 (09:09 +0200)]
Makefile.uk: Add sysexits.h include dependency

This is required by Python3.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #22

2 years agoComment macros to stop using VDSO
Florin Postolache [Mon, 15 Aug 2022 09:31:24 +0000 (12:31 +0300)]
Comment macros to stop using VDSO

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

3 years agoMake musl initialization work with unikraft RELEASE-0.10.0 RELEASE-0.6 RELEASE-0.7.0 RELEASE-0.8.0 RELEASE-0.9.0
Cyril Soldani [Thu, 10 Dec 2020 08:31:16 +0000 (09:31 +0100)]
Make musl initialization work with unikraft

Work around some syscalls not being implemented in unikraft.

Signed-off-by: Cyril Soldani <cyril.soldani@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoEnable sendfile, used by other modules
Cyril Soldani [Tue, 10 Nov 2020 10:18:05 +0000 (11:18 +0100)]
Enable sendfile, used by other modules

Signed-off-by: Cyril Soldani <cyril.soldani@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoPrevent syscall shim layer libc wrapper generation
Cyril Soldani [Fri, 9 Oct 2020 16:55:50 +0000 (18:55 +0200)]
Prevent syscall shim layer libc wrapper generation

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

3 years agoAdd patches that fixes stdout
gaulthier gain [Fri, 9 Oct 2020 16:00:23 +0000 (16:00 +0000)]
Add patches that fixes stdout

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoUpdate README.md
gaulthier gain [Tue, 6 Oct 2020 18:24:10 +0000 (18:24 +0000)]
Update README.md

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3