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/06/15 05:49:21 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   ## Summary
   
   ## Impact
   
   ## 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.

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



[GitHub] [incubator-nuttx] patacongo removed a comment on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

Posted by GitBox <gi...@apache.org>.
patacongo removed a comment on pull request #3923:
URL: https://github.com/apache/incubator-nuttx/pull/3923#issuecomment-861684819


   
   > up_assert: Assertion failed at file:armv7-m/arm_hardfault.c line: 135 task: init
   
   On ARMv7-M, strlen on a NULL pointer should not cause a hardfault.  Something else is wrong.
   
   The loop in nxtask_setup_stackargs() looks wrong to me:  When argv[argc] == NULL, how does it ever get out of the loop?
   
       506   argc = 0;
       507   if (argv != NULL)
       508     {
       511       while (argv[argc])
       512         {
       534         }
       535     }
       


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

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



[GitHub] [incubator-nuttx] masayuki2009 edited a comment on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

Posted by GitBox <gi...@apache.org>.
masayuki2009 edited a comment on pull request #3923:
URL: https://github.com/apache/incubator-nuttx/pull/3923#issuecomment-861589290


   @xiaoxiang781216 
   
   Hmm,
   
   I noticed that spresense:elf crashed with this PR.
   
   ```
   Registering romdisk at /dev/ram0
   
   Memory Usage after romdisk_register:
     Before:     5056 After:     5136 Change:       80
   Mounting ROMFS filesystem at target=/mnt/romfs with source=/dev/ram0
   
   Memoryarm_hardfault: PANIC!!! Hard fault: 40000000
   up_assert: Assertion failed at file:armv7-m/arm_hardfault.c line: 135 task: init
   up_registerdump: R0: 00168b00 00000000 00168b00 00168b01 00000000 2d018850 00000009 2d0189b0
   up_registerdump: R8: 0d00d500 00000101 00000800 00000000 00000001 2d018798 0d003c43 0d005d32
   up_registerdump: xPSR: 01000000 BASEPRI: 000000e0 CONTROL: 00000000
   up_registerdump: EXC_RETURN: ffffffe9
   up_dumpstate: sp:         2d018650
   up_dumpstate: stack base: 2d0180a0
   up_dumpstate: stack size: 000007f0
   up_stackdump: 2d018640: 2d0180a0 2d017c60 2d016850 0d00685f 000000e0 00000000 00000000 00000001
   up_stackdump: 2d018660: 2d018798 0d003c43 0d005d32 0d005da5 00000000 2d016850 00000003 2d0186c4
   up_stackdump: 2d018680: 00000000 0d00d500 00000101 0d00536b 0d00a505 0d001453 0d001431 0d002f4b
   up_stackdump: 2d0186a0: 50000000 0d00141d 000000e0 2d0186c4 2d018850 00000009 2d0189b0 0d000309
   up_stackdump: 2d0186c0: 00000003 2d018798 000000e0 00000000 2d018850 00000009 2d0189b0 0d00d500
   up_stackdump: 2d0186e0: 00000101 00000800 00000000 ffffffe9 00000000 00000000 00000000 00000000
   up_stackdump: 2d018700: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
   up_stackdump: 2d018720: 00000000 00000000 00000000 00000000 00168b00 00000000 00168b00 00168b01
   up_stackdump: 2d018740: 00000001 0d003c43 0d005d32 01000000 00000000 00000000 00000000 00000000
   up_stackdump: 2d018760: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
   up_stackdump: 2d018780: 00000000 00000000 00000000 00000000 00000000 0d003bd5 00000001 00000000
   up_stackdump: 2d0187a0: 2d0189b0 00000000 00000000 00000000 00000064 00000800 00000000 0d003a79
   up_stackdump: 2d0187c0: 00000000 00000000 2d01884c 2d0189b0 2d018980 2d01884c 00000000 00000000
   up_stackdump: 2d0187e0: 00000000 0d009ae7 00000800 0d018c01 2d018850 00000001 00000000 2d018980
   up_stackdump: 2d018800: 0d01313f 0d009209 00000020 0d013264 00000000 00000000 0d00d8ab 0d00d828
   up_stackdump: 2d018820: 0d013364 0d009243 00000000 2d01884c 2d0159b8 0d006dd1 00000000 00000000
   up_stackdump: 2d018840: 0d003ca0 01000000 00000000 00000000 00168b00 0000002c 00000200 0d00d8f8
   up_stackdump: 2d018860: 000013c0 00167760 0d006ce5 00000000 00000000 00000000 00000000 0d005555
   up_stackdump: 2d018880: 00000000 0d003cdd 00000000 00000000 6c82a44a 6a2913fa 00000020 80000840
   
   ```


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

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



[GitHub] [incubator-nuttx] patacongo commented on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   
   > up_assert: Assertion failed at file:armv7-m/arm_hardfault.c line: 135 task: init
   
   On ARMv7-M, strlen on a NULL pointer should not cause a hardfault.  Something else is wrong.
   
   The loop in nxtask_setup_stackargs() looks wrong to me:  When argv[argc] == NULL, how does it ever get out of the loop?
   
       506   argc = 0;
       507   if (argv != NULL)
       508     {
       511       while (argv[argc])
       512         {
       534         }
       535     }
       


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #3923:
URL: https://github.com/apache/incubator-nuttx/pull/3923#issuecomment-861690961


   Since we change the code from:
   ```  
   ret = nxtask_init(tcb, filename, binp->priority, NULL,
                       binp->stacksize, binp->entrypt, argv);
   ```
   To:
   ```  
   ret = nxtask_init(tcb, argv[0], binp->priority, NULL,
                       binp->stacksize, binp->entrypt, &argv[1]);
   ```
   If caller pass NULL argv or one NULL element, the crash will happen.


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

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



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   > @masayuki2009 does #3916 generate the similar crash? or just this PR?
   
   @xiaoxiang781216 
   This 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.

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



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   @xiaoxiang781216 
   
   It seems that the crash happened in the strlen() in nxtask_setup_stackargs()
   
   ```
   strlen at /mnt/m2ssd/opensource/RTOS/nuttx/nuttx/libs/libc/string/lib_strlen.c:37 (discriminator 1)
   xtask_setup_stackargs at /mnt/m2ssd/opensource/RTOS/nuttx/nuttx/sched/task/task_setup.c:519
   ```
   
   Actually, PID=2 shows <noname>
   
   ```
   arm_hardfault: PANIC!!! Hard fault: 40000000
   up_assert: Assertion failed at file:armv7-m/arm_hardfault.c line: 135 task: init
   up_registerdump: R0: 0015ab00 00000000 0015ab00 0015ab01 00000000 2d026850 00000009 2d0269b0
   up_registerdump: R8: 0d00d600 00000101 00000800 00000000 00000001 2d026798 0d003c43 0d005d32
   up_registerdump: xPSR: 01000000 BASEPRI: 000000e0 CONTROL: 00000000
   up_registerdump: EXC_RETURN: ffffffe9
   up_dumpstate: sp:         2d026650
   up_dumpstate: stack base: 2d0260a0
   up_dumpstate: stack size: 000007f0
   up_dumpstate: stack used: 00000328
   up_stackdump: 2d026640: 2d0260a0 2d025c60 2d024850 0d0068a1 000000e0 00000000 00000000 00000001
   up_stackdump: 2d026660: 2d026798 0d003c43 0d005d32 0d005da5 00000000 2d024850 00000003 2d0266c4
   up_stackdump: 2d026680: 00000000 0d00d600 00000101 0d00536b 0d00a605 0d001453 0d001431 0d002f4b
   up_stackdump: 2d0266a0: 50000000 0d00141d 000000e0 2d0266c4 2d026850 00000009 2d0269b0 0d000309
   up_stackdump: 2d0266c0: 00000003 2d026798 000000e0 00000000 2d026850 00000009 2d0269b0 0d00d600
   up_stackdump: 2d0266e0: 00000101 00000800 00000000 ffffffe9 00000000 00000000 00000000 00000000
   up_stackdump: 2d026700: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
   up_stackdump: 2d026720: 00000000 00000000 00000000 00000000 0015ab00 00000000 0015ab00 0015ab01
   up_stackdump: 2d026740: 00000001 0d003c43 0d005d32 01000000 00000000 00000000 00000000 00000000
   up_stackdump: 2d026760: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
   up_stackdump: 2d026780: 00000000 00000000 00000000 00000000 00000000 0d003bd5 00000001 00000000
   up_stackdump: 2d0267a0: 2d0269b0 00000000 00000000 00000000 00000064 00000800 00000000 0d003a79
   up_stackdump: 2d0267c0: 00000000 00000000 2d02684c 2d0269b0 2d026980 2d02684c 00000000 00000000
   up_stackdump: 2d0267e0: 00000000 0d009be7 00000800 0d026e31 2d026850 00000001 00000000 2d026980
   up_stackdump: 2d026800: 0d021287 0d009309 00000020 0d0213ac 00000000 00000000 0d00d9f3 0d00d970
   up_stackdump: 2d026820: 0d0214ac 0d009343 00000000 2d02684c 2d023b18 0d006e95 00000000 00000000
   up_stackdump: 2d026840: 0d003ca0 01000000 00000000 00000000 0015ab00 0000009c 00000200 0d00da40
   up_stackdump: 2d026860: 000013c0 00159760 0d006da9 00000000 00000000 00000000 00000000 0d005555
   up_stackdump: 2d026880: 00000000 0d003cdd 00000000 00000000 fe317cf4 9cc3a75d 00000020 80000840
   up_taskdump: Idle Task: PID=0 Stack Used=368 of 976
   up_taskdump: init: PID=1 Stack Used=872 of 2032
   up_taskdump: <noname>: PID=2 Stack Used=0 of 2048
   ```


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   Note: this patch revert https://github.com/apache/incubator-nuttx/pull/3916 and provide a better fix.


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   Since we change the code from:
   ```  
   ret = nxtask_init(tcb, filename, binp->priority, NULL,
                       binp->stacksize, binp->entrypt, argv);
   ```
   To:
   ```  
   ret = nxtask_init(tcb, argv[0], binp->priority, NULL,
                       binp->stacksize, binp->entrypt, &argv[1]);
   ```
   If caller pass NULL argv, the crash will happen.


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

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



[GitHub] [incubator-nuttx] patacongo commented on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   That makes sense.  You can probably pass NULL in both cases if argv is NULL.
   
   argv[] cannot be NULL for posix_spawn(), that would be an error.  But NULL has been acceptable for task_xxx().
   


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   @masayuki2009 does https://github.com/apache/incubator-nuttx/pull/3916 generate the similar crash? or just this 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.

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



[GitHub] [incubator-nuttx] patacongo merged pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   Could you give the callstack? It look like the caller pass the NULL argv.


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #3923:
URL: https://github.com/apache/incubator-nuttx/pull/3923#issuecomment-861595843


   @masayuki2009 does https://github.com/apache/incubator-nuttx/pull/3916 generate the similar crash? or just this 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.

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



[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #3923:
URL: https://github.com/apache/incubator-nuttx/pull/3923#issuecomment-861704082


   Here is the patch: https://github.com/apache/incubator-nuttx/pull/3928, @masayuki2009 please try it.


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   Here is the patch: https://github.com/apache/incubator-nuttx/pull/3928


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

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



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #3923: sched/posix_spawn: Don't insert name at the begin of argv

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


   Hmm,
   
   I noticed that spresense:elf crashed with this PR.
   
   ```
   Registering romdisk at /dev/ram0
   
   Memory Usage after romdisk_register:
     Before:     5056 After:     5136 Change:       80
   Mounting ROMFS filesystem at target=/mnt/romfs with source=/dev/ram0
   
   Memoryarm_hardfault: PANIC!!! Hard fault: 40000000
   up_assert: Assertion failed at file:armv7-m/arm_hardfault.c line: 135 task: init
   up_registerdump: R0: 00168b00 00000000 00168b00 00168b01 00000000 2d018850 00000009 2d0189b0
   up_registerdump: R8: 0d00d500 00000101 00000800 00000000 00000001 2d018798 0d003c43 0d005d32
   up_registerdump: xPSR: 01000000 BASEPRI: 000000e0 CONTROL: 00000000
   up_registerdump: EXC_RETURN: ffffffe9
   up_dumpstate: sp:         2d018650
   up_dumpstate: stack base: 2d0180a0
   up_dumpstate: stack size: 000007f0
   up_stackdump: 2d018640: 2d0180a0 2d017c60 2d016850 0d00685f 000000e0 00000000 00000000 00000001
   up_stackdump: 2d018660: 2d018798 0d003c43 0d005d32 0d005da5 00000000 2d016850 00000003 2d0186c4
   up_stackdump: 2d018680: 00000000 0d00d500 00000101 0d00536b 0d00a505 0d001453 0d001431 0d002f4b
   up_stackdump: 2d0186a0: 50000000 0d00141d 000000e0 2d0186c4 2d018850 00000009 2d0189b0 0d000309
   up_stackdump: 2d0186c0: 00000003 2d018798 000000e0 00000000 2d018850 00000009 2d0189b0 0d00d500
   up_stackdump: 2d0186e0: 00000101 00000800 00000000 ffffffe9 00000000 00000000 00000000 00000000
   up_stackdump: 2d018700: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
   up_stackdump: 2d018720: 00000000 00000000 00000000 00000000 00168b00 00000000 00168b00 00168b01
   up_stackdump: 2d018740: 00000001 0d003c43 0d005d32 01000000 00000000 00000000 00000000 00000000
   up_stackdump: 2d018760: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
   up_stackdump: 2d018780: 00000000 00000000 00000000 00000000 00000000 0d003bd5 00000001 00000000
   up_stackdump: 2d0187a0: 2d0189b0 00000000 00000000 00000000 00000064 00000800 00000000 0d003a79
   up_stackdump: 2d0187c0: 00000000 00000000 2d01884c 2d0189b0 2d018980 2d01884c 00000000 00000000
   up_stackdump: 2d0187e0: 00000000 0d009ae7 00000800 0d018c01 2d018850 00000001 00000000 2d018980
   up_stackdump: 2d018800: 0d01313f 0d009209 00000020 0d013264 00000000 00000000 0d00d8ab 0d00d828
   up_stackdump: 2d018820: 0d013364 0d009243 00000000 2d01884c 2d0159b8 0d006dd1 00000000 00000000
   up_stackdump: 2d018840: 0d003ca0 01000000 00000000 00000000 00168b00 0000002c 00000200 0d00d8f8
   up_stackdump: 2d018860: 000013c0 00167760 0d006ce5 00000000 00000000 00000000 00000000 0d005555
   up_stackdump: 2d018880: 00000000 0d003cdd 00000000 00000000 6c82a44a 6a2913fa 00000020 80000840
   
   ```


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

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