lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210714180337.3e78394c@oasis.local.home>
Date:   Wed, 14 Jul 2021 18:03:37 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Chuck Lever <chuck.lever@...cle.com>
Subject: Re: [GIT PULL] tracing: Add __string_len() and __assign_str_len()
 helpers

On Wed, 14 Jul 2021 17:56:33 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:

> static inline notrace int trace_event_get_offsets_foo(
> 	struct trace_event_data_offsets_foo *__data_offsets, const char *foobar, int len)
> {
> 	int __data_size = 0;
> 	int __maybe_unused __item_length;
> 	struct trace_event_raw_foo __maybe_unused *entry;
> 
> // The "(len)+1" will be used to calculate the __item_length below
> 
> 	__item_length = (len + 1) * sizeof(char);
> 
> // the dynamic fields (strings and such) are located after the static
> // fields in the trace event, and the offset is recorded in the bottom
> // 16 bits of a 32 bit word, and the size in the top 16 bits.
> 
> 	__data_offsets->item = __data_size +
> 			       offsetof(typeof(*entry), __data);
> 	__data_offsets->item |= __item_length << 16;

I missed a manual substitution of the macro. This should have been:

 	__data_offsets->str = __data_size +
 			       offsetof(typeof(*entry), __data);
 	__data_offsets->str |= __item_length << 16;

As the macro creates the trace_event_data_offsets_foo structure (which
__data_offsets is declared as), which contains a field for every
__string/__string_len/__dynamic_array() in TP_STRUCT__entry.

The -">str" comes from the "str" in "__string_len(str, foobar, len)".

-- Steve


> 	__data_size += __item_length;
> 
> 
> // Each "__string_len()" or "__string()" in the TP_STRUCT__entry is inserted
> // into this macro created function. Thus, the above code is duplicated for
> // each field that uses __string(), __string_len() or __dynamic_array().
> 
> 
> 	return __data_size;
> }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ