Abhiroop / HasTEE

HasTEE⁺ - Haskell DSL for programming TEEs
Other
3 stars 1 forks source link

Unable to trace in Enclave #12

Open Abhiroop opened 1 day ago

Abhiroop commented 1 day ago

The current dpba branch is unable to trace the instrumented operations from the enclave. Surprisingly, the last operation gets traced (killing the enclave seems to flush the buffer but at that point, the buffer only has one operation left). There have been historical problems with flushing buffers (https://github.com/gramineproject/gramine/issues/788). There could be problems with laziness as well.

Abhiroop commented 7 hours ago

Temporary patch https://github.com/Abhiroop/HasTEE/commit/ee1071d4b8b4d060d03cfe606525e9ea91d0e887

This seems to be a laziness bug and I use seq combined with reading the entire file and then writing the file content appended with my log back. This works but is highly inefficient, especially for larger log files. Reading the whole file will blow up the enclave space.

I have some suspicions about where this behaviour might arise—the use of existential quantification to collect all logging arguments. (However, I did a preliminary check on that but couldn't pinpoint the issue). Keeping this issue open for future investigation.

Abhiroop commented 7 hours ago

Also, note the difference in base versions. Enclave runs base-4.14.0. The newer base (4.15.0 onwards) seems to expose a strict variant of readFile called readFile' (probably what I ended up implementing).