[DTrace-devel] [PATCH v3 06/21] dtprobed: add the DOF stash
Nick Alcock
nick.alcock at oracle.com
Tue Feb 13 12:48:17 UTC 2024
On 12 Feb 2024, Nick Alcock via DTrace-devel stated:
> On 12 Feb 2024, Kris Van Hees stated:
>>> +/*
>>> + * Compose a provider's name from pieces.
>>> + */
>>> +static char *
>>> +make_provider_name(const char *prov, pid_t pid)
>>> +{
>>> + char *ret;
>>> +
>>> + if (asprintf(&ret, "%s%li", prov, (long) pid) < 0) {
>>> + fuse_log(FUSE_LOG_ERR, "dtprobed: out of memory making provider name\n");
>>> + return NULL;
>>> + }
>>> + return ret;
>>> +}
>>
>> This function does not validate against the length limit on provider names?
>
> ... why would it need to? It's only being used to create filenames (and
> the OS checks its own limits on those already). Nothing in dof_stash.c
> cares how long the names are.
>
> Certainly dt_pid.c should validate the lengths, which it looks like it
> isn't. I'll add code to do that. (But that's another commit!)
OK my memory is failing me. I knew there was a reason why this was the
wrong place for it :) all this validation is already being done in the
right place: in the parser. See libcommon/dof_parser.c:validate_provider().
The stuff provided to this function is all a product of the parser, so
validate it there and nothing else need do so. (Well, not until we get
to parts of DTrace proper that can deal with non-USDT probes, which
might have arrived via paths that didn't go through that validation.)
--
NULL && (void)
More information about the DTrace-devel
mailing list