You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pussuw (via GitHub)" <gi...@apache.org> on 2023/02/16 12:42:10 UTC
[GitHub] [nuttx] pussuw opened a new pull request, #8545: group/tg_info/argv: Make utility function to read argv as string
pussuw opened a new pull request, #8545:
URL: https://github.com/apache/nuttx/pull/8545
## Summary
This creates a generic and safe way to read a process argument vector as string from any context. Use the interface from assert
and procfs.
## Impact
Converges copy&pasted code into a single location. Also fixes a system crash when trying to copy the argument vector in procfs.
## Testing
icicle:knsh
--
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] [nuttx] pussuw commented on pull request #8545: group/tg_info/argv: Make utility function to read argv as string
Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on PR #8545:
URL: https://github.com/apache/nuttx/pull/8545#issuecomment-1433033869
Easy way to reproduce is to create a process that never exits (I added a while(1) loop into hello), then start the process in the background and call ps. It will cause as system crash.
```
NuttShell (NSH) NuttX-10.4.0
nsh> hello &
hello [0:100]
nsh> ps
PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND
0 0 0 FIFO Kthread N-- Ready 00000000 002000 000760 38.0% Idle Task
1 1 249 RR Kthread --- Waiting Semaphore 00000000 008096 000688 8.4% hpwork 0xa2007090
2 2 50 RR Kthread --- Waiting Semaphore 0riscv_exception: EXCEPTION: Load page fault. MCAUSE: 000000000000000d, EPC: 00000000a00198c8, MTVAL: ffffff8302e7866b
riscv_exception: PANIC!!! Exception = 000000000000000d
_assert: Current Version: NuttX 10.4.0 e11a2841a6-dirty Feb 16 2023 11:52:19 risc-v
_assert: Assertion failed panic: at file: common/riscv_exception.c:85 task: /sbin/init 0xc000357a
up_dump_register: EPC: 00000000a00198c8
up_dump_register: A0: 0000000000000005 A1: 00000000a2072694 A2: 0000000000000005 A3: 000000000000006f
up_dump_register: A4: 0000000000000001 A5: 00000000c00042c0 A6: 00000000a2072694 A7: 0000000000000008
up_dump_register: T0: 00000000a0004318 T1: 00000000a001edd8 T2: 000000000000002d T3: 0000000000000000
up_dump_register: T4: 00000000a2072790 T5: 000000000000002a T6: 000000000000002e
up_dump_register: S0: 0000000000000005 S1: 00000000000003ff S2: 00000000a206d2b8 S3: 00000000c001a9f5
up_dump_register: S4: 00000000a2072694 S5: 46b4490302e7866b S6: 00000000000003fa S7: 00000000a0145c48
up_dump_register: S8: 0000000000000004 S9: 00000000c001aa2d S10: 00000000c001aa8c S11: 0000000000000000
up_dump_register: SP: 00000000a206e3e0 FP: 0000000000000005 TP: 0000000000000000 RA: 00000000a0019874
dump_stack: IRQ Stack:
dump_stack: sp: 0xa2001e90
dump_stack: base: 0xa2001810
dump_stack: size: 00002048
stack_dump: 0xa2001e80: a206cec0 00000000 a001c628 00000000 a2001ec8 00000000 0000000d 00000000
stack_dump: 0xa2001ea0: a2001810 00000000 a0029e3e 00000000 00000009 00000000 7474754e 00000058
stack_dump: 0xa2001ec0: a2000038 00000000 a00f7738 00000000 a2001f18 00000000 00000037 00000000
stack_dump: 0xa2001ee0: a0029ea4 00000000 a0029e42 2e303100 00302e34 00000000 0000000a 00000000
stack_dump: 0xa2001f00: 3165000d 38326131 36613134 7269642d 46207974 31206265 30322036 31203332
stack_dump: 0xa2001f20: 32353a31 0039313a 72004ea0 2d637369 a2000076 00000000 a2001f50 00000000
stack_dump: 0xa2001f40: a2072694 00000000 c001a9f5 00000000 a206e1d0 00000000 a206e1d0 00000000
stack_dump: 0xa2001f60: 0000000d 00000000 a000488e 00000000 00000009 00000000 a00019ce 00000000
stack_dump: 0xa2001f80: c001a2e0 00000000 a0001936 00000000 0000000d 00000000 a001c1f4 00000000
stack_dump: 0xa2001fa0: deadbeef deadbeef 00000000 00000000 0c204004 00000000 a200d240 00000000
stack_dump: 0xa2001fc0: a206e1d0 00000000 a0001626 00000000 c001a9f0 00000000 a206e1d0 00000000
stack_dump: 0xa2001fe0: 0000000d 00000000 a0000e66 00000000 a206d2b8 00000000 000003ff 00000000
dump_stack: User Stack:
dump_stack: sp: 0xa206e3e0
dump_stack: base: 0xc00189d0
dump_stack: size: 00008112
dump_stack: ERROR: User Stack pointer is not within the stack
dump_stack: Kernel Stack:
dump_stack: sp: 0xa206e3e0
dump_stack: base: 0xa206d5e0
dump_stack: size: 00004096
stack_dump: 0xa206e3e0: c001a4b0 00000000 a2070e30 00000000 00000000 00000000 a0004084 00000000
stack_dump: 0xa206e400: 00000000 00000000 0000002d 00000000 c001a9a0 00000000 0000005a 00000000
stack_dump: 0xa206e420: 00000005 00000000 a001eb06 00000000 00000005 00000000 00000000 00000000
stack_dump: 0xa206e440: 00000020 00000000 0000000d 00000000 00000018 00000000 00000008 00000000
stack_dump: 0xa206e460: c001a9f0 00000000 00000400 00000000 c001aa3f 00000000 c00138b0 00000000
stack_dump: 0xa206e480: 0000000a 00000000 c0013b78 00000000 c0013b88 00000000 c001aa2d 00000000
stack_dump: 0xa206e4a0: c001aa8c 00000000 a001ec30 00000000 00000000 00000000 00000001 00000000
stack_dump: 0xa206e4c0: a206d160 00000000 00000000 00000000 00000001 00000000 00000001 00000000
stack_dump: 0xa206e4e0: a206d160 00000000 00000000 00000000 00000001 00000000 a001e8d8 00000000
stack_dump: 0xa206e500: 000003ff 00000000 00000000 00000000 c001aa8c 00000000 c001aa2d 00000000
stack_dump: 0xa206e520: 00000004 00000000 00000000 00000000 c001a9f0 00000000 c00138b0 00000000
stack_dump: 0xa206e540: 000003ff 00000000 00000400 00000000 c001a9f0 00000000 00000005 00000000
stack_dump: 0xa206e560: c001a9f0 00000000 a00106ac 00000000 c001a9f0 00000000 a00106de 00000000
stack_dump: 0xa206e580: a206cec0 00000000 000003ff 00000000 00000000 7ff80000 a206d2b8 00000000
stack_dump: 0xa206e5a0: 00000005 00000000 a0010708 00000000 000003ff 00000000 c001a9f0 00000000
stack_dump: 0xa206e5c0: c001a9a0 00000000 a0002c1c 00000000 c0008d84 00000000 00000001 00000000
show_tasks: PID PRI STACKBASE STACKSIZE USED FILLED COMMAND
show_tasks: ---- --- 0xa2001810 2048 1188 58.0% irq
dump_task: 0 0 0xa2060030 2000 760 38.0% Idle Task
dump_task: 1 249 0xa20667c0 8096 688 8.4% hpwork 0xa2007090
dump_task: 2 50 0xa2069220 4000 688 17.2% lpwork 0xa20070c8
dump_task: 4 100 0xc00189d0 8112 2176 26.8% /sbin/init
dump_task: 6 100 0xc00049d0 8112 736 9.0% hello
```
--
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] [nuttx] pussuw commented on pull request #8545: group/tg_info/argv: Make utility function to read argv as string
Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on PR #8545:
URL: https://github.com/apache/nuttx/pull/8545#issuecomment-1433030986
Easy way to reproduce the crash is to create a process that never exits, then start it as a background process. Then ps will fail.
```
NuttShell (NSH) NuttX-10.4.0
saluki-knsh> hello &
hello [0:100]
saluki-knsh> ps
PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND
0 0 0 FIFO Kthread N-- Ready 00000000 002000 000760 38.0% Idle Task
1 1 249 RR Kthread --- Waiting Semaphore 00000000 008096 000688 8.4% hpwork 0xa2007090
2 2 50 RR Kthread --- Waiting Semaphore 0riscv_exception: EXCEPTION: Load page fault. MCAUSE: 000000000000000d, EPC: 00000000a00198c8, MTVAL: ffffff8302e7866b
riscv_exception: PANIC!!! Exception = 000000000000000d
_assert: Current Version: NuttX 10.4.0 e11a2841a6-dirty Feb 16 2023 11:52:19 risc-v
_assert: Assertion failed panic: at file: common/riscv_exception.c:85 task: /sbin/init 0xc000357a
up_dump_register: EPC: 00000000a00198c8
up_dump_register: A0: 0000000000000005 A1: 00000000a2072694 A2: 0000000000000005 A3: 000000000000006f
up_dump_register: A4: 0000000000000001 A5: 00000000c00042c0 A6: 00000000a2072694 A7: 0000000000000008
up_dump_register: T0: 00000000a0004318 T1: 00000000a001edd8 T2: 000000000000002d T3: 0000000000000000
up_dump_register: T4: 00000000a2072790 T5: 000000000000002a T6: 000000000000002e
up_dump_register: S0: 0000000000000005 S1: 00000000000003ff S2: 00000000a206d2b8 S3: 00000000c001a9f5
up_dump_register: S4: 00000000a2072694 S5: 46b4490302e7866b S6: 00000000000003fa S7: 00000000a0145c48
up_dump_register: S8: 0000000000000004 S9: 00000000c001aa2d S10: 00000000c001aa8c S11: 0000000000000000
up_dump_register: SP: 00000000a206e3e0 FP: 0000000000000005 TP: 0000000000000000 RA: 00000000a0019874
dump_stack: IRQ Stack:
dump_stack: sp: 0xa2001e90
dump_stack: base: 0xa2001810
dump_stack: size: 00002048
stack_dump: 0xa2001e80: a206cec0 00000000 a001c628 00000000 a2001ec8 00000000 0000000d 00000000
stack_dump: 0xa2001ea0: a2001810 00000000 a0029e3e 00000000 00000009 00000000 7474754e 00000058
stack_dump: 0xa2001ec0: a2000038 00000000 a00f7738 00000000 a2001f18 00000000 00000037 00000000
stack_dump: 0xa2001ee0: a0029ea4 00000000 a0029e42 2e303100 00302e34 00000000 0000000a 00000000
stack_dump: 0xa2001f00: 3165000d 38326131 36613134 7269642d 46207974 31206265 30322036 31203332
stack_dump: 0xa2001f20: 32353a31 0039313a 72004ea0 2d637369 a2000076 00000000 a2001f50 00000000
stack_dump: 0xa2001f40: a2072694 00000000 c001a9f5 00000000 a206e1d0 00000000 a206e1d0 00000000
stack_dump: 0xa2001f60: 0000000d 00000000 a000488e 00000000 00000009 00000000 a00019ce 00000000
stack_dump: 0xa2001f80: c001a2e0 00000000 a0001936 00000000 0000000d 00000000 a001c1f4 00000000
stack_dump: 0xa2001fa0: deadbeef deadbeef 00000000 00000000 0c204004 00000000 a200d240 00000000
stack_dump: 0xa2001fc0: a206e1d0 00000000 a0001626 00000000 c001a9f0 00000000 a206e1d0 00000000
stack_dump: 0xa2001fe0: 0000000d 00000000 a0000e66 00000000 a206d2b8 00000000 000003ff 00000000
dump_stack: User Stack:
dump_stack: sp: 0xa206e3e0
dump_stack: base: 0xc00189d0
dump_stack: size: 00008112
dump_stack: ERROR: User Stack pointer is not within the stack
dump_stack: Kernel Stack:
dump_stack: sp: 0xa206e3e0
dump_stack: base: 0xa206d5e0
dump_stack: size: 00004096
stack_dump: 0xa206e3e0: c001a4b0 00000000 a2070e30 00000000 00000000 00000000 a0004084 00000000
stack_dump: 0xa206e400: 00000000 00000000 0000002d 00000000 c001a9a0 00000000 0000005a 00000000
stack_dump: 0xa206e420: 00000005 00000000 a001eb06 00000000 00000005 00000000 00000000 00000000
stack_dump: 0xa206e440: 00000020 00000000 0000000d 00000000 00000018 00000000 00000008 00000000
stack_dump: 0xa206e460: c001a9f0 00000000 00000400 00000000 c001aa3f 00000000 c00138b0 00000000
stack_dump: 0xa206e480: 0000000a 00000000 c0013b78 00000000 c0013b88 00000000 c001aa2d 00000000
stack_dump: 0xa206e4a0: c001aa8c 00000000 a001ec30 00000000 00000000 00000000 00000001 00000000
stack_dump: 0xa206e4c0: a206d160 00000000 00000000 00000000 00000001 00000000 00000001 00000000
stack_dump: 0xa206e4e0: a206d160 00000000 00000000 00000000 00000001 00000000 a001e8d8 00000000
stack_dump: 0xa206e500: 000003ff 00000000 00000000 00000000 c001aa8c 00000000 c001aa2d 00000000
stack_dump: 0xa206e520: 00000004 00000000 00000000 00000000 c001a9f0 00000000 c00138b0 00000000
stack_dump: 0xa206e540: 000003ff 00000000 00000400 00000000 c001a9f0 00000000 00000005 00000000
stack_dump: 0xa206e560: c001a9f0 00000000 a00106ac 00000000 c001a9f0 00000000 a00106de 00000000
stack_dump: 0xa206e580: a206cec0 00000000 000003ff 00000000 00000000 7ff80000 a206d2b8 00000000
stack_dump: 0xa206e5a0: 00000005 00000000 a0010708 00000000 000003ff 00000000 c001a9f0 00000000
stack_dump: 0xa206e5c0: c001a9a0 00000000 a0002c1c 00000000 c0008d84 00000000 00000001 00000000
show_tasks: PID PRI STACKBASE STACKSIZE USED FILLED COMMAND
show_tasks: ---- --- 0xa2001810 2048 1188 58.0% irq
dump_task: 0 0 0xa2060030 2000 760 38.0% Idle Task
dump_task: 1 249 0xa20667c0 8096 688 8.4% hpwork 0xa2007090
dump_task: 2 50 0xa2069220 4000 688 17.2% lpwork 0xa20070c8
dump_task: 4 100 0xc00189d0 8112 2176 26.8% /sbin/init
dump_task: 5 255 0xa206b1d0 2480 768 30.9% wq:manager
dump_task: 6 100 0xc00049d0 8112 736 9.0% hello
```
--
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] [nuttx] xiaoxiang781216 merged pull request #8545: group/tg_info/argv: Make utility function to read argv as string
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #8545:
URL: https://github.com/apache/nuttx/pull/8545
--
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