Skip to contentSkip to conversation

Fix compilation of UML after the stack-randomization patches

PATCH Frank Sorenson 3 participants 3 messages Feb 4, 2005 – Feb 7, 2005 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

The stack randomization patches that went into 2.6.11-rc3-mm1 broke compilation of ARCH=um. This patch fixes compiling by adding arch_align_stack back in.

Frank

Signature · 4 lines
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
[email protected]
arch/um/kernel/process_kern.c +9 -0
diff -Naur linux-2.6.11-rc3-mm1_bak/arch/um/kernel/process_kern.c linux-2.6.11-rc3-mm1/arch/um/kernel/process_kern.c
@@ -21,6 +21,7 @@
 #include "linux/spinlock.h"
 #include "linux/proc_fs.h"
 #include "linux/ptrace.h"
+#include "linux/random.h"
 #include "asm/unistd.h"
 #include "asm/mman.h"
 #include "asm/segment.h"
@@ -479,6 +480,14 @@
 	return 2;
 }
 
+unsigned long arch_align_stack(unsigned long sp)
+{
+	if (randomize_va_space)
+		sp -= get_random_int() % 8192;
+	return sp & ~0xf;
+}
+
+
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
  * Emacs will notice this stuff at the end of the file and automatically
#1 lore raw
Quoted 6 lines · Frank Sorenson

The stack randomization patches that went into 2.6.11-rc3-mm1 broke compilation of ARCH=um. This patch fixes compiling by adding arch_align_stack back in.

I've just spotted that if the function is arch-dependent it means that for us it will be subarch-dependant.

I've the doubt that the addition would better go under sys-i386 or some other subarch-dependent directories (in a file compiled against kernelspace headers, i.e. not listed in USER_OBJS in the directory it's contained inside), and it'd be nice to add also the x86_64 version.

Signature · 17 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade





-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw
Quoted 5 lines · [email protected] said:

I've the doubt that the addition would better go under sys-i386 or some other subarch-dependent directories (in a file compiled against kernelspace headers, i.e. not listed in USER_OBJS in the directory it's contained inside), and it'd be nice to add also the x86_64 version.

Yes, good point.

Jeff

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel