[lttng-dev] UST tracepoint() NULL pointer argument handling
Ettore Del Negro
ettore at ettoredelnegro.me
Thu May 10 16:34:34 EDT 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Thanks David for your reply, next time (i.e. now) i will check the bug tracker first!
I noticed that passing a NULL (string) pointer to a tracepoint()'s argument is not handled
properly (i.e not supposed to happen). It causes the program to SIGSEV because of strlen( NULL )
in ust-tracepoint-event.h:271 .
I tried some trivial patching like
- - __event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1;
+ __event_len += __dynamic_len[__dynamic_len_idx++] = (_src == NULL ? 1 : strlen(_src) + 1);
but then lib_ring_buffer_do_copy causes a SIGSEV because of memcpy( .., NULL, .. ), so i assume a
NULL pointer is not expected at all.
Is there any particular reason to not handle a NULL pointer? That could save the developer a
ternary statement on theorically every string argument given to tracepoint() and, most
importantly, the application from crash because of LTTng.
Thanks,
Ettore
On 10/5/2012 4:46 PM, David Goulet wrote:
> Hey,
>
> We have right now an opened bug about this exact issue. We will soon fix this and, as you said,
> help considerably the user experience with subbuffer size :)
>
> Thanks for the report!
>
> Cheers David
>
> On 09/05/12 08:51 PM, Ettore Del Negro wrote:
>> Hello, i have a simple question which may lead to a small user experience improvement:
>
>>> lttng create tsession
>> Session tsession created. Traces will be written in
>> .../lttng-traces/tsession-20120510-015819
>>> lttng enable-channel tchan -u -s tsession --subbuf-size=1024
>> UST channel tchan enabled for session tsession
>
>> a message stating that buffer size is set to a value different than default would be nice
>
>>> lttng enable-channel tchan -u -s tsession --subbuf-size=1022
>> UST channel tchan enabled for session tsession
>
>> What happens? Is it set to a value not power of 2? Is it set to the default value? (i guess
>> the latter). The help says: --subbuf-size SIZE Subbuffer size in bytes (default: 4096,
>> kernel default: 262144) Needs to be a power of 2 for kernel and ust tracers
>
>> Thanks, Ettore
>
>> _______________________________________________ lttng-dev mailing list
>> lttng-dev at lists.lttng.org http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJPrCZaAAoJEBroCbr/OjsadOkP/3D69W4daouFhhsWFWHUZdfz
aWa1jWK1oTqSzI1aU8+wZA+XD0eV/qMiAVQWMguI9+/C9uI0qndWasaF6wZMH7h9
jFhoKzUssqMnSz6iIXQCYhdMm9v5z0NU+kKw3xnmlX4Wfxzn9wjzN1F62B/LwBiw
slESKP72pRKMuigcUyUod1+C3Ddhl2odO/I091zHT3dYxA3qhLZL2sPKkR3I12YJ
cP8+p4bii7rowAhUSt57dzU0V1k+yZUvvEvqvvuVFrjlf171kmy05f//Xm6npFxU
Br4y/WFLg0Lf41uXRGMf0FFoXiWHPxgXpDc4vEYIjL3iHKn+JhYBxlZkw0YGPYbI
G9kBw7TQogZrAxMkKL6djzuTTP/Ic/7GRqhiWP2kJrqdLI/zjobZLCy5YUOLYeZp
6iGUoZR2qMhCxpOAQuU226WuWaQmhwr3oFq5Eo602SQB58lBFqTFG+O8+rwZ+iQQ
sc9MJb6Ov6WeQBzstbnQHnj1MVfbOcyz9bsztuyiMzbZ+JGk1OeDsl5sGlwzf5GP
KLIukByYLvLH+7VIN2qIvIJyWQ5LobCkHjLVdMuCVgVGvemEYbt3bMaup+8acyjM
+9FKw3HQER5RH7GazQylxGd9C7iV29bCWBAj2wFmh98YgWJ6V7uA73f3etpmAD0x
8ASlJci0JJVDPy8RN0hP
=ds7n
-----END PGP SIGNATURE-----
More information about the lttng-dev
mailing list