-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using snprintf to populate buffer for rev_write segfaults #198
Comments
in this test case, i'm using snprintf which is a compressed instruction so removing the them throws an error that "Compressed instructions not enabled!". Hence unsure if this is also a side effect of compressed instructions problem. |
When running this test against this branch, which fixes compressed instructions,: https://github.com/tactcomplabs/rev/tree/TestDbg we no longer see the failure. This branch currently has a vexing memory corruption issue preventing it from being merged to devel, but the changes here should fix this issue when merged |
Probably still being worked on but just wanted to update that I tested it out on the above branch, and though i dont see a crash anymore, there is no print to console i.e the ECALL to rev_write doesnt seem to have been made. |
Describe the bug
To print a variable from inside rev, we use snprintf to populate a buffer. But this causes a segfault inside rev's calcphysaddr.
To Reproduce
Expected behavior
To print the value 98
BackTrace
Additional context
Attached the binary's objdump as well and looks like the PC during failure (0x13b00) is a LOAD instruction inside the snprint function call.
Code compiled with below command with compressed instruction enabled -
"/opt/riscv/bin/riscv64-unknown-elf-gcc" -march=rv64imafdc -O0 -o revprint.exe rev_print.c -static.
code.tar.gz
The text was updated successfully, but these errors were encountered: