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

Validate IOCTL header length #1256

Merged
merged 1 commit into from
Jun 29, 2022
Merged

Conversation

dthaler
Copy link
Collaborator

@dthaler dthaler commented Jun 27, 2022

Description

Validate the header.length passed to various requests.

Also add one test case that's part of #1139

Testing

Includes updated tests.

Documentation

No impact.

@codecov
Copy link

codecov bot commented Jun 27, 2022

Codecov Report

Merging #1256 (935540e) into main (025639b) will decrease coverage by 0.00%.
The diff coverage is 86.84%.

❗ Current head 935540e differs from pull request most recent head 57cc13f. Consider uploading reports for the commit 57cc13f to get more accurate results

@@            Coverage Diff             @@
##             main    #1256      +/-   ##
==========================================
- Coverage   88.04%   88.04%   -0.01%     
==========================================
  Files         101      101              
  Lines       17488    17546      +58     
==========================================
+ Hits        15397    15448      +51     
- Misses       2091     2098       +7     
Impacted Files Coverage Δ
libs/execution_context/ebpf_core.c 91.21% <80.00%> (-0.49%) ⬇️
...ution_context/unit/execution_context_unit_test.cpp 98.86% <92.68%> (-0.24%) ⬇️
tests/end_to_end/test_helper.cpp 89.36% <0.00%> (+0.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a1b36d5...57cc13f. Read the comment docs.

Alan-Jowett
Alan-Jowett previously approved these changes Jun 27, 2022
Copy link
Collaborator

@shankarseal shankarseal left a comment

Choose a reason for hiding this comment

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

Why not add safe add for the IOCTL processing as well?

@dthaler
Copy link
Collaborator Author

dthaler commented Jun 28, 2022

Why not add safe add for the IOCTL processing as well?

I don't understand your question, can you elaborate?
Also since you commented without approving, does that mean you want some change before merging?

@shankarseal
Copy link
Collaborator

Why not add safe add for the IOCTL processing as well?

I don't understand your question, can you elaborate? Also since you commented without approving, does that mean you want some change before merging?

What I meant to ask is, is ebpf_safe_size_t_add/multiply not required in similar IOCTL processing code? Such as line 324 in ebpf_core.c ?

@dthaler
Copy link
Collaborator Author

dthaler commented Jun 28, 2022

Why not add safe add for the IOCTL processing as well?

I don't understand your question, can you elaborate? Also since you commented without approving, does that mean you want some change before merging?

What I meant to ask is, is ebpf_safe_size_t_add/multiply not required in similar IOCTL processing code? Such as line 324 in ebpf_core.c ?

@shankarseal that particular line does not need it because request->header.length is only 16 bits, so maxes out at 65535. That means count_of_helpers is at most 16383 which means line 324 cannot possibly overflow.

shankarseal
shankarseal previously approved these changes Jun 29, 2022
@dthaler dthaler merged commit 5bb8238 into microsoft:main Jun 29, 2022
@dthaler dthaler deleted the validate-header-length branch June 29, 2022 15:56
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.

3 participants