Cannot build Mender 1.7.0 THUD on IMX6 u-boot because of a buffer overflow caused by do_mender_uboot_auto_configure

233 views
Skip to first unread message

Ks89

unread,
Dec 24, 2018, 3:15:12 PM12/24/18
to Mender List mender.io
HI!

I updated mender to 1.7.0 thud and meta-freescale to thud for my iMX6ULL evk board. Also, I added these two lines in local.conf:
 
MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd"
MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"

However I cannot build with mender.


First I updated mender patches "0003-Integration-of-Mender-boot-code-into-U-Boot.patch" and "0004-Disable-CONFIG_BOOTCOMMAND-and-enable-CONFIG_MENDER_.patch" to apply them to u-boot 2017.03 thud. The cose is the same, but I simply regenerated patch files because weren't apply.

However I cannot build yet. The error is:

Initialising tasks: 100% |#######################################| Time: 0:00:00
Sstate summary: Wanted 9 Found 2 Missed 7 Current 72 (22% match, 91% complete)
NOTE
: Executing SetScene Tasks
NOTE
: Executing RunQueue Tasks
ERROR
: u-boot-imx-2017.03-r0 do_mender_uboot_auto_configure: Function failed: do_mender_uboot_auto_configure (log file is located at /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/temp/log.do_mender_uboot_auto_configure.85361)
ERROR
: Logfile of failure stored in: /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/temp/log.do_mender_uboot_auto_configure.85361
Log data follows:
| DEBUG: Executing shell function do_mender_uboot_auto_configure
| If at any point you get an unexpanded variable, there is probably an argument
| you haven't given.
| + SUB_X=-x
| + set -u
| + rm -rf /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/tmp-src
| ++ dirname /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/tmp-src
| + mkdir -p /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0
| + cp -r /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/git /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/tmp-src
| + cd /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/tmp-src
| + make '
HOSTCC=gcc  -DMENDER_AUTO_PROBING' 'CC=arm-poky-linux-gnueabi-gcc  -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/recipe-sysroot -DMENDER_AUTO_PROBING' mx6ull_14x14_evk_defconfig
|   HOSTCC  scripts/basic/fixdep
|   HOSTCC  scripts/kconfig/conf.o
|   SHIPPED scripts/kconfig/zconf.tab.c
|   SHIPPED scripts/kconfig/zconf.lex.c
|   SHIPPED scripts/kconfig/zconf.hash.c
|   HOSTCC  scripts/kconfig/zconf.tab.o
|   HOSTLD  scripts/kconfig/conf
| #
| # configuration written to .config
| #
| + grep -q '
^tools-all: *env\b' Makefile
| + ENV_TARGET=env
| + grep -q '
^tools-all: *envtools\b' Makefile
| + '
[' -z env ']'
| + bash -x /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/uboot_auto_patch.sh --patch-config-file
| + UBI=0
| +++ dirname /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/uboot_auto_patch.sh
| ++ readlink -f /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0
| + SCRIPT_DIR=/home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0
| + '
[' -z --patch-config-file ']'
| + '
[' --patch-config-file = -h ']'
| + '
[' --patch-config-file = --help ']'
| + set -e
| + '
[' --patch-config-file = --patch-config-file ']'
| + '
[' 1 -gt 1 ']'
| + sed -i -e '
s/^[ \t]*#[ \t]*define[ \t]*CONFIG_FILE\b.*/#define CONFIG_FILE "fw_env.config"/' tools/env/fw_env.h
| + exit 0
| + make 'HOSTCC=gcc  -DMENDER_AUTO_PROBING' 'CC=gcc  -DMENDER_AUTO_PROBING' env
| scripts/kconfig/conf  --silentoldconfig Kconfig
|   CHK     include/config.h
|   UPD     include/config.h
|   CFG     u-boot.cfg
|   GEN     include/autoconf.mk
|   GEN     include/autoconf.mk.dep
|   LD      tools/env/built-in.o
|   HOSTCC  tools/env/aes.o
|   HOSTCC  tools/env/crc32.o
|   HOSTCC  tools/env/ctype.o
|   HOSTCC  tools/env/env_attr.o
|   HOSTCC  tools/env/env_flags.o
|   HOSTCC  tools/env/fw_env.o
|   HOSTCC  tools/env/linux_string.o
|   AR      tools/env/lib.a
|   HOSTCC  tools/env/fw_env_main.o
|   HOSTLD  tools/env/fw_printenv
|   STRIP   tools/env/fw_printenv
| ++ printf %d 0x20000
| + dd if=/dev/zero of=fake-env.txt count=1 bs=131072
| 1+0 records in
| 1+0 records out
| 131072 bytes (131 kB, 128 KiB) copied, 0.000150445 s, 871 MB/s
| + cat
| + mkdir -p fw_printenv.lock
| + ret=0
| + tools/env/fw_printenv -l fw_printenv.lock
| *** buffer overflow detected ***: tools/env/fw_printenv terminated
| ======= Backtrace: =========
| /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f89404207e5]
| /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f89404c215c]
| /lib/x86_64-linux-gnu/libc.so.6(+0x117160)[0x7f89404c0160]
| /lib/x86_64-linux-gnu/libc.so.6(+0x1166c9)[0x7f89404bf6c9]
| /lib/x86_64-linux-gnu/libc.so.6(_IO_default_xsputn+0x80)[0x7f89404246b0]
| /lib/x86_64-linux-gnu/libc.so.6(_IO_vfprintf+0x7bd)[0x7f89403f692d]
| /lib/x86_64-linux-gnu/libc.so.6(__vsprintf_chk+0x84)[0x7f89404bf754]
| /lib/x86_64-linux-gnu/libc.so.6(__sprintf_chk+0x7d)[0x7f89404bf6ad]
| tools/env/fw_printenv[0x40118a]
| /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f89403c9830]
| tools/env/fw_printenv[0x401379]
| ======= Memory map: ========
| 00400000-00408000 r-xp 00000000 08:01 3651193                            /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/tmp-src/tools/env/fw_printenv
| 00607000-00608000 r--p 00007000 08:01 3651193                            /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/tmp-src/tools/env/fw_printenv
| 00608000-00609000 rw-p 00008000 08:01 3651193                            /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/tmp-src/tools/env/fw_printenv
| 01b3b000-01b5c000 rw-p 00000000 00:00 0                                  [heap]
| 7f8940193000-7f89401a9000 r-xp 00000000 08:01 791347                     /lib/x86_64-linux-gnu/libgcc_s.so.1
| 7f89401a9000-7f89403a8000 ---p 00016000 08:01 791347                     /lib/x86_64-linux-gnu/libgcc_s.so.1
| 7f89403a8000-7f89403a9000 rw-p 00015000 08:01 791347                     /lib/x86_64-linux-gnu/libgcc_s.so.1
| 7f89403a9000-7f8940569000 r-xp 00000000 08:01 791309                     /lib/x86_64-linux-gnu/libc-2.23.so
| 7f8940569000-7f8940769000 ---p 001c0000 08:01 791309                     /lib/x86_64-linux-gnu/libc-2.23.so
| 7f8940769000-7f894076d000 r--p 001c0000 08:01 791309                     /lib/x86_64-linux-gnu/libc-2.23.so
| 7f894076d000-7f894076f000 rw-p 001c4000 08:01 791309                     /lib/x86_64-linux-gnu/libc-2.23.so
| 7f894076f000-7f8940773000 rw-p 00000000 00:00 0
| 7f8940773000-7f8940799000 r-xp 00000000 08:01 791281                     /lib/x86_64-linux-gnu/ld-2.23.so
| 7f894097c000-7f894097f000 rw-p 00000000 00:00 0
| 7f8940997000-7f8940998000 rw-p 00000000 00:00 0
| 7f8940998000-7f8940999000 r--p 00025000 08:01 791281                     /lib/x86_64-linux-gnu/ld-2.23.so
| 7f8940999000-7f894099a000 rw-p 00026000 08:01 791281                     /lib/x86_64-linux-gnu/ld-2.23.so
| 7f894099a000-7f894099b000 rw-p 00000000 00:00 0
| 7ffe837f0000-7ffe83812000 rw-p 00000000 00:00 0                          [stack]
| 7ffe839fa000-7ffe839fd000 r--p 00000000 00:00 0                          [vvar]
| 7ffe839fd000-7ffe839ff000 r-xp 00000000 00:00 0                          [vdso]
| ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
| ./uboot_auto_configure.sh: line 121: 86214 Aborted                 (core dumped) tools/env/fw_printenv -l fw_printenv.lock > "$TMP_DIR/compiled-environment.txt"
| + ret=134
| + rm -rf fw_printenv.lock
| + '[' 134 -ne 0 ']'
| + '[' 134 -eq 134 -o 134 -eq 139 ']'
| + echo 'Detected SIGABRT or SIGSEGV. This may be an indication that your u-boot-fw-utils package is lacking an important patch. See https://docs.mender.io/troubleshooting/yocto-project-build#do_mender_uboot_auto_configure-fails-when-executing-toolsenvfw_p'
| Detected SIGABRT or SIGSEGV. This may be an indication that your u-boot-fw-utils package is lacking an important patch. See https://docs.mender.io/troubleshooting/yocto-project-build#do_mender_uboot_auto_configure-fails-when-executing-toolsenvfw_p
| + exit 134
| WARNING: exit code 134 from a shell command.
| ERROR: Function failed: do_mender_uboot_auto_configure (log file is located at /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/temp/log.do_mender_uboot_auto_configure.85361)
ERROR
: Task (/home/ks89/git/poky/meta-freescale/recipes-bsp/u-boot/u-boot-imx_2017.03.bb:do_mender_uboot_auto_configure) failed with exit code '1'
NOTE
: Tasks Summary: Attempted 487 tasks of which 480 didn't need to be rerun and 1 failed.


Summary: 1 task failed:
  /home/ks89/git/poky/meta-freescale/recipes-bsp/u-boot/u-boot-imx_2017.03.bb:do_mender_uboot_auto_configure
Summary: There was 1 ERROR message shown, returning a non-zero exit code.


I highlighted the message "*** buffer overflow detected ***: tools/env/fw_printenv terminated" caused by "do_mender_uboot_auto_configure".
Do you have any suggestion?


thank you.

Mirza Krak

unread,
Dec 24, 2018, 3:46:18 PM12/24/18
to Mender List mender.io
On Mon, Dec 24, 2018 at 9:15 PM Ks89 <stefano.c...@gmail.com> wrote:
HI!

I updated mender to 1.7.0 thud and meta-freescale to thud for my iMX6ULL evk board. Also, I added these two lines in local.conf:
 
MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd"
MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"

However I cannot build with mender.


First I updated mender patches "0003-Integration-of-Mender-boot-code-into-U-Boot.patch" and "0004-Disable-CONFIG_BOOTCOMMAND-and-enable-CONFIG_MENDER_.patch" to apply them to u-boot 2017.03 thud. The cose is the same, but I simply regenerated patch files because weren't apply.

However I cannot build yet. The error is:

Initialising tasks: 100% |#######################################| Time: 0:00:00
Sstate summary: Wanted 9 Found 2 Missed 7 Current 72 (22% match, 91% complete)
NOTE
: Executing SetScene Tasks
NOTE
: Executing RunQueue Tasks
ERROR
: u-boot-imx-2017.03-r0 do_mender_uboot_auto_configure: Function failed: do_mender_uboot_auto_configure (log file is located at /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/temp/log.do_mender_uboot_auto_configure.85361)

You probably need this patch [1], could you try applying it as well to your 2017.03 U-boot and check back.

--
Mirza Krak | Embedded Solutions Architect | https://mender.io

 Northern.tech AS | @northerntechHQ




Ks89

unread,
Dec 26, 2018, 10:26:13 AM12/26/18
to Mender List mender.io, mirza...@northern.tech
Hi, thank you for the answer.

I applied your patch but it isn't working yet. The issue seems the same.

The patch is applied successfully in both work/..../u-boot-imx/..../git/tools/ and work/..../u-boot-imx/..../git/tools/env

Error message is:

NOTE: Executing RunQueue Tasks
ERROR
: u-boot-imx-2017.03-r0 do_mender_uboot_auto_configure: Function failed: do_mender_uboot_auto_configure (log file is located at /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/temp/log.do_mender_uboot_auto_configure.89095)
ERROR
: Logfile of failure stored in: /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/temp/log.do_mender_uboot_auto_configure.89095
| 131072 bytes (131 kB, 128 KiB) copied, 0.000149999 s, 874 MB/s
| + cat
| + mkdir -p fw_printenv.lock
| + ret=0
| + tools/env/fw_printenv -l fw_printenv.lock
| *** buffer overflow detected ***: tools/env/fw_printenv terminated
| ======= Backtrace: =========
| /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7ff57b6897e5]
| /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7ff57b72b15c]
| /lib/x86_64-linux-gnu/libc.so.6(+0x117160)[0x7ff57b729160]
| /lib/x86_64-linux-gnu/libc.so.6(+0x1166c9)[0x7ff57b7286c9]
| /lib/x86_64-linux-gnu/libc.so.6(_IO_default_xsputn+0x80)[0x7ff57b68d6b0]
| /lib/x86_64-linux-gnu/libc.so.6(_IO_vfprintf+0x7bd)[0x7ff57b65f92d]
| /lib/x86_64-linux-gnu/libc.so.6(__vsprintf_chk+0x84)[0x7ff57b728754]
| /lib/x86_64-linux-gnu/libc.so.6(__sprintf_chk+0x7d)[0x7ff57b7286ad]
| tools/env/fw_printenv[0x40118a]
| /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7ff57b632830]

| tools/env/fw_printenv[0x401379]
| ======= Memory map: ========
| 00400000-00408000 r-xp 00000000 08:01 3651265                            /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/tmp-src/tools/env/fw_printenv
| 00607000-00608000 r--p 00007000 08:01 3651265                            /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/tmp-src/tools/env/fw_printenv
| 00608000-00609000 rw-p 00008000 08:01 3651265                            /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/tmp-src/tools/env/fw_printenv
| 011f9000-0121a000 rw-p 00000000 00:00 0                                  [heap]
| 7ff57b3fc000-7ff57b412000 r-xp 00000000 08:01 791347                     /lib/x86_64-linux-gnu/libgcc_s.so.1
| 7ff57b412000-7ff57b611000 ---p 00016000 08:01 791347                     /lib/x86_64-linux-gnu/libgcc_s.so.1
| 7ff57b611000-7ff57b612000 rw-p 00015000 08:01 791347                     /lib/x86_64-linux-gnu/libgcc_s.so.1
| 7ff57b612000-7ff57b7d2000 r-xp 00000000 08:01 791309                     /lib/x86_64-linux-gnu/libc-2.23.so
| 7ff57b7d2000-7ff57b9d2000 ---p 001c0000 08:01 791309                     /lib/x86_64-linux-gnu/libc-2.23.so
| 7ff57b9d2000-7ff57b9d6000 r--p 001c0000 08:01 791309                     /lib/x86_64-linux-gnu/libc-2.23.so
| 7ff57b9d6000-7ff57b9d8000 rw-p 001c4000 08:01 791309                     /lib/x86_64-linux-gnu/libc-2.23.so
| 7ff57b9d8000-7ff57b9dc000 rw-p 00000000 00:00 0
| 7ff57b9dc000-7ff57ba02000 r-xp 00000000 08:01 791281                     /lib/x86_64-linux-gnu/ld-2.23.so
| 7ff57bbe5000-7ff57bbe8000 rw-p 00000000 00:00 0
| 7ff57bc00000-7ff57bc01000 rw-p 00000000 00:00 0
| 7ff57bc01000-7ff57bc02000 r--p 00025000 08:01 791281                     /lib/x86_64-linux-gnu/ld-2.23.so
| 7ff57bc02000-7ff57bc03000 rw-p 00026000 08:01 791281                     /lib/x86_64-linux-gnu/ld-2.23.so
| 7ff57bc03000-7ff57bc04000 rw-p 00000000 00:00 0
| 7ffd608cd000-7ffd608ef000 rw-p 00000000 00:00 0                          [stack]
| 7ffd609ae000-7ffd609b1000 r--p 00000000 00:00 0                          [vvar]
| 7ffd609b1000-7ffd609b3000 r-xp 00000000 00:00 0                          [vdso]

| ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
| ./uboot_auto_configure.sh: line 121: 89948 Aborted                 (core dumped) tools/env/fw_printenv -l fw_printenv.lock > "$TMP_DIR/compiled-environment.txt"

| + ret=134
| + rm -rf fw_printenv.lock
| + '[' 134 -ne 0 ']'
| + '[' 134 -eq 134 -o 134 -eq 139 ']'
| + echo 'Detected SIGABRT or SIGSEGV. This may be an indication that your u-boot-fw-utils package is lacking an important patch. See https://docs.mender.io/troubleshooting/yocto-project-build#do_mender_uboot_auto_configure-fails-when-executing-toolsenvfw_p'
| Detected SIGABRT or SIGSEGV. This may be an indication that your u-boot-fw-utils package is lacking an important patch. See https://docs.mender.io/troubleshooting/yocto-project-build#do_mender_uboot_auto_configure-fails-when-executing-toolsenvfw_p
| + exit 134
| WARNING: exit code 134 from a shell command.
| ERROR: Function failed: do_mender_uboot_auto_configure (log file is located at /home/ks89/git/poky/build/tmp/work/evk-poky-linux-gnueabi/u-boot-imx/2017.03-r0/temp/log.do_mender_uboot_auto_configure.89095)

ERROR
: Task (/home/ks89/git/poky/meta-freescale/recipes-bsp/u-boot/u-boot-imx_2017.03.bb:do_mender_uboot_auto_configure) failed with exit code '1'
NOTE
: Tasks Summary: Attempted 487 tasks of which 480 didn't need to be rerun and 1 failed.


Summary: 1 task failed:
  /home/ks89/git/poky/meta-freescale/recipes-bsp/u-boot/u-boot-imx_2017.03.bb:do_mender_uboot_auto_configure
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

Mirza Krak

unread,
Dec 26, 2018, 10:29:51 AM12/26/18
to Ks89, Mender List mender.io
On Wed, Dec 26, 2018 at 4:26 PM Ks89 <stefano.c...@gmail.com> wrote:
Hi, thank you for the answer.

Hello,

< cut >

| ./uboot_auto_configure.sh: line 121: 89948 Aborted                 (core dumped) tools/env/fw_printenv -l fw_printenv.lock > "$TMP_DIR/compiled-environment.txt"
| + ret=134
| + rm -rf fw_printenv.lock
| + '[' 134 -ne 0 ']'
| + '[' 134 -eq 134 -o 134 -eq 139 ']'
| + echo 'Detected SIGABRT or SIGSEGV. This may be an indication that your u-boot-fw-utils package is lacking an important patch. See https://docs.mender.io/troubleshooting/yocto-project-build#do_mender_uboot_auto_configure-fails-when-executing-toolsenvfw_p'
| Detected SIGABRT or SIGSEGV. This may be an indication that your u-boot-fw-utils package is lacking an important patch. See https://docs.mender.io/troubleshooting/yocto-project-build#do_mender_uboot_auto_configure-fails-when-executing-toolsenvfw_p
| + exit 134

Oh did not look at the full log, have you tried the suggested patch mentioned above in our docs?

-- 

Ks89

unread,
Dec 26, 2018, 10:33:43 AM12/26/18
to Mender List mender.io, stefano.c...@gmail.com, mirza...@northern.tech

Mirza Krak

unread,
Dec 26, 2018, 10:35:00 AM12/26/18
to Ks89, Mender List mender.io

Ks89

unread,
Dec 26, 2018, 1:40:00 PM12/26/18
to Mender List mender.io, stefano.c...@gmail.com, mirza...@northern.tech
Fixed applying the patch you suggested. Thank you for the support.
Reply all
Reply to author
Forward
0 new messages