FreeRTOS / FreeRTOS-Kernel

FreeRTOS kernel files only, submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos.
https://www.FreeRTOS.org
MIT License
2.51k stars 1.05k forks source link

Add removed unprivileged access check to ARM_CRx_MPU xPortIsAuthorizedToAccessBuffer() #1016

Closed Skptak closed 3 months ago

Skptak commented 3 months ago

Description

During PR review of the ARM_CRx_MPU port a check for permissions inside of xPortIsAuthorizedToAccessBuffer() was modified and introduced a new bug. The check for if the task had write permissions to a variable it was attempting to read from was removed. This PR fixes this by adding this check back in.

Test Steps

Run the following code from an unprivileged task.

xReturned = xTaskNotifyGive( xTaskGetCurrentTaskHandle() );
prvNotifyCheck( xReturned );

This will cause a failure in the existing version of xPortIsAuthorizedToAccessBuffer(). Currently there is no check for if the buffer being used is allowed write access.

This PR fixes this issue.

Checklist:

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.00%. Comparing base (345a86d) to head (f5fae02).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1016 +/- ## ======================================= Coverage 93.00% 93.00% ======================================= Files 6 6 Lines 3200 3200 Branches 879 879 ======================================= Hits 2976 2976 Misses 111 111 Partials 113 113 ``` | [Flag](https://app.codecov.io/gh/FreeRTOS/FreeRTOS-Kernel/pull/1016/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FreeRTOS) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/FreeRTOS/FreeRTOS-Kernel/pull/1016/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FreeRTOS) | `93.00% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FreeRTOS#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud