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

core: fix null pointer dereference #19757

Merged
merged 1 commit into from
Jul 6, 2023
Merged

Conversation

szsam
Copy link
Contributor

@szsam szsam commented Jun 22, 2023

Check return values of following functions for null:

  • thread_get
  • thread_get_unchecked

Contribution description

Testing procedure

Issues/PRs references

@szsam szsam requested a review from kaspar030 as a code owner June 22, 2023 19:26
@github-actions github-actions bot added the Area: core Area: RIOT kernel. Handle PRs marked with this with care! label Jun 22, 2023
@benpicco benpicco added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 23, 2023
@riot-ci
Copy link

riot-ci commented Jun 23, 2023

Murdock results

✔️ PASSED

3fad959 core: fix null pointer dereference

Success Failures Total Runtime
6931 0 6931 10m:15s

Artifacts

core/msg.c Outdated
Comment on lines 325 to 327
if (target == NULL) {
DEBUG("msg_reply_int(): target thread %d does not exist\n", m->sender_pid);
return -1;
}

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, this looks to me like it can only trigger when in violation with the API. E.g. msg_reply_int() must make sure that the thread to reply to does exists (e.g. in an app where no thread ever exits, this is trivial).

Adding an assert() here with a comment that msg_reply_int() can only be used to reply to existing threads could help debugging, though.

@kaspar030 Could we deprecate all the msg*_ist() functions? IMO apps should migrate to msg_post() for IRQ to thread communication anyway.

@szsam
Copy link
Contributor Author

szsam commented Jul 5, 2023

I force-pushed my branch. But the update is not shown here...

Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

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

thx for the PR. Please squash :)

Check return values of following functions for null:
  - thread_get
  - thread_get_unchecked
@szsam szsam force-pushed the null-check/core branch from 8748d7f to 3fad959 Compare July 5, 2023 18:51
@benpicco
Copy link
Contributor

benpicco commented Jul 5, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented Jul 6, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit f0dc0e7 into RIOT-OS:master Jul 6, 2023
@benpicco benpicco added this to the Release 2023.07 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: core Area: RIOT kernel. Handle PRs marked with this with care! CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants