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


##########
arch/arm64/src/common/arm64_fatal.c:
##########
@@ -675,19 +831,31 @@ uint64_t *arm64_fatal_handler(uint64_t *regs)
            * the register dump to the paths that are fatal.
            */
 
-          ptcb = nxsched_get_tcb(tcb->group->tg_pid);
+          if (report)
+            {
+              ptcb = nxsched_get_tcb(tcb->group->tg_pid);
 
-          _alert("Segmentation fault in %s (PID %d: %s)\n",
-                 ptcb != NULL ? get_task_name(ptcb) : "<gone>",
-                 tcb->pid, get_task_name(tcb));
-          _alert("Reason: %s - %s\n", reason, desc);
+              _alert("Segmentation fault in %s (PID %d: %s)\n",
+                     ptcb != NULL ? get_task_name(ptcb) : "<gone>",
+                     tcb->pid, get_task_name(tcb));
+              _alert("Reason: %s - %s\n", reason, desc);
+            }
 
-          tcb->flags |= TCB_FLAG_FORCED_CANCEL;
+          if (resume)
+            {
+              /* Return from memcpy() or memset() to its caller */

Review Comment:
   Exit releases what the task group owns (its file descriptors, memory and 
threads), so a fault in user mode leaks nothing. A fault inside a system call 
is different: the call also holds resources that only its own code releases. 
`read()` and `write()` take a file reference with `file_get()` and drop it with 
`file_put()` after the access, and a pipe write holds its buffer. An exit at 
the fault skips that code, so the file stays allocated after the last 
`close()`: these were the 33816 bytes of the first version.
   



-- 
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