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

BSD socket sendmsg() parameters were not verified in usermode #25706

Merged
merged 2 commits into from Jun 2, 2020

Conversation

jukkar
Copy link
Member

@jukkar jukkar commented May 28, 2020

Fixes #25702

@jukkar jukkar added this to the v2.3.0 milestone May 28, 2020
@zephyrbot zephyrbot added the area: Tests Issues related to a particular existing or missing test label May 28, 2020
@zephyrbot
Copy link
Collaborator

All checks passed.

checkpatch (informational only, not a failure)

-:154: WARNING:LONG_LINE: line over 80 characters
#154: FILE: tests/net/socket/udp/src/main.c:930:
+			 ztest_user_unit_test(test_v4_sendmsg_recvfrom_connected),

-:156: WARNING:LONG_LINE: line over 80 characters
#156: FILE: tests/net/socket/udp/src/main.c:932:
+			 ztest_user_unit_test(test_v6_sendmsg_recvfrom_connected),

- total: 0 errors, 2 warnings, 143 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: Ignored message types: AVOID_EXTERNS BRACES CONFIG_EXPERIMENTAL CONST_STRUCT DATE_TIME FILE_PATH_CHANGES MINMAX NETWORKING_BLOCK_COMMENT_STYLE PRINTK_WITHOUT_KERN_LEVEL SPDX_LICENSE_TAG SPLIT_STRING VOLATILE

NOTE: If any of the errors are false positives, please report
      them to the maintainers.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

@carlescufi carlescufi added the bug The issue is a bug, or the PR is fixing a bug label May 29, 2020
size_t i;
int ret;

memcpy(&msg_copy, msg, sizeof(msg_copy));
Copy link
Contributor

Choose a reason for hiding this comment

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

msg is a pointer to user memory, need to use z_user_from_copy()

Copy link
Member Author

@jukkar jukkar Jun 1, 2020

Choose a reason for hiding this comment

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

Yep , and we need to validate the socket descriptor too.

Edit: I will fix these issues after #25804 is merged.
Edit2: The sock will be validated automatically by #25804 so no need to do anything special here. Will send a new version.

@andrewboie andrewboie requested a review from ceolin May 30, 2020 17:38
If run in usermode, the sendmsg() parameters were not verified.

Fixes zephyrproject-rtos#25702

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Some of the sendmsg() tests were not run when in usermode.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
@jukkar
Copy link
Member Author

jukkar commented Jun 1, 2020

Updated according to comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BSD socket sendmsg() did not verify params in usermode
5 participants