All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] sigjmp cleanup patch (2.6)
@ 2004-02-01 13:03 M A Young
  2004-02-01 20:17 ` Jeff Dike
  0 siblings, 1 reply; 2+ messages in thread
From: M A Young @ 2004-02-01 13:03 UTC (permalink / raw)
  To: user-mode-linux-devel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 279 bytes --]

This patch cleans up the code so that the sigsetjmp calls use the correct
data type (sigjmp_buf rather than jmp_buf). This could fix a potential
bug, though I don't know of any actual bugs that this fixes. The patch is
for 2.6, though 2.4 has the same issue also.

	Michael Young

[-- Attachment #2: Type: TEXT/PLAIN, Size: 3450 bytes --]

diff -Naur linux-2.6.0/arch/um/kernel/trap_user.c.orig linux-2.6.0/arch/um/kernel/trap_user.c
--- linux-2.6.0/arch/um/kernel/trap_user.c.orig	2004-01-13 23:21:34.264491000 +0000
+++ linux-2.6.0/arch/um/kernel/trap_user.c	2004-01-13 23:22:17.054491000 +0000
@@ -121,7 +121,7 @@
 
 void do_longjmp(void *b, int val)
 {
-	jmp_buf *buf = b;
+	sigjmp_buf *buf = b;
 
 	siglongjmp(*buf, val);
 }
diff -Naur linux-2.6.0/arch/um/kernel/process.c.orig linux-2.6.0/arch/um/kernel/process.c
--- linux-2.6.0/arch/um/kernel/process.c.orig	2004-01-13 23:20:09.004491000 +0000
+++ linux-2.6.0/arch/um/kernel/process.c	2004-01-13 23:21:10.264491000 +0000
@@ -231,7 +231,7 @@
 
 int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr)
 {
-	jmp_buf buf;
+	sigjmp_buf buf;
 	int n;
 
 	*jmp_ptr = &buf;
diff -Naur linux-2.6.0/arch/um/kernel/uaccess_user.c.orig linux-2.6.0/arch/um/kernel/uaccess_user.c
--- linux-2.6.0/arch/um/kernel/uaccess_user.c.orig	2004-01-13 23:22:41.554491000 +0000
+++ linux-2.6.0/arch/um/kernel/uaccess_user.c	2004-01-13 23:23:05.964491000 +0000
@@ -18,7 +18,7 @@
 {
 	unsigned long *faddrp = (unsigned long *) fault_addr, ret;
 
-	jmp_buf jbuf;
+	sigjmp_buf jbuf;
 	*fault_catcher = &jbuf;
 	if(sigsetjmp(jbuf, 1) == 0){
 		(*op)(to, from, n);
diff -Naur linux-2.6.0/arch/um/kernel/tt/uaccess_user.c.orig linux-2.6.0/arch/um/kernel/tt/uaccess_user.c
--- linux-2.6.0/arch/um/kernel/tt/uaccess_user.c.orig	2004-01-13 23:28:28.464491000 +0000
+++ linux-2.6.0/arch/um/kernel/tt/uaccess_user.c	2004-01-13 23:29:41.244491000 +0000
@@ -72,7 +72,7 @@
 	struct tt_regs save = TASK_REGS(get_current())->tt;
 	int ret;
 	unsigned long *faddrp = (unsigned long *)fault_addr;
-	jmp_buf jbuf;
+	sigjmp_buf jbuf;
 
 	*fault_catcher = &jbuf;
 	if(sigsetjmp(jbuf, 1) == 0)
diff -Naur linux-2.6.0/arch/um/kernel/skas/process.c.orig linux-2.6.0/arch/um/kernel/skas/process.c
--- linux-2.6.0/arch/um/kernel/skas/process.c.orig	2004-01-13 23:36:10.684491000 +0000
+++ linux-2.6.0/arch/um/kernel/skas/process.c	2004-01-13 23:38:28.584491000 +0000
@@ -188,7 +188,7 @@
 void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
 		void (*handler)(int))
 {
-	jmp_buf switch_buf, fork_buf;
+	sigjmp_buf switch_buf, fork_buf;
 
 	*switch_buf_ptr = &switch_buf;
 	*fork_buf_ptr = &fork_buf;
@@ -201,7 +201,7 @@
 
 void thread_wait(void *sw, void *fb)
 {
-	jmp_buf buf, **switch_buf = sw, *fork_buf;
+	sigjmp_buf buf, **switch_buf = sw, *fork_buf;
 
 	*switch_buf = &buf;
 	fork_buf = fb;
@@ -263,23 +263,23 @@
 
 void switch_threads(void *me, void *next)
 {
-	jmp_buf my_buf, **me_ptr = me, *next_buf = next;
+	sigjmp_buf my_buf, **me_ptr = me, *next_buf = next;
 	
 	*me_ptr = &my_buf;
 	if(sigsetjmp(my_buf, 1) == 0)
 		siglongjmp(*next_buf, 1);
 }
 
-static jmp_buf initial_jmpbuf;
+static sigjmp_buf initial_jmpbuf;
 
 /* XXX Make these percpu */
 static void (*cb_proc)(void *arg);
 static void *cb_arg;
-static jmp_buf *cb_back;
+static sigjmp_buf *cb_back;
 
 int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
 {
-	jmp_buf **switch_buf = switch_buf_ptr;
+	sigjmp_buf **switch_buf = switch_buf_ptr;
 	int n;
 
 	*fork_buf_ptr = &initial_jmpbuf;
@@ -315,7 +315,7 @@
 
 void initial_thread_cb_skas(void (*proc)(void *), void *arg)
 {
-	jmp_buf here;
+	sigjmp_buf here;
 
 	cb_proc = proc;
 	cb_arg = arg;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-01 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-01 13:03 [uml-devel] sigjmp cleanup patch (2.6) M A Young
2004-02-01 20:17 ` Jeff Dike

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.