Closed
Conversation
CMakeRust only supports building Rust static libraries, so this uses a small C wrapper to call the Rust code. This version of it (calling libc's `write`) succeeds, and causes the output to be written to the expected log file. Calling `println!` in the Rust code when running under Shadow results in the Rust internals calling abort. Running gdb running shadow running the test results in a segfault when trying to load the plugin.
Contributor
Author
|
@robgjansen @rwails for discussion ^ |
Contributor
|
Back when we were working on elf-loader, there were some attempts to get a plugin written in Rust working: |
Contributor
Author
|
Interesting, thanks! #402 indeed might explain the segfault under gdb; maybe we're "luckily" getting an aligned stack in this case when not running under gdb. |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not intended to be merged in its current state; just for discussion. Follow-up to discussion in #761
Pulls in CMakeRust as a submodule, and creates a hello-world "test" using Rust. This version of it (directly calling libc's
writefrom Rust) works, but aborts or segfaults if we call Rust'sprintln!instead.Applied these to the Phantom branch, and it works fine there (including using
println!)My inclination is to keep the integration tests (code meant to be run under Shadow) in C for now so that we don't end up writing phantom-only integration tests (nor have to spend time figuring out how to get Rust code running reliably under the elf loader).
The CMakeRust tool used here could be useful though as a way to start to writing Shadow code itself in Rust; especially code that we intend to extract into its own library anyway.