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/04/16 05:52:46 UTC

[GitHub] [incubator-nuttx] yamt opened a new pull request #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   ## Summary
   
   This reverts commit 2335b69120a3e36f1aa0cecc19c95208806cae54.
   
   It seems that the commit is question broke sim/Linux and sim/macOS.
   Both of the following crashes are fixed by this revert.
   
   My app running with sim/Linux started crashing with the commit.
   
   ```
   Program received signal SIGSEGV, Segmentation fault.
   0x00000000004583ad in snprintf (buf=0x7f6260682b30 "\020", size=140060500962096, format=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>) at stdio/lib_snprintf.c:41
   41      stdio/lib_snprintf.c: No such file or directory.
   rax            0x0                 0
   rbx            0x0                 0
   rcx            0x1                 1
   rdx            0x5515d0            5576144
   rsi            0x10                16
   rdi            0x7f6260682858      140060500961368
   rbp            0x7f6260682808      0x7f6260682808
   rsp            0x7f6260682628      0x7f6260682628
   r8             0x7f62606825e0      140060500960736
   r9             0x0                 0
   r10            0x8                 8
   r11            0x246               582
   r12            0x0                 0
   r13            0x0                 0
   r14            0x0                 0
   r15            0x0                 0
   rip            0x4583ad            0x4583ad <snprintf+13>
   eflags         0x10246             [ PF ZF IF RF ]
   cs             0x33                51
   ss             0x2b                43
   ds             0x0                 0
   es             0x0                 0
   fs             0x0                 0
   gs             0x0                 0
   ```
   
   sim:ostest on macOS crashes like the following.
   
   ```
   spacetanuki% lldb ./nuttx
   (lldb) target create "./nuttx"
   Current executable set to './nuttx' (x86_64).
   (lldb) run
   Process 67434 launched: '/Users/yamamoto/git/nuttx/nuttx/nuttx' (x86_64)
   Process 67434 stopped
   * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
       frame #0: 0x00007fff6f1633a6 libdyld.dylib`stack_not_16_byte_aligned_error
   libdyld.dylib`stack_not_16_byte_aligned_error:
   ->  0x7fff6f1633a6 <+0>: movdqa %xmm0, (%rsp)
       0x7fff6f1633ab <+5>: int3
   
   libdyld.dylib`_dyld_fast_stub_entry:
       0x7fff6f1633ac <+0>: pushq  %rbp
       0x7fff6f1633ad <+1>: movq   %rsp, %rbp
   Target 0: (nuttx) stopped.
   (lldb) bt
   * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
     * frame #0: 0x00007fff6f1633a6 libdyld.dylib`stack_not_16_byte_aligned_error
       frame #1: 0x0000000101002048
       frame #2: 0x000000010001682d nuttx`tty_send(dev=0x000000010002f370, ch=115) at up_uart.c:447:3
       frame #3: 0x000000010000d7df nuttx`uart_xmitchars(dev=0x000000010002f370) at serial_io.c:68:7
       frame #4: 0x0000000100016a95 nuttx`tty_txint(dev=0x000000010002f370, enable='\x01') at up_uart.c:462:7
       frame #5: 0x000000010000ce48 nuttx`uart_write(filep=0x00000001010011e8, buffer="", buflen=0) at serial.c:1260:7
       frame #6: 0x0000000100024ef3 nuttx`file_write(filep=0x00000001010011e8, buf=0x0000000100027a30, nbytes=23) at fs_write.c:89:10
       frame #7: 0x0000000100024f6a nuttx`nx_write(fd=1, buf=0x0000000100027a30, nbytes=23) at fs_write.c:138:13
       frame #8: 0x0000000100024fab nuttx`file_write(filep=0x0000000100027a30, buf=0x0000000000000017, nbytes=0) at fs_write.c:76:7
       frame #9: 0x000000010002215e nuttx`stdio_test at ostest_main.c:574:3
       frame #10: 0x0000000100021f1b nuttx`ostest_main(argc=1, argv=0x0000000101001300) at ostest_main.c:602:3
       frame #11: 0x000000010000ff05 nuttx`nxtask_startup(entrypt=(nuttx`ostest_main at ostest_main.c:592), argc=1, argv=0x0000000101001300) at task_startup.c:150:8
       frame #12: 0x000000010000a580 nuttx`nxtask_start at task_start.c:129:7
   (lldb)
   ```
   
   ## 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] xiaoxiang781216 commented on pull request #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   Let's close it since #3574 is merged.


-- 
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 #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   @yamt which config do you use? I have tested on sim:smp and run both ostest and smp without problem. Could you try sim:smp or share your config to me?


-- 
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 #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   > > sim:ostest has the same below config:
   > > ```
   > > # CONFIG_TLS_ALIGNED is not set
   > > CONFIG_TLS_NELEM=4
   > > 
   > > CONFIG_IDLETHREAD_STACKSIZE=4096
   > > 
   > > # CONFIG_STACK_COLORATION is not set
   > > ```
   > > 
   > > 
   > > both config(ostest and smp) can pass ostest without any problem in my Ubuntu and WSL environment. Could you try the stock config(ostest and smp) on Ubuntu and macOS without the local change and collect the result here?
   > 
   > why?
   > 
   > i've already reported stock ostest on macOS is broken.
   > given that you have akready run it on Ubuntu, i don't see any reason for me to repeat it.
   
   You reported Ubuntu stop working on your environment, but I can't reproduce locally. Since I am more familiar with Linux, so I want to fix the issue on Ubuntu first, then look at macOS.


-- 
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] yamt commented on pull request #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   here's the backtrace shown by gdb for the linux case.
   ```
   #0  0x00000000004583ad in snprintf (buf=0x7f6260682b30 "\020", size=140060500962096, format=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>) at stdio/lib_snprintf.c:41
   #1  0x000000000052ba9b in ramdisk_register (minor=1, buffer=0x535160 <romfs_img> "-rom1fs-", nsectors=16, sectsize=64, rdflags=0 '\000') at ramdisk.c:444
   #2  0x0000000000452128 in boardctl (cmd=65288, arg=140060500961528) at boardctl.c:468
   #3  0x000000000041f802 in nsh_romfsetc () at nsh_romfsetc.c:108
   #4  0x0000000000413846 in nsh_initialize () at nsh_init.c:98
   #5  0x00000000004137b1 in nsh_main (argc=1, argv=0x7f62606809e0) at nsh_main.c:143
   #6  0x000000000040bb79 in nxtask_startup (entrypt=0x413760 <nsh_main>, argc=1, argv=0x7f62606809e0) at sched/task_startup.c:150
   #7  0x0000000000402ae4 in nxtask_start () at task/task_start.c:129
   #8  0xaaaaaaaaaaaaaaaa in ?? ()
   #9  0x80002060000000a0 in ?? ()
   #10 0x00007f6260682a10 in ?? ()
   #11 0x0000000000405100 in ?? () at signal/sig_default.c:402
   #12 0x0000000200000000 in ?? ()
   #13 0xaaaaaaaaaaaaaa06 in ?? ()
   #14 0x00007f6260682a30 in ?? ()
   #15 0x0000000000405100 in ?? () at signal/sig_default.c:402
   #16 0x0000000200000000 in ?? ()
   #17 0xaaaaaaaaaaaaaa07 in ?? ()
   #18 0x00007f6260682a50 in ?? ()
   #19 0x0000000000405160 in ?? () at signal/sig_default.c:320
   #20 0x0000000200000000 in ?? ()
   #21 0xaaaaaaaaaaaaaa08 in ?? ()
   #22 0x00007f6260682a90 in ?? ()
   #23 0x00000000004051a0 in ?? () at signal/sig_default.c:175
   #24 0x0000000200000000 in ?? ()
   #25 0xaaaaaaaaaaaaaa0a in ?? ()
   #26 0xaaaaaaaaaaaaaaaa in ?? ()
   #27 0xaaaaaaaaaaaaaaaa in ?? ()
   #28 0xaaaaaaaaaaaaaaaa in ?? ()
   #29 0x800000a0000000a0 in ?? ()
   #30 0x00007f6260682ab0 in ?? ()
   #31 0x00000000004051a0 in ?? () at signal/sig_default.c:175
   #32 0x0000000200000000 in ?? ()
   #33 0xaaaaaaaaaaaaaa09 in ?? ()
   #34 0x00007f6260682ad0 in ?? ()
   #35 0x00000000004051a0 in ?? () at signal/sig_default.c:175
   #36 0x0000000200000000 in ?? ()
   #37 0xaaaaaaaaaaaaaa0b in ?? ()
   #38 0x00007f6260682af0 in ?? ()
   #39 0x00000000004051a0 in ?? () at signal/sig_default.c:175
   #40 0x0000000200000000 in ?? ()
   #41 0xaaaaaaaaaaaaaa0c in ?? ()
   #42 0x0000000000000000 in ?? ()
   ```


-- 
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 #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   > > sim:ostest has the same below config:
   > > ```
   > > # CONFIG_TLS_ALIGNED is not set
   > > CONFIG_TLS_NELEM=4
   > > 
   > > CONFIG_IDLETHREAD_STACKSIZE=4096
   > > 
   > > # CONFIG_STACK_COLORATION is not set
   > > ```
   > > 
   > > 
   > > both config(ostest and smp) can pass ostest without any problem in my Ubuntu and WSL environment. Could you try the stock config(ostest and smp) on Ubuntu and macOS without the local change and collect the result here?
   > 
   > why?
   > 
   > i've already reported stock ostest on macOS is broken.
   > given that you have akready run it on Ubuntu, i don't see any reason for me to repeat it.
   
   You reported Ubuntu stop working on your environment, but I can't reproduce locally and need you more input to repo the issue. Since I am more familiar with Linux, so I want to fix the issue on Ubuntu first, then look at macOS.


-- 
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 #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   @yamt which config do you use? I have tested on sim:smp and run both ostest and smp without problem.


-- 
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] yamt commented on pull request #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   > @yamt which config do you use? I have tested on sim:smp and run both ostest and smp without problem.
   
   stock sim:ostest on macOS.
   
   sorry, the linux one is not open source. the config includes the following.
   i can check other specific config values on demand.
   ```
   # CONFIG_TLS_ALIGNED is not set
   CONFIG_TLS_NELEM=4
   
   CONFIG_IDLETHREAD_STACKSIZE=4096
   
   # CONFIG_STACK_COLORATION is not set
   ```
   


-- 
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 #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   sim:ostest has the same below config:
   ```
   # CONFIG_TLS_ALIGNED is not set
   CONFIG_TLS_NELEM=4
   
   CONFIG_IDLETHREAD_STACKSIZE=4096
   
   # CONFIG_STACK_COLORATION is not set
   ```
   both config(ostest and smp) can pass ostest  without any problem in my Ubuntu and WSL environment. Could you try the stock config(ostest and smp) on Ubuntu and macOS without the local change and collect the result here?


-- 
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 #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   @yamt which config do you use? I have test on sim:smp and run both ostest and smp without problem.


-- 
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 #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   > > sim:ostest has the same below config:
   > > ```
   > > # CONFIG_TLS_ALIGNED is not set
   > > CONFIG_TLS_NELEM=4
   > > 
   > > CONFIG_IDLETHREAD_STACKSIZE=4096
   > > 
   > > # CONFIG_STACK_COLORATION is not set
   > > ```
   > > 
   > > 
   > > both config(ostest and smp) can pass ostest without any problem in my Ubuntu and WSL environment. Could you try the stock config(ostest and smp) on Ubuntu and macOS without the local change and collect the result here?
   > 
   > why?
   > 
   > i've already reported stock ostest on macOS is broken.
   > given that you have akready run it on Ubuntu, i don't see any reason for me to repeat it.
   
   You reported Ubuntu stop working on your environment, but I can't reproduce locally and need you more input to repo the issue. Since I am more familiar with Linux, I want to fix the issue on Ubuntu first, then look at macOS.


-- 
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] yamt commented on pull request #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   i marked this PR a draft because i submitted a less intrusive 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] yamt commented on pull request #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   @xiaoxiang781216
   see https://github.com/apache/incubator-nuttx/pull/3574
   this fixes at least the macOS case.
   


-- 
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] yamt commented on pull request #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   > sim:ostest has the same below config:
   > 
   > ```
   > # CONFIG_TLS_ALIGNED is not set
   > CONFIG_TLS_NELEM=4
   > 
   > CONFIG_IDLETHREAD_STACKSIZE=4096
   > 
   > # CONFIG_STACK_COLORATION is not set
   > ```
   > 
   > both config(ostest and smp) can pass ostest without any problem in my Ubuntu and WSL environment. Could you try the stock config(ostest and smp) on Ubuntu and macOS without the local change and collect the result here?
   
   why?
   
   i've already reported stock ostest on macOS is broken.
   given that you have akready run it on Ubuntu, i don't see any reason for me to repeat 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] yamt commented on pull request #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   > Yes, but I need more input from @yamt to repro the symptom locally before I can make the investigation.
   
   maybe i will investigate the issue by myself in the next week.
   i prefer it to be reverted first though.


-- 
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 closed pull request #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   


-- 
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 #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   Yes, but I need more input from @yamt to repro the symptom locally before I can make the investigation.


-- 
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 #3560: Revert "arch: Allocate the space from the beginning in up_stack_frame"

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


   This is a pretty big change and lot of testing has been done.  Some bugs were still expected.  I propose that we let @xiaoxiang781216 analyze the problem and find solutions if necessary before reverting the whole thing.


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