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-next>] [day] [month] [year] [list]
Message-Id: <20210528200432.459120-1-jarmo.tiitto@gmail.com>
Date:   Fri, 28 May 2021 23:04:32 +0300
From:   Jarmo Tiitto <jarmo.tiitto@...il.com>
To:     samitolvanen@...gle.com
Cc:     wcw@...gle.com, nathan@...nel.org, ndesaulniers@...gle.com,
        linux-kernel@...r.kernel.org, Jarmo Tiitto <jarmo.tiitto@...il.com>
Subject: [PATCH 2/6] pgo: modules Add definitions in pgo/pgo.h for modules

Add new function and struct definitions to pgo/pgo.h
Few functions are shared by the new machinery so mark them as extern.

Signed-off-by: Jarmo Tiitto <jarmo.tiitto@...il.com>
---
 kernel/pgo/fs.c  | 13 ++++++++-----
 kernel/pgo/pgo.h | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/kernel/pgo/fs.c b/kernel/pgo/fs.c
index 1678df3b7d64..575142735273 100644
--- a/kernel/pgo/fs.c
+++ b/kernel/pgo/fs.c
@@ -26,7 +26,7 @@
 #include <linux/vmalloc.h>
 #include "pgo.h"
 
-static struct dentry *directory;
+struct dentry *directory;
 
 struct prf_private_data {
 	void *buffer;
@@ -82,7 +82,7 @@ static void prf_copy_to_buffer(void **buffer, void *src, unsigned long size)
 	*buffer += size;
 }
 
-static u32 __prf_get_value_size(struct llvm_prf_data *p, u32 *value_kinds)
+u32 __prf_get_value_size(struct llvm_prf_data *p, u32 *value_kinds)
 {
 	struct llvm_prf_value_node **nodes =
 		(struct llvm_prf_value_node **)p->values;
@@ -140,7 +140,7 @@ static u32 prf_get_value_size(void)
 }
 
 /* Serialize the profiling's value. */
-static void prf_serialize_value(struct llvm_prf_data *p, void **buffer)
+void prf_serialize_value(struct llvm_prf_data *p, void **buffer)
 {
 	struct llvm_prf_value_data header;
 	struct llvm_prf_value_node **nodes =
@@ -254,7 +254,10 @@ static int prf_serialize(struct prf_private_data *p)
 	return err;
 }
 
-/* open() implementation for PGO. Creates a copy of the profiling data set. */
+/*
+ * open() implementation for PGO.
+ * Creates a copy of the profiling data set.
+ */
 static int prf_open(struct inode *inode, struct file *file)
 {
 	struct prf_private_data *data;
@@ -292,7 +295,7 @@ static ssize_t prf_read(struct file *file, char __user *buf, size_t count,
 	BUG_ON(!data);
 
 	return simple_read_from_buffer(buf, count, ppos, data->buffer,
-				       data->size);
+					   data->size);
 }
 
 /* release() implementation for PGO. Release resources allocated by open(). */
diff --git a/kernel/pgo/pgo.h b/kernel/pgo/pgo.h
index ddc8d3002fe5..a9ff51abbfd5 100644
--- a/kernel/pgo/pgo.h
+++ b/kernel/pgo/pgo.h
@@ -19,6 +19,11 @@
 #ifndef _PGO_H
 #define _PGO_H
 
+#include <linux/kernel.h>
+#include <linux/debugfs.h>
+#include <linux/fs.h>
+#include <linux/module.h>
+
 /*
  * Note: These internal LLVM definitions must match the compiler version.
  * See llvm/include/llvm/ProfileData/InstrProfData.inc in LLVM's source code.
@@ -200,4 +205,38 @@ __DEFINE_PRF_SIZE(vnds);
 
 #undef __DEFINE_PRF_SIZE
 
+/* debugfs directory */
+extern struct dentry *directory;
+
+struct prf_mod_private_data {
+	struct list_head link;
+	struct rcu_head rcu;
+
+	void *buffer;
+	unsigned long size;
+
+	char mod_name[MODULE_NAME_LEN];
+	struct module *mod;
+	struct dentry *file;
+
+	int current_node;
+};
+
+/* Mutex protecting the prf_mod_list and entries */
+extern struct mutex prf_mod_lock;
+
+/* List of modules profiled */
+extern struct list_head prf_mod_list;
+
+extern void prf_modules_init(void);
+extern void prf_modules_exit(void);
+
+/* Update each modules snapshot of the profiling data. */
+extern int prf_modules_snapshot(void);
+
+/* below funcs are required by prf_modules_snapshot() */
+extern u32 __prf_get_value_size(struct llvm_prf_data *p, u32 *value_kinds);
+
+extern void prf_serialize_value(struct llvm_prf_data *p, void **buffer);
+
 #endif /* _PGO_H */
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ