sancus-tee / sancus-core

Minimal OpenMSP430 hardware extensions for isolation and attestation
BSD 3-Clause "New" or "Revised" License
20 stars 13 forks source link

sancus-sim: Loguru caught a signal: SIGSEGV #31

Open jovanbulck opened 2 years ago

jovanbulck commented 2 years ago

When installing fresh on Ubuntu 22.04, sancus-sim (Verilator) ends with a SEGV. This is relatively harmless, as it seems to only happen after the simulation has ended. Not sure where exactly it goes wrong? Maybe @fritzalder can have a look?

Might or might not have something to do with the warning I had to disable to get it to install on Ubuntu 22.04 with more recent verilator versions:

https://github.com/sancus-tee/sancus-core/commit/09adaef918ea54fac8eeb6c5bac40b9104c138f0

Example output below (sancus-examples/hello-world):

jo@icecream:~/sancus-main/sancus-examples/hello-world$ verilator --version
Verilator 4.038 2020-07-11 rev v4.036-114-g0cd4a57ad
jo@icecream:~/sancus-main/sancus-examples/hello-world$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:    22.04
Codename:   jammy

jo@icecream:~/sancus-main/sancus-examples/hello-world$ make sim
sancus-cc -I"/usr/local/share/sancus-support"/include/ -Wfatal-errors -fcolor-diagnostics -Os -g   -c -o main.o main.c
sancus-ld -L"/usr/local/share/sancus-support"/lib/ --ram 16K --rom 41K  -lsm-io -ldev --inline-arithmetic --standalone --verbose -o no_wrap_main.elf main.o
INFO: Found new Sancus modules:
INFO:  * hello:
INFO:   - Entries: hello_disable, hello_greet
INFO:   - No calls to other modules
INFO:   - Unprotected calls: puts, printf2
INFO:   - YAML SM Configuration: No YAML config provided.
INFO: No existing Sancus modules found
INFO: No asm Sancus modules found
INFO: Found MSP430 install directory: /usr/msp430
INFO: Found MSP430 GCC install directory: /usr/lib/gcc/msp430/4.6.3
INFO: Using output file no_wrap_main.elf
INFO: Cleaning up temporary files: /tmp/tmpofole9o0.o, /tmp/tmp6o7_vl_y.o, /tmp/tmpy86_0unw.o, /tmp/tmp_fl1ee1d
sancus-crypto --fill-macs --key 4078d505d82099ba --verbose -o main.elf no_wrap_main.elf
sancus-sim --dumpfile=sancus_sim.vcd main.elf
2022-10-17 13:16:12.602 (   0.000s) [        246D33C0]               main.cpp:296   INFO| Using input file main.elf.
   v| 
INFO| arguments: sancus-sim --dumpfile=sancus_sim.vcd main.elf
INFO| Current dir: /home/jo/sancus-main/sancus-examples/hello-world
INFO| stderr verbosity: 0
INFO| -----------------------------------
INFO| ======================= Sancus Simulator =======================
INFO| { Performing objcopy of elf file
INFO| .   Generating temporary binary form of given elf file...
INFO| .   Temp file is /tmp/tmp_sancus_769JBI
INFO| .   >> msp430-objcopy -O binary main.elf /tmp/tmp_sancus_769JBI
INFO| .   ..done!
INFO| } 0.002 s: Performing objcopy of elf file
INFO| Using sancus_sim.vcd as simulation file.
INFO| Enabled automatic timeout after 1000000000 cycles.
INFO| Will abort simulation 0 cycles after any SM_VIOLATION
INFO| Read program memory of 41984 bytes.
=== SpongeWrap parameters ===
Rate:           16
Security:       64
Blocks in key:   4
=============================
=== Spongent parameters ===
Rate:        18
State size: 176
===========================

------

New SM 1 config: 6de8 70b4 0200 032c, 0
Vendor key: 4078d505d82099ba
SM key: fc30dc631ca41ab6
SM hello with ID 1 enabled  : 0x6de8 0x70b4 0x0200 0x032c
[main.c] Hi from SM with ID 1, called by 0
SM 1 disabled
[main.c] SM disabled; all done!

all done; exiting..

INFO| ======================== Simulation ended ========================
INFO| Total/crypto cycles simulated: 70229/34114.
INFO| ================ Simulation succeeded gracefully =================
INFO| atexit

Loguru caught a signal: SIGSEGV
FATL| Signal: SIGSEGV
make: *** [Makefile:21: sim] Segmentation fault (core dumped)