Closed tegimeki closed 1 year ago
All modified lines are covered by tests :white_check_mark:
Comparison is base (
5a9d7c8
) 93.62% compared to head (b534a8e
) 93.62%.:exclamation: Current head b534a8e differs from pull request most recent head 69e6b75. Consider uploading reports for the commit 69e6b75 to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@tegimeki Thank you for creating this PR. We will look into it and discuss with you here.
Kudos, SonarCloud Quality Gate passed!
@tegimeki Thank you for creating this PR. We will look into it and discuss with you here.
Thanks @chinglee-iot, I just pushed a new commit which addresses the formatting issue (unbalanced whitespace) and added another note in the commit message about a (pre-existing, now fixed) compilation warning on Mac OS:
FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix/port.c:153:22: warning: incompatible integer to pointer conversion assigning to 'StackType_t *' (aka 'unsigned long *') from 'unsigned long long' [-Wint-conversion]
pxEndOfStack = mach_vm_round_page( pxEndOfStack );
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This was addressed by casting the result to StackType_t *
.
Description
Aligns the stack end to a page boundary before computing its size, since the size depends on both the start and end.
The original change which introduced stack alignment (#674) only worked for cases where the round + trunc operation would wind up within the same area, but would lead to segfaults in other cases.
Tested on ARM64 and Intel MacOS, as well as ARM64 and Intel Linux. The test cases included a single-task case, as well as a case with two tasks passing queue messages.
Test Steps
Using the Posix port on an M1 Mac, create a task with the default
PTHREAD_STACK_MIN
or some other "lucky" size. The task can do nothing more than delay in a loop, and you should get a segfault. If not, a different stack size will cause one. Example backtrace:Checklist:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.