Skip to content

Valgrind reports that statx arguments point to unaddressable bytes #68979

Closed
@shepmaster

Description

@shepmaster

I tried this code:

fn main() {
    std::fs::metadata("/").unwrap();
}

I compiled it and ran it under Valgrind:

$ rustc example.rs
$ valgrind ./example

I expected to see that Valgrind reported no errors.

Instead, it reports errors:

==1164== Memcheck, a memory error detector
==1164== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1164== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==1164== Command: ./example
==1164==
==1164== Syscall param statx(file_name) points to unaddressable byte(s)
==1164==    at 0x49B094D: syscall (syscall.S:38)
==1164==    by 0x1149AB: statx (weak.rs:90)
==1164==    by 0x1149AB: std::sys::unix::fs::try_statx (fs.rs:132)
==1164==    by 0x11430E: std::sys::unix::fs::stat (fs.rs:995)
==1164==    by 0x10C43B: std::fs::metadata (in /home/ubuntu/example)
==1164==    by 0x10CBB2: example::main (in /home/ubuntu/example)
==1164==    by 0x10C382: std::rt::lang_start::{{closure}} (in /home/ubuntu/example)
==1164==    by 0x113082: {{closure}} (rt.rs:52)
==1164==    by 0x113082: std::panicking::try::do_call (panicking.rs:292)
==1164==    by 0x114E39: __rust_maybe_catch_panic (lib.rs:78)
==1164==    by 0x113A7F: try<i32,closure-0> (panicking.rs:270)
==1164==    by 0x113A7F: catch_unwind<closure-0,i32> (panic.rs:394)
==1164==    by 0x113A7F: std::rt::lang_start_internal (rt.rs:51)
==1164==    by 0x10C367: std::rt::lang_start (in /home/ubuntu/example)
==1164==    by 0x10CBEA: main (in /home/ubuntu/example)
==1164==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==1164==
==1164== Syscall param statx(buf) points to unaddressable byte(s)
==1164==    at 0x49B094D: syscall (syscall.S:38)
==1164==    by 0x1149AB: statx (weak.rs:90)
==1164==    by 0x1149AB: std::sys::unix::fs::try_statx (fs.rs:132)
==1164==    by 0x11430E: std::sys::unix::fs::stat (fs.rs:995)
==1164==    by 0x10C43B: std::fs::metadata (in /home/ubuntu/example)
==1164==    by 0x10CBB2: example::main (in /home/ubuntu/example)
==1164==    by 0x10C382: std::rt::lang_start::{{closure}} (in /home/ubuntu/example)
==1164==    by 0x113082: {{closure}} (rt.rs:52)
==1164==    by 0x113082: std::panicking::try::do_call (panicking.rs:292)
==1164==    by 0x114E39: __rust_maybe_catch_panic (lib.rs:78)
==1164==    by 0x113A7F: try<i32,closure-0> (panicking.rs:270)
==1164==    by 0x113A7F: catch_unwind<closure-0,i32> (panic.rs:394)
==1164==    by 0x113A7F: std::rt::lang_start_internal (rt.rs:51)
==1164==    by 0x10C367: std::rt::lang_start (in /home/ubuntu/example)
==1164==    by 0x10CBEA: main (in /home/ubuntu/example)
==1164==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

Meta

rustc --version --verbose:

$ rustc --version --verbose
rustc 1.41.0 (5e1a79984 2020-01-27)
binary: rustc
commit-hash: 5e1a799842ba6ed4a57e91f7ab9435947482f7d8
commit-date: 2020-01-27
host: x86_64-unknown-linux-gnu
release: 1.41.0
LLVM version: 9.0

rustc +nightly --version --verbose:

rustc 1.43.0-nightly (a29424a22 2020-02-07)
binary: rustc
commit-hash: a29424a2265411dda7d7446516ac5fd7499e2b55
commit-date: 2020-02-07
host: x86_64-unknown-linux-gnu
release: 1.43.0-nightly
LLVM version: 9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-linuxOperating system: LinuxT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions