Skip to content

Add .updated target to handle the no builtin app case correctly - #3

Merged
patacongo merged 1 commit into
apache:masterfrom
xiaoxiang781216:builtin
Jan 1, 2020
Merged

patacongo merged 1 commit into
apache:masterfrom
xiaoxiang781216:builtin

Conversation

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

Change-Id: Ia61ff63b4b1e4cb6ec52ac216626bbb76fdf3a33
Signed-off-by: Xiang Xiao [email protected]

Change-Id: Ia61ff63b4b1e4cb6ec52ac216626bbb76fdf3a33
Signed-off-by: Xiang Xiao <[email protected]>
@patacongo
patacongo merged commit 73e1696 into apache:master Jan 1, 2020
@xiaoxiang781216
xiaoxiang781216 deleted the builtin branch January 2, 2020 15:23
yamt added a commit to yamt/incubator-nuttx-apps that referenced this pull request May 7, 2021
For EINVAL, it doesn't make sense to keep parsing.
(For E2BIG, it might make some sense.)

Found by LLVM ASan.

```
=================================================================
==81622==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000000f2 at pc 0x00010d2746ca bp 0x7ffee29a9980 sp 0x7ffee29a9978
READ of size 1 at 0x6020000000f2 thread T0
    #0 0x10d2746c9 in netlib_parseurl netlib_parseurl.c:121
    apache#1 0x10d26b293 in parseurl webclient.c:479
    apache#2 0x10d265e48 in webclient_perform webclient.c:690
    apache#3 0x10d277c5b in main main.c:210
    apache#4 0x7fff7a06f3d4 in start+0x0 (libdyld.dylib:x86_64+0x163d4)

0x6020000000f2 is located 0 bytes to the right of 2-byte region [0x6020000000f0,0x6020000000f2)
allocated by thread T0 here:
    #0 0x10d3996d3 in wrap_strdup+0x203 (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x3e6d3)
    apache#1 0x10d276abe in main main.c:147
    apache#2 0x7fff7a06f3d4 in start+0x0 (libdyld.dylib:x86_64+0x163d4)

SUMMARY: AddressSanitizer: heap-buffer-overflow netlib_parseurl.c:121 in netlib_parseurl
Shadow bytes around the buggy address:
  0x1c03ffffffc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03ffffffd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03ffffffe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03fffffff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c0400000000: fa fa fd fd fa fa fd fd fa fa 00 00 fa fa 00 00
=>0x1c0400000010: fa fa 00 fa fa fa 00 00 fa fa 00 06 fa fa[02]fa
  0x1c0400000020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==81622==ABORTING
```
xiaoxiang781216 pushed a commit that referenced this pull request May 8, 2021
For EINVAL, it doesn't make sense to keep parsing.
(For E2BIG, it might make some sense.)

Found by LLVM ASan.

```
=================================================================
==81622==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000000f2 at pc 0x00010d2746ca bp 0x7ffee29a9980 sp 0x7ffee29a9978
READ of size 1 at 0x6020000000f2 thread T0
    #0 0x10d2746c9 in netlib_parseurl netlib_parseurl.c:121
    #1 0x10d26b293 in parseurl webclient.c:479
    #2 0x10d265e48 in webclient_perform webclient.c:690
    #3 0x10d277c5b in main main.c:210
    #4 0x7fff7a06f3d4 in start+0x0 (libdyld.dylib:x86_64+0x163d4)

0x6020000000f2 is located 0 bytes to the right of 2-byte region [0x6020000000f0,0x6020000000f2)
allocated by thread T0 here:
    #0 0x10d3996d3 in wrap_strdup+0x203 (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x3e6d3)
    #1 0x10d276abe in main main.c:147
    #2 0x7fff7a06f3d4 in start+0x0 (libdyld.dylib:x86_64+0x163d4)

SUMMARY: AddressSanitizer: heap-buffer-overflow netlib_parseurl.c:121 in netlib_parseurl
Shadow bytes around the buggy address:
  0x1c03ffffffc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03ffffffd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03ffffffe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03fffffff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c0400000000: fa fa fd fd fa fa fd fd fa fa 00 00 fa fa 00 00
=>0x1c0400000010: fa fa 00 fa fa fa 00 00 fa fa 00 06 fa fa[02]fa
  0x1c0400000020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==81622==ABORTING
```
Shunichi-K referenced this pull request in SPRESENSE/nuttx-apps Nov 7, 2022
netutils/wiznet: Add support for W5500 Daemon
JianyuWang0623 added a commit to JianyuWang0623/nuttx-apps that referenced this pull request Sep 10, 2024
CID 329130: (apache#3 of 3): 越界写入 (OVERRUN)
6. overrun-local: 在字节偏移 64 处使用索引 r(其值为 64)越界 64 字节访问数组 buffer

Signed-off-by: wangjianyu3 <[email protected]>
JianyuWang0623 added a commit to JianyuWang0623/nuttx-apps that referenced this pull request Sep 11, 2024
CID 329130: (apache#3 of 3): 越界写入 (OVERRUN)
6. overrun-local: 在字节偏移 64 处使用索引 r(其值为 64)越界 64 字节访问数组 buffer

Signed-off-by: wangjianyu3 <[email protected]>
zyfeier pushed a commit to zyfeier/incubator-nuttx-apps that referenced this pull request Sep 30, 2024
wdog.c:190:3: runtime error: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long int'
    #0 0x40e35d3a in wdog_test_run /home/cuiziwei/ska/vela/vela-dev2/apps/testing/ostest/wdog.c:190
    apache#1 0x40e35e75 in wdog_test_thread /home/cuiziwei/ska/vela/vela-dev2/apps/testing/ostest/wdog.c:207
    apache#2 0x40773ffa in pthread_startup pthread/pthread_create.c:59
    apache#3 0x4495e037 in pthread_start pthread/pthread_create.c:139
    apache#4 0x40301864 in pre_start sim/sim_initialstate.c:52

Signed-off-by: cuiziwei <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Oct 1, 2024
wdog.c:190:3: runtime error: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long int'
    #0 0x40e35d3a in wdog_test_run /home/cuiziwei/ska/vela/vela-dev2/apps/testing/ostest/wdog.c:190
    #1 0x40e35e75 in wdog_test_thread /home/cuiziwei/ska/vela/vela-dev2/apps/testing/ostest/wdog.c:207
    #2 0x40773ffa in pthread_startup pthread/pthread_create.c:59
    #3 0x4495e037 in pthread_start pthread/pthread_create.c:139
    #4 0x40301864 in pre_start sim/sim_initialstate.c:52

Signed-off-by: cuiziwei <[email protected]>
Zhangshoukui added a commit to Zhangshoukui/nuttx-apps that referenced this pull request Dec 17, 2024
…ter was read

    #0 0x43c7443a in strnlen nuttx/libs/libc/string/lib_strnlen.c:42
    apache#1 0x43c698aa in vsprintf_internal nuttx/libs/libc/stdio/lib_libvsprintf.c:933
    apache#2 0x43c6ca80 in lib_vsprintf nuttx/libs/libc/stdio/lib_libvsprintf.c:1383
    apache#3 0x4409c0bd in vsnprintf nuttx/libs/libc/stdio/lib_vsnprintf.c:72
    apache#4 0x47137cd0 in vcmocka_print_error apps/testing/cmocka/cmocka/src/cmocka.c:2097
    apache#5 0x47139573 in cmocka_print_error apps/testing/cmocka/cmocka/src/cmocka.c:2422
    apache#6 0x471376ff in string_equal_display_error apps/testing/cmocka/cmocka/src/cmocka.c:1410
    apache#7 0x471379a0 in _assert_string_equal apps/testing/cmocka/cmocka/src/cmocka.c:1952
    apache#8 0x4433d972 in read_default apps/testing/drivertest/drivertest_uart.c:242
    apache#9 0x4713c6cd in cmocka_run_one_test_or_fixture apps/testing/cmocka/cmocka/src/cmocka.c:3029
    apache#10 0x4713d487 in cmocka_run_one_tests apps/testing/cmocka/cmocka/src/cmocka.c:3143
    apache#11 0x4713f2ca in _cmocka_run_group_tests apps/testing/cmocka/cmocka/src/cmocka.c:3294
    apache#12 0x443444c6 in cmocka_driver_uart_main apps/testing/drivertest/drivertest_uart.c:358
    apache#13 0x4409a472 in nxtask_startup nuttx/libs/libc/sched/task_startup.c:72
    apache#14 0x43dc92e7 in nxtask_start nuttx/sched/task/task_start.c:116
    apache#15 0x43e31f00 in pre_start nuttx/arch/sim/src/sim/sim_initialstate.c:52

Signed-off-by: zhangshoukui <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Dec 17, 2024
…ter was read

    #0 0x43c7443a in strnlen nuttx/libs/libc/string/lib_strnlen.c:42
    #1 0x43c698aa in vsprintf_internal nuttx/libs/libc/stdio/lib_libvsprintf.c:933
    #2 0x43c6ca80 in lib_vsprintf nuttx/libs/libc/stdio/lib_libvsprintf.c:1383
    #3 0x4409c0bd in vsnprintf nuttx/libs/libc/stdio/lib_vsnprintf.c:72
    #4 0x47137cd0 in vcmocka_print_error apps/testing/cmocka/cmocka/src/cmocka.c:2097
    #5 0x47139573 in cmocka_print_error apps/testing/cmocka/cmocka/src/cmocka.c:2422
    #6 0x471376ff in string_equal_display_error apps/testing/cmocka/cmocka/src/cmocka.c:1410
    #7 0x471379a0 in _assert_string_equal apps/testing/cmocka/cmocka/src/cmocka.c:1952
    #8 0x4433d972 in read_default apps/testing/drivertest/drivertest_uart.c:242
    #9 0x4713c6cd in cmocka_run_one_test_or_fixture apps/testing/cmocka/cmocka/src/cmocka.c:3029
    #10 0x4713d487 in cmocka_run_one_tests apps/testing/cmocka/cmocka/src/cmocka.c:3143
    #11 0x4713f2ca in _cmocka_run_group_tests apps/testing/cmocka/cmocka/src/cmocka.c:3294
    #12 0x443444c6 in cmocka_driver_uart_main apps/testing/drivertest/drivertest_uart.c:358
    #13 0x4409a472 in nxtask_startup nuttx/libs/libc/sched/task_startup.c:72
    #14 0x43dc92e7 in nxtask_start nuttx/sched/task/task_start.c:116
    #15 0x43e31f00 in pre_start nuttx/arch/sim/src/sim/sim_initialstate.c:52

Signed-off-by: zhangshoukui <[email protected]>
Zhangshoukui added a commit to Zhangshoukui/nuttx-apps that referenced this pull request Jan 15, 2025
…int to a stack space

==1805058==ERROR: AddressSanitizer: heap-use-after-free on address 0xe18126a0 at pc 0x52b06320 bp 0xd7b13ee8 sp 0xd7b13ed8
READ of size 1 at 0xe18126a0 thread T0
    #0 0x52b0631f in tre_parse regex/regcomp.c:1356
    apache#1 0x52b2b1d0 in regcomp regex/regcomp.c:3710
    apache#2 0x48f55435 in c_regexmatch cmocka/src/cmocka.c:494
    apache#3 0x48f65bcf in _cmocka_run_group_tests cmocka/src/cmocka.c:3252
    apache#4 0x48f67e2d in cmocka_fs_test_main apps/testing/testsuites/kernel/fs/cmocka_fs_test.c:201
    apache#5 0x46210b2a in nxtask_startup sched/task_startup.c:72
    apache#6 0x45ff40fb in nxtask_start task/task_start.c:116
    apache#7 0x462695bb in pre_start sim/sim_initialstate.c:52

Signed-off-by: zhangshoukui <[email protected]>
Zhangshoukui added a commit to Zhangshoukui/nuttx-apps that referenced this pull request Jan 15, 2025
…int to a stack space

==1805058==ERROR: AddressSanitizer: heap-use-after-free on address 0xe18126a0 at pc 0x52b06320 bp 0xd7b13ee8 sp 0xd7b13ed8
READ of size 1 at 0xe18126a0 thread T0
    #0 0x52b0631f in tre_parse regex/regcomp.c:1356
    apache#1 0x52b2b1d0 in regcomp regex/regcomp.c:3710
    apache#2 0x48f55435 in c_regexmatch cmocka/src/cmocka.c:494
    apache#3 0x48f65bcf in _cmocka_run_group_tests cmocka/src/cmocka.c:3252
    apache#4 0x48f67e2d in cmocka_fs_test_main apps/testing/testsuites/kernel/fs/cmocka_fs_test.c:201
    apache#5 0x46210b2a in nxtask_startup sched/task_startup.c:72
    apache#6 0x45ff40fb in nxtask_start task/task_start.c:116
    apache#7 0x462695bb in pre_start sim/sim_initialstate.c:52

Signed-off-by: zhangshoukui <[email protected]>
Zhangshoukui added a commit to Zhangshoukui/nuttx-apps that referenced this pull request Jan 16, 2025
…int to a stack space

==1805058==ERROR: AddressSanitizer: heap-use-after-free on address 0xe18126a0 at pc 0x52b06320 bp 0xd7b13ee8 sp 0xd7b13ed8
READ of size 1 at 0xe18126a0 thread T0
    #0 0x52b0631f in tre_parse regex/regcomp.c:1356
    apache#1 0x52b2b1d0 in regcomp regex/regcomp.c:3710
    apache#2 0x48f55435 in c_regexmatch cmocka/src/cmocka.c:494
    apache#3 0x48f65bcf in _cmocka_run_group_tests cmocka/src/cmocka.c:3252
    apache#4 0x48f67e2d in cmocka_fs_test_main apps/testing/testsuites/kernel/fs/cmocka_fs_test.c:201
    apache#5 0x46210b2a in nxtask_startup sched/task_startup.c:72
    apache#6 0x45ff40fb in nxtask_start task/task_start.c:116
    apache#7 0x462695bb in pre_start sim/sim_initialstate.c:52

Signed-off-by: zhangshoukui <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Jan 16, 2025
…int to a stack space

==1805058==ERROR: AddressSanitizer: heap-use-after-free on address 0xe18126a0 at pc 0x52b06320 bp 0xd7b13ee8 sp 0xd7b13ed8
READ of size 1 at 0xe18126a0 thread T0
    #0 0x52b0631f in tre_parse regex/regcomp.c:1356
    #1 0x52b2b1d0 in regcomp regex/regcomp.c:3710
    #2 0x48f55435 in c_regexmatch cmocka/src/cmocka.c:494
    #3 0x48f65bcf in _cmocka_run_group_tests cmocka/src/cmocka.c:3252
    #4 0x48f67e2d in cmocka_fs_test_main apps/testing/testsuites/kernel/fs/cmocka_fs_test.c:201
    #5 0x46210b2a in nxtask_startup sched/task_startup.c:72
    #6 0x45ff40fb in nxtask_start task/task_start.c:116
    #7 0x462695bb in pre_start sim/sim_initialstate.c:52

Signed-off-by: zhangshoukui <[email protected]>
huanwei added a commit to huanwei/nuttx-apps that referenced this pull request Oct 4, 2026
监督者不再读文件。配置由**部署/O&M 代理**(ortd,非实时约束)读进来、
原样放进内核配置槽;监督者每周期只读两个标量(代数 + 心跳),
变了才取回快照、**自己校验**。

控制循环里因此不再有不可控最坏耗时的操作 —— 这是 apache#3 的唯一硬判据。

新增 ortd(testing/ortd):注册为部署代理(槽位钉住,同监督者规则),
每 200ms 读源文件 → PUT,并 ALIVE 一次。

监督者侧:
· manifest_load(path) → manifest_parse(text, len):解析落在内存缓冲上,
  全程靠 pos.length 界定,不依赖字符串终止符;超长行仍然拒绝。
· 轮询按 **代数** 而不是时间:不变就什么都不做(一次整数比较)。
· 启动时有界等待第一份配置(Q2),超时 → BOOT_FAILED。
· 心跳停滞 → **报告 + 保持当前配置**(Q1),不自动降级、不重启代理。

★ 心跳必须与"写配置"分开(PR_ORT_CFG_ALIVE):
  代理由内核比较内容,只在真变了时加 generation;tick 与内容无关。
  第一版把心跳挂在 PUT 上 —— 那样代理**读不到源文件**(正被替换)
  这种"活着但没东西可写"的情形会被报成"失联",是一条不实的告警。

★ 踩到的坑:ortd 第一版把 4KB 缓冲区放栈上,而任务栈也是 4KB ——
  `ortd &` 之后**一行日志都没有**,任务在自己的第一条 printf 之前
  就把栈踩穿了。静默的死和一个正常启动的后台任务在日志上完全一样。
  改用 static,并把栈调到 8KB。

ORT-A 实测(qemu-armv7a:knsh):
· 标准场景 SUPERVISOR RESULT **逐字不变**、横幅 1 次
· 热重载经代理走通(配置变更 → 替换 → 10ms 干净退出)
· 代理被 kill → `*** 部署/O&M 代理失联(心跳停滞 3000 ms)***`
  且监督者照常跑到正常终态
· 监督者源码里已无 fopen/fgets/fclose/open/read

⚠️ 未验:ORT-A(knsh)下 app 的 PRIORITY 不生效(ps 里 ortd 和 ortsup
   都是 100),所以"代理优先级低于监督者"这条在 ORT-A 上没被验证。
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.

2 participants