nanovms / nanos

A kernel designed to run one and only one application in a virtualized environment
https://nanos.org
Apache License 2.0
2.64k stars 137 forks source link

Klog: Ensure sufficient alignment for dump #1941

Closed sanderssj closed 1 year ago

sanderssj commented 1 year ago

The klog_dump used by the kernel is a buffer passed directly to a storage handler, but some storage drivers like xen require at least sector alignment for the transaction's buffer. The dump was located in the bss at the end of the klog struct, so it had no alignment guarantees. This change moves it to the front of the struct and adds a 512-byte alignment requirement to the struct. This fixes an assertion failure when running klog_save on a xen instance.