[DTrace-devel] [PATCH 03/12] Fix alloca() non-constant size check

Eugene Loh eugene.loh at oracle.com
Fri Jul 22 20:49:36 UTC 2022


Thanks for the explanations.  Just a little more discussion below...

On 7/22/22 12:41, Kris Van Hees wrote:
> On Fri, Jul 22, 2022 at 10:49:25AM -0700, Eugene Loh via DTrace-devel wrote:
>> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
>>
>> Specifically, I do not understand the whole "8" thing.  (I guess there is an
>> initial 8-byte padding to represent a NULL pointer. This padding is so
>> invasive, hard-coded into every access to the scratch area.  Might it have
>> been better placed at the *end* of the scratch area?  I don't know.  But,
>> again, this eccentricity is being exposed in so many places in the code...
>> that magic "8" value is all over the place.)
>>
>> I don't get why DTRACEOPT_SCRATCHSIZE is not the value of the scratchsize
>> option, as the name would suggest (at least to me).
> The initial 8 bytes are there because they occur at offset 0 which means that
> an alloca offset of 0 maps to a NULL pointer quite nicely.

Okay, but I still wonder why DTRACEOPT_SCRATCHSIZE doesn't refer to the 
value of the scratch size option.  I would think that's the most obvious 
meaning (and using it for a different purposes leads to the confusion 
that requires a patch like this one).



More information about the DTrace-devel mailing list