Skip to content

Race Condition May Result in Data Loss During Log Rotation #5761

@zwass

Description

@zwass

This is a theorized issue that has not been demonstrated in the real-world. I am reporting this because it seems like a potential problem when reading the code.

There is a potential race condition in which result logs may be lost when log rotation is performed by an external tool (the recommended strategy). See #302 for some context.

Take the following ordering of events:

  1. Osquery opens the log file to write results.

  2. An external log rotation process rotates the log file.

  3. Osquery writes results to the fd of the old log file (now defunct due to the log rotation performed externally).

In this scenario, I believe that the final set of logs may be permanently lost. This could depend on the exact behavior of the log rotation tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions