Bryan Drewery f222a6b886 dtrace: Fix /"string" == NULL/ comparisons using an uninitialized value.
A test of this is funcs/tst.strtok.d which has this filter:

    BEGIN
    /(this->field = strtok(this->str, ",")) == NULL/
    {
            exit(1);
    }
The test will randomly fail with exit status of 1 indicating that this->field
was NULL even though printing it out shows it is not.

This is compiled to the DTrace instruction set:
    // Pushed arguments not shown here
    // call strtok() and set result into %r1
    07: 2f001f01    call DIF_SUBR(31), %r1          ! strtok
    // set thread local scalar this->field from %r1
    08: 39050101    stls %r1, DT_VAR(1281)          ! DT_VAR(1281) = "field"
    // Prepare for the == comparison
    // Set right side of %r2 to NULL
    09: 25000102    setx DT_INTEGER[1], %r2         ! 0x0
    // string compare %r1 (strtok result) to %r2
    10: 27010200    scmp %r1, %r2

In this case only %r1 is loaded with a string limit set to lim1.  %r2 being
NULL does not get loaded and does not set lim2.  Then we call dtrace_strncmp()
with MIN(lim1, lim2) resulting in passing 0 and comparing neither side.
dtrace_strncmp() handles this case fine and it already has been while
being lucky with what lim2 was [un]initialized as.

Reviewed by:	markj, Don Morris <dgmorris AT earthlink.net>
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D27671
2021-01-08 14:37:17 -08:00
..
2018-07-07 15:55:52 +00:00
2018-05-24 17:06:00 +00:00
2020-10-02 18:18:01 +00:00
2020-02-03 17:35:11 +00:00
2018-01-12 12:14:14 +00:00
2018-11-01 23:11:47 +00:00
2020-02-03 17:35:11 +00:00
2018-07-17 23:23:45 +00:00
2020-04-28 16:09:18 +00:00
2019-03-01 04:17:43 +00:00
2020-02-03 17:35:11 +00:00
2019-03-28 08:30:45 +00:00
2019-03-28 08:30:45 +00:00
2020-03-20 21:06:58 +00:00
2020-12-17 14:20:36 +00:00
2019-03-28 08:59:11 +00:00
2019-06-06 03:02:25 +00:00
2017-04-03 03:07:48 +00:00
2020-03-20 21:06:58 +00:00
2020-03-20 21:06:58 +00:00
2020-02-03 17:35:11 +00:00
2020-02-06 21:01:19 +00:00
2020-08-22 03:57:55 +00:00
2020-02-03 17:35:11 +00:00
2020-05-16 02:29:10 +00:00
2020-03-20 21:06:58 +00:00
2020-03-20 21:06:58 +00:00
2020-03-20 21:06:58 +00:00
2020-03-20 21:06:58 +00:00
2020-03-20 21:06:58 +00:00
2020-03-20 21:06:58 +00:00
2020-03-20 21:06:58 +00:00
2020-03-20 21:06:58 +00:00
2017-06-09 12:06:22 +00:00
2020-03-20 21:06:58 +00:00
2021-01-07 20:40:41 -07:00
2019-08-16 20:30:31 +00:00
2019-08-21 22:18:01 +00:00
2020-12-04 21:12:17 +00:00
2019-10-12 23:01:16 +00:00
2020-11-05 15:55:23 +00:00
2020-03-20 21:06:58 +00:00
2017-08-21 20:27:45 +00:00
2020-04-28 16:09:18 +00:00
2018-01-12 12:14:14 +00:00
2018-01-12 12:14:14 +00:00
2020-04-28 16:09:18 +00:00
2020-02-03 17:35:11 +00:00
2018-07-20 17:46:55 +00:00
2019-07-01 17:05:41 +00:00
2020-10-08 20:56:00 +00:00
2017-05-09 05:22:51 +00:00
2020-10-19 20:43:29 +00:00
2019-02-26 19:55:03 +00:00
2019-08-25 17:13:00 +00:00
2021-01-07 20:41:06 -07:00