Re: event tracing, ringbuffer and RB_MAX_SMALL_DATA

From: Li Zefan
Date: Tue Jul 14 2009 - 21:09:55 EST


Johannes Berg wrote:
> Hi,
>
> By code inspection, I think there's a bug if your event contains only
>
> __dynamic_array(u8, buf, buflen)
>
> and your buflen is only, say, 3. Then the event size will be the common
> event size (12 bytes) plus this, so 15, which is well below
> RB_MAX_SMALL_DATA (4*28 = 112), so it'll be divided by four to be stored
> into type_len. At this point, however, you've lost the information that
> your dynamic array was only three bytes, and it'll be considered _four_
> bytes long by parsers as far as I can tell?
>

Right, the length of a dynamic array is not recorded, and this
causes 2 problems:

- the event filter is not working properly for dynamic strings
- userspace parsers can't figure out the length of those arrays

I had an idea some time ago, and hopefully will send out a
patch today or tomorrow.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/