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: <e0ec2448-6460-7b84-084d-f59dbd9604e5@bmw-carit.de>
Date:   Tue, 30 Aug 2016 17:02:03 +0200
From:   Daniel Wagner <daniel.wagner@...-carit.de>
To:     Steven Rostedt <rostedt@...dmis.org>,
        Binoy Jayan <binoy.jayan@...aro.org>
CC:     Ingo Molnar <mingo@...hat.com>, Arnd Bergmann <arnd@...db.de>,
        <linaro-kernel@...ts.linaro.org>, Carsten Emde <C.Emde@...dl.org>,
        Linux kernel mailing list <linux-kernel@...r.kernel.org>,
        Masami <masami.hiramatsu@...aro.org>
Subject: Re: [PATCH v3 2/3] tracing: Add trace_irqsoff tracepoints

On 08/30/2016 04:20 PM, Daniel Wagner wrote:
> Just setting the size of the type is not enough. The hist_field_* 
> getter function want to know the offset too:

With this hack here it should work. The COMM generic field is handled via
the tracing_map_ops. We could do it also there but than we need to 
a condition in the trace_map_ops if it is COMM or CPU. 
This shortcut here avoids it:

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 03c0a48..ab8958f 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -152,7 +152,8 @@ EXPORT_SYMBOL_GPL(trace_define_field);
 
 #define __generic_field(type, item, filter_type)			\
 	ret = __trace_define_field(&ftrace_generic_fields, #type,	\
-				   #item, 0, 0, is_signed_type(type),	\
+				   #item, 0, sizeof(type),		\
+				   is_signed_type(type),		\
 				   filter_type);			\
 	if (ret)							\
 		return ret;
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index f3a960e..77073b7 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -75,6 +75,11 @@ static u64 hist_field_log2(struct hist_field *hist_field, void *event)
 	return (u64) ilog2(roundup_pow_of_two(val));
 }
 
+static u64 hist_field_cpu(struct hist_field *hist_field, void *event)
+{
+	return (u64) smp_processor_id();
+}
+
 #define DEFINE_HIST_FIELD_FN(type)					\
 static u64 hist_field_##type(struct hist_field *hist_field, void *event)\
 {									\
@@ -119,6 +124,7 @@ enum hist_field_flags {
 	HIST_FIELD_FL_SYSCALL		= 128,
 	HIST_FIELD_FL_STACKTRACE	= 256,
 	HIST_FIELD_FL_LOG2		= 512,
+	HIST_FIELD_FL_CPU		= 1024,
 };
 
 struct hist_trigger_attrs {
@@ -371,6 +377,11 @@ static struct hist_field *create_hist_field(struct ftrace_event_field *field,
 		goto out;
 	}
 
+	if (flags & HIST_FIELD_FL_CPU) {
+		hist_field->fn = hist_field_cpu;
+		goto out;
+	}
+
 	if (WARN_ON_ONCE(!field))
 		goto out;
 
@@ -556,6 +567,11 @@ static int create_key_field(struct hist_trigger_data *hist_data,
 			key_size = MAX_FILTER_STR_VAL;
 		else
 			key_size = field->size;
+
+		// strcmp(field_name, "cpu") would also work to figure
+		// out if this is a one of the generic fields.
+		if (field->filter_type == FILTER_CPU)
+			flags |= HIST_FIELD_FL_CPU;
 	}
 
 	hist_data->fields[key_idx] = create_hist_field(field, flags);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ