iovisor / ply

Dynamic Tracing in Linux
GNU General Public License v2.0
972 stars 92 forks source link

ply: Correct alignment of stack allocations #91

Closed andersson closed 2 months ago

andersson commented 1 year ago

As entries are allocated on the stack the stack pointer is decremented and then adjusted to meet the requested alignment requirements. The current math does unfortunately not always provide the requested alignment.

One example is when the stack pointer is at -1 and an allocation of 4 bytes with alignment of 4 is performed, which results in an allocation at offset -6. A typical case where this happens is when working with tracepoints containing boolean fields.

Update the adjustment to properly round the stack pointer down to the requested alignment.

wkz commented 2 months ago

Pulled in via #95 so that I could run it through the new CI test suite.

Thank you! Sorry for the (extremely) long delay.