Skip to content

Android does not support faccessat2 #24860

Description

@lunagl

Zig Version

0.15.0-dev.1519+dd4e25cf4

Steps to Reproduce and Observed Behavior

Since #23541 Zig unconditionally uses the faccessat2 syscall in std.os.linux.faccessat.

Unfortunately Android does not support this syscall, and due to their seccomp filter it results in the process receiving a SIGSYS.

const std = @import("std");

pub fn main() !void {
    try std.posix.faccessat(0, "/usr/bin/env", std.posix.F_OK, 0);
}

Results in the program terminating with Unknown signal 31.

Additionally, I have observed this happening when running a zig build-exe using a Zig debug build without LLVM, because it tried to check for build.zig with faccessat2. The prebuilt release I have tested does not show this behaviour.

Go also ran into this issue previously, see golang/go#57393.

Expected Behavior

The faccessat2 syscall should not be used on Android.

This might be difficult at the moment, since Zig treats Android as Linux, has no separate release builds for Android and currently as far as I can tell no proper detection of the Android ABI.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavioros-androidAndroid (Linux variant)standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions