Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: GetDevlinkDeviceParam to handle edge-cases correctly #782

Merged

Conversation

ykulazhenkov
Copy link
Collaborator

@ykulazhenkov ykulazhenkov commented Sep 23, 2024

On some kernels GetDevlinkDeviceParam may return empty values for some kernel parameters. The netlink library is able to handle this, but the code in GetDevlinkDeviceParam function may panic if unexpected value received.
Add extra checks to avoid panics.

The problem was discovered on an old kernel (5.15.0-25-generic) for Ubuntu 22.04.
The parameter has no value:

devlink dev param show pci/0000:08:00.0 name flow_steering_mode
pci/0000:08:00.0:
  name flow_steering_mode type driver-specific
    values:

segfault happens when trying to set the value

devlink dev param set pci/0000:08:00.0 name flow_steering_mode value smfs  cmode runtime
Segmentation fault (core dumped)

In the recent kernels everything works as expected. This change is primarily intended to enhance the operator's robustness, rather than to address any current issues.

Copy link

Thanks for your PR,
To run vendors CIs, Maintainers can use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs, Maintainers can use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

On some kernels GetDevlinkDeviceParam may return empty values
for some kernel parameters. The netlink library is able to handle this, but
the code in GetDevlinkDeviceParam function may panic if unexpected value
received. Add extra checks to avoid panics
@coveralls
Copy link

Pull Request Test Coverage Report for Build 10998783450

Details

  • 8 of 20 (40.0%) changed or added relevant lines in 2 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.008%) to 45.042%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/host/internal/sriov/sriov.go 0 5 0.0%
pkg/host/internal/network/network.go 8 15 53.33%
Files with Coverage Reduction New Missed Lines %
controllers/drain_controller.go 1 68.06%
pkg/host/internal/network/network.go 1 56.11%
Totals Coverage Status
Change from base Build 10979758277: 0.008%
Covered Lines: 6632
Relevant Lines: 14724

💛 - Coveralls

Copy link
Collaborator

@adrianchiris adrianchiris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

@ykulazhenkov
Copy link
Collaborator Author

@zeeke @SchSeba Can you check this one? Thanks

@ykulazhenkov ykulazhenkov removed the request for review from e0ne September 24, 2024 08:42
Copy link
Member

@zeeke zeeke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ykulazhenkov ykulazhenkov removed the request for review from SchSeba October 1, 2024 14:03
@e0ne e0ne merged commit 31175eb into k8snetworkplumbingwg:master Oct 2, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants