[DTrace-devel] [PATCH 01/14] Mark subroutines with appropriate ALLOCA and DPTR flags

Eugene Loh eugene.loh at oracle.com
Tue Feb 21 16:26:39 UTC 2023


Okay.  FWIW, there was a v2 of this patch on Nov 15, 2022.

On 2/18/23 01:08, Kris Van Hees wrote:
> Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
>
> ... with some changes I applied to correct the information I gave you
> concerning how ALLOCA and DPTR interact.
>
> On Thu, Nov 03, 2022 at 03:52:13PM -0400, eugene.loh--- via DTrace-devel wrote:
>> From: Eugene Loh <eugene.loh at oracle.com>
>>
>> Clearly, alloca() should be marked ALLOCA.
>>
>> We also return copyin() and copyinstr() in scratch memory.
>>
>> These and other subroutines return results in DTrace-managed storage.
>>
>> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
>> ---
>>   libdtrace/dt_open.c | 36 ++++++++++++++++++------------------
>>   1 file changed, 18 insertions(+), 18 deletions(-)
>>
>> diff --git a/libdtrace/dt_open.c b/libdtrace/dt_open.c
>> index a3754a32..11364825 100644
>> --- a/libdtrace/dt_open.c
>> +++ b/libdtrace/dt_open.c
>> @@ -86,8 +86,8 @@ static const dt_provimpl_t *dt_providers[] = {
>>    * argument.
>>    */
>>   static const dt_ident_t _dtrace_globals[] = {
>> -{ "alloca", DT_IDENT_FUNC, DT_IDFLG_ALLOCA, DIF_SUBR_ALLOCA, DT_ATTR_STABCMN,
>> -	DT_VERS_1_0, &dt_idops_func, "void *(size_t)" },
>> +{ "alloca", DT_IDENT_FUNC, DT_IDFLG_ALLOCA | DT_IDFLG_DPTR, DIF_SUBR_ALLOCA,
>> +	DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_func, "void *(size_t)" },
>>   { "arg0", DT_IDENT_SCALAR, 0, DIF_VAR_ARG0, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_type, "int64_t" },
>>   { "arg1", DT_IDENT_SCALAR, 0, DIF_VAR_ARG1, DT_ATTR_STABCMN, DT_VERS_1_0,
>> @@ -112,7 +112,7 @@ static const dt_ident_t _dtrace_globals[] = {
>>   	&dt_idops_args, NULL },
>>   { "avg", DT_IDENT_AGGFUNC, 0, DT_AGG_AVG, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "void(@)" },
>> -{ "basename", DT_IDENT_FUNC, 0, DIF_SUBR_BASENAME, DT_ATTR_STABCMN, DT_VERS_1_0,
>> +{ "basename", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_BASENAME, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "string(const char *)" },
>>   { "bcopy", DT_IDENT_FUNC, 0, DIF_SUBR_BCOPY, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "void(void *, void *, size_t)" },
>> @@ -123,15 +123,15 @@ static const dt_ident_t _dtrace_globals[] = {
>>   	&dt_idops_type, "uintptr_t" },
>>   { "chill", DT_IDENT_ACTFUNC, 0, DT_ACT_CHILL, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "void(int)" },
>> -{ "cleanpath", DT_IDENT_FUNC, 0, DIF_SUBR_CLEANPATH, DT_ATTR_STABCMN,
>> +{ "cleanpath", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_CLEANPATH, DT_ATTR_STABCMN,
>>   	DT_VERS_1_0, &dt_idops_func, "string(const char *)" },
>>   { "clear", DT_IDENT_ACTFUNC, 0, DT_ACT_CLEAR, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "void(@)" },
>>   { "commit", DT_IDENT_ACTFUNC, 0, DT_ACT_COMMIT, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "void(int)" },
>> -{ "copyin", DT_IDENT_FUNC, 0, DIF_SUBR_COPYIN, DT_ATTR_STABCMN, DT_VERS_1_0,
>> +{ "copyin", DT_IDENT_FUNC, DT_IDFLG_ALLOCA | DT_IDFLG_DPTR, DIF_SUBR_COPYIN, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "void *(uintptr_t, size_t)" },
>> -{ "copyinstr", DT_IDENT_FUNC, 0, DIF_SUBR_COPYINSTR,
>> +{ "copyinstr", DT_IDENT_FUNC, DT_IDFLG_ALLOCA | DT_IDFLG_DPTR, DIF_SUBR_COPYINSTR,
>>   	DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "string(uintptr_t, [size_t])" },
>>   { "copyinto", DT_IDENT_FUNC, 0, DIF_SUBR_COPYINTO, DT_ATTR_STABCMN,
>> @@ -149,14 +149,14 @@ static const dt_ident_t _dtrace_globals[] = {
>>   	{ DTRACE_STABILITY_STABLE, DTRACE_STABILITY_PRIVATE,
>>   	DTRACE_CLASS_COMMON }, DT_VERS_1_0,
>>   	&dt_idops_type, "vmlinux`struct task_struct *" },
>> -{ "d_path", DT_IDENT_FUNC, 0, DIF_SUBR_D_PATH, DT_ATTR_EVOLCMN,
>> +{ "d_path", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_D_PATH, DT_ATTR_EVOLCMN,
>>   	DT_VERS_1_0, &dt_idops_func, "string(struct path *)" },
>>   { "ddi_pathname", DT_IDENT_FUNC, 0, DIF_SUBR_DDI_PATHNAME,
>>   	DT_ATTR_EVOLCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "string(void *, int64_t)" },
>>   { "denormalize", DT_IDENT_ACTFUNC, 0, DT_ACT_DENORMALIZE, DT_ATTR_STABCMN,
>>   	DT_VERS_1_0, &dt_idops_func, "void(@)" },
>> -{ "dirname", DT_IDENT_FUNC, 0, DIF_SUBR_DIRNAME, DT_ATTR_STABCMN, DT_VERS_1_0,
>> +{ "dirname", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_DIRNAME, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "string(const char *)" },
>>   { "discard", DT_IDENT_ACTFUNC, 0, DT_ACT_DISCARD, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "void(int)" },
>> @@ -192,11 +192,11 @@ static const dt_ident_t _dtrace_globals[] = {
>>   	&dt_idops_type, "uint_t" },
>>   { "index", DT_IDENT_FUNC, 0, DIF_SUBR_INDEX, DT_ATTR_STABCMN, DT_VERS_1_1,
>>   	&dt_idops_func, "int(const char *, const char *, [int])" },
>> -{ "inet_ntoa", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA, DT_ATTR_STABCMN,
>> +{ "inet_ntoa", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_INET_NTOA, DT_ATTR_STABCMN,
>>   	DT_VERS_1_5, &dt_idops_func, "string(void *)" }, /* FIXME should be ipaddr_t* */
>> -{ "inet_ntoa6", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA6, DT_ATTR_STABCMN,
>> +{ "inet_ntoa6", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_INET_NTOA6, DT_ATTR_STABCMN,
>>   	DT_VERS_1_5, &dt_idops_func, "string(struct in6_addr *)" },
>> -{ "inet_ntop", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOP, DT_ATTR_STABCMN,
>> +{ "inet_ntop", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_INET_NTOP, DT_ATTR_STABCMN,
>>   	DT_VERS_1_5, &dt_idops_func, "string(int, void *)" },
>>   { "ipl", DT_IDENT_SCALAR, 0, DIF_VAR_IPL, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_type, "uint_t" },
>> @@ -207,7 +207,7 @@ static const dt_ident_t _dtrace_globals[] = {
>>   { "llquantize", DT_IDENT_AGGFUNC, 0, DT_AGG_LLQUANTIZE,
>>   	DT_ATTR_STABCMN, DT_VERS_1_6_4,
>>   	&dt_idops_func, "void(@, int32_t, int32_t, int32_t, int32_t, ...)" },
>> -{ "lltostr", DT_IDENT_FUNC, 0, DIF_SUBR_LLTOSTR, DT_ATTR_STABCMN, DT_VERS_1_0,
>> +{ "lltostr", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_LLTOSTR, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "string(int64_t)" },
>>   { "lquantize", DT_IDENT_AGGFUNC, 0, DT_AGG_LQUANTIZE,
>>   	DT_ATTR_STABCMN, DT_VERS_1_0,
>> @@ -304,19 +304,19 @@ static const dt_ident_t _dtrace_globals[] = {
>>   	DT_VERS_1_6, &dt_idops_func, "void(@)" },
>>   { "stop", DT_IDENT_ACTFUNC, 0, DT_ACT_STOP, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "void()" },
>> -{ "strchr", DT_IDENT_FUNC, 0, DIF_SUBR_STRCHR, DT_ATTR_STABCMN, DT_VERS_1_1,
>> +{ "strchr", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_STRCHR, DT_ATTR_STABCMN, DT_VERS_1_1,
>>   	&dt_idops_func, "string(const char *, char)" },
>>   { "strlen", DT_IDENT_FUNC, 0, DIF_SUBR_STRLEN, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "size_t(const char *)" },
>> -{ "strjoin", DT_IDENT_FUNC, 0, DIF_SUBR_STRJOIN, DT_ATTR_STABCMN, DT_VERS_1_0,
>> +{ "strjoin", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_STRJOIN, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "string(const char *, const char *)" },
>> -{ "strrchr", DT_IDENT_FUNC, 0, DIF_SUBR_STRRCHR, DT_ATTR_STABCMN, DT_VERS_1_1,
>> +{ "strrchr", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_STRRCHR, DT_ATTR_STABCMN, DT_VERS_1_1,
>>   	&dt_idops_func, "string(const char *, char)" },
>> -{ "strstr", DT_IDENT_FUNC, 0, DIF_SUBR_STRSTR, DT_ATTR_STABCMN, DT_VERS_1_1,
>> +{ "strstr", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_STRSTR, DT_ATTR_STABCMN, DT_VERS_1_1,
>>   	&dt_idops_func, "string(const char *, const char *)" },
>> -{ "strtok", DT_IDENT_FUNC, 0, DIF_SUBR_STRTOK, DT_ATTR_STABCMN, DT_VERS_1_1,
>> +{ "strtok", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_STRTOK, DT_ATTR_STABCMN, DT_VERS_1_1,
>>   	&dt_idops_func, "string(const char *, const char *)" },
>> -{ "substr", DT_IDENT_FUNC, 0, DIF_SUBR_SUBSTR, DT_ATTR_STABCMN, DT_VERS_1_1,
>> +{ "substr", DT_IDENT_FUNC, DT_IDFLG_DPTR, DIF_SUBR_SUBSTR, DT_ATTR_STABCMN, DT_VERS_1_1,
>>   	&dt_idops_func, "string(const char *, int, [int])" },
>>   { "sum", DT_IDENT_AGGFUNC, 0, DT_AGG_SUM, DT_ATTR_STABCMN, DT_VERS_1_0,
>>   	&dt_idops_func, "void(@)" },
>> -- 
>> 2.18.4
>>
>>
>> _______________________________________________
>> DTrace-devel mailing list
>> DTrace-devel at oss.oracle.com
>> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list