← Back to Pull requests

syscalls: compare filesystem types as u64s #426

Open
unknown opened this pull request with 380 lines diff across 4 files
View on GitHub
unknown unknown commented on Sep 08, 2026 07:35 UTC
Author

libpathrs does not compile on s390x with musl:

error[E0308]: mismatched types
--> src/procfs.rs:982:19
|
982 | if fs_type != rustix_fs::PROC_SUPER_MAGIC {
| ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found u64

The type of "struct statfs"'s f_type field is not always the same as
rustix::fs::FsWord. s390x uses rustix's libc backend, where FsWord is a
u64 for musl, but the libc crate declares statfs.f_type as a c_uint on
s390x-musl -- so the two cannot be compared. (This only happens on musl;
on s390x-gnu both types are u32s, which is why nobody noticed.)

Rather than relying on those two types matching, add a fstatfs_type()
wrapper that widens statfs.f_type to a u64 and use our own u64 constants
for the filesystem magic numbers, so that the comparisons compile
regardless of which architecture and rustix backend we are built for.

Our check-cross matrix only contained s390x-unknown-linux-gnu, so it
could never have caught this -- add s390x-unknown-linux-musl as well.
rustup does not distribute a pre-built libstd for that target (it is
tier 3), so that matrix entry uses nightly Rust and -Zbuild-std to build
libstd itself.

Fixes #425

  • - -
  • Test: docker build --platform amd64,arm64,ppc64le,s390x,riscv64,linux/arm/v6,linux/arm/v7 .

    ARG ALPINE_VERSION=3.24.1
    ARG LIBPATHRS_REPO=https://github.com/AkihiroSuda/libpathrs.git
    ARG LIBPATHRS_VERSION=fix-425
    
    FROM --platform=$BUILDPLATFORM alpine:${ALPINE_VERSION}
    RUN apk add --no-cache cargo rust git
    
    ARG LIBPATHRS_REPO
    ARG LIBPATHRS_VERSION
    ADD --keep-git-dir=true "$LIBPATHRS_REPO#$LIBPATHRS_VERSION" libpathrs
    WORKDIR /libpathrs
    
    ARG TARGETARCH
    ARG TARGETVARIANT
    RUN set -ex; \
        case "$TARGETARCH/$TARGETVARIANT" in \
          amd64/*)     apk_arch=x86_64;  triple=x86_64-alpine-linux-musl           ;; \
          arm64/*)     apk_arch=aarch64; triple=aarch64-alpine-linux-musl          ;; \
          arm/v6)      apk_arch=armhf;   triple=armv6-alpine-linux-musleabihf      ;; \
          arm/v7|arm/) apk_arch=armv7;   triple=armv7-alpine-linux-musleabihf      ;; \
          ppc64le/*)   apk_arch=ppc64le; triple=powerpc64le-alpine-linux-musl      ;; \
          s390x/*)     apk_arch=s390x;   triple=s390x-alpine-linux-musl            ;; \
          riscv64/*)   apk_arch=riscv64; triple=riscv64-alpine-linux-musl          ;; \
          *) echo "unsupported platform $TARGETARCH/$TARGETVARIANT" >&2; exit 1 ;; \
        esac; \
        rustc --print target-list | grep -qx "$triple" \
          || { echo "rustc has no target spec for $triple" >&2; exit 1; }; \
        mkdir -p /sysroot/etc/apk/keys; \
        cp /etc/apk/repositories /sysroot/etc/apk/; \
        echo "$apk_arch" >/sysroot/etc/apk/arch; \
        apk add --no-cache --initdb --root /sysroot --allow-untrusted alpine-keys; \
        apk add --no-cache --root /sysroot rust; \
        ln -s "/sysroot/usr/lib/rustlib/$triple" \
              "$(rustc --print sysroot)/lib/rustlib/$triple"; \
        cargo build --target "$triple"
    

    Diff: 380 lines (+285 / -95) across 4 files Reviewer: cyphar Review duration: 33931m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 380 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.356
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #426"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.9% (MEDIUM) · Higher = larger blast radius
    42.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.9% · Safe to merge
    22.9%