Conversation
AT_SYMLINK_NOFOLLOW must only suppress following the final pathname component. do_utimensat previously used lookup(), whose zero symlink budget also prevented intermediate directory symlinks from being resolved. Valid usr-merged paths consequently failed with ENOTDIR. Reuse lookup_follow_symlink2 with the normal follow budget and an explicit final-component policy. Keep the fd path, timestamp permission checks, metadata masks and notification behavior unchanged. This fixes the trigger observed while Ubuntu dpkg sets timestamps on /sbin/ip.dpkg-new during iproute2 installation. The prior error entered dpkg's diversion cleanup path, which removed /bin and /sbin and prevented the next boot. The kernel change does not special-case those names or claim to fix dpkg's independent rollback behavior. Add 30 parameterized dunitest checks covering tmp and current-directory fixtures, intermediate relative/absolute links, dirfd paths, final and dangling links, trailing slashes, search permissions, error cases, UTIME_OMIT, current-time updates and futimens. Register the suite in the CI whitelist and no-skip list. Validation: - Linux new suite: 30 passed; pre-fix DragonOS: 6 passed, 24 failed. - Fixed DragonOS on tmpfs/ext4: 30 passed, including after reboot. - Existing open_dangling_symlink suite: 11 passed. - Selected gVisor utimes/futimesat/utimensat tests: 14 passed. - make kernel, make fmt and FMT_CHECK=1 make fmt passed. - Normal nginx apt installation completed with iproute2, nginx-common and nginx installed; system links survived sync and reboot. The separate nginx dual-stack bind failure remains outside this fix. Signed-off-by: longjin <longjin@dragonos.org>
Member
Author
|
@codex review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
utimensat(AT_SYMLINK_NOFOLLOW)to follow intermediate directory symlinks while leaving the final symlink unfollowed.Root cause
The pathname branch used
lookup(), which disables all symlink traversal, instead of selecting only the final-component policy. A valid path such as/sbin/ip.dpkg-newtherefore returnedENOTDIRon a usr-merged Ubuntu rootfs.This was reproduced without nginx by unpacking Ubuntu iproute2 6.1.0-1ubuntu6.4. dpkg 1.22.6ubuntu6.6 then entered its diversion rollback path: extraction used the diverted directory names, while cleanup used the original names and removed
/binand/sbin. The next boot could not resolve/bin/busybox.This PR fixes the kernel trigger by matching Linux 6.6 pathname semantics. It does not add path-specific unlink protection or modify dpkg, and does not claim to fix dpkg rollback under unrelated installation errors.
Validation
make kernelmake fmtFMT_CHECK=1 make fmtnginx -tThe gVisor selection excludes the existing blocklisted
UtimeTest.ZeroAtimeandMtime; no reference tests or blocklists were changed. Independent adversarial reviews covered Linux semantics, permissions, lifecycle, performance, maintainability and test validity.Scope and remaining issues
Default nginx service startup still reports
EADDRINUSEfor[::]:80; a separate IPv4 smoke test succeeds. This networking issue, the previously observed concurrency/TLS issues, and dpkg's independent diversion rollback risk are not fixed by this PR. Installation and reboot success must not be interpreted as full nginx compatibility.