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