Repository navigation
Conversation
Some runtimes bring up lo with 127.0.0.1/8 in newly created network namespaces. Verify that state before issuing exclusive address creation, which otherwise fails with EEXIST under gVisor. Keep the original setup and failure handling for incomplete state or query errors. Add a TAP regression covering the verified fast path, failed queries, incomplete loopback state and descriptor cleanup. Fixes: containers#745 Signed-off-by: Vyacheslav Titov <viachesl4v@gmail.com>
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.
--unshare-netfails withloopback: Failed RTM_NEWADDRwhen the new network namespace already has its loopback configured. This happens with bubblewrap 0.12.0 under gVisorrelease-20260914.0; the unconditional setup is still present on current main.In a fresh gVisor network namespace,
lois already up with127.0.0.1/8. Adding that same address withRTM_NEWADDR | NLM_F_CREATE | NLM_F_EXCLreceivesNLMSG_ERRORwith-EEXIST. The printed errno can be misleading becausertnl_read_reply()currently does not propagate the netlink error toerrno.Check whether loopback already has the required state before configuring it. Return early only when the interface has both
IFF_UPandIFF_LOOPBACK, the address and netmask queries succeed withAF_INET, and the values are exactly127.0.0.1and255.0.0.0. Each query uses a separate zero-initialized request; gVisor can preserve the supplied address family while writing only the address. Query failures and state mismatches retain the original setup and fatal error handling.The check runs after the existing network namespace creation, so
--unshare-netkeeps creating its private namespace. No namespace, capability, seccomp, or mount restrictions are removed.Reproducer inside an existing gVisor container:
Validation:
-Wall -Wextra -Werrorbuild. Replacing the guard with an unconditional skip makes its second case fail, as expected.runsc release-20260914.0with UID/GID 1000, zero capabilities, andNoNewPrivs=1. Those checks cover command execution, file-descriptor environment handoff, raw network separation, read-only filesystem restrictions, and failure before the command when the sandbox binary is missing. A further six-check run verified private loopback and writable profile home with owner/sibling home restrictions.Fixes #745
Related: google/gvisor#13438