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] [day] [month] [year] [list]
Message-ID: <20140711174027.2c6473e0@gandalf.local.home>
Date:	Fri, 11 Jul 2014 17:40:27 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Ard Biesheuvel <ard.biesheuvel@...aro.org>
Cc:	linux-kernel@...r.kernel.org, paulmck@...ux.vnet.ibm.com
Subject: Re: [PATCH v2] rcu: define tracepoint strings only if
 CONFIG_TRACING is set

On Fri, 11 Jul 2014 22:50:45 +0200
Ard Biesheuvel <ard.biesheuvel@...aro.org> wrote:

> Commit f7f7bac9cb1c ("rcu: Have the RCU tracepoints use the tracepoint_string
> infrastructure") unconditionally populates the __tracepoint_str input section,
> but this section is not assigned an output section if CONFIG_TRACING is not set.
> This results in the __tracepoint_str turning up in unexpected places, i.e.,
> after _edata.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...aro.org>
> Cc: rostedt@...dmis.org
> Cc: paulmck@...ux.vnet.ibm.com
> ---
> v2:
> - s/DEFINE_TPS/DEFINE_RCU_TPS/
> 
>  kernel/rcu/tree.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index f1ba77363fbb..eec9f3d6f506 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -79,9 +79,16 @@ static struct lock_class_key rcu_fqs_class[RCU_NUM_LVLS];
>   * the tracing userspace tools to be able to decipher the string
>   * address to the matching string.
>   */
> +#ifdef CONFIG_TRACING
> +#define DEFINE_RCU_TPS(sname) \
> +static const char *tp_##sname##_varname __used __tracepoint_string = sname##_varname;
> +#else
> +#define DEFINE_RCU_TPS(sname)
> +#endif
> +
>  #define RCU_STATE_INITIALIZER(sname, sabbr, cr) \
>  static char sname##_varname[] = #sname; \
> -static const char *tp_##sname##_varname __used __tracepoint_string = sname##_varname; \
> +DEFINE_RCU_TPS(sname) \
>  struct rcu_state sname##_state = { \
>  	.level = { &sname##_state.node[0] }, \
>  	.call = cr, \

Looking at this a bit deeper (actually looking at it in the context of
the code), we can make this even better.

#ifdef CONFIG_TRACING
# define DEFINE_RCU_TPS(sname) \
static char sname##_varname[] = #sname; \
static const char *tp_##sname##_varname __used __tracepoint_string = sname##_varname;
# define RCU_STATE_NAME(sname) sname##_varname;
#else
# define DEFINE_RCU_TPS(sname)
# define RCU_STATE_NAME(sname) __stringify(sname)
#endif

Then add:

	.name = RCU_STATE_NAME(sname), \


This will get rid of the sname##_varname variable as well.

-- Steve


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ