linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v2 3/9] kernel-shark: Fix KS_DEFINE_PLUGIN_CONTEXT macro
Date: Thu, 6 May 2021 14:11:51 -0400	[thread overview]
Message-ID: <20210506141151.2f31f263@gandalf.local.home> (raw)
In-Reply-To: <20210428134730.187533-4-y.karadz@gmail.com>

On Wed, 28 Apr 2021 16:47:24 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> The KS_DEFINE_PLUGIN_CONTEXT macro implements methods that are used
> to deal with plugin-specific context objects. However, when this macro
> is used in multiple plugins and those plugins are loaded together
> the symbol resolving fails, resulting in undefined behavior. Namely,
> version of the function from one plugin, being called by another
> plugin. Here we make sure that the methods defined in
> KS_DEFINE_PLUGIN_CONTEXT are not visible outside of the corresponding
> plugin.
> 
> Fixing: 15df009 (kernel-shark: Add KS_DEFINE_PLUGIN_CONTEXT macro)
> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
> ---
>  src/libkshark-plugin.h     | 22 ++++++++++++++++++----
>  src/plugins/sched_events.c |  3 +++
>  src/plugins/sched_events.h |  3 +--
>  3 files changed, 22 insertions(+), 6 deletions(-)
> 
> diff --git a/src/libkshark-plugin.h b/src/libkshark-plugin.h
> index c110616..752dbeb 100644
> --- a/src/libkshark-plugin.h
> +++ b/src/libkshark-plugin.h
> @@ -24,6 +24,8 @@ extern "C" {
>  /* Quiet warnings over documenting simple structures */
>  //! @cond Doxygen_Suppress
>  
> +#define __hidden __attribute__((visibility ("hidden")))
> +
>  #define _MAKE_STR(x)	#x
>  
>  #define MAKE_STR(x)	_MAKE_STR(x)
> @@ -364,11 +366,14 @@ int kshark_handle_all_dpis(struct kshark_data_stream *stream,
>  	__ok;								\
>  })									\
>  
> -/** General purpose macro defining methods for adding plugin context. */
> +/**
> + * General purpose macro defining methods for adding plugin context.
> + * Do not use this macro in header files.
> + */
>  #define KS_DEFINE_PLUGIN_CONTEXT(type)					\
>  static type **__context_handler;					\
>  static ssize_t __n_streams = -1;					\
> -static inline type *__init(int sd)					\
> +__hidden type *__init(int sd)						\

This is strange, because static inline should never be a problem in this
regard (otherwise things will break elsewhere too).

static is never exported (it's stronger than "hidden").

Can you show me how you see this error, because this solution does not make
any sense.

-- Steve

  reply	other threads:[~2021-05-06 18:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 13:47 [PATCH v2 0/9] (Not so) Minor fixes toward KS 2.0 Yordan Karadzhov (VMware)
2021-04-28 13:47 ` [PATCH v2 1/9] kernel-shark: Fix the build for 32b systems Yordan Karadzhov (VMware)
2021-04-28 13:47 ` [PATCH v2 2/9] kernel-shark: Add "cron" job to workflows Yordan Karadzhov (VMware)
2021-04-28 13:47 ` [PATCH v2 3/9] kernel-shark: Fix KS_DEFINE_PLUGIN_CONTEXT macro Yordan Karadzhov (VMware)
2021-05-06 18:11   ` Steven Rostedt [this message]
2021-05-10 11:53     ` Yordan Karadzhov
2021-05-10 18:25       ` Steven Rostedt
2021-05-10 18:50         ` Yordan Karadzhov
2021-05-10 19:23           ` Steven Rostedt
2021-05-10 20:18             ` Yordan Karadzhov
2021-05-10 20:34             ` Yordan Karadzhov
2021-05-10 21:02               ` Steven Rostedt
2021-05-11 13:30                 ` Yordan Karadzhov
2021-04-28 13:47 ` [PATCH v2 4/9] kernel-shark: Add cleanup of all plugin contexts Yordan Karadzhov (VMware)
2021-04-28 13:47 ` [PATCH v2 5/9] kernel-shark: Fix memory leak in "sched events" plugin Yordan Karadzhov (VMware)
2021-04-28 13:47 ` [PATCH v2 6/9] kernel-shark: Disable the pop-up offset dialog Yordan Karadzhov (VMware)
2021-04-28 13:47 ` [PATCH v2 7/9] kernel-shark: Remove kvm_combo from the list of default plugins Yordan Karadzhov (VMware)
2021-05-06 18:25   ` Steven Rostedt
2021-05-10 12:15     ` Yordan Karadzhov
2021-04-28 13:47 ` [PATCH v2 8/9] kernel-shark: Remove debugging print out from plugins Yordan Karadzhov (VMware)
2021-04-28 13:47 ` [PATCH v2 9/9] kernel-shark: Hide all plugin internals Yordan Karadzhov (VMware)
2021-05-06 18:26 ` [PATCH v2 0/9] (Not so) Minor fixes toward KS 2.0 Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210506141151.2f31f263@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=y.karadz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).