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: <49A50A36.8000305@cn.fujitsu.com>
Date:	Wed, 25 Feb 2009 17:07:02 +0800
From:	Lai Jiangshan <laijs@...fujitsu.com>
To:	Steven Rostedt <rostedt@...dmis.org>
CC:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Theodore Tso <tytso@....edu>,
	Arjan van de Ven <arjan@...radead.org>,
	Pekka Paalanen <pq@....fi>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Jason Baron <jbaron@...hat.com>,
	Martin Bligh <mbligh@...gle.com>,
	Mathieu Desnoyers <compudj@...stal.dyndns.org>,
	"Frank Ch. Eigler" <fche@...hat.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Jens Axboe <jens.axboe@...cle.com>,
	Masami Hiramatsu <mhiramat@...hat.com>,
	Steven Rostedt <srostedt@...hat.com>
Subject: Re: [PATCH 2/4] tracing: add event trace infrastructure

a very nice infrastructure!

Two comments about format:

Steven Rostedt 写道:
> From: Steven Rostedt <srostedt@...hat.com>
> +#undef TPFMT
> +#define TPFMT(fmt, args...)	fmt "\n", ##args

Where is other TPFMT's definition?
I think TPFMT should be defined in tracepoint.h, because trace/<type>.h
uses it.

> +#define DEFINE_TRACE_FMT(call, proto, args, fmt)			\
> +static void ftrace_event_##call(proto)					\
> +{									\
> +	event_trace_printk(_RET_IP_, "(" #call ") " fmt);		\
> +}									\
> +									\
> +static int ftrace_reg_event_##call(void)				\
> +{									\
> +	int ret;							\
> +									\
> +	ret = register_trace_##call(ftrace_event_##call);		\
> +	if (!ret)							\
> +		pr_info("event trace: Could not activate trace point "	\
> +			"probe to " #call);				\
> +	return ret;							\
> +}									\
> +									\
> +static void ftrace_unreg_event_##call(void)				\
> +{									\
> +	unregister_trace_##call(ftrace_event_##call);			\
> +}									\
> +									\
> +static struct ftrace_event_call __used					\
> +__attribute__((section("_ftrace_events"))) event_##call = {		\
> +	.name 			= #call,				\
> +	.regfunc		= ftrace_reg_event_##call,		\
> +	.unregfunc		= ftrace_unreg_event_##call,		\
> +}
> +
> +void event_trace_printk(unsigned long ip, const char *fmt, ...);

add format checking here:
__attribute__ ((format (printf, 2, 3)))

If user does not use this infrastructure(he uses trace/<type>.h only),
this checking is not work, so I think we can add format checking
in DEFINE_TRACE_FMT in tracepoint.h

--------example:

static inline void  __tp_check_format(const char *fmt, ...)
		__attribute__ ((format (printf, 1, 2)));
static inline void __tp_check_format(const char *fmt, ...) {}

#define DECLARE_TRACE_FORMAT_CHECK(name, proto, fmt, fmt_args...)	\
static inline void ftrace_event_check_format_##name(proto)		\
{									\
	__tp_check_format(fmt, ##fmt_args);				\
}

#define DEFINE_TRACE_FMT(name, proto, args, fmt)			\
	DECLARE_TRACE_FORMAT_CHECK(name, TPPROTO(proto), fmt)		\
	DECLARE_TRACE(name, TPPROTO(proto), TPARGS(args))

---------

Thanks, Lai

--
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