Skip to content

Segmentation fault with sequence of conditionally compiled tracing debug calls on certain archs #3324

Open
@s-m-e

Description

@s-m-e

Bug Report

Minimal example, it requires a project with a few optional features (e.g. ddd and hhh disabled, rest enabled):

use std::process::ExitCode;

use tracing::{debug, info, Level};
use tracing_subscriber;

fn main() -> ExitCode {
    tracing_subscriber::fmt()
        .json()
        .with_max_level(Level::DEBUG)
        .with_current_span(false)
        .init();

    // start

    #[cfg(feature = "aaa")]
    debug!(feature = "aaa");
    #[cfg(feature = "bbb")]
    debug!(feature = "bbb");
    #[cfg(feature = "ccc")]
    debug!(feature = "ccc");
    #[cfg(feature = "ddd")]
    debug!(feature = "ddd");
    #[cfg(feature = "eee")]
    debug!(feature = "eee");
    #[cfg(feature = "fff")]
    debug!(feature = "fff");
    #[cfg(feature = "hhh")]
    debug!(feature = "hhh");

    // end

    ExitCode::from(0)
}

Version

RUST_VERSION=1.87.0
RUSTUP_VERSION=1.28.2

    │   │   │   └── tracing v0.1.41
    │   │   │       ├── tracing-attributes v0.1.28 (proc-macro)
    │   │   │       └── tracing-core v0.1.33
    ├── tracing v0.1.41 (*)
    ├── tracing-subscriber v0.3.19
    │   ├── tracing-core v0.1.33 (*)
    │   ├── tracing-log v0.2.0
    │   │   └── tracing-core v0.1.33 (*)
    │   └── tracing-serde v0.2.0
    │       └── tracing-core v0.1.33 (*)

Platform

Bug does not trigger on Linux x86-64 with glibc & musl and recent Linux environments (Ubuntu LTS 22, 24, equivalent Debians, etc).

Bug does trigger on ARM (v7 / 32bit, compiled on x86-64) with glibc (cargo build --release --target arm-unknown-linux-gnueabi), Linux 5.10.213-xilinx 1 SMP PREEMPT armv7l.

Description

On the described target platform, the above code segfaults right out of the gate - the binary appears to be broken. Any code prior to start also does not get executed. If code between start and end is removed, it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions