Re: [RFC] Persist ima logs to disk
From: Raphael Gianotti <hidden>
Date: 2021-01-07 18:36:34
On 1/7/2021 7:45 AM, Janne Karhunen wrote:
On Tue, Jan 5, 2021 at 9:57 PM Raphael Gianotti [off-list ref] wrote:quoted
In a thread with Janne Karhunen[2], it was mentioned that another approach, using mm had been considered. Upon some investigation the approach used in this RFC still seemed adequate for solving this problem.Curious to hear in more detail where did this land? Not sure I remember this correctly anymore, but wouldn't it be possible to have mmap'd tmpfile at address __heap of size __heap_sz and have something this simple pulling memory from it? uint8_t *get_static_buffer(size_t size) { static size_t buf_index; uint8_t *bufp = NULL; size = ROUND_UP(size, sizeof(double)); if ((buf_index + size) >= __heap_sz) return NULL; bufp = (uint8_t *)__heap + buf_index; buf_index += size; *bufp = 0; return bufp; } Then just replace every related measurement list allocation with this get_static_buffer and that would be pretty much all there is to it? The mm code should automatically push those pages out when it needs memory. It will also read those pages back in when someone scans through the measurement list creating a nicely formatted one. I think. -- Janne
As I replied to the other comment from Mimi, I think I may have been overcomplicating it. My knowledge of mm is still not very deep, so I may have overthought some parts of it and thought anything I was coming up with didn't seem like a good way to do it. I will revisit this, especially since I wasn't aware of the PCR concerns Mimi had, which make sense and will probably be hard to solve with the code I just sent. Raph