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: <9db918711d1108cc89f991e2494f58d60cbd2555.1221282535.git.jbarnold@mit.edu>
Date:	Sat, 13 Sep 2008 01:14:44 -0400
From:	Jeffrey Brian Arnold <jbarnold@....EDU>
To:	linux-kernel@...r.kernel.org
Cc:	Tim Abbott <tabbott@....edu>, Anders Kaseorg <andersk@....edu>,
	Waseem Daher <wdaher@....edu>,
	Denys Vlasenko <vda.linux@...glemail.com>
Subject: [RFC v2 PATCH 8/9] Ksplice: ARM support

Add support for Ksplice on ARM.

Signed-off-by: Jeffrey Brian Arnold <jbarnold@....edu>
Signed-off-by: Anders Kaseorg <andersk@....edu>
Signed-off-by: Tim Abbott <tabbott@....edu>
---
 arch/arm/Kconfig               |    1 +
 arch/arm/kernel/ksplice-arch.c |   79 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/kernel/ksplice-arch.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 70dba16..e73f205 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -14,6 +14,7 @@ config ARM
 	select HAVE_OPROFILE
 	select HAVE_ARCH_KGDB
 	select HAVE_KPROBES if (!XIP_KERNEL)
+	select HAVE_KSPLICE if (!XIP_KERNEL)
 	select HAVE_KRETPROBES if (HAVE_KPROBES)
 	select HAVE_FTRACE if (!XIP_KERNEL)
 	select HAVE_DYNAMIC_FTRACE if (HAVE_FTRACE)
diff --git a/arch/arm/kernel/ksplice-arch.c b/arch/arm/kernel/ksplice-arch.c
new file mode 100644
index 0000000..981cf75
--- /dev/null
+++ b/arch/arm/kernel/ksplice-arch.c
@@ -0,0 +1,79 @@
+/*  Copyright (C) 2007-2008  Jeffrey Brian Arnold <jbarnold@....edu>
+ *  Copyright (C) 2008  Anders Kaseorg <andersk@....edu>,
+ *                      Tim Abbott <tabbott@....edu>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License, version 2.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+ *  02110-1301, USA.
+ */
+
+#include <linux/thread_info.h>
+#define KSPLICE_IP(x) thread_saved_pc(x)
+#define KSPLICE_SP(x) thread_saved_fp(x)
+
+static const struct ksplice_symbol trampoline_symbol = {
+	.name = NULL,
+	.label = "<trampoline>",
+};
+
+static const struct ksplice_reloc trampoline_reloc = {
+	.symbol = &trampoline_symbol,
+	.pcrel = 1,
+	.addend = -8,
+	.size = 4,
+	.dst_mask = 0x00ffffffL,
+	.rightshift = 2,
+	.signed_addend = 1,
+};
+
+static abort_t trampoline_target(struct ksplice_pack *pack, unsigned long addr,
+				 unsigned long *new_addr)
+{
+	abort_t ret;
+	uint32_t word;
+	if (probe_kernel_read(&word, (void *)addr, sizeof(word)) == -EFAULT)
+		return NO_MATCH;
+
+	if ((word & 0xff000000) != 0xea000000)
+		return NO_MATCH;
+
+	ret = read_reloc_value(pack, &trampoline_reloc, addr, new_addr);
+	if (ret != OK)
+		return ret;
+
+	*new_addr += addr;
+	return OK;
+}
+
+static abort_t prepare_trampoline(struct ksplice_pack *pack,
+				  struct ksplice_trampoline *t)
+{
+	t->size = 4;
+	*(uint32_t *)t->trampoline = 0xea000000;
+	return write_reloc_value(pack, &trampoline_reloc,
+				 (unsigned long)t->trampoline,
+				 t->repladdr - t->oldaddr);
+}
+
+static abort_t handle_paravirt(struct ksplice_pack *pack,
+			       unsigned long pre_addr, unsigned long run_addr,
+			       int *matched)
+{
+	*matched = 0;
+	return OK;
+}
+
+static bool valid_stack_ptr(const struct thread_info *tinfo, const void *p)
+{
+	return p > (const void *)tinfo
+	    && p <= (const void *)tinfo + THREAD_SIZE - sizeof(long);
+}
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ