zephyr/tests
Josh DeWitt c05cfbf15e kernel/sched: Re-sort waitq on priority change
k_thread_priority_set() on a pended thread wasn't re-inserting into the
waitq, causing the incorrect thread to run based on priority. When using
the scalable waitq config, this can also break assumptions of the tree
and leave the owner of a waitq still being in the waitq tree, cycles in
the tree, or a crash.

Remove and re-add a thread to a waitq to ensure the waitq remains in
order and the tree's assumptions are not violated.

To illustrate the issue, consider 4 threads in decreasing priority
order: A, B, C, and D along with two mutexes, m0 and m1. This is
implemented in the new complex_inversion mutex_api test.
1. D locks m1
2. C locks m0
3. C pends on m1
4. B pends on m1
5. A pends on m0, boosts C's priority, now tree on m1 is not sorted
6. D unlocks m1, left-most thread on tree is B. When removing B from
   tree it cannot be found because it searches to the right of C due to
   C's boosted priority when the node is actually on the left. rb_remove
   silently fails.
7. B unlocks m1, left-most thread on tree is still B and it tries to
   unpend itself, resulting in a NULL pointer dereference on
   B->base.pended_on.

Signed-off-by: Josh DeWitt <josh.dewitt@garmin.com>
2025-03-24 07:58:36 +01:00
..
application_development scripts: code_relocate: support section filter 2025-02-14 03:02:56 +01:00
arch tests: drivers: add overlay/testcase for silabs xg29_rb4412a board 2025-03-20 17:14:35 +01:00
benchmarks tests: thread_metric: Fix cooperative for SMP 2025-03-17 07:05:36 +01:00
bluetooth Bluetooth: tester: Fix name of btp_ascs_ase_found_ev 2025-03-23 13:19:51 +01:00
boards boards: espressif: esp32c6: Add LP Core board support 2025-03-21 17:05:20 +01:00
boot tests: boot: test_mcuboot: Add swap using offset test 2025-02-10 19:05:25 +01:00
bsim tests/bsim/run_parallel: Fail if an explicitly listed test is missing 2025-03-20 17:15:27 +01:00
cmake dts: zephyr,native-posix-cpu changed to zephyr,native-sim-cpu 2025-03-12 02:27:36 +01:00
crypto
ctest/base tests: Add CTest base harness testing 2025-01-10 04:12:42 +01:00
drivers tests: drivers: mfd: add maxq10xx device 2025-03-23 13:18:44 +01:00
integration/kernel
kconfig
kernel kernel/sched: Re-sort waitq on priority change 2025-03-24 07:58:36 +01:00
lib tests: lib: cmsis_dsp: Fix -Wsometimes-uninitialized warning 2025-03-23 13:19:27 +01:00
misc tests: linker: iterable_sections: Test sorting with 5 numeric characters 2025-01-22 10:40:45 +01:00
modules tests: modules: nanopb: Test on Big Endian platform 2024-12-19 15:20:11 +01:00
net scripts: make sure we do not install vulunerable python packages 2025-03-22 14:03:56 -04:00
posix test: posix: timers: Fix unused function warning 2025-03-24 07:53:10 +01:00
robot
subsys tests: pm: Enable standby power mode support on NXP RW612 Boards 2025-03-21 09:51:38 +01:00
unit everywhere: Use correct macro for gcc-specific warnings 2025-03-20 21:57:47 +01:00
ztest Revert "arch: deprecate _current" 2025-01-10 07:49:08 +01:00
test_config_ci.yaml twister: config: test on integration plaforms if defined 2025-03-19 08:51:50 -04:00
test_config.yaml