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]
Date:   Tue,  6 Sep 2016 11:49:25 -0600
From:   Shuah Khan <shuahkh@....samsung.com>
To:     rostedt@...dmis.org, mingo@...hat.com, gregkh@...uxfoundation.org
Cc:     Shuah Khan <shuahkh@....samsung.com>, linux-kernel@...r.kernel.org
Subject: [PATCH 3/3] kobject: Add calls to kobject trace points

Add calls to kobject trace points to kobject init, add, init_and_add,
create_and_add, move, set_name, rename, get, put, cleanup, and del.

Signed-off-by: Shuah Khan <shuahkh@....samsung.com>
---
 lib/kobject.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/lib/kobject.c b/lib/kobject.c
index 445dcae..97ab522 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -18,6 +18,7 @@
 #include <linux/stat.h>
 #include <linux/slab.h>
 #include <linux/random.h>
+#include <trace/events/kobject.h>
 
 /**
  * kobject_namespace - return @kobj's namespace tag
@@ -306,6 +307,9 @@ int kobject_set_name(struct kobject *kobj, const char *fmt, ...)
 	retval = kobject_set_name_vargs(kobj, fmt, vargs);
 	va_end(vargs);
 
+	if (!retval)
+		trace_kobject_set_name(kobj);
+
 	return retval;
 }
 EXPORT_SYMBOL(kobject_set_name);
@@ -343,6 +347,7 @@ void kobject_init(struct kobject *kobj, struct kobj_type *ktype)
 
 	kobject_init_internal(kobj);
 	kobj->ktype = ktype;
+	trace_kobject_init(kobj);
 	return;
 
 error:
@@ -411,6 +416,9 @@ int kobject_add(struct kobject *kobj, struct kobject *parent,
 	retval = kobject_add_varg(kobj, parent, fmt, args);
 	va_end(args);
 
+	if (!retval)
+		trace_kobject_add(kobj);
+
 	return retval;
 }
 EXPORT_SYMBOL(kobject_add);
@@ -438,6 +446,9 @@ int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype,
 	retval = kobject_add_varg(kobj, parent, fmt, args);
 	va_end(args);
 
+	if (!retval)
+		trace_kobject_init_and_add(kobj);
+
 	return retval;
 }
 EXPORT_SYMBOL_GPL(kobject_init_and_add);
@@ -494,11 +505,14 @@ int kobject_rename(struct kobject *kobj, const char *new_name)
 	dup_name = kobj->name;
 	kobj->name = name;
 
+	trace_kobject_rename(kobj, devpath);
+
 	/* This function is mostly/only used for network interface.
 	 * Some hotplug package track interfaces by their name and
 	 * therefore want to know when the name is changed by the user. */
 	kobject_uevent_env(kobj, KOBJ_MOVE, envp);
 
+
 out:
 	kfree_const(dup_name);
 	kfree(devpath_string);
@@ -553,6 +567,7 @@ int kobject_move(struct kobject *kobj, struct kobject *new_parent)
 	new_parent = NULL;
 	kobject_put(old_parent);
 	kobject_uevent_env(kobj, KOBJ_MOVE, envp);
+	trace_kobject_move(kobj, old_parent);
 out:
 	kobject_put(new_parent);
 	kobject_put(kobj);
@@ -581,6 +596,7 @@ void kobject_del(struct kobject *kobj)
 	kobj_kset_leave(kobj);
 	kobject_put(kobj->parent);
 	kobj->parent = NULL;
+	trace_kobject_del(kobj);
 }
 EXPORT_SYMBOL(kobject_del);
 
@@ -596,6 +612,7 @@ struct kobject *kobject_get(struct kobject *kobj)
 			       "initialized, yet kobject_get() is being "
 			       "called.\n", kobject_name(kobj), kobj);
 		kref_get(&kobj->kref);
+		trace_kobject_get(kobj);
 	}
 	return kobj;
 }
@@ -620,6 +637,8 @@ static void kobject_cleanup(struct kobject *kobj)
 	pr_debug("kobject: '%s' (%p): %s, parent %p\n",
 		 kobject_name(kobj), kobj, __func__, kobj->parent);
 
+	trace_kobject_cleanup(kobj);
+
 	if (t && !t->release)
 		pr_debug("kobject: '%s' (%p): does not have a release() "
 			 "function, it is broken and must be fixed.\n",
@@ -688,6 +707,8 @@ void kobject_put(struct kobject *kobj)
 			WARN(1, KERN_WARNING "kobject: '%s' (%p): is not "
 			       "initialized, yet kobject_put() is being "
 			       "called.\n", kobject_name(kobj), kobj);
+		/* call it now - kobj could get released during kref_put() */
+		trace_kobject_put(kobj);
 		kref_put(&kobj->kref, kobject_release);
 	}
 }
@@ -756,6 +777,7 @@ struct kobject *kobject_create_and_add(const char *name, struct kobject *parent)
 		kobject_put(kobj);
 		kobj = NULL;
 	}
+	trace_kobject_create_and_add(kobj);
 	return kobj;
 }
 EXPORT_SYMBOL_GPL(kobject_create_and_add);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ