Linux Security / Advanced: constrained design and verified change / Lesson 21
Review object identity across a path race
Model and verify a defensive resource-access design when a directory entry can change over time.
On this page
Lesson goals
- Distinguish a pathname from object identity.
- Identify the check-to-use interval and directory authority.
- Evaluate a bounded synthetic verification.
Model resource identity over time
A pathname is a route to an object, and the object reached by the same name can change if an authorized actor modifies a directory entry. A security-sensitive worker that checks a path and later uses it must consider the interval between those operations. In this synthetic offline model, a name refers to object A at one time and may refer to object B later. The purpose is defensive design review in an authorized isolated lab, not manipulation of a live system.
Identify the check and use boundary
Write down the condition checked, the subsequent operation and which object identity each step actually refers to. A successful earlier check on a pathname does not automatically prove that a later operation reached the same object. The first table illustrates a possible sequence, not observed execution. Review the platform’s supported object-handle and path-resolution semantics for the task, and decide how to bind validation and use under the application’s authority model. Do not claim that one generic flag solves every race.
Time | Observation
T1 | name refers to object A
T2 | directory entry changes
T3 | name may refer to object B
The table describes a hypothetical lab sequence and contains no executable commands.
Review authority over the directory
Identify who can create, rename or replace entries in each relevant directory and whether links or mounts are part of the supported workflow. The second table lists questions for the design review rather than operating commands. Restrict the experiment to synthetic objects and a disposable workspace. A directory assumed to be private but writable by an unrelated principal changes the threat model. Ownership, permission and lifecycle assumptions should be documented and reviewed with the service owner.
Review question | Evidence
who changes directory? | ownership and permissions
which object is used? | supported handle semantics
The table describes a hypothetical lab sequence and contains no executable commands.
Design a controlled verification
In an isolated lab, construct a controlled fixture that changes a synthetic directory entry between a modeled check and use, and record which object the supported test method observes. Also test a normal permitted operation and a denied unrelated operation. Preserve the fixture, timing assumptions and exact method without accessing real user files. If the method cannot establish object identity, mark the result inconclusive rather than inferring safety from the absence of a visible error.
Report the supported conclusion
After a design correction, repeat the controlled fixture and verify that the intended operation targets the expected object and unrelated access remains denied. Record the platform assumptions, artifact and configuration tested, and request an independent review of the authority boundary. These results support the selected scenario and implementation; they do not establish that all path races, filesystems or concurrent schedules are safe. Retain the test and revisit it when directory ownership or the resource workflow changes.
Common errors and fixes
Assuming a checked name always refers to the same object
- Why it happens
- A directory entry can change between operations.
- How to fix it
- Review how validation and use bind to object identity.
- Prevent it next time
- Model concurrent changes in an isolated test.
Ignoring who can modify the parent directory
- Why it happens
- Ownership and permissions are outside the initial model.
- How to fix it
- Review effective directory authority and workflow.
- Prevent it next time
- Document the full resource path and its owners.
Treating one passing schedule as proof of safety
- Why it happens
- The test covers only selected timing and platform conditions.
- How to fix it
- Record scope and seek independent design review.
- Prevent it next time
- Retain controlled fixtures and revisit assumptions.
2 practice exercises
1. A name refers to A at the check and B at use. What assumption failed?
Show worked solution
The earlier pathname observation was assumed to identify the later object. Review the authority and supported method that bind validation to use.
2. A controlled test cannot determine which object was used. What should it report?
Show worked solution
The result is inconclusive. Improve the safe observation method and retain the uncertainty instead of calling the design secure.
Key takeaways
- Pathnames and object identities can diverge over time.
- Review directory authority and test bounded synthetic scenarios.