Skip to content

Principal-root object reads can wait indefinitely on a FIFO at an object path #458

Closed

Description

@SashaMIT

Summary

open_principal_root_object_file (elastos/crates/elastos-server/src/auth.rs:5453 on develop 3beb8164) opens an object with O_NOFOLLOW but without O_NONBLOCK. It checks that the object is a regular file only after open() returns. If a FIFO sits at an object path, a read-only open() waits until something opens the FIFO for writing. That wait can be indefinite.

read_principal_root_object (auth.rs:5300) takes the process-wide principal_root_object_mutation_lock() (auth.rs:5308) before it calls read_principal_root_object_locked, which opens the file (auth.rs:5352). While that open() waits, every other principal-root read and write that needs the same lock waits too.

Scope

Possible fix

Open with O_NONBLOCK added (O_NOFOLLOW | O_NONBLOCK), keep the existing metadata().is_file() refusal, then clear O_NONBLOCK with fcntl before reading. A FIFO then fails the regular-file check immediately instead of waiting. A test could create a FIFO with mkfifo at an object path and assert that read_principal_root_object returns an error within a short timeout.

Found while adding the limited-read link and non-regular-object tests to #67 (a968ffc5). Those tests leave out a FIFO case for this reason.

Activity

  1. andersalm commented on Oct 21, 2026

    @andersalm
    Contributor

    Duplicate of #450 (L8): fixed on the train in 2d12a35; #450 tracks it.

  2. andersalm commented on Oct 21, 2026

    @andersalm
    Contributor

    Reopened: the fix 2d12a3563 is on the 0.8.0 release train, which is not on develop yet. This issue closes when that fix is on develop with its review recorded and the FIFO case returns an error instead of waiting. #450 keeps the other open-path items for after 0.8.0.

  3. added this to the 0.8.0 milestone on Oct 21, 2026
  4. andersalm commented on Nov 11, 2026

    @andersalm
    Contributor

    Fix 2d12a35 shipped in 2.0.0: these object reads no longer wait on a FIFO.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions