nuttx/sched/sched
yushuailong 8cec1d01db
Some checks are pending
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
sched/sched: Fix uninitialized sporadic params returned by nxsched_get_param()
When querying the calling task itself (pid == 0 or the caller's own
pid), nxsched_get_param() only filled in sched_priority and never
touched the SCHED_SPORADIC related members (sched_ss_low_priority,
sched_ss_max_repl, sched_ss_repl_period and sched_ss_init_budget).
With CONFIG_SCHED_SPORADIC enabled, the caller received uninitialized
stack garbage in these fields, and a task running under the sporadic
policy could not retrieve its own sporadic parameters.

Fix this by factoring the sporadic parameter fill-in into a common
helper nxsched_get_sporadic_param() shared by both the self-query and
the lookup paths, so both paths now return identical information.

The self-query path keeps its original fast-path behavior: no TCB
lookup and a lock-free read of sched_priority.  Only the read of the
sporadic state is wrapped in a critical section, because tcb->sporadic
may be freed concurrently, e.g. by sched_setscheduler() from another
CPU switching the task away from SCHED_SPORADIC.

Signed-off-by: yushuailong <yyyusl@qq.com>
2026-08-01 11:19:50 +08:00
..
CMakeLists.txt sched/wdog: Simplify timer expiration for hrtimer. 2026-02-02 13:26:22 +08:00
Make.defs sched/wdog: Simplify timer expiration for hrtimer. 2026-02-02 13:26:22 +08:00
nxsched_checkstackoverflow.c sched: Improve nxsched stack overflow checking implementation 2025-10-11 18:00:44 +08:00
queue.h
sched.h sched/sched: fix typos and remove unused declarations in sched.h 2026-02-25 12:38:13 -05:00
sched_addblocked.c
sched_addreadytorun.c sched: Fix scheduler CPU selection and ready-to-run list management 2026-01-28 13:02:58 -03:00
sched_backtrace.c sched/backtrace: fix cross-CPU buffer access under addrenv 2026-07-20 21:01:28 -03:00
sched_cpuload.c style: Fix "the the" typo across the codebase. 2026-03-23 11:07:49 +01:00
sched_cpuload_oneshot.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
sched_cpuload_period.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
sched_critmonitor.c sched/sched_critmonitor: remove duplicate preemption start block 2026-07-28 16:04:50 +08:00
sched_dumponexit.c sched: add dump_stack() for dumponexit 2026-01-17 18:04:28 -03:00
sched_foreach.c
sched_get_stackinfo.c sched/sched/sched_get_stackinfo.c: coverity HIS_metric_violation: RETURN 2026-01-28 01:24:58 +08:00
sched_get_stateinfo.c sched_get_stateinfo.c: misra_c_2012_rule_8_9_violation 2026-01-31 02:39:19 +08:00
sched_get_tls.c sched/tls: fix uninitialized argv pointer in task info 2026-01-15 16:10:11 -03:00
sched_getaffinity.c
sched_getcpu.c
sched_getfiles.c sched_getfiles.c: coverity HIS_metric_violation: RETURN 2026-01-28 22:01:01 +08:00
sched_getparam.c sched/sched: Fix uninitialized sporadic params returned by nxsched_get_param() 2026-08-01 11:19:50 +08:00
sched_getscheduler.c sched_getscheduler.c: coverity HIS_metric_violation: RETURN 2026-01-28 13:07:20 -03:00
sched_gettcb.c
sched_idletask.c Revert "sched_idletask: remove the check for whether tcb is NULL" 2025-11-27 08:26:53 -03:00
sched_lock.c sched/sched: Modify the critical section interface name. 2026-01-26 21:13:05 +08:00
sched_lockcount.c
sched_mergepending.c coverity: Dereferencing after a null check (FORWARD_NULL) 2026-01-27 22:29:17 +08:00
sched_process_delivered.c sched: Fix scheduler CPU selection and ready-to-run list management 2026-01-28 13:02:58 -03:00
sched_processtick.c sched/wdog: Simplify timer expiration for hrtimer. 2026-02-02 13:26:22 +08:00
sched_processtickless.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
sched_profil.c !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
sched_releasetcb.c pthread: remove tl_lock 2026-01-26 20:56:12 +08:00
sched_removeblocked.c
sched_removereadytorun.c sched: Fix scheduler CPU selection and ready-to-run list management 2026-01-28 13:02:58 -03:00
sched_reprioritize.c
sched_reprioritizertr.c
sched_roundrobin.c sched/sched_roundrobin.c: fix round-robin scheduling in SMP mode 2026-01-17 18:03:45 -03:00
sched_rrgetinterval.c sched/sched/sched_rrgetinterval.c: coverity HIS_metric_violation: RETURN 2026-01-27 22:28:59 +08:00
sched_self.c
sched_setaffinity.c
sched_setparam.c !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
sched_setpriority.c sched_setpriority.c: coverity HIS_metric_violation: RETURN 2026-01-31 02:38:55 +08:00
sched_setscheduler.c !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
sched_sleep.c sched/sched: add nxsched_abstick_sleep() 2026-02-26 17:04:47 +08:00
sched_smp.c
sched_sporadic.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
sched_suspend.c arch, sched/signal: Fix compilation with ENABLE_PARTIAL_SIGNALS=y 2026-06-16 17:07:32 +08:00
sched_switchcontext.c sched: Improve nxsched stack overflow checking implementation 2025-10-11 18:00:44 +08:00
sched_sysinfo.c sched_sysinfo.c: coverity HIS_metric_violation: RETURN 2026-01-31 02:53:58 +08:00
sched_unlock.c sched/sched: Modify the critical section interface name. 2026-01-26 21:13:05 +08:00
sched_verifytcb.c
sched_wait.c
sched_waitid.c sched_waitid.c: HIS_metric_violation: CCM 2026-01-31 13:11:34 -03:00
sched_waitpid.c sched_waitpid.c: HIS_metric_violation: CCM 2026-02-04 03:04:44 +08:00
sched_yield.c