casaroli commented on code in PR #21615:
URL: https://github.com/apache/nuttx/pull/21615#discussion_r4522964011


##########
sched/sched/sched_setpriority.c:
##########
@@ -227,6 +228,18 @@ static inline void nxsched_blocked_setpriority(FAR struct 
tcb_s *tcb,
   tasklist = TLIST_BLOCKED(tcb);
   if (TLIST_ISPRIORITIZED(task_state))
     {
+      FAR struct addrenv_s *oldenv = NULL;
+      bool selected = false;
+
+      /* The wait list of a semaphore can be in the address environment of
+       * the waiter only.
+       */
+
+      if (task_state == TSTATE_WAIT_SEM)

Review Comment:
   It does: for TSTATE_WAIT_SEM, `tasklist = TLIST_BLOCKED(tcb)` is the wait 
list inside the semaphore (`g_tasklisttable[TSTATE_WAIT_SEM]` is 
`offsetof(sem_t, waitlist)` with `TLIST_ATTR_OFFSET`, and `__TLIST_HEAD()` adds 
it to `tcb->waitobj`). So the `dq_rem()` and `nxsched_add_prioritized()` below 
write `sem->waitlist`, which is in the user memory of the waiter.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to