littlekernel / lk

LK embedded kernel
MIT License
3.14k stars 615 forks source link

False negative in thread join test? #180

Open ashoksekar opened 7 years ago

ashoksekar commented 7 years ago

At [1], the join_tester_server test 3 is checking if the thread struct's magic is zero but the thread structure is freed by then at thread_exit [2] and thread->magic now holds the value of &delayed_free_list from heap_delayed_free. In other test cases(1,2 and 4) also thread->magic is checked after it is freed but the test didn't fail since HEAP_FREE doesn't seem to change its contents.

[1] https://github.com/littlekernel/lk/blob/master/app/tests/thread_tests.c#L548 - join_tester_server test 3 [2] https://github.com/littlekernel/lk/blob/master/kernel/thread.c#L431