Can't use e-acsl on a dynamic library containing all the instrumentations
ID0002422: This issue was created automatically from Mantis Issue 2422. Further discussion may take place here.
Id | Project | Category | View | Due Date | Updated |
---|---|---|---|---|---|
ID0002422 | Frama-C | Plug-in > E-ACSL | public | 2019-01-22 | 2019-01-23 |
Reporter | rmalak | Assigned To | signoles | Resolution | open |
Priority | normal | Severity | crash | Reproducibility | always |
Platform | x86_64 | OS | Linux 4.19 Ocaml 4.07.0 | OS Version | Debian Sid |
Product Version | Frama-C 18-Argon | Target Version | Frama-C 19-Potassium | Fixed in Version | - |
Description :
Hi !
main.c contains the entry point : the main function and is not instrumented by frama-c
it calls instrumented func.c (e-acsl.func.c containing the __e_acsl_memory_init call) compiled as a dynamic library libe-acsl.func.so
then the e-acsl code segfault at
e_acsl_segment_tracking.h:815
Additional Information :
Why the hell am I doing this ? :)
Contiki-NG is an IoT OS. It can be build as a firmware for several IoT devices, as a ELF for Linux x86/x86_64, and as a shared library loaded by the Java Cooja network simulator (with some JNI).
Before experimenting with dlopen in C and JNI in Java, which is going to fail because of the __executable_start symbol at ./share/frama-c/e-acsl/segment_model/e_acsl_shadow_layout.h:47
(this will the subject of another future post)
I would like to be able, as a first step, to use a e-acsl instrumented dynamic library used by a non-instrumented program (containing main or not).
I am open to a solution that eventually needs some change inside the C E-ACSL code.
Steps To Reproduce :
$ make rm -vf *.*o ./loader ./main e-acsl frama-c -main func -variadic-no-translation -machdep gcc_x86_64 -c11 -cpp-extra-args="-std=c99 -D_DEFAULT_SOURCE -D__NO_CTYPE -D__FC_MACHDEP_X86_64" -no-frama-c-stdlib func.c -e-acsl-prepare -rte -warn-signed-overflow -warn-unsigned-overflow -warn-signed-downcast -warn-unsigned-downcast -rte-div -rte-float-to-int -rte-mem -rte-pointer-call -rte-shift -rte-no-trivial-annotations -then -e-acsl -e-acsl-full-mmodel -then-last -print -ocode e-acsl.func.c [kernel] Parsing FRAMAC_SHARE/e-acsl/e_acsl_gmp_api.h (with preprocessing) [kernel] Parsing FRAMAC_SHARE/e-acsl/e_acsl.h (with preprocessing) [kernel] Parsing func.c (with preprocessing) [rte] annotating function __bswap_16 [rte] annotating function __bswap_32 [rte] annotating function __bswap_64 [rte] annotating function __uint16_identity [rte] annotating function __uint32_identity [rte] annotating function __uint64_identity [rte] annotating function func [e-acsl] beginning translation. [kernel:annot:missing-spec] :0: Warning: Neither code nor specification for function __builtin_bswap16, generating default assigns from the prototype [kernel:annot:missing-spec] :0: Warning: Neither code nor specification for function __builtin_bswap32, generating default assigns from the prototype [kernel:annot:missing-spec] :0: Warning: Neither code nor specification for function __builtin_bswap64, generating default assigns from the prototype [kernel:annot:missing-spec] /usr/include/stdio.h:332: Warning: Neither code nor specification for function printf, generating default assigns from the prototype [e-acsl] translation done in project "e-acsl". gcc -shared -fPIC -DE_ACSL_SEGMENT_MMODEL -DE_ACSL_STACK_SIZE=32 -DE_ACSL_HEAP_SIZE=128 -std=c99 -m64 -O0 -g -fno-builtin -fno-merge-constants -Wall -Wno-long-long -Wno-attributes -Wno-nonnull -Wno-undef -Wno-unused -Wno-unused-function -Wno-unused-result -Wno-unused-value -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-implicit-function-declaration -Wno-empty-body -I/home/jean/local-frama-c/share/frama-c/e-acsl/ -o libe-acsl.func.so e-acsl.func.c /home/jean/local-frama-c/share/frama-c/e-acsl/e_acsl_rtl.c /home/jean/local-frama-c/share/frama-c/../../lib/libeacsl-dlmalloc.a /home/jean/local-frama-c/share/frama-c/../../lib/libeacsl-gmp.a -lm gcc -o main main.c -L. -le-acsl.func
LD_LIBRARY_PATH=:./ ./main Segmentation fault make: *** [Makefile:11: e-acsl-main-shared] Error 139