[DTrace-devel] [PATCH v3 06/19] alloca: add alloca() itself
Kris Van Hees
kris.van.hees at oracle.com
Fri Apr 1 14:10:37 UTC 2022
On Fri, Apr 01, 2022 at 02:50:07PM +0100, Nick Alcock wrote:
> On 30 Mar 2022, Kris Van Hees uttered the following:
>
> > On Thu, Mar 24, 2022 at 06:24:32PM +0000, Nick Alcock via DTrace-devel wrote:
> >> + /*
> >> + * Set the maximum scratch space permitted.
> >> + */
> >> + dtp->dt_options[DTRACEOPT_SCRATCHSIZE] = _dtrace_scratchsize;
> >
> > Round up to 8-byte boundary.
>
> No other option values are ever so rounded. Why is this one special?
Because you use scratchsizse to do bounds checking on scratchsize_top, and if
that one now automatically extends allocations to the next 8 byte boundary,
you wouldn't want an allocation to fail because that extending puts it past
the scratchsizse limit.
E.g. if cratchsize_top is 16, scratchsize is 20, I try to allocate 3 bytes.
The extending to the next boundary will place the new cratchsize_top at 24
which will fail the bounds check againsy scratchsize, yet the allocation size
is small enough that it ought to work.
More information about the DTrace-devel
mailing list