Skip to content

statx system call may return ENOSYS due to seccomp #23514

@dtinth

Description

@dtinth

Related issue:

I’m not a Zig user, but I use Bun, which is built on top of Zig (and has recently upgraded to use Zig 0.14), to build applications that is packaged into a Docker image. However, in some environments it gets deployed to, the statx system call caused the application to crash when a file is read. Following is the strace line:

statx(12, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_TYPE|STATX_MODE|STATX_ATIME|STATX_MTIME|STATX_CTIME, 0x7fff8f276b30) = -1 ENOSYS (Function not implemented)

According to issue #23153, Zig requires kernel v4.19+. However, the environment in question is running on kernel version 6.1.0, yet we face the same issue.

This issue seems to be widespread in the Bun community:

…when the application image is deployed into envionments where developers cannot control the kernel, such as:

  • NAS devices stuck with an older kernel
  • PaaS services running an older kernel
  • Old servers running an old kernel

Our current workaround is to revert back to using an older version of Bun built on top of Zig 0.13, but that means we are stuck with an older Bun runtime for the time being. I reported this issue to the Bun project, and for the time being Bun team intends to patch Zig’s stdlib in their fork.

However, this issue may affect other non-Bun Zig users, so I am filing an issue here as well. It would also be great if we can arrive at a solution where Bun can use Zig without much patching on their side.

Alternatively, is there any way to disable the use of this system call?

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.os-linuxLinuxstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions