Skip to main content

extract_dmesg

Function extract_dmesg 

Source
pub fn extract_dmesg<P: PhysicalMemoryProvider>(
    reader: &ObjectReader<P>,
) -> Result<Vec<DmesgEntry>>
Expand description

Extract dmesg entries from the kernel ring buffer.

Looks up the log_buf symbol, dereferences the pointer to obtain the buffer address, reads log_buf_len to determine buffer size, then iterates printk_log records until len == 0 or the buffer is exhausted.

Returns an empty Vec if the log_buf symbol is not found (e.g., wrong profile or non-Linux image).

ยงSafety limit

Caps extraction at 65,536 entries to prevent runaway iteration on corrupt data.