---
# System prepended metadata

title: 'Musl, July 20, 2022'
tags: [' musl', unikraft]

---

---
title: "Musl, July 20, 2022"
tags: unikraft, musl
datetime: 2022-07-20T10:00:00+02:00
location: Online, Discord (https://bit.ly/UnikraftDiscord), the `#monkey-business` voice channel
teams:
- musl
participants:
- TODO
---

## :dart: Agenda

- `clone` updates
- Testing updates
- Next updates

## :closed_book: Discussions

DA: `libs` calls `set_thread_are` which calls `arch_prctl` that sets `fs` to the thread data structure you allocate to Musl.

DA: The return value of `pthread_self` returns a different value in `real_main()` in the initial thread.

DA: We have different values for `uktlsp` and `tlsp`.

DA: If you want to use the `uktslp` for all threads, the function TODO must be called.

SK: Yes, that function needs to be called by all threads, including the init thread.

DA: There is another problem.
`uksched` should not allocate another TLS pointer.
`uksched` should reuse the `tlps` and make `uktlsp` have the same value.

SK: It's incorrect that Musl says the TLS is only 24 bytes.
Maybe it's only looking at some linker symbols.

SK: If new is the same as `_tls_end` then the next 8 bytes are reserved.

SK: You could have some padding between `_tls_start` and `_tls_end`.

DA: There may be some environment variables.

SK: Since we are not a Linux ELF programs, we don't need this.

DA/SK: We should use `__libc_start_main` and then we need to patch the function to provide the correct size.

SK: We have two things.
Use the information from `ukarch_tls.h`.
You can call call `uk_arch_tls_area_copy` or you patch Musl to use our function.

## :wrench: TODOs and Decisions

TODO
