Skip to content

Managed file descriptors, loading dynamic executables #31

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

Merged
merged 7 commits into from
Apr 20, 2025

Conversation

fwsGonzo
Copy link
Member

This allows managing file descriptors from TinyKVM. More work is needed to cover all use-cases.

@fwsGonzo fwsGonzo requested a review from Copilot April 19, 2025 06:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces basic support for managing file descriptors in TinyKVM. Key changes include replacing and adding header includes to support Linux-specific functionality, adding new methods in Machine for file descriptor handling, and implementing file descriptor management in new files (fds.hpp and fds.cpp).

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/tinykvm/machine.hpp Replaced signals include with linux-specific ones and added declarations for file descriptor accessors
lib/tinykvm/machine.cpp Updated inclusion of thread headers
lib/tinykvm/linux/threads.hpp & .cpp Updated relative paths to headers
lib/tinykvm/linux/signals.hpp & .cpp Updated relative paths to headers and implemented sigaction
lib/tinykvm/linux/fds.hpp New header providing file descriptor management definitions
lib/tinykvm/linux/fds.cpp New implementation for managing file descriptors
Files not reviewed (1)
  • lib/CMakeLists.txt: Language not supported
Comments suppressed due to low confidence (1)

lib/tinykvm/linux/fds.cpp:88

  • [nitpick] The variable name 'gucci_path' is overly informal and may be unclear to other developers. Consider renaming it to 'allowed_path'.
for (const auto& gucci_path : this->m_allowed_paths)

@fwsGonzo fwsGonzo mentioned this pull request Apr 19, 2025
@fwsGonzo fwsGonzo force-pushed the file_descriptors branch 3 times, most recently from 7311ce3 to 6c6a8a7 Compare April 19, 2025 07:51
New FileDescriptors class that manages files and paths
MMAP with fd support
Implemented writev for files
@fwsGonzo fwsGonzo changed the title WIP managed file descriptors in TinyKVM Managed file descriptors, loading dynamic executables Apr 19, 2025
@fwsGonzo
Copy link
Member Author

At this point, it's enough to load a simple glibc hello world! A C++ shared executable is failing on something, which looks to be a trashed stack. However, Rust programs only depend on glibc, which in theory means that Rust default builds should now be loadable in TinyKVM.

@fwsGonzo fwsGonzo merged commit 89b8750 into master Apr 20, 2025
4 checks passed
@fwsGonzo fwsGonzo deleted the file_descriptors branch April 20, 2025 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant