From: Daniel Borkmann > Sent: 11 August 2017 17:47 > On 08/09/2017 10:34 PM, Daniel Borkmann wrote: > > On 08/09/2017 09:39 AM, James Hogan wrote: > > [...] > >> time (but please consider looking at the other patch which is certainly > >> a more real issue). > > > > Sorry for the delay, started looking into that and whether we > > have some other options, I'll get back to you on this. > > Could we solve this more generically (as in: originally intended) in > the sense that we don't need to trust the gcc va_list handling; I feel > this is relying on an implementation detail? Perhaps something like > below poc patch?
That patch still has 'cond ? arg : cond1 ? (long)arg : (u32)arg' so probably has the same warning as the original version. The va_list handling is defined by the relevant ABI, not gcc. It is ok on x86-64 because all 32bit values are extended to 64bits before being passed as arguments (either in registers, or on the stack). Nothing in the C language requires that, so other 64bit architectures could pass 32bit values in 4 bytes of stack. David