Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vfscore: Support closing STD{IN,OUT,ERR} file descriptors #41

Open
clupuishere opened this issue Jan 31, 2020 · 3 comments · May be fixed by #1226
Open

vfscore: Support closing STD{IN,OUT,ERR} file descriptors #41

clupuishere opened this issue Jan 31, 2020 · 3 comments · May be fixed by #1226
Labels
kind/bug Something isn't working

Comments

@clupuishere
Copy link
Member

The initial release of vfscore library did not introduce closing of standard file descriptors. This is also mentioned in the code here. The underlying structure for standard file descriptors is statically allocated, unlike ordinary file descriptors. A proper fix should allocate these dynamically as well.

@clupuishere clupuishere added the kind/bug Something isn't working label Jan 31, 2020
@skuenzer
Copy link
Member

skuenzer commented Jan 31, 2020

I guess we would need to introduce a destructor table where libraries can register clean-up work like this. The dtors would get called on machine shutdown.

@clupuishere
Copy link
Member Author

@skuenzer This has nothing to do with cleaning up on shutdown. It just fixes calls such as close(STDIN_FILENO) when you just want to reuse the file descriptor.

@skuenzer
Copy link
Member

skuenzer commented Aug 7, 2020

In such a case, I expect that we get a bit more clean solution with introducing fdtable: #52 . STDIN, STDOUT, STDERR should register a close fd-handler.

@nderjung nderjung added this to TODO in General Kanban May 10, 2021
@nderjung nderjung linked a pull request May 10, 2023 that will close this issue
4 tasks
eduardvintila pushed a commit to eduardvintila/unikraft_riscv64 that referenced this issue Jul 28, 2023
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: unikraft#41
eduardvintila pushed a commit to eduardvintila/unikraft_riscv64 that referenced this issue Jul 28, 2023
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: unikraft#41
eduardvintila pushed a commit to eduardvintila/unikraft_riscv64 that referenced this issue Jul 28, 2023
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: unikraft#41
eduardvintila pushed a commit to eduardvintila/unikraft_riscv64 that referenced this issue Jul 28, 2023
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: unikraft#41
eduardvintila pushed a commit to eduardvintila/unikraft_riscv64 that referenced this issue Jul 28, 2023
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: unikraft#41
eduardvintila pushed a commit to eduardvintila/unikraft_riscv64 that referenced this issue Jul 28, 2023
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: unikraft#41
eduardvintila pushed a commit to eduardvintila/unikraft_riscv64 that referenced this issue Jul 28, 2023
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: unikraft#41
eduardvintila pushed a commit to eduardvintila/unikraft_riscv64 that referenced this issue Jul 28, 2023
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: unikraft#41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
No open projects
2 participants