Closed pjdobrowolski closed 1 year ago
Please share your exact command line; there are many ways to invoke rimage from various wrapper scripts.
west sign --build-dir $home/zephyrproject/build-mtl -t rimage --tool-path $home/zephyrproject/build-rimage/rimage.exe --tool-data $home/zephyrproject/sof/rimage/config -- -k $home/keys/mtl_private_key.pem
Looks like we need to validate more of the toml input config per platform ?
@pjdobrowolski will you be able to fix ?
To Reproduce
Configure Xtensa toolchain variables: set XTENSA_INSTALL_PATH=c:\usr\xtensa set ZEPHYR_TOOLCHAIN_VARIANT=xcc set XTENSA_CORE=ace10_LX7HiFi4_RI_2020_5 set XTENSA_TOOLS_VERSION=RI-2020.5-win32 set XTENSAD_LICENSE_FILE=84300@xtensa01p.elic.intel.com set XTENSA_TOOLS_DIR=%XTENSA_INSTALL_PATH%\XtDevTools\install\tools set XTENSA_BUILDS_DIR=%XTENSA_INSTALL_PATH%\XtDevTools\install\builds set XTENSA_TOOLCHAIN_PATH=%XTENSA_TOOLS_DIR%\%XTENSA_TOOLS_VERSION% set XTENSA_TOOLS=%XTENSA_TOOLS_DIR%\%XTENSA_TOOLS_VERSION%\XtensaTools set XTENSA_SYSTEM=%XTENSA_BUILDS_DIR%\%XTENSA_TOOLS_VERSION%\%XTENSA_CORE%\config Set generator to Ninja: set CMAKE_GENERATOR=Ninja Execute command python sof\scripts\xtensa-build-zephyr.py -u mtl -o sof\app\overlays\mtl\fpga_overlay.conf -k mtl_private_key.pem Reproduction Rate 50%? Look likes like environment reconfiguration helps (setting all variables from the start and deletion of all build cache).
Expected behavior Rimage.exe should produce properly signed zephyr.ri file (with more than 0 bytes). On failure like this one, zephyr.ri file should not be generated at all (error handling). Produced stackdump should contain readable content? Stack trace maybe?
Impact Annoyance.
Environment
Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).
Name of the topology file
Name of the platform(s) on which the bug is observed.
Environment:
Screenshots or console output
Rimage stackdump (quite useless frankly): rimage.EXE.log
I tried hard to reproduce on Linux but I could not. I ran rimage
with valgrind and it never found any memory corruption issue on my system.
assertion "(uint64_t)offset + section->size <= image->adsp->image_size" failed:
That's not a crash, that's a failed assert()
catching bad inputs. It's not impossible but I'm surprised this assert fails only half the time. Do you see this assert()
every time it "crashes" or is there any actual rimage crash some other times?
A long time ago we found some (actual) rimage crash when passing an invalid key file: thesofproject/sof#8680. This time I did not try an invalid key file, I only tried a couple valid, secret key files (but maybe not the same as yours)
Can you reproduce with other keys or only with this one secret key you use now? What happens with the default key?
rimage revision: https://github.com/thesofproject/rimage/commit/3ee717eebc6a2a512a0216363ae77473f94532c1 tomlc99 revision: e3a03f5ec7d8d33be705c5ce8a632d998ce9b4d1 zephyr revision: 2e66fac6d3ff66502689a03520737bda7527ef6c All taken from sof upstream west.yml
The sof version is the only one needed and it was the only one missing. All other versions are defined by sof/west.yml (and you should not use override sof/west.yml and use other versions when reporting a bug)
I tested both today's sof commit 8b79a6dc8e50 and also sof commit b553e529ee48 as reported later by @aborisovich but no repro.
Configure Xtensa toolchain variables:
When using scripts/xtensa-build-zephyr.py
, XTENSA_TOOLS_ROOT
should be the only variable needed. At least it is on my Linux system.
python sof\scripts\xtensa-build-zephyr.py -u mtl -o sof\app\overlays\mtl\fpga_overlay.conf -k mtl_private_key.pem
@pjdobrowolski are you using this overlay too? You only shared the west sign
command, this obviously does not tell us what you built and how.
Yes, I also use fpga overlay, however I don't use pythons scripts.
#Paths settings for west build system
XTENSA_INSTALL_PATH="c:/usr/xtensa"
export ZEPHYR_TOOLCHAIN_VARIANT=xcc
export XTENSA_CORE=ace10_LX7HiFi4_RI_2020_5
export XTENSA_TOOLS_VERSION=RI-2020.5-win32
export XTENSAD_LICENSE_FILE=84300@xtensa03p.elic.intel.com
export XTENSA_TOOLCHAIN_PATH=$XTENSA_INSTALL_PATH/XtDevTools/install/tools/$XTENSA_TOOLS_VERSION
export XTENSA_TOOLS=$XTENSA_TOOLS_DIR/$XTENSA_TOOLS_VERSION/XtensaTools
export NINJA_PATH='C:/Program Files/ninja'
export CMAKE_GENERATOR=Ninja
west -v -v build --build-dir build-mtl -p always -b intel_adsp_ace15_mtpm ./sof/app -- -DOVERLAY_CONFIG=overlays/mtl/fpga_overlay.conf
#Paths settings for rimage build
export OPENSSL_PATH="c:/msys64/var/lib/pacman/local/openssl-1.1.1.n-1"
export CAT_PATH="c:/Program Files/Git/usr/bin"
export NINJA_PATH="c:/Program/ Files/ninja"
export MSYS_INSTALL_DIR="C:/msys64/usr/bin/"
export CMAKE_GENERATOR=Ninja
echo -e '\033[0;33m'
echo '-----> cmake rimage build'
echo -e '\033[0m'
cmake -B $home/zephyrproject/build-rimage -S $home/zephyrproject/sof/rimage
echo -e '\033[0;33m'
echo '-----> cmake rimage --build'
echo -e '\033[0m'
cmake --build $home/zephyrproject/build-rimage
echo -e '\033[0;33m'
echo '-----> make backup build-mtl'
echo -e '\033[0m'
cp -r $home/zephyrproject/build-mtl/ $home/zephyrproject/build-mtl-backup
echo -e '\033[0;33m'
echo '-----> cmake west sign'
echo -e '\033[0m'
west sign --build-dir $home/zephyrproject/build-mtl -t rimage --tool-path $home/zephyrproject/build-rimage/rimage.exe --tool-data $home/zephyrproject/sof/rimage/config -- -k $home/keys/mtl_private_key.pem
echo -e '\033[0;33m'
echo '-----> smex *.ldc logs build'
echo -e '\033[0m'
$home/zephyrproject/build-mtl/zephyr/smex_ep/build/smex.exe -l $home/zephyrproject/build-mtl/zephyr/zephyr.ldc $home/zephyrproject/build-mtl/zephyr/zephyr.elf
echo -e '\033[0;32m'
date
echo '-----> DONE <------'
echo -e '\033[0m'
Yes, I also use fpga overlay, however I don't use pythons scripts.
The python wrapper script is not mandatory, using west directly is perfectly fine. However it is mandatory for reproducing and filing bugs because it makes sure we're all using the same configuration and testing (almost) the same thing. You already have python anyway (otherwise you couldn't compile Zephyr at all) so please try to reproduce with scripts/xtensa-build-zephyr.py
too and share the command line that reproduces. Then you can go back to manual, verbose and complicated configuration if you need to or want to.
Can you reproduce with other keys or only with this one secret key you use now? What happens with the default key?
Ping? (and some other questions too)
export OPENSSL_PATH="c:/msys64/var/lib/pacman/local/openssl-1.1.1.n-1"
@juimonen is it possible to sign MTL with legacy openssl 1 ?
@pjdobrowolski, @aborisovich could you try to uninstall openssl 1 and install openssl 3 instead? Does it still reproduce?
Some rimage+openssl background information:
@marc-hb dont recall very well... I think mtl was signed before with openssl1 and I did the "upgrade" as the openssl3 was getting into our CI machines with new ubuntus. rimage is getting the openssl ver from the system when building, so your system needs to have correctly installed openssl. I've been fiddling the openssl version with my own git version of it and just brutally sudo installing it in my machine... maybe not very recommended way. Just found out it was not super easy to switch between the versions with apt or dnf...
@aborisovich is using pythons for building so I didn't think it is necessary to redo his in pythons on my machine, do I? Before it appears that it is some rimage issue, I've switched between keys and issue was the same. Although problems might be with Zephyr? Because I didn't have such errors week ago.
@aborisovich is using pythons for building so I didn't think it is necessary to redo his in pythons on my machine, do I? Before it appears that it is some rimage issue, I've switched between keys and issue was the same. Although problems might be with Zephyr? Because I didn't have such errors week ago.
There were changes to rimage recently. I think we could try to bisect some commits from rimage repo to find the cause.
Does valgrind work on Windows ? If so, can this be tried ?
@aborisovich is using pythons [scripts/xtensa-build-zephyr.py] for building so I didn't think it is necessary to redo his in pythons on my machine, do I?
You're technically correct but we're struggling to understand the specific conditions required to reproduce so more datapoints is always useful. Also, the reluctance to align on the same configuration is concerning: what if @aborisovich is not available to help you file your next bug? (about rimage or not). The only side effects of scripts/xtensa-build-zephyr.py are running west
commands very similar (but maybe not 100% identical) to your west
commands, so what are you afraid of?
Bug is not reproducing after @softwarecki clean up.
Just for the record:
Originally posted by @aborisovich in https://github.com/thesofproject/sof/issues/7414#issuecomment-1511093485
> You mean this crash?
Not this one, we have other sporadicalls not reported yet.
Rimage is crashing during zephyr.ri signing
rimage revision: 3ee717eebc6a2a512a0216363ae77473f94532c1 tomlc99 revision: e3a03f5ec7d8d33be705c5ce8a632d998ce9b4d1 zephyr revision: 2e66fac6d3ff66502689a03520737bda7527ef6c All taken from sof upstream west.yml
Repro rate is ca 50%, I'm using west sign on windows with msys2 and instaled