You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/11/01 07:09:17 UTC

[GitHub] [incubator-nuttx] GUIDINGLI opened a new pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

GUIDINGLI opened a new pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759


   ## Summary
   
   mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set
   
   This is used for memory corruption check, when "this_task" or  "g_running_tasks" thread flags TCB_FLAG_DEBUG_CHECK set,  then scheduler will check memory blocks in IRQ.
   
   For example:
   
   thread 15 set TCB_FLAG_DEBUG_CHECK:
   
   thread14                         thread 15 overwrite                     thread 16
                     IRQ&switch                                  IRQ&switch
                                                                           checked overwrite
   
   ## Impact
   
   Debug method
   
   ## Testing
   
   


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] GUIDINGLI commented on a change in pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Posted by GitBox <gi...@apache.org>.
GUIDINGLI commented on a change in pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759#discussion_r745409397



##########
File path: sched/irq/irq_dispatch.c
##########
@@ -184,6 +185,14 @@ void irq_dispatch(int irq, FAR void *context)
   sched_note_irqhandler(irq, vector, false);
 #endif
 
+#ifdef CONFIG_DEBUG_MM
+  if ((g_running_tasks[this_cpu()]->flags & TCB_FLAG_MEM_CHECK) || \
+       (this_task()->flags & TCB_FLAG_MEM_CHECK))
+    {
+      kmm_checkcorruption();

Review comment:
       @Ouss4 But this is useful for debugging, if all the thread set TCB_FLAG_MEM_CHECK to flags, then once someone overwrite the memblock, then we can catch it immediately.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] GUIDINGLI commented on a change in pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Posted by GitBox <gi...@apache.org>.
GUIDINGLI commented on a change in pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759#discussion_r743436110



##########
File path: sched/irq/irq_dispatch.c
##########
@@ -184,6 +185,14 @@ void irq_dispatch(int irq, FAR void *context)
   sched_note_irqhandler(irq, vector, false);
 #endif
 
+#ifdef CONFIG_DEBUG_MM
+  if ((g_running_tasks[this_cpu()]->flags & TCB_FLAG_MEM_CHECK) || \
+       (this_task()->flags & TCB_FLAG_MEM_CHECK))
+    {
+      kmm_checkcorruption();

Review comment:
       Yes, you are right,
   
   For example:
   thread1 -> thread2 -> thread3 -> idle -> thread4 -> crash
   overwrite
   
   If just check in idle, then can't get the "killer" as early as possible.
   With this method, then we can check the "killer" at each context_switch.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759#discussion_r743124566



##########
File path: sched/irq/irq_dispatch.c
##########
@@ -184,6 +185,14 @@ void irq_dispatch(int irq, FAR void *context)
   sched_note_irqhandler(irq, vector, false);
 #endif
 
+#ifdef CONFIG_DEBUG_MM
+  if ((g_running_tasks[this_cpu()]->flags & TCB_FLAG_MEM_CHECK) || \
+       (this_task()->flags & TCB_FLAG_MEM_CHECK))
+    {
+      kmm_checkcorruption();

Review comment:
       We also do the same check in the idle thread, is this to catch an issue as early as possible?




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] GUIDINGLI commented on pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Posted by GitBox <gi...@apache.org>.
GUIDINGLI commented on pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759#issuecomment-960959088


   > I think the first patch is independent of the second one, can we have it a separate PR?
   
   done


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759#discussion_r744882681



##########
File path: sched/irq/irq_dispatch.c
##########
@@ -184,6 +185,14 @@ void irq_dispatch(int irq, FAR void *context)
   sched_note_irqhandler(irq, vector, false);
 #endif
 
+#ifdef CONFIG_DEBUG_MM
+  if ((g_running_tasks[this_cpu()]->flags & TCB_FLAG_MEM_CHECK) || \
+       (this_task()->flags & TCB_FLAG_MEM_CHECK))
+    {
+      kmm_checkcorruption();

Review comment:
       @Ouss4 how about your thinking?




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] Ouss4 commented on pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759#issuecomment-956183101


   I think the first patch is independent of the second one, can we have it a separate PR?


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759#discussion_r744991903



##########
File path: sched/irq/irq_dispatch.c
##########
@@ -184,6 +185,14 @@ void irq_dispatch(int irq, FAR void *context)
   sched_note_irqhandler(irq, vector, false);
 #endif
 
+#ifdef CONFIG_DEBUG_MM
+  if ((g_running_tasks[this_cpu()]->flags & TCB_FLAG_MEM_CHECK) || \
+       (this_task()->flags & TCB_FLAG_MEM_CHECK))
+    {
+      kmm_checkcorruption();

Review comment:
       @xiaoxiang781216 as I understand, this won't have any effect without https://github.com/apache/incubator-nuttx/pull/4782.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759


   


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759#discussion_r743124566



##########
File path: sched/irq/irq_dispatch.c
##########
@@ -184,6 +185,14 @@ void irq_dispatch(int irq, FAR void *context)
   sched_note_irqhandler(irq, vector, false);
 #endif
 
+#ifdef CONFIG_DEBUG_MM
+  if ((g_running_tasks[this_cpu()]->flags & TCB_FLAG_MEM_CHECK) || \
+       (this_task()->flags & TCB_FLAG_MEM_CHECK))
+    {
+      kmm_checkcorruption();

Review comment:
       We also do the same check in the idle thread, is this to catch an issue as early as possible?

##########
File path: sched/irq/irq_dispatch.c
##########
@@ -184,6 +185,14 @@ void irq_dispatch(int irq, FAR void *context)
   sched_note_irqhandler(irq, vector, false);
 #endif
 
+#ifdef CONFIG_DEBUG_MM
+  if ((g_running_tasks[this_cpu()]->flags & TCB_FLAG_MEM_CHECK) || \
+       (this_task()->flags & TCB_FLAG_MEM_CHECK))
+    {
+      kmm_checkcorruption();

Review comment:
       We also do the same check in the idle thread, is this to catch an issue as early as possible?




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] GUIDINGLI commented on a change in pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Posted by GitBox <gi...@apache.org>.
GUIDINGLI commented on a change in pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759#discussion_r743436110



##########
File path: sched/irq/irq_dispatch.c
##########
@@ -184,6 +185,14 @@ void irq_dispatch(int irq, FAR void *context)
   sched_note_irqhandler(irq, vector, false);
 #endif
 
+#ifdef CONFIG_DEBUG_MM
+  if ((g_running_tasks[this_cpu()]->flags & TCB_FLAG_MEM_CHECK) || \
+       (this_task()->flags & TCB_FLAG_MEM_CHECK))
+    {
+      kmm_checkcorruption();

Review comment:
       Yes, you are right,
   
   For example:
   thread1 -> thread2 -> thread3 -> idle -> thread4 -> crash
   overwrite
   
   If just check in idle, then can't get the "killer" as early as possible.
   With this method, then we can check the "killer" at each context_switch.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] GUIDINGLI commented on a change in pull request #4759: mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Posted by GitBox <gi...@apache.org>.
GUIDINGLI commented on a change in pull request #4759:
URL: https://github.com/apache/incubator-nuttx/pull/4759#discussion_r743436110



##########
File path: sched/irq/irq_dispatch.c
##########
@@ -184,6 +185,14 @@ void irq_dispatch(int irq, FAR void *context)
   sched_note_irqhandler(irq, vector, false);
 #endif
 
+#ifdef CONFIG_DEBUG_MM
+  if ((g_running_tasks[this_cpu()]->flags & TCB_FLAG_MEM_CHECK) || \
+       (this_task()->flags & TCB_FLAG_MEM_CHECK))
+    {
+      kmm_checkcorruption();

Review comment:
       Yes, you are right,
   
   For example:
   thread1 -> thread2 -> thread3 -> idle -> thread4 -> crash
   overwrite
   
   If just check in idle, then can't get the "killer" as early as possible.
   With this method, then we can check the "killer" at each context_switch.




-- 
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-unsubscribe@nuttx.apache.org

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