Repository navigation
libct/validate: fix netdev name length check - #5606
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
Contributor
|
@RaphaelFakhri can you please use your real email in the Signed-off-by? |
This comment was marked as outdated.
This comment was marked as outdated.
IFNAMSIZ (16) includes the terminating NUL byte, so the longest valid network interface name is 15 bytes, and the kernel rejects a 16-byte one (see dev_valid_name and the IFLA_IFNAME netlink policy). devValidName accepted 16-byte names, so a config with such a linux.netDevices name passed validation, and runc failed later, when moving the device, with "numerical result out of range". By then, the host interface was already set down, and it stayed down. Reject names of IFNAMSIZ bytes or longer, and fix the test case which treated a 16-byte name as valid. Signed-off-by: Raphael Fakhri <mail@raphaelfakhri.com>
RaphaelFakhri
force-pushed
the
netdev-ifname-len
branch
from
November 6, 2026 20:17
c0e23c2 to
e152f7a
Compare
Author
|
@kolyshkin The commit now uses For the unit test: the commit already changes the |
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.
IFNAMSIZ(16) includes the terminating NUL byte, so the longest valid network interface name is 15 bytes, and the kernel rejects a 16-byte one (seedev_valid_nameand theIFLA_IFNAMEnetlink policy).devValidNameaccepted 16-byte names, so a config with such alinux.netDevicesname passed validation, and runc failed later, while moving the device, withnumerical result out of range. By then, the host interface was already set down, and it stayed down.This change rejects names of
IFNAMSIZbytes or longer, and fixes theTestDevValidNamecase that treated a 16-byte name as valid.Fixes #5605
Testing
go test -run TestDevValidName ./libcontainer/configs/validate/fails without the fix (16-byte case) and passes with it.netDevicesname,runc runnow fails withinvalid network device name "abcdefghijklmnop"and the host interface stays up. A 15-byte name still works.