[U-Boot] [BUG] efi_loader: unaligned access in disk/part_efi.c, cmd/bootefi.c, efi_hii_sibt_string_ucs2_block_next()

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Jul 14 08:02:44 UTC 2019


Ramon reported the following bug:

[14.07  08:29] <rfried> Hey. running unit-tests fails on compilation for
some reason on my setup
[14.07  08:30] <rfried> https://pastebin.com/E1YhU71Y
[14.07  08:41] <rfried> I have gcc (GCC) 9.1.0

(venv) stdcall at stdcall-pc:~/dev/u-boot (pci_ep) $ make mrproper
(venv) stdcall at stdcall-pc:~/dev/u-boot (pci_ep) $ ./test/py/test.py --bd
sandbox --build -k ut_dm_pci_ep_base
+make O=/home/stdcall/dev/u-boot/build-sandbox -s sandbox_defconfig
+make O=/home/stdcall/dev/u-boot/build-sandbox -s -j8
../disk/part_efi.c: In function ‘gpt_verify_partitions’:
../disk/part_efi.c:737:49: error: taking address of packed member of
‘struct _gpt_entry’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
   737 |   gpt_convert_efi_name_to_char(efi_str, gpt_e[i].partition_name,
       |                                         ~~~~~~~~^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [../scripts/Makefile.build:278: disk/part_efi.o] Error 1
make[1]: *** [/home/stdcall/dev/u-boot/Makefile:1594: disk] Error 2
make[1]: *** Waiting for unfinished jobs....
In file included from ../include/efi_loader.h:13,
                  from ../common/board_r.c:50:
../include/efi_api.h: In function ‘efi_hii_sibt_string_ucs2_block_next’:
../include/efi_api.h:820:18: error: taking address of packed member of
‘struct efi_hii_sibt_string_ucs2_block’ may result in an unaligned
pointer value [-Werror=address-of-packed-member]
   820 |   (u16_strlen(blk->string_text) + 1) * 2;
       |               ~~~^~~~~~~~~~~~~
In file included from ../include/vxworks.h:10,
                  from ../common/bootm_os.c:12:
../include/efi_api.h: In function ‘efi_hii_sibt_string_ucs2_block_next’:
../include/efi_api.h:820:18: error: taking address of packed member of
‘struct efi_hii_sibt_string_ucs2_block’ may result in an unaligned
pointer value [-Werror=address-of-packed-member]
   820 |   (u16_strlen(blk->string_text) + 1) * 2;
       |               ~~~^~~~~~~~~~~~~
cc1: all warnings being treated as errors
In file included from ../include/efi_loader.h:13,
                  from ../cmd/bootefi.c:12:
../include/efi_api.h: In function ‘efi_hii_sibt_string_ucs2_block_next’:
../include/efi_api.h:820:18: error: taking address of packed member of
‘struct efi_hii_sibt_string_ucs2_block’ may result in an unaligned
pointer value [-Werror=address-of-packed-member]
   820 |   (u16_strlen(blk->string_text) + 1) * 2;
       |               ~~~^~~~~~~~~~~~~
../cmd/bootefi.c: In function ‘get_config_table’:
../cmd/bootefi.c:189:22: error: taking address of packed member of
‘struct efi_configuration_table’ may result in an unaligned pointer
value [-Werror=address-of-packed-member]
   189 |   if (!guidcmp(guid, &systab.tables[i].guid))
       |                      ^~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [../scripts/Makefile.build:278: common/board_r.o] Error 1
make[2]: *** Waiting for unfinished jobs....
cc1: all warnings being treated as errors
make[2]: *** [../scripts/Makefile.build:278: common/bootm_os.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [../scripts/Makefile.build:278: cmd/bootefi.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/home/stdcall/dev/u-boot/Makefile:1594: cmd] Error 2
make[1]: *** [/home/stdcall/dev/u-boot/Makefile:1594: common] Error 2
make: *** [Makefile:148: sub-make] Error 2
Exit code: 2
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/_pytest/main.py",
line 205, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/_pytest/config/__init__.py",
line 663, in _do_configure
INTERNALERROR>
self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/hooks.py",
line 311, in call_historic
INTERNALERROR>     res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/manager.py",
line 68, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/manager.py",
line 62, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if
hook.spec else False,
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/callers.py",
line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/callers.py",
line 81, in get_result
INTERNALERROR>     _reraise(*ex)  # noqa
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/callers.py",
line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/stdcall/dev/u-boot/test/py/conftest.py",
line 138, in pytest_configure
INTERNALERROR>     runner.run(cmd, cwd=source_dir)
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/test/py/multiplexed_log.py", line 173, in run
INTERNALERROR>     raise exception
INTERNALERROR> Exception: Exit code: 2
(venv) stdcall at stdcall-pc:~/dev/u-boot (pci_ep)


More information about the U-Boot mailing list