awnumar / memguard

Secure software enclave for storage of sensitive information in memory.
Apache License 2.0
2.49k stars 124 forks source link

Nil pointer panic before main function call #150

Closed papazloynt closed 2 months ago

papazloynt commented 10 months ago

Hello, I am using in my project an imported module github.com/awnumar/fastrand which uses indirect as a dependency on the github.com/awnumar/memguard package. My project works well when launching the release version, but as soon as I switch to debug mode, my program crashes with a panic until the main function is called, here is the error images: .

error occurs right here

find error ocuring code

panic info

panic info

But when I run my program with sudo in debug mode, everything works fine like in relese mode. Please tell me if this is a bug or a feature and what could be the reason for this behavior. I came across similar issues related to benchmarks and telegraph, but none of the solutions helped me. I would be grateful if you could help me solve my problem, thanks in advance!

awnumar commented 6 months ago

This is most likely because debug mode prevents Mlock. Unfortunately memguard doesn't currently support disabling Mlock