Unsound usage of no_mangle
- Dominant language
- Rust
- Stars
- 98
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
```rust
#[no_mangle]
pub fn async_log_capture_caller() {
panic!("wat");
}
fn main() {
std::env::set_var("RUST_BACKTRACE", "1");
async_log::Logger::wrap(femme::pretty::Logger::new(), || 12)
.start(log::LevelFilter::Trace)
.unwrap();
log::info!("Hello, world!");
async_log_capture_caller();
}
```
```console
> cargo add femme@1 async-log@2 log@0.4
> cargo run
Running `target/debug/foo`
● Hello, world!, filename=/private/var/folders/0p/5yvmrvhj5w3_vy1y8x7dvk7m0000gn/T/tmp.AWJu4vYd/foo/src/main.rs, line=11, fn_name=foo::main::h3c9bc8b278fd41da
src/main.rs:11
› thread_id: 1
› task_id: 12
[1] 76248 segmentation fault cargo run
```
You have no guarantees that there is no other crate or non-Rust linked code using the global symbol `async_log_capture_caller`, so this crate should document that it reserves that name for its internal usage.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the crate-level or API documentation for the logging and caller-capture functionality. Document that the global symbol async_log_capture_caller is reserved for internal use because defining it elsewhere can cause a symbol collision and undefined behavior; the documentation should clearly state this restriction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- observability-sre
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100