From: Michael Ellerman > Sent: 18 July 2022 05:41 ... > So we're memsetting all of args to 254, not zero. > > That's happening because allmodconfig with gcc 12 enables > CONFIG_INIT_STACK_ALL_PATTERN, whereas gcc 11 doesn't.
I can't help feeling it would be better if that generated a call to a memset64() function. Saving loads of tests at the top of the function, and (most of?) the constant expansion to 64bit. Although and explicit 'stack clear' function would be better for the kernel - since it would give the option of patching it away at startup. I really can't help feeling that initialising on-stack arrays will kill performance. While kernel stack frames have to be relatively small, in userspace very large on-stack arrays can be allocated (and correctly bound checked) knowing that the cost is minimal (maybe a TLB miss). David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)