Two fixes for the tracing system.

o When trace_printk() is used with a non constant format descriptor,
    it adds a NULL pointer into the trace format section, and the code
    isn't prepared to deal with it. This bug appeared by a change that
    was added in v3.5.
 
  o The ftracetest (selftests section) can't handle testing histograms
    when histograms are not configured. Currently it shows that they
    fail the test, when they should state that they are unsupported.
    This bug was added in the 4.7 merge window with the addition of
    the historgram code.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJXZ/TGAAoJEKKk/i67LK/8OKEH/2pRnbWFh2EHScrhUgpnzzsn
 9BSrxsON82KZtaRIl7QOCBXO8XGKdEfRzf6nz85q6I7GghURuzoGPpJ65YTx+InL
 Ksg3TVIVPzMTRMoHQRMO6LNaX2Ks76KeyWxA8T7ib6qJFLJjHkgTYg/NE5A7cnNl
 dNdz09GpHAgRt5zfETe/oS7pfc76w6x5wWSlt7oaeBXhY3goeq7WnX+/hqX3+/QI
 fLlvJi8A8K0PY+xx9Tn/k1mn74cRuT475grHyyypWeEgo7HNU4CjLXKlZclT2hvX
 qzv7tmJwccMmEVF0mdEpCttHmnnniJd8oZg4OQK/V3DX1RLKLMEz6OFUwBmXcbw=
 =z/B5
 -----END PGP SIGNATURE-----

Merge tag 'trace-v4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt:
 "Two fixes for the tracing system:

   - When trace_printk() is used with a non constant format descriptor,
     it adds a NULL pointer into the trace format section, and the code
     isn't prepared to deal with it.  This bug appeared by a change that
     was added in v3.5.

   - The ftracetest (selftests section) can't handle testing histograms
     when histograms are not configured.  Currently it shows that they
     fail the test, when they should state that they are unsupported.
     This bug was added in the 4.7 merge window with the addition of the
     historgram code"

* tag 'trace-v4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  ftracetest: Fix hist unsupported result in hist selftests
  tracing: Handle NULL formats in hold_module_trace_bprintk_format()
This commit is contained in:
Linus Torvalds 2016-06-20 10:35:48 -07:00
Родитель 97f78c7de8 0ded5174e9
Коммит f780f00d72
4 изменённых файлов: 18 добавлений и 16 удалений

Просмотреть файл

@ -36,6 +36,10 @@ struct trace_bprintk_fmt {
static inline struct trace_bprintk_fmt *lookup_format(const char *fmt) static inline struct trace_bprintk_fmt *lookup_format(const char *fmt)
{ {
struct trace_bprintk_fmt *pos; struct trace_bprintk_fmt *pos;
if (!fmt)
return ERR_PTR(-EINVAL);
list_for_each_entry(pos, &trace_bprintk_fmt_list, list) { list_for_each_entry(pos, &trace_bprintk_fmt_list, list) {
if (!strcmp(pos->fmt, fmt)) if (!strcmp(pos->fmt, fmt))
return pos; return pos;
@ -57,7 +61,8 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)
for (iter = start; iter < end; iter++) { for (iter = start; iter < end; iter++) {
struct trace_bprintk_fmt *tb_fmt = lookup_format(*iter); struct trace_bprintk_fmt *tb_fmt = lookup_format(*iter);
if (tb_fmt) { if (tb_fmt) {
*iter = tb_fmt->fmt; if (!IS_ERR(tb_fmt))
*iter = tb_fmt->fmt;
continue; continue;
} }

Просмотреть файл

@ -23,15 +23,14 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer if [ ! -f events/sched/sched_process_fork/hist ]; then
do_reset
FEATURE=`grep hist events/sched/sched_process_fork/trigger`
if [ -z "$FEATURE" ]; then
echo "hist trigger is not supported" echo "hist trigger is not supported"
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
echo "Test histogram with execname modifier" echo "Test histogram with execname modifier"
echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger

Просмотреть файл

@ -23,15 +23,14 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer if [ ! -f events/sched/sched_process_fork/hist ]; then
do_reset
FEATURE=`grep hist events/sched/sched_process_fork/trigger`
if [ -z "$FEATURE" ]; then
echo "hist trigger is not supported" echo "hist trigger is not supported"
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
echo "Test histogram basic tigger" echo "Test histogram basic tigger"
echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger

Просмотреть файл

@ -23,15 +23,14 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer if [ ! -f events/sched/sched_process_fork/hist ]; then
do_reset
FEATURE=`grep hist events/sched/sched_process_fork/trigger`
if [ -z "$FEATURE" ]; then
echo "hist trigger is not supported" echo "hist trigger is not supported"
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
reset_trigger reset_trigger
echo "Test histogram multiple tiggers" echo "Test histogram multiple tiggers"