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: <20181017223332.11964-6-linux@rasmusvillemoes.dk>
Date:   Thu, 18 Oct 2018 00:33:26 +0200
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     linux-kernel@...r.kernel.org
Cc:     x86@...nel.org, "H . Peter Anvin" <hpa@...or.com>,
        Ingo Molnar <mingo@...nel.org>,
        "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: [POC 06/12] ugly ugly hack

Just to have a quick way of seeing that rai-patching works (i.e., once
we implement rai_load, we'd not expect the output to change). Also,
inside virtme we can do a quick "gdb vmlinux /proc/kcode" and
disassemble rai_proc_show to see how the patched function looks.

Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
---
 arch/x86/kernel/rai.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/arch/x86/kernel/rai.c b/arch/x86/kernel/rai.c
index 2c6ff06f7a34..819d03a025e3 100644
--- a/arch/x86/kernel/rai.c
+++ b/arch/x86/kernel/rai.c
@@ -37,3 +37,43 @@ update_rai_access(void)
 	rai_patch(__start_rai_data, __stop_rai_data);
 	mutex_unlock(&text_mutex);
 }
+
+#if 1
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+
+static int one, two;
+static long three;
+
+static int
+rai_proc_show(struct seq_file *m, void *v) {
+	seq_printf(m, "one: %d, two: %d, three: %ld\n",
+		   rai_load(one), rai_load(two), rai_load(three));
+	one = two = three = -1;
+
+	return 0;
+}
+
+static int
+rai_proc_open(struct inode *inode, struct  file *file) {
+	return single_open(file, rai_proc_show, NULL);
+}
+
+static const struct file_operations rai_proc_fops = {
+	.owner = THIS_MODULE,
+	.open = rai_proc_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+};
+
+static int __init rai_proc_init(void) {
+	one = 1;
+	two = 2;
+	three = 3;
+
+	proc_create("rai", 0, NULL, &rai_proc_fops);
+	return 0;
+}
+late_initcall(rai_proc_init);
+#endif
-- 
2.19.1.6.gbde171bbf5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ