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

lib/posix-unixsocket: Fix NULL deref crash #1326

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

andreittr
Copy link
Contributor

Description of changes

Previously unix_socket_recvfrom would not check its fromlen argument before dereferencing it, even though the API allows for it to be NULL. This change fixes this oversight, eliminating a potential crash.

Prerequisite checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Ran the checkpatch.uk on your commit series before opening this PR;
  • Updated relevant documentation.

Base target

  • Architecture(s): N/A
  • Platform(s): N/A
  • Application(s): N/A

Additional configuration

Test: call recvfrom() on a unix socket with NULL for src_addr.

Previously `unix_socket_recvfrom` would not check its `fromlen` argument
before dereferencing it, even though the API allows for it to be NULL.
This change fixes this oversight, eliminating a potential crash.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
@andreittr andreittr requested a review from a team as a code owner February 16, 2024 14:24
@github-actions github-actions bot added area/lib Internal Unikraft Microlibrary lang/c Issues or PRs to do with C/C++ labels Feb 16, 2024
@razvand razvand requested review from razvand, mariasfiraiala and Mihnea0Firoiu and removed request for a team and razvand March 13, 2024 20:35
@razvand razvand added this to the v0.17.0 (Calypso) milestone Mar 13, 2024
Copy link
Member

@Mihnea0Firoiu Mihnea0Firoiu left a comment

Choose a reason for hiding this comment

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

All good.
Reviewed-by: Mihnea Firoiu mihneafiroiu0@gmail.com

Copy link
Contributor

@mariasfiraiala mariasfiraiala left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

Reviewed-by: Maria Sfiraiala maria.sfiraiala@gmail.com

Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

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

Approved-by: Razvan Deaconescu razvand@unikraft.io

@razvand razvand changed the base branch from staging to staging-1326 March 18, 2024 06:42
@razvand razvand merged commit 3aa29ea into unikraft:staging-1326 Mar 18, 2024
12 checks passed
razvand pushed a commit that referenced this pull request Mar 18, 2024
Previously `unix_socket_recvfrom` would not check its `fromlen` argument
before dereferencing it, even though the API allows for it to be NULL.
This change fixes this oversight, eliminating a potential crash.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1326
@andreittr andreittr deleted the ttr/fix-unixsock-recvcrash branch March 18, 2024 12:57
SerbanSo pushed a commit to SerbanSo/unikraft-ASLR that referenced this pull request Jun 16, 2024
Previously `unix_socket_recvfrom` would not check its `fromlen` argument
before dereferencing it, even though the API allows for it to be NULL.
This change fixes this oversight, eliminating a potential crash.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: unikraft#1326
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lib Internal Unikraft Microlibrary lang/c Issues or PRs to do with C/C++
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants