Hello, Priority inheritance has a known bug, and it is not working correctly. See issue #6310: https://github.com/apache/incubator-nuttx/issues/6310
I had to disable it in our application, as it causes lots of problems. As I see, there are a couple of propositions on fixing this, but none of them is merged yet. I would like to also express interest in this getting fixed. It is important for our application. Maybe the fix should be included in the upcoming release? On Mon, Sep 5, 2022 at 11:24 PM Nathan Hartman <hartman.nat...@gmail.com> wrote: > Has anyone ended up in __stack_chk_fail() from nxsig_nanosleep()? > > I am running ostest on tiva and consistently getting a panic in the > "priority_inheritance: Restoration Test" (priority_inheritance() in > apps/testing/ostest/prioinherit.c). > > It always happens in the same place: > > The above-mentioned function creates 3 tasks called Task0, Task1, > Task2; grep for NUMBER_OF_COMPETING_THREADS to find the place where > these three tasks are started. > > The task main function is adversary() in the same file; adversary() > looks like this: > > static int adversary(int argc, FAR char *argv[]) > { > int index = atoi(argv[1]); > int inital_delay = atoi(argv[2]); > int hold_delay = atoi(argv[3]); > > sleep_and_display(index, inital_delay); > printf("priority_inheritance: " > "%s Started, waiting %d uS to take count\n", argv[0], > inital_delay); > sem_wait(&g_sem); > sleep_and_display(index, hold_delay); > sem_post(&g_sem); > printf("priority_inheritance: %s Posted\n", argv[0]); > sleep_and_display(index, 0); > return 0; > } > > It runs sleep_and_display(), which calls usleep(), which eventually > calls nxsig_nanosleep(). When nxsig_nanosleep() finishes and wants to > return, the stack smashing protection kicks in and we end up in > __stack_chk_fail(). I think this is happening in Task2() or is in some > way connected to context switching between Task2() and another task > due to the sleep. > > So far I can't seem to figure out why. > > Thanks, > Nathan >