[DTrace-devel] [PATCH v2 3/3] String args to dt_strcmp() need to be copied if not DPTR

Eugene Loh eugene.loh at oracle.com
Fri Oct 7 18:45:32 UTC 2022


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

I'm left wondering if it might make sense just to use the "fix" all the 
time, bypassing the need for the DT_NF_DPTR part of this work, but the 
patch is fine as is.

Ideally, the tests would check the comparison results, but again the 
patch is fine as is.

Finally, to be ridiculously picky:

On 10/6/22 20:48, Kris Van Hees via DTrace-devel wrote:
> diff --git a/bpf/strcmp.S b/bpf/strcmp.S
> @@ -86,8 +87,14 @@ dt_strcmp_not :
>    *     // based on this location, judge if the strings are >, <, or ==
>    *     if (r0 > r6) goto Lsame;
>    *     if (r0 > r7) goto Lsame;
> - *     if (s[r0] > t[r0]) return +1;
> - *     if (s[r0] < t[r0]) return +1;
> +
> + *     s += r0;
> + *     t += r0;
> +
> + *     if (flags & 1) { } else { bpf_probe_read(tmp1, 1, s); s = tmp1; }
> + *     if (flags & 2) { } else { bpf_probe_read(tmp2, 1, t); t = tmp2; }
> + *     if (s[0] > t[0]) return +1;
> + *     if (s[0] < t[0]) return +1;
>    *
>    *     // if all chars are the same, break tie on string length
>    * Lsame:

I guess our convention, for those otherwise blank lines in /* */ comment 
blocks, is nevertheless still to have that '*' char in column 2.



More information about the DTrace-devel mailing list