Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wireless: remove unnecessary flags #10

Merged
merged 1 commit into from
Dec 31, 2019

Conversation

xiaoxiang781216
Copy link
Contributor

and some flags(e.g. IW_TXPOW_NFLAGS) is wrong actually

Change-Id: I6fe0c6705f5d67a66c7427ec617cf34813b5f6ee
Signed-off-by: chao.an anchao@xiaomi.com

and some flags(e.g. IW_TXPOW_NFLAGS) is wrong actually

Change-Id: I6fe0c6705f5d67a66c7427ec617cf34813b5f6ee
Signed-off-by: chao.an <anchao@xiaomi.com>
@patacongo patacongo merged commit 78904cd into apache:master Dec 31, 2019
@xiaoxiang781216
Copy link
Contributor Author

@patacongo this PR need merge too:
apache/nuttx-apps#1
otherwise, wapi will build break.

@xiaoxiang781216 xiaoxiang781216 deleted the wireless branch December 31, 2019 16:39
anchao added a commit to anchao/nuttx that referenced this pull request Jun 15, 2020
ASAN trace:
...
==32087==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4502120 at pc 0x56673ca3 bp 0xff9b6a08 sp 0xff9b69f8
WRITE of size 1 at 0xf4502120 thread T0
    #0 0x56673ca2 in strcpy string/lib_strcpy.c:64

0xf4502120 is located 0 bytes to the right of 8224-byte region [0xf4500100,0xf4502120)
allocated by thread T0 here:
    #0 0xf7a60f54 in malloc (/usr/lib32/libasan.so.4+0xe5f54)
    #1 0x5667725d in up_create_stack sim/up_createstack.c:135
    #2 0x56657ed8 in nxthread_create task/task_create.c:125
    #3 0x566580bb in kthread_create task/task_create.c:297
    #4 0x5665935f in work_start_highpri wqueue/kwork_hpthread.c:149
    #5 0x56656f31 in nx_workqueues init/nx_bringup.c:181
    #6 0x56656fc6 in nx_bringup init/nx_bringup.c:436
    apache#7 0x56656e95 in nx_start init/nx_start.c:809
    apache#8 0x566548d4 in main sim/up_head.c:95
    apache#9 0xf763ae80 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18e80)

CALLSTACK:
    apache#8  0xf79de7a5 in __asan_report_store1 () from /usr/lib32/libasan.so.4
    apache#9  0x565fd4d7 in strcpy (dest=0xf4a02121 "", src=0xf5c00895 "k") at string/lib_strcpy.c:64
    apache#10 0x565e4eb2 in nxtask_setup_stackargs (tcb=0xf5c00810, argv=0x0) at task/task_setup.c:570
    apache#11 0x565e50ff in nxtask_setup_arguments (tcb=0xf5c00810, name=0x5679e580 "hpwork", argv=0x0) at task/task_setup.c:714
    apache#12 0x565e414e in nxthread_create (name=0x5679e580 "hpwork", ttype=2 '\002', priority=224, stack=0x0, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:143
    apache#13 0x565e42e3 in kthread_create (name=0x5679e580 "hpwork", priority=224, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:297
    apache#14 0x565e5557 in work_start_highpri () at wqueue/kwork_hpthread.c:149
    apache#15 0x565e3e32 in nx_workqueues () at init/nx_bringup.c:181
    apache#16 0x565e3ec7 in nx_bringup () at init/nx_bringup.c:436
    apache#17 0x565e3d96 in nx_start () at init/nx_start.c:809
    apache#18 0x565e3195 in main (argc=1, argv=0xffe6b954, envp=0xffe6b95c) at sim/up_head.c:95

Change-Id: I096f7952aae67d055daa737e967242eb217ef8ac
Signed-off-by: chao.an <anchao@xiaomi.com>
patacongo pushed a commit that referenced this pull request Jun 15, 2020
ASAN trace:
...
==32087==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4502120 at pc 0x56673ca3 bp 0xff9b6a08 sp 0xff9b69f8
WRITE of size 1 at 0xf4502120 thread T0
    #0 0x56673ca2 in strcpy string/lib_strcpy.c:64

0xf4502120 is located 0 bytes to the right of 8224-byte region [0xf4500100,0xf4502120)
allocated by thread T0 here:
    #0 0xf7a60f54 in malloc (/usr/lib32/libasan.so.4+0xe5f54)
    #1 0x5667725d in up_create_stack sim/up_createstack.c:135
    #2 0x56657ed8 in nxthread_create task/task_create.c:125
    #3 0x566580bb in kthread_create task/task_create.c:297
    #4 0x5665935f in work_start_highpri wqueue/kwork_hpthread.c:149
    #5 0x56656f31 in nx_workqueues init/nx_bringup.c:181
    #6 0x56656fc6 in nx_bringup init/nx_bringup.c:436
    #7 0x56656e95 in nx_start init/nx_start.c:809
    #8 0x566548d4 in main sim/up_head.c:95
    #9 0xf763ae80 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18e80)

CALLSTACK:
    #8  0xf79de7a5 in __asan_report_store1 () from /usr/lib32/libasan.so.4
    #9  0x565fd4d7 in strcpy (dest=0xf4a02121 "", src=0xf5c00895 "k") at string/lib_strcpy.c:64
    #10 0x565e4eb2 in nxtask_setup_stackargs (tcb=0xf5c00810, argv=0x0) at task/task_setup.c:570
    #11 0x565e50ff in nxtask_setup_arguments (tcb=0xf5c00810, name=0x5679e580 "hpwork", argv=0x0) at task/task_setup.c:714
    #12 0x565e414e in nxthread_create (name=0x5679e580 "hpwork", ttype=2 '\002', priority=224, stack=0x0, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:143
    #13 0x565e42e3 in kthread_create (name=0x5679e580 "hpwork", priority=224, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:297
    #14 0x565e5557 in work_start_highpri () at wqueue/kwork_hpthread.c:149
    #15 0x565e3e32 in nx_workqueues () at init/nx_bringup.c:181
    #16 0x565e3ec7 in nx_bringup () at init/nx_bringup.c:436
    #17 0x565e3d96 in nx_start () at init/nx_start.c:809
    #18 0x565e3195 in main (argc=1, argv=0xffe6b954, envp=0xffe6b95c) at sim/up_head.c:95

Change-Id: I096f7952aae67d055daa737e967242eb217ef8ac
Signed-off-by: chao.an <anchao@xiaomi.com>
yamt added a commit to yamt/incubator-nuttx that referenced this pull request Sep 1, 2020
Note: dlsymtab is not in standards. but just in case.

	(gdb) bt
	#0  getpid () at task/task_getpid.c:91
	apache#1  0x00000000004fbc9d in modlib_registry_lock ()
		at modlib/modlib_registry.c:89
	apache#2  0x0000000000719ee0 in modsym (handle=0xffffffffffffffff,
		name=0x7fa7ebdde8c7 "mmap") at module/mod_modsym.c:92
	apache#3  0x000000000071597d in dlsym (handle=0xffffffffffffffff,
		name=0x7fa7ebdde8c7 "mmap") at dlfcn/lib_dlsym.c:164
	apache#4  0x00007fa7ebdbeb39 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
	apache#5  0x00007fa7ebd79b28 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
	apache#6  0x00007fa7ebd9d7a7 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
	apache#7  0x00007fa7ec6ce03a in ?? () from /lib64/ld-linux-x86-64.so.2
	apache#8  0x00007fa7ec6ce141 in ?? () from /lib64/ld-linux-x86-64.so.2
	apache#9  0x00007fa7ec6be13a in ?? () from /lib64/ld-linux-x86-64.so.2
	apache#10 0x0000000000000001 in ?? ()
	apache#11 0x00007fff028f686b in ?? ()
	apache#12 0x0000000000000000 in ?? ()
	(gdb) quit
xiaoxiang781216 pushed a commit that referenced this pull request Sep 1, 2020
Note: dlsymtab is not in standards. but just in case.

	(gdb) bt
	#0  getpid () at task/task_getpid.c:91
	#1  0x00000000004fbc9d in modlib_registry_lock ()
		at modlib/modlib_registry.c:89
	#2  0x0000000000719ee0 in modsym (handle=0xffffffffffffffff,
		name=0x7fa7ebdde8c7 "mmap") at module/mod_modsym.c:92
	#3  0x000000000071597d in dlsym (handle=0xffffffffffffffff,
		name=0x7fa7ebdde8c7 "mmap") at dlfcn/lib_dlsym.c:164
	#4  0x00007fa7ebdbeb39 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
	#5  0x00007fa7ebd79b28 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
	#6  0x00007fa7ebd9d7a7 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
	#7  0x00007fa7ec6ce03a in ?? () from /lib64/ld-linux-x86-64.so.2
	#8  0x00007fa7ec6ce141 in ?? () from /lib64/ld-linux-x86-64.so.2
	#9  0x00007fa7ec6be13a in ?? () from /lib64/ld-linux-x86-64.so.2
	#10 0x0000000000000001 in ?? ()
	#11 0x00007fff028f686b in ?? ()
	#12 0x0000000000000000 in ?? ()
	(gdb) quit
anchao added a commit to anchao/nuttx that referenced this pull request Nov 9, 2020
(gdb) b longjmp
Breakpoint 1 at 0x8270
(gdb) r
Starting program: /home/chao/code/m3/nuttx/nuttx
[    0.000000] Assertion failed at file:task/task_onexit.c line: 99

Breakpoint 1, 0xf7b905e0 in siglongjmp () from /lib/i386-linux-gnu/libc.so.6
(gdb)
(gdb) bt
|#0  0xf7b905e0 in siglongjmp () from /lib/i386-linux-gnu/libc.so.6
|#1  0xf7f9c3dc in siglongjmp_alias () from /lib/i386-linux-gnu/libpthread.so.0
|#2  0x5655d668 in up_assert (filename=0x56641018 "task/task_onexit.c", line=99) at sim/up_head.c:132
|#3  0x56567413 in _assert (filename=0x56641018 "task/task_onexit.c", linenum=99) at assert/lib_assert.c:36
|#4  0x565f8cfd in on_exit (func=0x565f8c12 <exitfunc>, arg=0x565fd780 <simuart_restoremode>) at task/task_onexit.c:99
|#5  0x565f8c89 in atexit (func=0x565fd780 <simuart_restoremode>) at task/task_atexit.c:109
|#6  0x565fd819 in simuart_start () at sim/up_simuart.c:112
|apache#7  0x5656c844 in up_uartinit () at sim/up_uart.c:496
|apache#8  0x5656ba7a in up_initialize () at sim/up_initialize.c:234
|apache#9  0x5655da56 in nx_start () at init/nx_start.c:701
|apache#10 0x5655d5e9 in main (argc=1, argv=0xffffd6f4, envp=0xffffd6fc) at sim/up_head.c:96

Change-Id: Ifd7196b2de7bf9fc7cea764c19a5c0eacf08fdb6
Signed-off-by: chao.an <anchao@xiaomi.com>
acassis pushed a commit that referenced this pull request Nov 9, 2020
(gdb) b longjmp
Breakpoint 1 at 0x8270
(gdb) r
Starting program: /home/chao/code/m3/nuttx/nuttx
[    0.000000] Assertion failed at file:task/task_onexit.c line: 99

Breakpoint 1, 0xf7b905e0 in siglongjmp () from /lib/i386-linux-gnu/libc.so.6
(gdb)
(gdb) bt
|#0  0xf7b905e0 in siglongjmp () from /lib/i386-linux-gnu/libc.so.6
|#1  0xf7f9c3dc in siglongjmp_alias () from /lib/i386-linux-gnu/libpthread.so.0
|#2  0x5655d668 in up_assert (filename=0x56641018 "task/task_onexit.c", line=99) at sim/up_head.c:132
|#3  0x56567413 in _assert (filename=0x56641018 "task/task_onexit.c", linenum=99) at assert/lib_assert.c:36
|#4  0x565f8cfd in on_exit (func=0x565f8c12 <exitfunc>, arg=0x565fd780 <simuart_restoremode>) at task/task_onexit.c:99
|#5  0x565f8c89 in atexit (func=0x565fd780 <simuart_restoremode>) at task/task_atexit.c:109
|#6  0x565fd819 in simuart_start () at sim/up_simuart.c:112
|#7  0x5656c844 in up_uartinit () at sim/up_uart.c:496
|#8  0x5656ba7a in up_initialize () at sim/up_initialize.c:234
|#9  0x5655da56 in nx_start () at init/nx_start.c:701
|#10 0x5655d5e9 in main (argc=1, argv=0xffffd6f4, envp=0xffffd6fc) at sim/up_head.c:96

Change-Id: Ifd7196b2de7bf9fc7cea764c19a5c0eacf08fdb6
Signed-off-by: chao.an <anchao@xiaomi.com>
anchao added a commit to anchao/nuttx that referenced this pull request Dec 14, 2020
Deadlock during recursive access if unionfs overlays procfs,
check the critical segment only and remove the useless protection part.

|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
...
|#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|apache#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026

original call stack:
(gdb) bt
|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
|#1  0x08071629 in mountpoint_filter (node=0xf3df4540, dirpath=0xf3df4a28 "/proc", arg=0xf3de2fc4) at mount/fs_foreachmountpoint.c:119
|#2  0x0807171b in foreach_inodelevel (node=0xf3df4540, info=0xf3df4a20) at inode/fs_foreachinode.c:90
|#3  0x08071898 in foreach_inode (handler=0x8071530 <mountpoint_filter>, arg=0xf3de2fc4) at inode/fs_foreachinode.c:193
|#4  0x080716c1 in foreach_mountpoint (handler=0x8070e2f <blocks_entry>, arg=0xf3de300c) at mount/fs_foreachmountpoint.c:169
|#5  0x08071399 in mount_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at mount/fs_procfs_mount.c:537
|#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|apache#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026
|apache#8  0x080657a2 in file_read (filep=0xf3de219c, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:110
|apache#9  0x0806581a in nx_read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:175
|apache#10 0x08065847 in read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:206
|apache#11 0x0805a242 in nsh_catfile (vtbl=0xf3df3f10, cmd=0xf3df4378 "df", filepath=0x808d5ed "/proc/fs/blocks") at nsh_fsutils.c:116
|apache#12 0x0805b1de in cmd_df (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_mntcmds.c:73
|apache#13 0x08056370 in nsh_command (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_command.c:1061
|apache#14 0x08053b16 in nsh_execute (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0, redirfile=0x0, oflags=0) at nsh_parse.c:741
|apache#15 0x08055998 in nsh_parse_command (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2578
|apache#16 0x08055a7b in nsh_parse (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2662
|apache#17 0x0805d691 in nsh_session (pstate=0xf3df3f10, login=1 '\001', argc=1, argv=0xf3de34b0) at nsh_session.c:191
|apache#18 0x0805b542 in nsh_consolemain (argc=1, argv=0xf3de34b0) at nsh_consolemain.c:115
|apache#19 0x0805346c in nsh_main (argc=1, argv=0xf3de34b0) at nsh_main.c:168
|apache#20 0x0805075a in nxtask_startup (entrypt=0x805340a <nsh_main>, argc=1, argv=0xf3de34b0) at sched/task_startup.c:165
|apache#21 0x08049713 in nxtask_start () at task/task_start.c:144
|apache#22 0x00000000 in ?? ()

Change-Id: Ic4c7aff0ea50388a371c525745e817a787dabcca
Signed-off-by: chao.an <anchao@xiaomi.com>
anchao added a commit to anchao/nuttx that referenced this pull request Dec 14, 2020
Deadlock during recursive access if unionfs overlays procfs,
check the critical segment only and remove the useless protection part.

|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
...
|#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|apache#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026

original call stack:
(gdb) bt
|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
|#1  0x08071629 in mountpoint_filter (node=0xf3df4540, dirpath=0xf3df4a28 "/proc", arg=0xf3de2fc4) at mount/fs_foreachmountpoint.c:119
|#2  0x0807171b in foreach_inodelevel (node=0xf3df4540, info=0xf3df4a20) at inode/fs_foreachinode.c:90
|#3  0x08071898 in foreach_inode (handler=0x8071530 <mountpoint_filter>, arg=0xf3de2fc4) at inode/fs_foreachinode.c:193
|#4  0x080716c1 in foreach_mountpoint (handler=0x8070e2f <blocks_entry>, arg=0xf3de300c) at mount/fs_foreachmountpoint.c:169
|#5  0x08071399 in mount_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at mount/fs_procfs_mount.c:537
|#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|apache#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026
|apache#8  0x080657a2 in file_read (filep=0xf3de219c, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:110
|apache#9  0x0806581a in nx_read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:175
|apache#10 0x08065847 in read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:206
|apache#11 0x0805a242 in nsh_catfile (vtbl=0xf3df3f10, cmd=0xf3df4378 "df", filepath=0x808d5ed "/proc/fs/blocks") at nsh_fsutils.c:116
|apache#12 0x0805b1de in cmd_df (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_mntcmds.c:73
|apache#13 0x08056370 in nsh_command (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_command.c:1061
|apache#14 0x08053b16 in nsh_execute (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0, redirfile=0x0, oflags=0) at nsh_parse.c:741
|apache#15 0x08055998 in nsh_parse_command (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2578
|apache#16 0x08055a7b in nsh_parse (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2662
|apache#17 0x0805d691 in nsh_session (pstate=0xf3df3f10, login=1 '\001', argc=1, argv=0xf3de34b0) at nsh_session.c:191
|apache#18 0x0805b542 in nsh_consolemain (argc=1, argv=0xf3de34b0) at nsh_consolemain.c:115
|apache#19 0x0805346c in nsh_main (argc=1, argv=0xf3de34b0) at nsh_main.c:168
|apache#20 0x0805075a in nxtask_startup (entrypt=0x805340a <nsh_main>, argc=1, argv=0xf3de34b0) at sched/task_startup.c:165
|apache#21 0x08049713 in nxtask_start () at task/task_start.c:144
|apache#22 0x00000000 in ?? ()

Change-Id: Ic4c7aff0ea50388a371c525745e817a787dabcca
Signed-off-by: chao.an <anchao@xiaomi.com>
xiaoxiang781216 pushed a commit that referenced this pull request Dec 15, 2020
Deadlock during recursive access if unionfs overlays procfs,
check the critical segment only and remove the useless protection part.

|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
...
|#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026

original call stack:
(gdb) bt
|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
|#1  0x08071629 in mountpoint_filter (node=0xf3df4540, dirpath=0xf3df4a28 "/proc", arg=0xf3de2fc4) at mount/fs_foreachmountpoint.c:119
|#2  0x0807171b in foreach_inodelevel (node=0xf3df4540, info=0xf3df4a20) at inode/fs_foreachinode.c:90
|#3  0x08071898 in foreach_inode (handler=0x8071530 <mountpoint_filter>, arg=0xf3de2fc4) at inode/fs_foreachinode.c:193
|#4  0x080716c1 in foreach_mountpoint (handler=0x8070e2f <blocks_entry>, arg=0xf3de300c) at mount/fs_foreachmountpoint.c:169
|#5  0x08071399 in mount_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at mount/fs_procfs_mount.c:537
|#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026
|#8  0x080657a2 in file_read (filep=0xf3de219c, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:110
|#9  0x0806581a in nx_read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:175
|#10 0x08065847 in read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:206
|#11 0x0805a242 in nsh_catfile (vtbl=0xf3df3f10, cmd=0xf3df4378 "df", filepath=0x808d5ed "/proc/fs/blocks") at nsh_fsutils.c:116
|#12 0x0805b1de in cmd_df (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_mntcmds.c:73
|#13 0x08056370 in nsh_command (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_command.c:1061
|#14 0x08053b16 in nsh_execute (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0, redirfile=0x0, oflags=0) at nsh_parse.c:741
|#15 0x08055998 in nsh_parse_command (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2578
|#16 0x08055a7b in nsh_parse (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2662
|#17 0x0805d691 in nsh_session (pstate=0xf3df3f10, login=1 '\001', argc=1, argv=0xf3de34b0) at nsh_session.c:191
|#18 0x0805b542 in nsh_consolemain (argc=1, argv=0xf3de34b0) at nsh_consolemain.c:115
|#19 0x0805346c in nsh_main (argc=1, argv=0xf3de34b0) at nsh_main.c:168
|#20 0x0805075a in nxtask_startup (entrypt=0x805340a <nsh_main>, argc=1, argv=0xf3de34b0) at sched/task_startup.c:165
|#21 0x08049713 in nxtask_start () at task/task_start.c:144
|#22 0x00000000 in ?? ()

Change-Id: Ic4c7aff0ea50388a371c525745e817a787dabcca
Signed-off-by: chao.an <anchao@xiaomi.com>
yamt added a commit to yamt/incubator-nuttx that referenced this pull request Mar 23, 2021
```
    Program received signal SIGSEGV, Segmentation fault.
    getpid () at task/task_getpid.c:76
    76      task/task_getpid.c: No such file or directory.
    rax            0x2feeb4            3141300
    rbx            0xc53f83            12926851
    rcx            0x6837665ee4c00     1833394399759360
    rdx            0x472080            4661376
    rsi            0xc53f83            12926851
    rdi            0xffffffffffffffff  -1
    rbp            0x7ffe4cdfe140      0x7ffe4cdfe140
    rsp            0x7ffe4cdfe0f0      0x7ffe4cdfe0f0
    r8             0xffffffffffffffff  -1
    r9             0x0                 0
    r10            0x22                34
    r11            0x246               582
    r12            0x472080            4661376
    r13            0x7ffe4cdfe3e8      140730188162024
    r14            0x472080            4661376
    r15            0xf60398            16122776
    rip            0x4e9b93            0x4e9b93 <getpid+35>
    eflags         0x10206             [ PF IF RF ]
    cs             0x33                51
    ss             0x2b                43
    ds             0x0                 0
    es             0x0                 0
    fs             0x0                 0
    gs             0x0                 0
    #0  getpid () at task/task_getpid.c:76
    apache#1  0x00000000006ad25a in modlib_registry_lock () at modlib/modlib_registry.c:89
    apache#2  0x0000000000c3648d in modsym (handle=0xffffffffffffffff, name=0xc53f83 "mmap") at module/mod_modsym.c:77
    apache#3  0x0000000000c2cd3a in dlsym (handle=0xffffffffffffffff, name=0xc53f83 "mmap") at dlfcn/lib_dlsym.c:149
    apache#4  0x00000000004a0034 in __interception::InterceptFunction(char const*, unsigned long*, unsigned long, unsigned long) ()
    apache#5  0x000000000048181e in InitializeCommonInterceptors() ()
    apache#6  0x000000000048106a in __asan::InitializeAsanInterceptors() ()
    apache#7  0x000000000049b85e in __asan::AsanInitInternal() ()
    apache#8  0x00007f09cfb04ce6 in ?? () from /lib64/ld-linux-x86-64.so.2
    apache#9  0x00007f09cfaf413a in ?? () from /lib64/ld-linux-x86-64.so.2
    apache#10 0x0000000000000001 in ?? ()
    apache#11 0x00007ffe4cdfff56 in ?? ()
    apache#12 0x0000000000000000 in ?? ()
```
yamt added a commit to yamt/incubator-nuttx that referenced this pull request Mar 23, 2021
Fixes the following crash with CONFIG_SIM_SANITIZE=y on Linux.

```
    Program received signal SIGSEGV, Segmentation fault.
    getpid () at task/task_getpid.c:76
    76      task/task_getpid.c: No such file or directory.
    rax            0x2feeb4            3141300
    rbx            0xc53f83            12926851
    rcx            0x6837665ee4c00     1833394399759360
    rdx            0x472080            4661376
    rsi            0xc53f83            12926851
    rdi            0xffffffffffffffff  -1
    rbp            0x7ffe4cdfe140      0x7ffe4cdfe140
    rsp            0x7ffe4cdfe0f0      0x7ffe4cdfe0f0
    r8             0xffffffffffffffff  -1
    r9             0x0                 0
    r10            0x22                34
    r11            0x246               582
    r12            0x472080            4661376
    r13            0x7ffe4cdfe3e8      140730188162024
    r14            0x472080            4661376
    r15            0xf60398            16122776
    rip            0x4e9b93            0x4e9b93 <getpid+35>
    eflags         0x10206             [ PF IF RF ]
    cs             0x33                51
    ss             0x2b                43
    ds             0x0                 0
    es             0x0                 0
    fs             0x0                 0
    gs             0x0                 0
    #0  getpid () at task/task_getpid.c:76
    apache#1  0x00000000006ad25a in modlib_registry_lock () at modlib/modlib_registry.c:89
    apache#2  0x0000000000c3648d in modsym (handle=0xffffffffffffffff, name=0xc53f83 "mmap") at module/mod_modsym.c:77
    apache#3  0x0000000000c2cd3a in dlsym (handle=0xffffffffffffffff, name=0xc53f83 "mmap") at dlfcn/lib_dlsym.c:149
    apache#4  0x00000000004a0034 in __interception::InterceptFunction(char const*, unsigned long*, unsigned long, unsigned long) ()
    apache#5  0x000000000048181e in InitializeCommonInterceptors() ()
    apache#6  0x000000000048106a in __asan::InitializeAsanInterceptors() ()
    apache#7  0x000000000049b85e in __asan::AsanInitInternal() ()
    apache#8  0x00007f09cfb04ce6 in ?? () from /lib64/ld-linux-x86-64.so.2
    apache#9  0x00007f09cfaf413a in ?? () from /lib64/ld-linux-x86-64.so.2
    apache#10 0x0000000000000001 in ?? ()
    apache#11 0x00007ffe4cdfff56 in ?? ()
    apache#12 0x0000000000000000 in ?? ()
```
xiaoxiang781216 pushed a commit that referenced this pull request Mar 23, 2021
Fixes the following crash with CONFIG_SIM_SANITIZE=y on Linux.

```
    Program received signal SIGSEGV, Segmentation fault.
    getpid () at task/task_getpid.c:76
    76      task/task_getpid.c: No such file or directory.
    rax            0x2feeb4            3141300
    rbx            0xc53f83            12926851
    rcx            0x6837665ee4c00     1833394399759360
    rdx            0x472080            4661376
    rsi            0xc53f83            12926851
    rdi            0xffffffffffffffff  -1
    rbp            0x7ffe4cdfe140      0x7ffe4cdfe140
    rsp            0x7ffe4cdfe0f0      0x7ffe4cdfe0f0
    r8             0xffffffffffffffff  -1
    r9             0x0                 0
    r10            0x22                34
    r11            0x246               582
    r12            0x472080            4661376
    r13            0x7ffe4cdfe3e8      140730188162024
    r14            0x472080            4661376
    r15            0xf60398            16122776
    rip            0x4e9b93            0x4e9b93 <getpid+35>
    eflags         0x10206             [ PF IF RF ]
    cs             0x33                51
    ss             0x2b                43
    ds             0x0                 0
    es             0x0                 0
    fs             0x0                 0
    gs             0x0                 0
    #0  getpid () at task/task_getpid.c:76
    #1  0x00000000006ad25a in modlib_registry_lock () at modlib/modlib_registry.c:89
    #2  0x0000000000c3648d in modsym (handle=0xffffffffffffffff, name=0xc53f83 "mmap") at module/mod_modsym.c:77
    #3  0x0000000000c2cd3a in dlsym (handle=0xffffffffffffffff, name=0xc53f83 "mmap") at dlfcn/lib_dlsym.c:149
    #4  0x00000000004a0034 in __interception::InterceptFunction(char const*, unsigned long*, unsigned long, unsigned long) ()
    #5  0x000000000048181e in InitializeCommonInterceptors() ()
    #6  0x000000000048106a in __asan::InitializeAsanInterceptors() ()
    #7  0x000000000049b85e in __asan::AsanInitInternal() ()
    #8  0x00007f09cfb04ce6 in ?? () from /lib64/ld-linux-x86-64.so.2
    #9  0x00007f09cfaf413a in ?? () from /lib64/ld-linux-x86-64.so.2
    #10 0x0000000000000001 in ?? ()
    #11 0x00007ffe4cdfff56 in ?? ()
    #12 0x0000000000000000 in ?? ()
```
yamt added a commit to yamt/incubator-nuttx that referenced this pull request Apr 16, 2021
This reverts commit 2335b69.

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 apache#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 apache#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 apache#1: 0x0000000101002048
    frame apache#2: 0x000000010001682d nuttx`tty_send(dev=0x000000010002f370, ch=115) at up_uart.c:447:3
    frame apache#3: 0x000000010000d7df nuttx`uart_xmitchars(dev=0x000000010002f370) at serial_io.c:68:7
    frame apache#4: 0x0000000100016a95 nuttx`tty_txint(dev=0x000000010002f370, enable='\x01') at up_uart.c:462:7
    frame apache#5: 0x000000010000ce48 nuttx`uart_write(filep=0x00000001010011e8, buffer="", buflen=0) at serial.c:1260:7
    frame apache#6: 0x0000000100024ef3 nuttx`file_write(filep=0x00000001010011e8, buf=0x0000000100027a30, nbytes=23) at fs_write.c:89:10
    frame apache#7: 0x0000000100024f6a nuttx`nx_write(fd=1, buf=0x0000000100027a30, nbytes=23) at fs_write.c:138:13
    frame apache#8: 0x0000000100024fab nuttx`file_write(filep=0x0000000100027a30, buf=0x0000000000000017, nbytes=0) at fs_write.c:76:7
    frame apache#9: 0x000000010002215e nuttx`stdio_test at ostest_main.c:574:3
    frame apache#10: 0x0000000100021f1b nuttx`ostest_main(argc=1, argv=0x0000000101001300) at ostest_main.c:602:3
    frame apache#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 apache#12: 0x000000010000a580 nuttx`nxtask_start at task_start.c:129:7
(lldb)
```
GUIDINGLI added a commit to GUIDINGLI/incubator-nuttx that referenced this pull request Mar 25, 2022
VELAPLATFO-1942

-apache#9  0xf7abf899 in __asan::__asan_report_load2 (addr=4072681776) at ../../../../../src/libsanitizer/asan/asan_rtl.cc:117
-apache#10 0x5693f718 in inode_release (node=0xf2c03124) at inode/fs_inoderelease.c:69
-apache#11 0x568ea61b in file_close (filep=0xf55fedd0) at vfs/fs_close.c:79
-apache#12 0x568e7e56 in nx_close (fd=3) at inode/fs_files.c:528
-apache#13 0x568e7f0e in close (fd=3) at inode/fs_files.c:562
-apache#14 0x56e76c39 in epoll_close (epfd=3) at vfs/fs_epoll.c:252
-apache#15 0x56c33829 in sensor_service_delete (ctrl=0x578b8540 <control>) at src/common.c:439
-apache#16 0x56a0561e in sensor_middle_service_main (argc=1, argv=0xf55de820) at sensor_main.c:118
-apache#17 0x56878675 in nxtask_startup (entrypt=0x56a054cc <sensor_middle_service_main>, argc=1, argv=0xf55de820) at sched/task_startup.c:70
-apache#18 0x5684427a in nxtask_start () at task/task_start.c:133
-apache#19 0xdeadbeef in ?? ()

reason:
epoll_close -> close -> epoll_do_close (free inode)
                     -> inode_release  (reuse inode, crash)

fix:
use the global inode to match the fd which will return to user.
like the g_sock_inode in fs/socket/socket.c

Change-Id: I0096ac691ce9cf4169d1fb8bfa6d27a8c1ee7d52
Signed-off-by: ligd <liguiding1@xiaomi.com>
GUIDINGLI added a commit to GUIDINGLI/incubator-nuttx that referenced this pull request Mar 25, 2022
-apache#9  0xf7abf899 in __asan::__asan_report_load2 (addr=4072681776) at ../../../../../src/libsanitizer/asan/asan_rtl.cc:117
-apache#10 0x5693f718 in inode_release (node=0xf2c03124) at inode/fs_inoderelease.c:69
-apache#11 0x568ea61b in file_close (filep=0xf55fedd0) at vfs/fs_close.c:79
-apache#12 0x568e7e56 in nx_close (fd=3) at inode/fs_files.c:528
-apache#13 0x568e7f0e in close (fd=3) at inode/fs_files.c:562
-apache#14 0x56e76c39 in epoll_close (epfd=3) at vfs/fs_epoll.c:252
-apache#15 0x56c33829 in sensor_service_delete (ctrl=0x578b8540 <control>) at src/common.c:439
-apache#16 0x56a0561e in sensor_middle_service_main (argc=1, argv=0xf55de820) at sensor_main.c:118
-apache#17 0x56878675 in nxtask_startup (entrypt=0x56a054cc <sensor_middle_service_main>, argc=1, argv=0xf55de820) at sched/task_startup.c:70
-apache#18 0x5684427a in nxtask_start () at task/task_start.c:133
-apache#19 0xdeadbeef in ?? ()

reason:
epoll_close -> close -> epoll_do_close (free inode)
                     -> inode_release  (reuse inode, crash)

fix:
use the global inode to match the fd which will return to user.
like the g_sock_inode in fs/socket/socket.c

Signed-off-by: ligd <liguiding1@xiaomi.com>
pkarashchenko pushed a commit that referenced this pull request Mar 27, 2022
-#9  0xf7abf899 in __asan::__asan_report_load2 (addr=4072681776) at ../../../../../src/libsanitizer/asan/asan_rtl.cc:117
-#10 0x5693f718 in inode_release (node=0xf2c03124) at inode/fs_inoderelease.c:69
-#11 0x568ea61b in file_close (filep=0xf55fedd0) at vfs/fs_close.c:79
-#12 0x568e7e56 in nx_close (fd=3) at inode/fs_files.c:528
-#13 0x568e7f0e in close (fd=3) at inode/fs_files.c:562
-#14 0x56e76c39 in epoll_close (epfd=3) at vfs/fs_epoll.c:252
-#15 0x56c33829 in sensor_service_delete (ctrl=0x578b8540 <control>) at src/common.c:439
-#16 0x56a0561e in sensor_middle_service_main (argc=1, argv=0xf55de820) at sensor_main.c:118
-#17 0x56878675 in nxtask_startup (entrypt=0x56a054cc <sensor_middle_service_main>, argc=1, argv=0xf55de820) at sched/task_startup.c:70
-#18 0x5684427a in nxtask_start () at task/task_start.c:133
-#19 0xdeadbeef in ?? ()

reason:
epoll_close -> close -> epoll_do_close (free inode)
                     -> inode_release  (reuse inode, crash)

fix:
use the global inode to match the fd which will return to user.
like the g_sock_inode in fs/socket/socket.c

Signed-off-by: ligd <liguiding1@xiaomi.com>
tito97sp added a commit to tito97sp/incubator-nuttx that referenced this pull request May 26, 2022
Add nuttx_compilation test into custom Docker image
yamt added a commit to yamt/incubator-nuttx that referenced this pull request Jul 8, 2022
This reverts commit b88a1fd. [1]

Because:

* It casues assertion failures like [2].

* I don't understand what it attempted to fix.

[1]
```
commit b88a1fd
Author: chao.an <anchao@xiaomi.com>
Date:   Sat Jul 2 13:17:41 2022 +0800

    net/tcp: discard connect reference before free

    connect reference should be set to 0 before free

    Signed-off-by: chao.an <anchao@xiaomi.com>
```

[2]
```
    #0  up_assert (filename=0x5516d0 "tcp/tcp_conn.c", lineno=771) at sim/up_assert.c:75
    apache#1  0x000000000040a4bb in _assert (filename=0x5516d0 "tcp/tcp_conn.c", linenum=771) at assert/lib_assert.c:36
    apache#2  0x000000000042a2ad in tcp_free (conn=0x597fe0 <g_tcp_connections+384>) at tcp/tcp_conn.c:771
    apache#3  0x000000000053bdc2 in tcp_close_disconnect (psock=0x7f58d1abbd80) at tcp/tcp_close.c:331
    apache#4  0x000000000053bc69 in tcp_close (psock=0x7f58d1abbd80) at tcp/tcp_close.c:366
    apache#5  0x000000000052eefe in inet_close (psock=0x7f58d1abbd80) at inet/inet_sockif.c:1689
    apache#6  0x000000000052eb9b in psock_close (psock=0x7f58d1abbd80) at socket/net_close.c:102
    apache#7  0x0000000000440495 in sock_file_close (filep=0x7f58d1b35f40) at socket/socket.c:115
    apache#8  0x000000000043b8b6 in file_close (filep=0x7f58d1b35f40) at vfs/fs_close.c:74
    apache#9  0x000000000043ab22 in nx_close (fd=9) at inode/fs_files.c:544
    apache#10 0x000000000043ab7f in close (fd=9) at inode/fs_files.c:578
```
xiaoxiang781216 pushed a commit that referenced this pull request Jul 8, 2022
This reverts commit b88a1fd. [1]

Because:

* It casues assertion failures like [2].

* I don't understand what it attempted to fix.

[1]
```
commit b88a1fd
Author: chao.an <anchao@xiaomi.com>
Date:   Sat Jul 2 13:17:41 2022 +0800

    net/tcp: discard connect reference before free

    connect reference should be set to 0 before free

    Signed-off-by: chao.an <anchao@xiaomi.com>
```

[2]
```
    #0  up_assert (filename=0x5516d0 "tcp/tcp_conn.c", lineno=771) at sim/up_assert.c:75
    #1  0x000000000040a4bb in _assert (filename=0x5516d0 "tcp/tcp_conn.c", linenum=771) at assert/lib_assert.c:36
    #2  0x000000000042a2ad in tcp_free (conn=0x597fe0 <g_tcp_connections+384>) at tcp/tcp_conn.c:771
    #3  0x000000000053bdc2 in tcp_close_disconnect (psock=0x7f58d1abbd80) at tcp/tcp_close.c:331
    #4  0x000000000053bc69 in tcp_close (psock=0x7f58d1abbd80) at tcp/tcp_close.c:366
    #5  0x000000000052eefe in inet_close (psock=0x7f58d1abbd80) at inet/inet_sockif.c:1689
    #6  0x000000000052eb9b in psock_close (psock=0x7f58d1abbd80) at socket/net_close.c:102
    #7  0x0000000000440495 in sock_file_close (filep=0x7f58d1b35f40) at socket/socket.c:115
    #8  0x000000000043b8b6 in file_close (filep=0x7f58d1b35f40) at vfs/fs_close.c:74
    #9  0x000000000043ab22 in nx_close (fd=9) at inode/fs_files.c:544
    #10 0x000000000043ab7f in close (fd=9) at inode/fs_files.c:578
```
anchao added a commit to anchao/nuttx that referenced this pull request Jul 8, 2022
When the free connection list is unenough to alloc a new instance,
the TCP stack will reuse the currently closed connection, but if
the handle is not released by the user via close(2), the reference
count of the connection remains in a non-zero value, it will cause
the assertion to fail, so when the handle is not released we should
not use such a conn instance when being actively closed, and ensure
that the reference count is assigned within the net lock protection

|(gdb) bt
|#0  up_assert (filename=0x565c78f7 "tcp/tcp_conn.c", lineno=771) at sim/up_assert.c:75
|#1  0x56566177 in _assert (filename=0x565c78f7 "tcp/tcp_conn.c", linenum=771) at assert/lib_assert.c:36
|#2  0x5657d620 in tcp_free (conn=0x565fb3e0 <g_tcp_connections>) at tcp/tcp_conn.c:771
|#3  0x5657d5a1 in tcp_alloc (domain=2 '\002') at tcp/tcp_conn.c:700
|#4  0x565b1f50 in inet_tcp_alloc (psock=0xf3dea150) at inet/inet_sockif.c:144
|#5  0x565b2082 in inet_setup (psock=0xf3dea150, protocol=0) at inet/inet_sockif.c:253
|#6  0x565b1bf0 in psock_socket (domain=2, type=1, protocol=0, psock=0xf3dea150) at socket/socket.c:121
|apache#7  0x56588f5f in socket (domain=2, type=1, protocol=0) at socket/socket.c:278
|apache#8  0x565b11c0 in hello_main (argc=1, argv=0xf3dfab10) at hello_main.c:35
|apache#9  0x56566631 in nxtask_startup (entrypt=0x565b10ef <hello_main>, argc=1, argv=0xf3dfab10) at sched/task_startup.c:70
|apache#10 0x565597fa in nxtask_start () at task/task_start.c:134

Signed-off-by: chao.an <anchao@xiaomi.com>
chenzhihong007 pushed a commit to hpmicro/nuttx that referenced this pull request Aug 1, 2023
- add tmr driver
- add timer demo defconfig

Signed-off-by: Runcheng Lu <runcheng.lu@hpmicro.com>
GUIDINGLI added a commit to GUIDINGLI/incubator-nuttx that referenced this pull request Sep 23, 2023
==1729315==ERROR: AddressSanitizer: heap-use-after-free on address 0xf0501d60 at pc 0x032ffe43 bp 0xef4ed158 sp 0xef4ed148
READ of size 2 at 0xf0501d60 thread T0
    #0 0x32ffe42 in nxsem_wait semaphore/sem_wait.c:94
    #1 0x3548cf5 in _net_timedwait utils/net_lock.c:97
    #2 0x3548f48 in net_sem_timedwait utils/net_lock.c:236
    apache#3 0x3548f8c in net_sem_wait utils/net_lock.c:318
    apache#4 0x350124d in local_accept local/local_accept.c:246
    apache#5 0x3492719 in psock_accept socket/accept.c:149
    apache#6 0x3492bcc in accept4 socket/accept.c:280
    apache#7 0x662dc04 in accept net/lib_accept.c:50
    apache#8 0x55c81ab in kvdb_loop kvdb/server.c:415
    apache#9 0x55c860a in kvdbd_main kvdb/server.c:458
    apache#10 0x33d968b in nxtask_startup sched/task_startup.c:70
    apache#11 0x32ec039 in nxtask_start task/task_start.c:134
    apache#12 0x34109be in pre_start sim/sim_initialstate.c:52

0xf0501d60 is located 288 bytes inside of 420-byte region [0xf0501c40,0xf0501de4)
freed by thread T0 here:
    #0 0xf7aa6a3f in __interceptor_free ../../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127
    #1 0x73aa06e in host_free sim/posix/sim_hostmemory.c:192
    #2 0x34131d6 in mm_free sim/sim_heap.c:230
    apache#3 0x3409388 in free umm_heap/umm_free.c:49
    apache#4 0x35631f3 in local_free local/local_conn.c:225
    apache#5 0x3563f75 in local_release local/local_release.c:129
    apache#6 0x34f5a32 in local_close local/local_sockif.c:785
    apache#7 0x3496ee8 in psock_close socket/net_close.c:102
    apache#8 0x36500bc in sock_file_close socket/socket.c:115
    apache#9 0x3635f6c in file_close vfs/fs_close.c:74
    apache#10 0x3632439 in nx_close_from_tcb inode/fs_files.c:670
    apache#11 0x36324f3 in nx_close inode/fs_files.c:697
    apache#12 0x3632557 in close inode/fs_files.c:735
    apache#13 0x55be289 in property_set_ kvdb/client.c:210
    apache#14 0x55c0309 in property_set_int32_ kvdb/common.c:226
    apache#15 0x55c03f5 in property_set_int32_oneway kvdb/common.c:236

Signed-off-by: ligd <liguiding1@xiaomi.com>
xiaoxiang781216 pushed a commit that referenced this pull request Sep 24, 2023
==1729315==ERROR: AddressSanitizer: heap-use-after-free on address 0xf0501d60 at pc 0x032ffe43 bp 0xef4ed158 sp 0xef4ed148
READ of size 2 at 0xf0501d60 thread T0
    #0 0x32ffe42 in nxsem_wait semaphore/sem_wait.c:94
    #1 0x3548cf5 in _net_timedwait utils/net_lock.c:97
    #2 0x3548f48 in net_sem_timedwait utils/net_lock.c:236
    #3 0x3548f8c in net_sem_wait utils/net_lock.c:318
    #4 0x350124d in local_accept local/local_accept.c:246
    #5 0x3492719 in psock_accept socket/accept.c:149
    #6 0x3492bcc in accept4 socket/accept.c:280
    #7 0x662dc04 in accept net/lib_accept.c:50
    #8 0x55c81ab in kvdb_loop kvdb/server.c:415
    #9 0x55c860a in kvdbd_main kvdb/server.c:458
    #10 0x33d968b in nxtask_startup sched/task_startup.c:70
    #11 0x32ec039 in nxtask_start task/task_start.c:134
    #12 0x34109be in pre_start sim/sim_initialstate.c:52

0xf0501d60 is located 288 bytes inside of 420-byte region [0xf0501c40,0xf0501de4)
freed by thread T0 here:
    #0 0xf7aa6a3f in __interceptor_free ../../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127
    #1 0x73aa06e in host_free sim/posix/sim_hostmemory.c:192
    #2 0x34131d6 in mm_free sim/sim_heap.c:230
    #3 0x3409388 in free umm_heap/umm_free.c:49
    #4 0x35631f3 in local_free local/local_conn.c:225
    #5 0x3563f75 in local_release local/local_release.c:129
    #6 0x34f5a32 in local_close local/local_sockif.c:785
    #7 0x3496ee8 in psock_close socket/net_close.c:102
    #8 0x36500bc in sock_file_close socket/socket.c:115
    #9 0x3635f6c in file_close vfs/fs_close.c:74
    #10 0x3632439 in nx_close_from_tcb inode/fs_files.c:670
    #11 0x36324f3 in nx_close inode/fs_files.c:697
    #12 0x3632557 in close inode/fs_files.c:735
    #13 0x55be289 in property_set_ kvdb/client.c:210
    #14 0x55c0309 in property_set_int32_ kvdb/common.c:226
    #15 0x55c03f5 in property_set_int32_oneway kvdb/common.c:236

Signed-off-by: ligd <liguiding1@xiaomi.com>
anchao added a commit to anchao/nuttx that referenced this pull request Nov 6, 2023
Race condition if the remote proc is stoped during initialization phase

| #0  0x0249f959 in rpmsg_destroy_ept (ept=0xffffffc0) at open-amp/lib/rpmsg/rpmsg.c:376
| #1  0x024a938c in rpmsg_deinit_vdev (rvdev=0xf2303a48) at open-amp/lib/rpmsg/rpmsg_virtio.c:971
| #2  0x02117e33 in rptun_dev_stop (rproc=0xf2303a04, stop_ns=true) at rptun/rptun.c:891
| #3  0x021181d8 in rptun_do_ioctl (priv=0xf2303a00, cmd=11010, arg=0) at rptun/rptun.c:922
| #4  0x02119722 in rptun_ioctl_foreach (cpuname=0x0, cmd=11010, value=0) at rptun/rptun.c:1086
| #5  0x0211b9df in rptun_poweroff (cpuname=0x0) at rptun/rptun.c:1378
| #6  0x02053aa6 in board_power_off (status=0) at sim/sim_head.c:206
| apache#7  0x0253d65c in boardctl (cmd=65283, arg=0) at boardctl.c:400
| apache#8  0x021eb497 in cmd_poweroff (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_syscmds.c:356
| apache#9  0x021cdb4d in nsh_command (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_command.c:1164
| apache#10 0x021baa72 in nsh_execute (vtbl=0xef606280, argc=1, argv=0xef9b73e0, redirfile=0x0, oflags=0) at nsh_parse.c:845
| apache#11 0x021c6b0a in nsh_parse_command (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2744
| apache#12 0x021c7166 in nsh_parse (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2828
| apache#13 0x0221fa2f in nsh_session (pstate=0xef606280, login=1, argc=1, argv=0xef7a7860) at nsh_session.c:245
| apache#14 0x021f8c04 in nsh_consolemain (argc=1, argv=0xef7a7860) at nsh_consolemain.c:75
| apache#15 0x021b77eb in nsh_main (argc=1, argv=0xef7a7860) at nsh_main.c:74
| apache#16 0x02166ddf in nxtask_startup (entrypt=0x21b76ca <nsh_main>, argc=1, argv=0xef7a7860) at sched/task_startup.c:70
| apache#17 0x020b363c in nxtask_start () at task/task_start.c:134

Change-Id: I6996b4f7891e9e4452f3182f42360b66bdbc2d4c
Signed-off-by: chao an <anchao@xiaomi.com>
anchao added a commit to anchao/nuttx that referenced this pull request Nov 6, 2023
Race condition if the remote proc is stoped during initialization phase

| #0  0x0249f959 in rpmsg_destroy_ept (ept=0xffffffc0) at open-amp/lib/rpmsg/rpmsg.c:376
| #1  0x024a938c in rpmsg_deinit_vdev (rvdev=0xf2303a48) at open-amp/lib/rpmsg/rpmsg_virtio.c:971
| #2  0x02117e33 in rptun_dev_stop (rproc=0xf2303a04, stop_ns=true) at rptun/rptun.c:891
| #3  0x021181d8 in rptun_do_ioctl (priv=0xf2303a00, cmd=11010, arg=0) at rptun/rptun.c:922
| #4  0x02119722 in rptun_ioctl_foreach (cpuname=0x0, cmd=11010, value=0) at rptun/rptun.c:1086
| #5  0x0211b9df in rptun_poweroff (cpuname=0x0) at rptun/rptun.c:1378
| #6  0x02053aa6 in board_power_off (status=0) at sim/sim_head.c:206
| apache#7  0x0253d65c in boardctl (cmd=65283, arg=0) at boardctl.c:400
| apache#8  0x021eb497 in cmd_poweroff (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_syscmds.c:356
| apache#9  0x021cdb4d in nsh_command (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_command.c:1164
| apache#10 0x021baa72 in nsh_execute (vtbl=0xef606280, argc=1, argv=0xef9b73e0, redirfile=0x0, oflags=0) at nsh_parse.c:845
| apache#11 0x021c6b0a in nsh_parse_command (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2744
| apache#12 0x021c7166 in nsh_parse (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2828
| apache#13 0x0221fa2f in nsh_session (pstate=0xef606280, login=1, argc=1, argv=0xef7a7860) at nsh_session.c:245
| apache#14 0x021f8c04 in nsh_consolemain (argc=1, argv=0xef7a7860) at nsh_consolemain.c:75
| apache#15 0x021b77eb in nsh_main (argc=1, argv=0xef7a7860) at nsh_main.c:74
| apache#16 0x02166ddf in nxtask_startup (entrypt=0x21b76ca <nsh_main>, argc=1, argv=0xef7a7860) at sched/task_startup.c:70
| apache#17 0x020b363c in nxtask_start () at task/task_start.c:134

Signed-off-by: chao an <anchao@xiaomi.com>
xiaoxiang781216 pushed a commit that referenced this pull request Nov 7, 2023
Race condition if the remote proc is stoped during initialization phase

| #0  0x0249f959 in rpmsg_destroy_ept (ept=0xffffffc0) at open-amp/lib/rpmsg/rpmsg.c:376
| #1  0x024a938c in rpmsg_deinit_vdev (rvdev=0xf2303a48) at open-amp/lib/rpmsg/rpmsg_virtio.c:971
| #2  0x02117e33 in rptun_dev_stop (rproc=0xf2303a04, stop_ns=true) at rptun/rptun.c:891
| #3  0x021181d8 in rptun_do_ioctl (priv=0xf2303a00, cmd=11010, arg=0) at rptun/rptun.c:922
| #4  0x02119722 in rptun_ioctl_foreach (cpuname=0x0, cmd=11010, value=0) at rptun/rptun.c:1086
| #5  0x0211b9df in rptun_poweroff (cpuname=0x0) at rptun/rptun.c:1378
| #6  0x02053aa6 in board_power_off (status=0) at sim/sim_head.c:206
| #7  0x0253d65c in boardctl (cmd=65283, arg=0) at boardctl.c:400
| #8  0x021eb497 in cmd_poweroff (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_syscmds.c:356
| #9  0x021cdb4d in nsh_command (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_command.c:1164
| #10 0x021baa72 in nsh_execute (vtbl=0xef606280, argc=1, argv=0xef9b73e0, redirfile=0x0, oflags=0) at nsh_parse.c:845
| #11 0x021c6b0a in nsh_parse_command (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2744
| #12 0x021c7166 in nsh_parse (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2828
| #13 0x0221fa2f in nsh_session (pstate=0xef606280, login=1, argc=1, argv=0xef7a7860) at nsh_session.c:245
| #14 0x021f8c04 in nsh_consolemain (argc=1, argv=0xef7a7860) at nsh_consolemain.c:75
| #15 0x021b77eb in nsh_main (argc=1, argv=0xef7a7860) at nsh_main.c:74
| #16 0x02166ddf in nxtask_startup (entrypt=0x21b76ca <nsh_main>, argc=1, argv=0xef7a7860) at sched/task_startup.c:70
| #17 0x020b363c in nxtask_start () at task/task_start.c:134

Signed-off-by: chao an <anchao@xiaomi.com>
freakishness pushed a commit to freakishness/incubator-nuttx that referenced this pull request Feb 18, 2024
Race condition if the remote proc is stoped during initialization phase

| #0  0x0249f959 in rpmsg_destroy_ept (ept=0xffffffc0) at open-amp/lib/rpmsg/rpmsg.c:376
| #1  0x024a938c in rpmsg_deinit_vdev (rvdev=0xf2303a48) at open-amp/lib/rpmsg/rpmsg_virtio.c:971
| #2  0x02117e33 in rptun_dev_stop (rproc=0xf2303a04, stop_ns=true) at rptun/rptun.c:891
| #3  0x021181d8 in rptun_do_ioctl (priv=0xf2303a00, cmd=11010, arg=0) at rptun/rptun.c:922
| #4  0x02119722 in rptun_ioctl_foreach (cpuname=0x0, cmd=11010, value=0) at rptun/rptun.c:1086
| #5  0x0211b9df in rptun_poweroff (cpuname=0x0) at rptun/rptun.c:1378
| #6  0x02053aa6 in board_power_off (status=0) at sim/sim_head.c:206
| apache#7  0x0253d65c in boardctl (cmd=65283, arg=0) at boardctl.c:400
| apache#8  0x021eb497 in cmd_poweroff (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_syscmds.c:356
| apache#9  0x021cdb4d in nsh_command (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_command.c:1164
| apache#10 0x021baa72 in nsh_execute (vtbl=0xef606280, argc=1, argv=0xef9b73e0, redirfile=0x0, oflags=0) at nsh_parse.c:845
| apache#11 0x021c6b0a in nsh_parse_command (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2744
| apache#12 0x021c7166 in nsh_parse (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2828
| apache#13 0x0221fa2f in nsh_session (pstate=0xef606280, login=1, argc=1, argv=0xef7a7860) at nsh_session.c:245
| apache#14 0x021f8c04 in nsh_consolemain (argc=1, argv=0xef7a7860) at nsh_consolemain.c:75
| apache#15 0x021b77eb in nsh_main (argc=1, argv=0xef7a7860) at nsh_main.c:74
| apache#16 0x02166ddf in nxtask_startup (entrypt=0x21b76ca <nsh_main>, argc=1, argv=0xef7a7860) at sched/task_startup.c:70
| apache#17 0x020b363c in nxtask_start () at task/task_start.c:134

Signed-off-by: chao an <anchao@xiaomi.com>
chenzhihong007 pushed a commit to hpmicro/nuttx that referenced this pull request Feb 23, 2024
- add tmr driver
- add timer demo defconfig

Signed-off-by: Runcheng Lu <runcheng.lu@hpmicro.com>
halyssonJr pushed a commit to halyssonJr/nuttx that referenced this pull request Apr 10, 2024
Race condition if the remote proc is stoped during initialization phase

| #0  0x0249f959 in rpmsg_destroy_ept (ept=0xffffffc0) at open-amp/lib/rpmsg/rpmsg.c:376
| apache#1  0x024a938c in rpmsg_deinit_vdev (rvdev=0xf2303a48) at open-amp/lib/rpmsg/rpmsg_virtio.c:971
| apache#2  0x02117e33 in rptun_dev_stop (rproc=0xf2303a04, stop_ns=true) at rptun/rptun.c:891
| apache#3  0x021181d8 in rptun_do_ioctl (priv=0xf2303a00, cmd=11010, arg=0) at rptun/rptun.c:922
| apache#4  0x02119722 in rptun_ioctl_foreach (cpuname=0x0, cmd=11010, value=0) at rptun/rptun.c:1086
| apache#5  0x0211b9df in rptun_poweroff (cpuname=0x0) at rptun/rptun.c:1378
| apache#6  0x02053aa6 in board_power_off (status=0) at sim/sim_head.c:206
| apache#7  0x0253d65c in boardctl (cmd=65283, arg=0) at boardctl.c:400
| apache#8  0x021eb497 in cmd_poweroff (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_syscmds.c:356
| apache#9  0x021cdb4d in nsh_command (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_command.c:1164
| apache#10 0x021baa72 in nsh_execute (vtbl=0xef606280, argc=1, argv=0xef9b73e0, redirfile=0x0, oflags=0) at nsh_parse.c:845
| apache#11 0x021c6b0a in nsh_parse_command (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2744
| apache#12 0x021c7166 in nsh_parse (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2828
| apache#13 0x0221fa2f in nsh_session (pstate=0xef606280, login=1, argc=1, argv=0xef7a7860) at nsh_session.c:245
| apache#14 0x021f8c04 in nsh_consolemain (argc=1, argv=0xef7a7860) at nsh_consolemain.c:75
| apache#15 0x021b77eb in nsh_main (argc=1, argv=0xef7a7860) at nsh_main.c:74
| apache#16 0x02166ddf in nxtask_startup (entrypt=0x21b76ca <nsh_main>, argc=1, argv=0xef7a7860) at sched/task_startup.c:70
| apache#17 0x020b363c in nxtask_start () at task/task_start.c:134

Signed-off-by: chao an <anchao@xiaomi.com>
nealef pushed a commit to nealef/nuttx that referenced this pull request May 29, 2024
Race condition if the remote proc is stoped during initialization phase

| #0  0x0249f959 in rpmsg_destroy_ept (ept=0xffffffc0) at open-amp/lib/rpmsg/rpmsg.c:376
| apache#1  0x024a938c in rpmsg_deinit_vdev (rvdev=0xf2303a48) at open-amp/lib/rpmsg/rpmsg_virtio.c:971
| apache#2  0x02117e33 in rptun_dev_stop (rproc=0xf2303a04, stop_ns=true) at rptun/rptun.c:891
| apache#3  0x021181d8 in rptun_do_ioctl (priv=0xf2303a00, cmd=11010, arg=0) at rptun/rptun.c:922
| apache#4  0x02119722 in rptun_ioctl_foreach (cpuname=0x0, cmd=11010, value=0) at rptun/rptun.c:1086
| apache#5  0x0211b9df in rptun_poweroff (cpuname=0x0) at rptun/rptun.c:1378
| apache#6  0x02053aa6 in board_power_off (status=0) at sim/sim_head.c:206
| apache#7  0x0253d65c in boardctl (cmd=65283, arg=0) at boardctl.c:400
| apache#8  0x021eb497 in cmd_poweroff (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_syscmds.c:356
| apache#9  0x021cdb4d in nsh_command (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_command.c:1164
| apache#10 0x021baa72 in nsh_execute (vtbl=0xef606280, argc=1, argv=0xef9b73e0, redirfile=0x0, oflags=0) at nsh_parse.c:845
| apache#11 0x021c6b0a in nsh_parse_command (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2744
| apache#12 0x021c7166 in nsh_parse (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2828
| apache#13 0x0221fa2f in nsh_session (pstate=0xef606280, login=1, argc=1, argv=0xef7a7860) at nsh_session.c:245
| apache#14 0x021f8c04 in nsh_consolemain (argc=1, argv=0xef7a7860) at nsh_consolemain.c:75
| apache#15 0x021b77eb in nsh_main (argc=1, argv=0xef7a7860) at nsh_main.c:74
| apache#16 0x02166ddf in nxtask_startup (entrypt=0x21b76ca <nsh_main>, argc=1, argv=0xef7a7860) at sched/task_startup.c:70
| apache#17 0x020b363c in nxtask_start () at task/task_start.c:134

Signed-off-by: chao an <anchao@xiaomi.com>
jasonbu pushed a commit to jasonbu/nuttx that referenced this pull request Sep 27, 2024
ap> cat pm
=================================================================
==30235==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf436edd9 at pc 0x03338a48 bp 0x9d1b6ca8 sp 0x9d1b6c98
READ of size 1 at 0xf436edd9 thread T0
    #0 0x3338a47 in strncmp string/lib_strncmp.c:42
    apache#1 0x371af87 in pm_get_file_index power/pm/pm_procfs.c:174
    apache#2 0x371b066 in pm_open power/pm/pm_procfs.c:207
    apache#3 0x3640d20 in procfs_open procfs/fs_procfs.c:419
    apache#4 0x359bce2 in file_vopen vfs/fs_open.c:240
    apache#5 0x359c431 in nx_vopen vfs/fs_open.c:312
    apache#6 0x359cb53 in open vfs/fs_open.c:465
    apache#7 0x33bccc9 in nsh_catfile /apps/nshlib/nsh_fsutils.c:140
    apache#8 0x33b28cc in cmd_cat /apps/nshlib/nsh_fscmds.c:556
    apache#9 0x33a434f in nsh_command /apps/nshlib/nsh_command.c:1164
    apache#10 0x3381b8f in nsh_execute /apps/nshlib/nsh_parse.c:845
    apache#11 0x338dc17 in nsh_parse_command /apps/nshlib/nsh_parse.c:2744
    apache#12 0x338e273 in nsh_parse /apps/nshlib/nsh_parse.c:2828
    apache#13 0x3390b47 in nsh_session /apps/nshlib/nsh_session.c:245
    apache#14 0x337e90a in nsh_consolemain /apps/nshlib/nsh_consolemain.c:75
    apache#15 0x337e7f7 in nsh_main /apps/system/nsh/nsh_main.c:74
    apache#16 0x332b6e6 in nxtask_startup sched/task_startup.c:70
    apache#17 0x323ec3f in nxtask_start task/task_start.c:134
    apache#18 0x33636ea in pre_start sim/sim_initialstate.c:52

ap> cat net
=================================================================
==30303==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4479a5a at pc 0x03338a48 bp 0x9d2b6ce8 sp 0x9d2b6cd8
READ of size 1 at 0xf4479a5a thread T0
    #0 0x3338a47 in strncmp string/lib_strncmp.c:42
    apache#1 0x5395d62 in netprocfs_open procfs/net_procfs.c:215
    apache#2 0x3640d20 in procfs_open procfs/fs_procfs.c:419
    apache#3 0x359bce2 in file_vopen vfs/fs_open.c:240
    apache#4 0x359c431 in nx_vopen vfs/fs_open.c:312
    apache#5 0x359cb53 in open vfs/fs_open.c:465
    apache#6 0x33bccc9 in nsh_catfile /apps/nshlib/nsh_fsutils.c:140
    apache#7 0x33b28cc in cmd_cat /apps/nshlib/nsh_fscmds.c:556
    apache#8 0x33a434f in nsh_command /apps/nshlib/nsh_command.c:1164
    apache#9 0x3381b8f in nsh_execute /apps/nshlib/nsh_parse.c:845
    apache#10 0x338dc17 in nsh_parse_command /apps/nshlib/nsh_parse.c:2744
    apache#11 0x338e273 in nsh_parse /apps/nshlib/nsh_parse.c:2828
    apache#12 0x3390b47 in nsh_session /apps/nshlib/nsh_session.c:245
    apache#13 0x337e90a in nsh_consolemain /apps/nshlib/nsh_consolemain.c:75
    apache#14 0x337e7f7 in nsh_main /apps/system/nsh/nsh_main.c:74
    apache#15 0x332b6e6 in nxtask_startup sched/task_startup.c:70
    apache#16 0x323ec3f in nxtask_start task/task_start.c:134
    apache#17 0x33636ea in pre_start sim/sim_initialstate.c:52

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
xiaoxiang781216 pushed a commit that referenced this pull request Sep 27, 2024
ap> cat pm
=================================================================
==30235==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf436edd9 at pc 0x03338a48 bp 0x9d1b6ca8 sp 0x9d1b6c98
READ of size 1 at 0xf436edd9 thread T0
    #0 0x3338a47 in strncmp string/lib_strncmp.c:42
    #1 0x371af87 in pm_get_file_index power/pm/pm_procfs.c:174
    #2 0x371b066 in pm_open power/pm/pm_procfs.c:207
    #3 0x3640d20 in procfs_open procfs/fs_procfs.c:419
    #4 0x359bce2 in file_vopen vfs/fs_open.c:240
    #5 0x359c431 in nx_vopen vfs/fs_open.c:312
    #6 0x359cb53 in open vfs/fs_open.c:465
    #7 0x33bccc9 in nsh_catfile /apps/nshlib/nsh_fsutils.c:140
    #8 0x33b28cc in cmd_cat /apps/nshlib/nsh_fscmds.c:556
    #9 0x33a434f in nsh_command /apps/nshlib/nsh_command.c:1164
    #10 0x3381b8f in nsh_execute /apps/nshlib/nsh_parse.c:845
    #11 0x338dc17 in nsh_parse_command /apps/nshlib/nsh_parse.c:2744
    #12 0x338e273 in nsh_parse /apps/nshlib/nsh_parse.c:2828
    #13 0x3390b47 in nsh_session /apps/nshlib/nsh_session.c:245
    #14 0x337e90a in nsh_consolemain /apps/nshlib/nsh_consolemain.c:75
    #15 0x337e7f7 in nsh_main /apps/system/nsh/nsh_main.c:74
    #16 0x332b6e6 in nxtask_startup sched/task_startup.c:70
    #17 0x323ec3f in nxtask_start task/task_start.c:134
    #18 0x33636ea in pre_start sim/sim_initialstate.c:52

ap> cat net
=================================================================
==30303==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4479a5a at pc 0x03338a48 bp 0x9d2b6ce8 sp 0x9d2b6cd8
READ of size 1 at 0xf4479a5a thread T0
    #0 0x3338a47 in strncmp string/lib_strncmp.c:42
    #1 0x5395d62 in netprocfs_open procfs/net_procfs.c:215
    #2 0x3640d20 in procfs_open procfs/fs_procfs.c:419
    #3 0x359bce2 in file_vopen vfs/fs_open.c:240
    #4 0x359c431 in nx_vopen vfs/fs_open.c:312
    #5 0x359cb53 in open vfs/fs_open.c:465
    #6 0x33bccc9 in nsh_catfile /apps/nshlib/nsh_fsutils.c:140
    #7 0x33b28cc in cmd_cat /apps/nshlib/nsh_fscmds.c:556
    #8 0x33a434f in nsh_command /apps/nshlib/nsh_command.c:1164
    #9 0x3381b8f in nsh_execute /apps/nshlib/nsh_parse.c:845
    #10 0x338dc17 in nsh_parse_command /apps/nshlib/nsh_parse.c:2744
    #11 0x338e273 in nsh_parse /apps/nshlib/nsh_parse.c:2828
    #12 0x3390b47 in nsh_session /apps/nshlib/nsh_session.c:245
    #13 0x337e90a in nsh_consolemain /apps/nshlib/nsh_consolemain.c:75
    #14 0x337e7f7 in nsh_main /apps/system/nsh/nsh_main.c:74
    #15 0x332b6e6 in nxtask_startup sched/task_startup.c:70
    #16 0x323ec3f in nxtask_start task/task_start.c:134
    #17 0x33636ea in pre_start sim/sim_initialstate.c:52

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
kywwilson11 pushed a commit to kywwilson11/nuttx that referenced this pull request Sep 30, 2024
ap> cat pm
=================================================================
==30235==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf436edd9 at pc 0x03338a48 bp 0x9d1b6ca8 sp 0x9d1b6c98
READ of size 1 at 0xf436edd9 thread T0
    #0 0x3338a47 in strncmp string/lib_strncmp.c:42
    #1 0x371af87 in pm_get_file_index power/pm/pm_procfs.c:174
    apache#2 0x371b066 in pm_open power/pm/pm_procfs.c:207
    apache#3 0x3640d20 in procfs_open procfs/fs_procfs.c:419
    apache#4 0x359bce2 in file_vopen vfs/fs_open.c:240
    apache#5 0x359c431 in nx_vopen vfs/fs_open.c:312
    apache#6 0x359cb53 in open vfs/fs_open.c:465
    apache#7 0x33bccc9 in nsh_catfile /apps/nshlib/nsh_fsutils.c:140
    apache#8 0x33b28cc in cmd_cat /apps/nshlib/nsh_fscmds.c:556
    apache#9 0x33a434f in nsh_command /apps/nshlib/nsh_command.c:1164
    apache#10 0x3381b8f in nsh_execute /apps/nshlib/nsh_parse.c:845
    apache#11 0x338dc17 in nsh_parse_command /apps/nshlib/nsh_parse.c:2744
    apache#12 0x338e273 in nsh_parse /apps/nshlib/nsh_parse.c:2828
    apache#13 0x3390b47 in nsh_session /apps/nshlib/nsh_session.c:245
    apache#14 0x337e90a in nsh_consolemain /apps/nshlib/nsh_consolemain.c:75
    apache#15 0x337e7f7 in nsh_main /apps/system/nsh/nsh_main.c:74
    apache#16 0x332b6e6 in nxtask_startup sched/task_startup.c:70
    apache#17 0x323ec3f in nxtask_start task/task_start.c:134
    apache#18 0x33636ea in pre_start sim/sim_initialstate.c:52

ap> cat net
=================================================================
==30303==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4479a5a at pc 0x03338a48 bp 0x9d2b6ce8 sp 0x9d2b6cd8
READ of size 1 at 0xf4479a5a thread T0
    #0 0x3338a47 in strncmp string/lib_strncmp.c:42
    #1 0x5395d62 in netprocfs_open procfs/net_procfs.c:215
    apache#2 0x3640d20 in procfs_open procfs/fs_procfs.c:419
    apache#3 0x359bce2 in file_vopen vfs/fs_open.c:240
    apache#4 0x359c431 in nx_vopen vfs/fs_open.c:312
    apache#5 0x359cb53 in open vfs/fs_open.c:465
    apache#6 0x33bccc9 in nsh_catfile /apps/nshlib/nsh_fsutils.c:140
    apache#7 0x33b28cc in cmd_cat /apps/nshlib/nsh_fscmds.c:556
    apache#8 0x33a434f in nsh_command /apps/nshlib/nsh_command.c:1164
    apache#9 0x3381b8f in nsh_execute /apps/nshlib/nsh_parse.c:845
    apache#10 0x338dc17 in nsh_parse_command /apps/nshlib/nsh_parse.c:2744
    apache#11 0x338e273 in nsh_parse /apps/nshlib/nsh_parse.c:2828
    apache#12 0x3390b47 in nsh_session /apps/nshlib/nsh_session.c:245
    apache#13 0x337e90a in nsh_consolemain /apps/nshlib/nsh_consolemain.c:75
    apache#14 0x337e7f7 in nsh_main /apps/system/nsh/nsh_main.c:74
    apache#15 0x332b6e6 in nxtask_startup sched/task_startup.c:70
    apache#16 0x323ec3f in nxtask_start task/task_start.c:134
    apache#17 0x33636ea in pre_start sim/sim_initialstate.c:52

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
yangguangcai01 pushed a commit to yangguangcai01/nuttx that referenced this pull request Oct 16, 2024
RTOSXMDPYX-575

string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    apache#2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    apache#3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    apache#4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    apache#5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    apache#6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    apache#7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    apache#8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    apache#9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    apache#10 0x48b41eb4 in nxtask_start task/task_start.c:112
    apache#11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Change-Id: I6e969ce530edefdf4307d36dc6944dcf7ce5958f
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
yangguangcai01 pushed a commit to yangguangcai01/nuttx that referenced this pull request Oct 16, 2024
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    apache#2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    apache#3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    apache#4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    apache#5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    apache#6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    apache#7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    apache#8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    apache#9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    apache#10 0x48b41eb4 in nxtask_start task/task_start.c:112
    apache#11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
yangguangcai01 pushed a commit to yangguangcai01/nuttx that referenced this pull request Oct 16, 2024
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    apache#2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    apache#3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    apache#4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    apache#5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    apache#6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    apache#7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    apache#8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    apache#9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    apache#10 0x48b41eb4 in nxtask_start task/task_start.c:112
    apache#11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
yangguangcai01 pushed a commit to yangguangcai01/nuttx that referenced this pull request Oct 16, 2024
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    apache#2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    apache#3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    apache#4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    apache#5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    apache#6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    apache#7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    apache#8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    apache#9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    apache#10 0x48b41eb4 in nxtask_start task/task_start.c:112
    apache#11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
yangguangcai01 pushed a commit to yangguangcai01/nuttx that referenced this pull request Oct 16, 2024
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    apache#2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    apache#3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    apache#4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    apache#5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    apache#6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    apache#7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    apache#8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    apache#9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    apache#10 0x48b41eb4 in nxtask_start task/task_start.c:112
    apache#11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
yangguangcai01 pushed a commit to yangguangcai01/nuttx that referenced this pull request Oct 17, 2024
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    apache#2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    apache#3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    apache#4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    apache#5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    apache#6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    apache#7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    apache#8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    apache#9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    apache#10 0x48b41eb4 in nxtask_start task/task_start.c:112
    apache#11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
yangguangcai01 pushed a commit to yangguangcai01/nuttx that referenced this pull request Oct 17, 2024
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    apache#2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    apache#3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    apache#4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    apache#5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    apache#6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    apache#7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    apache#8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    apache#9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    apache#10 0x48b41eb4 in nxtask_start task/task_start.c:112
    apache#11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
yangguangcai01 pushed a commit to yangguangcai01/nuttx that referenced this pull request Oct 17, 2024
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    apache#2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    apache#3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    apache#4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    apache#5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    apache#6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    apache#7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    apache#8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    apache#9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    apache#10 0x48b41eb4 in nxtask_start task/task_start.c:112
    apache#11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
xiaoxiang781216 pushed a commit that referenced this pull request Oct 17, 2024
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    #2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    #3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    #4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    #5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    #6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    #7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    #8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    #9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    #10 0x48b41eb4 in nxtask_start task/task_start.c:112
    #11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
pwnall pushed a commit to pwnall/nuttx that referenced this pull request Oct 23, 2024
Deadlock during recursive access if unionfs overlays procfs,
check the critical segment only and remove the useless protection part.

|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
...
|apache#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|apache#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026

original call stack:
(gdb) bt
|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
|apache#1  0x08071629 in mountpoint_filter (node=0xf3df4540, dirpath=0xf3df4a28 "/proc", arg=0xf3de2fc4) at mount/fs_foreachmountpoint.c:119
|apache#2  0x0807171b in foreach_inodelevel (node=0xf3df4540, info=0xf3df4a20) at inode/fs_foreachinode.c:90
|apache#3  0x08071898 in foreach_inode (handler=0x8071530 <mountpoint_filter>, arg=0xf3de2fc4) at inode/fs_foreachinode.c:193
|apache#4  0x080716c1 in foreach_mountpoint (handler=0x8070e2f <blocks_entry>, arg=0xf3de300c) at mount/fs_foreachmountpoint.c:169
|apache#5  0x08071399 in mount_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at mount/fs_procfs_mount.c:537
|apache#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|apache#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026
|apache#8  0x080657a2 in file_read (filep=0xf3de219c, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:110
|apache#9  0x0806581a in nx_read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:175
|apache#10 0x08065847 in read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:206
|apache#11 0x0805a242 in nsh_catfile (vtbl=0xf3df3f10, cmd=0xf3df4378 "df", filepath=0x808d5ed "/proc/fs/blocks") at nsh_fsutils.c:116
|apache#12 0x0805b1de in cmd_df (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_mntcmds.c:73
|apache#13 0x08056370 in nsh_command (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_command.c:1061
|apache#14 0x08053b16 in nsh_execute (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0, redirfile=0x0, oflags=0) at nsh_parse.c:741
|apache#15 0x08055998 in nsh_parse_command (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2578
|apache#16 0x08055a7b in nsh_parse (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2662
|apache#17 0x0805d691 in nsh_session (pstate=0xf3df3f10, login=1 '\001', argc=1, argv=0xf3de34b0) at nsh_session.c:191
|apache#18 0x0805b542 in nsh_consolemain (argc=1, argv=0xf3de34b0) at nsh_consolemain.c:115
|apache#19 0x0805346c in nsh_main (argc=1, argv=0xf3de34b0) at nsh_main.c:168
|apache#20 0x0805075a in nxtask_startup (entrypt=0x805340a <nsh_main>, argc=1, argv=0xf3de34b0) at sched/task_startup.c:165
|apache#21 0x08049713 in nxtask_start () at task/task_start.c:144
|apache#22 0x00000000 in ?? ()

Change-Id: Ic4c7aff0ea50388a371c525745e817a787dabcca
Signed-off-by: chao.an <anchao@xiaomi.com>
zhhyu7 added a commit to zhhyu7/incubator-nuttx that referenced this pull request Oct 29, 2024
current sizeof(struct sockaddr_in) is 66

arp/arp_table.c:241:28: runtime error: member access within misaligned address 0xe5f134e6 for type 'struct sockaddr_in', which requires 4 byte alignment
0xe5f134e6: note: pointer points here
 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00
             ^
    #0 0x543287c1 in arp_get_arpreq arp/arp_table.c:241
    #1 0x5432a11f in arp_snapshot arp/arp_table.c:574
    #2 0x5435f0be in netlink_fill_arptable netlink/netlink_route.c:547
    apache#3 0x5435ffca in netlink_get_neighbor netlink/netlink_route.c:715
    apache#4 0x54360116 in netlink_get_neighborlist netlink/netlink_route.c:743
    apache#5 0x54363b20 in netlink_route_sendto netlink/netlink_route.c:1382
    apache#6 0x542ef1b1 in netlink_sendmsg netlink/netlink_sockif.c:625
    apache#7 0x542be94d in psock_sendmsg socket/sendmsg.c:96
    apache#8 0x542bc94b in psock_sendto socket/sendto.c:134
    apache#9 0x542bcb28 in sendto socket/sendto.c:247
    apache#10 0x542bc5ea in send socket/send.c:163
    apache#11 0x542aa715 in netlib_get_arptable /home/mi/gaofengzhi/code/dev1025/apps/netutils/netlib/netlib_getarptab.c:152
    apache#12 0x54279109 in cmd_arp /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_netcmds.c:1197
    apache#13 0x54257faf in nsh_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_command.c:1263
    apache#14 0x54231982 in nsh_execute /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:718
    apache#15 0x5423da42 in nsh_parse_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2619
    apache#16 0x5423e12a in nsh_parse /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2706
    apache#17 0x5424088f in nsh_session /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_session.c:245
    apache#18 0x5422efc9 in nsh_consolemain /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_consolemain.c:75
    apache#19 0x5419e89f in nsh_main /home/mi/gaofengzhi/code/dev1025/apps/system/nsh/nsh_main.c:74
    apache#20 0x54067ee1 in nxtask_startup sched/task_startup.c:70
    apache#21 0x53f366c6 in nxtask_start task/task_start.c:116
    apache#22 0x5409e1a4 in pre_start sim/sim_initialstate.c:52

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
zhhyu7 added a commit to zhhyu7/incubator-nuttx that referenced this pull request Oct 29, 2024
current sizeof(struct sockaddr_in) is 66

arp/arp_table.c:241:28: runtime error: member access within misaligned address 0xe5f134e6 for type 'struct sockaddr_in', which requires 4 byte alignment
0xe5f134e6: note: pointer points here
 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00
             ^
    #0 0x543287c1 in arp_get_arpreq arp/arp_table.c:241
    #1 0x5432a11f in arp_snapshot arp/arp_table.c:574
    #2 0x5435f0be in netlink_fill_arptable netlink/netlink_route.c:547
    apache#3 0x5435ffca in netlink_get_neighbor netlink/netlink_route.c:715
    apache#4 0x54360116 in netlink_get_neighborlist netlink/netlink_route.c:743
    apache#5 0x54363b20 in netlink_route_sendto netlink/netlink_route.c:1382
    apache#6 0x542ef1b1 in netlink_sendmsg netlink/netlink_sockif.c:625
    apache#7 0x542be94d in psock_sendmsg socket/sendmsg.c:96
    apache#8 0x542bc94b in psock_sendto socket/sendto.c:134
    apache#9 0x542bcb28 in sendto socket/sendto.c:247
    apache#10 0x542bc5ea in send socket/send.c:163
    apache#11 0x542aa715 in netlib_get_arptable /home/mi/gaofengzhi/code/dev1025/apps/netutils/netlib/netlib_getarptab.c:152
    apache#12 0x54279109 in cmd_arp /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_netcmds.c:1197
    apache#13 0x54257faf in nsh_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_command.c:1263
    apache#14 0x54231982 in nsh_execute /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:718
    apache#15 0x5423da42 in nsh_parse_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2619
    apache#16 0x5423e12a in nsh_parse /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2706
    apache#17 0x5424088f in nsh_session /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_session.c:245
    apache#18 0x5422efc9 in nsh_consolemain /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_consolemain.c:75
    apache#19 0x5419e89f in nsh_main /home/mi/gaofengzhi/code/dev1025/apps/system/nsh/nsh_main.c:74
    apache#20 0x54067ee1 in nxtask_startup sched/task_startup.c:70
    apache#21 0x53f366c6 in nxtask_start task/task_start.c:116
    apache#22 0x5409e1a4 in pre_start sim/sim_initialstate.c:52

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
xiaoxiang781216 pushed a commit that referenced this pull request Oct 29, 2024
current sizeof(struct sockaddr_in) is 66

arp/arp_table.c:241:28: runtime error: member access within misaligned address 0xe5f134e6 for type 'struct sockaddr_in', which requires 4 byte alignment
0xe5f134e6: note: pointer points here
 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00
             ^
    #0 0x543287c1 in arp_get_arpreq arp/arp_table.c:241
    #1 0x5432a11f in arp_snapshot arp/arp_table.c:574
    #2 0x5435f0be in netlink_fill_arptable netlink/netlink_route.c:547
    #3 0x5435ffca in netlink_get_neighbor netlink/netlink_route.c:715
    #4 0x54360116 in netlink_get_neighborlist netlink/netlink_route.c:743
    #5 0x54363b20 in netlink_route_sendto netlink/netlink_route.c:1382
    #6 0x542ef1b1 in netlink_sendmsg netlink/netlink_sockif.c:625
    #7 0x542be94d in psock_sendmsg socket/sendmsg.c:96
    #8 0x542bc94b in psock_sendto socket/sendto.c:134
    #9 0x542bcb28 in sendto socket/sendto.c:247
    #10 0x542bc5ea in send socket/send.c:163
    #11 0x542aa715 in netlib_get_arptable /home/mi/gaofengzhi/code/dev1025/apps/netutils/netlib/netlib_getarptab.c:152
    #12 0x54279109 in cmd_arp /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_netcmds.c:1197
    #13 0x54257faf in nsh_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_command.c:1263
    #14 0x54231982 in nsh_execute /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:718
    #15 0x5423da42 in nsh_parse_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2619
    #16 0x5423e12a in nsh_parse /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2706
    #17 0x5424088f in nsh_session /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_session.c:245
    #18 0x5422efc9 in nsh_consolemain /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_consolemain.c:75
    #19 0x5419e89f in nsh_main /home/mi/gaofengzhi/code/dev1025/apps/system/nsh/nsh_main.c:74
    #20 0x54067ee1 in nxtask_startup sched/task_startup.c:70
    #21 0x53f366c6 in nxtask_start task/task_start.c:116
    #22 0x5409e1a4 in pre_start sim/sim_initialstate.c:52

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants