Re: [RFC] Persist ima logs to disk
From: Janne Karhunen <hidden>
Date: 2021-01-07 15:46:53
On Tue, Jan 5, 2021 at 9:57 PM Raphael Gianotti [off-list ref] wrote:
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