[DTrace-devel] [PATCH 4/4] spec: correct semantics of specsize overflow

Kris Van Hees kris.van.hees at oracle.com
Fri May 12 03:54:29 UTC 2023


On Thu, May 11, 2023 at 02:44:47PM -0400, Eugene Loh via DTrace-devel wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

Forgot to address one comment...

> > +		 *	   dtp->dt_options[DTRACEOPT_SPECSIZE])
> > +		 *         return;
> > +		 * }
> > +		 */
> > +		dt_regset_xalloc(drp, BPF_REG_0);
> 
> Why hardwire to %r0???  Why not just let dt_regset_alloc() find one for you?

The set of usable registers is very small to begin with, and we know that
%r0 should be available for us (because all but one code paths that get us
to this code in fact xalloc and free %r0 already for calls).  Rather than
going the genereic route to allocate a register (with a higher chance to
require spilling and restoring), it is safe to use %r0 here since it is the
designated scratch register.



More information about the DTrace-devel mailing list