pussuw opened a new issue, #8917:
URL: https://github.com/apache/nuttx/issues/8917

   I have encountered a little issue with semaphores, and nxsem_wait_irq which 
is used to wake the process waiting for a sempahore and do other cleanup i.e. 
handle priority inheritance etc. 
   
   The issue arises when nxsem_wait_irq is called from ISR or from the signal 
dispatch logic; while it works like a charm with flat addressing, it fails when 
virtual memory is in use.
   
   The issue obviously is that sem_t is userspace data, and if the current task 
is not the one holding / waiting for the semaphore, the clean up fails due to 
wrong mappings.
   
   Now, the solution might be as simple as changing the mappings temporarily to 
the semaphore holder's mappings, but this to me seems like quite a heavy 
operation. At least the TLB is lost, maybe with other side effects as well.
   
   So I created this issue to open discussion about the subject. Is this a more 
generic problem (affecting more than just the semaphore API), needing a generic 
solution ? Has anyone ever thought of this issue and how to fix it ? Maybe 
coming up with a solution but no time to implement it ? If so I'll be more than 
happy to do the fix and test it.
   
   Regardless, I will present a patch (and reference this issue there) where 
the mappings are just swapped because that works and is a way to fix the issue. 
The issue is easier to grasp this way I think.


-- 
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: commits-unsubscr...@nuttx.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to