mirror of
https://github.com/apache/nuttx.git
synced 2025-05-08 22:32:04 +08:00

Fixes an issue in kernel build where the user addresses passed to accept() would be accessed when the wrong MMU mappings were active. A crash would manifest when attempting to accept() on a TCP server socket for instance under significant load. The accept event handler would be called by the HP worker upon client connection. At this point, accept_tcpsender() would attempt to write to `addr` resulting in a page fault. Reproducibility would depend on the current system load (num tasks or CPU stress) but in loaded environments, it would crash almost 100% of the times. It should be noted that Linux does this the other way around: it operates on kernel stack allocated data and once done, it copies them to user. This can also be a viable alternative, albeit with one extra copy and a little extra memory. Signed-off-by: George Poulios <gpoulios@census-labs.com>