logoalt Hacker News

jstarks11/07/20241 replyview on HN

I guess if the arch’s varargs conventions do something other than put each 32-bit value in a 64-bit “slot” (likely for inputs that end up on the stack, at least), then some of the arguments will not line up. Probably some of the last args will get combined into high/low parts of a 64-bit register when moved into registers to pass to the kernel. And then subsequent register inputs will get garbage from the stack.

Need to cast them to long or size_t or whatever to prevent this.


Replies

jagrsw11/07/2024

Yes