Re: [uml-devel] [PATCH 1/14] uml: fix build when SLOB is enabled

2008-08-05 Thread WANG Cong
On Fri, Aug 01, 2008 at 06:41:25PM -0400, Jeff Dike wrote:
>From 94409ded7768e15b0d0a5a172d611073c72308de Mon Sep 17 00:00:00 2001
>
>Reintroduce uml_kmalloc for the benefit of UML libc code.  The
>previous tactic of declaring __kmalloc so it could be called directly
>from the libc side of the house turned out to be getting too intimate
>with slab, and it doesn't work with slob.
>
>So, the uml_kmalloc wrapper is back.  It calls kmalloc or whatever
>that translates into, and libc code calls it.
>
>kfree is left alone since that still works, leaving a somewhat
>inconsistent API.
>
>Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
>Cc: WANG Cong <[EMAIL PROTECTED]>
>Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
>Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

Looks good. Thanks. :)


-- 
The opposite of love is not hate, but indifference.
--Elie Wiesel

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] kernel module support broken on x86-64?

2008-08-05 Thread juergen . kadidlo
Hi!

 I've compiled an UML kernel based on 2.6.25 but loading kernel modules 
seems to be broken. No matter which module I try to load the output 
looks similar to this:

 overflow in relocation type 11 val 80836d41
'loop' likely not compiled with -mcmodel=kernel

After searching for a while I found some threads from 2006 discussing 
this issue, e.g.:
http://www.mail-archive.com/user-mode-linux-devel@lists.sourceforge.net/msg03693.html
and
http://marc.info/?l=user-mode-linux-devel&m=115125101012707&w=2

As Andi Kleen has mentioned in a mail from the first thread, simply 
appending "-mcmodel=kernel" to the KBUILD_CFLAGS does not work (I tried 
it anyway and can confirm his statement ;)

Since I could not find any solution I've decided to write this mail and 
ask about the current state of this issue and of course for a solution! 
I simply don't want to believe that there is no loadable module support 
for UML in 2008...

Regards
JK

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] kernel module support broken on x86-64?

2008-08-05 Thread juergen . kadidlo

Boaz Harrosh wrote:


[EMAIL PROTECTED] wrote:
 


Hi!

I've compiled an UML kernel based on 2.6.25 but loading kernel modules 
seems to be broken. No matter which module I try to load the output 
looks similar to this:


overflow in relocation type 11 val 80836d41
'loop' likely not compiled with -mcmodel=kernel

After searching for a while I found some threads from 2006 discussing 
this issue, e.g.:

http://www.mail-archive.com/user-mode-linux-devel@lists.sourceforge.net/msg03693.html
and
http://marc.info/?l=user-mode-linux-devel&m=115125101012707&w=2

As Andi Kleen has mentioned in a mail from the first thread, simply 
appending "-mcmodel=kernel" to the KBUILD_CFLAGS does not work (I tried 
it anyway and can confirm his statement ;)


Since I could not find any solution I've decided to write this mail and 
ask about the current state of this issue and of course for a solution! 
I simply don't want to believe that there is no loadable module support 
for UML in 2008...


Regards
JK

   



Every thing is fine down here. What host Kernel-gcc-glibc / uml-gcc-glibc
are you using?

I'm using out-of-tree modules with uml for every kernel since 2.6.19.
I have both Host and UML as x86_64 on FC7 with gcc 4.1.2

Boaz

 

I'm glad to here that the bug has been fixed. Anyway, it does not work 
with my configuration:


- CentOS 5.1 as host system and UML root fs
- Kernel 2.6.25.4 (vanilla, but config taken from the CentOS kernel)
- GCC 4.1.2
- GLIBC 2.5

Regards
JK






-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] kernel module support broken on x86-64?

2008-08-05 Thread Boaz Harrosh
[EMAIL PROTECTED] wrote:
> Boaz Harrosh wrote:
>> [EMAIL PROTECTED] wrote:
>>   
>>> Hi!
>>>
>>>  I've compiled an UML kernel based on 2.6.25 but loading kernel modules 
>>> seems to be broken. No matter which module I try to load the output 
>>> looks similar to this:
>>>
>>>  overflow in relocation type 11 val 80836d41
>>> 'loop' likely not compiled with -mcmodel=kernel
>>>
>>> After searching for a while I found some threads from 2006 discussing 
>>> this issue, e.g.:
>>> http://www.mail-archive.com/user-mode-linux-devel@lists.sourceforge.net/msg03693.html
>>> and
>>> http://marc.info/?l=user-mode-linux-devel&m=115125101012707&w=2
>>>
>>> As Andi Kleen has mentioned in a mail from the first thread, simply 
>>> appending "-mcmodel=kernel" to the KBUILD_CFLAGS does not work (I tried 
>>> it anyway and can confirm his statement ;)
>>>
>>> Since I could not find any solution I've decided to write this mail and 
>>> ask about the current state of this issue and of course for a solution! 
>>> I simply don't want to believe that there is no loadable module support 
>>> for UML in 2008...
>>>
>>> Regards
>>> JK
>>>
>>> 
>>
>> Every thing is fine down here. What host Kernel-gcc-glibc / uml-gcc-glibc
>> are you using?
>>
>> I'm using out-of-tree modules with uml for every kernel since 2.6.19.
>> I have both Host and UML as x86_64 on FC7 with gcc 4.1.2
>>
>> Boaz
>>
>>   
> I'm glad to here that the bug has been fixed. Anyway, it does not work
> with my configuration:
> 
>  - CentOS 5.1 as host system and UML root fs
>  - Kernel 2.6.25.4 (vanilla, but config taken from the CentOS kernel)
>  - GCC 4.1.2
>  - GLIBC 2.5
> 
> Regards
> JK
> 

I used to run with red-hat 4.5 so this should work.
64 bit, right?

>From passed experience I've seen that UML will only
work if I first do "make ARCH=um defconfig"  and then
manually enable any needed options with make xconfig.
other wise it breaks in all kind of ways. Even doing
a make oldconfig on a good uml config file from older
kernel will not work. Try to do defconfig and see if
it loads at all.

How do you compile and run the out-of-tree module
or is it one of the built in modules?

Boaz


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] kernel module support broken on x86-64?

2008-08-05 Thread Jeff Dike
On Tue, Aug 05, 2008 at 06:37:18PM +0200, [EMAIL PROTECTED] wrote:
> I'm glad to here that the bug has been fixed. Anyway, it does not work  
> with my configuration:
>
> - CentOS 5.1 as host system and UML root fs
> - Kernel 2.6.25.4 (vanilla, but config taken from the CentOS kernel)
> - GCC 4.1.2
> - GLIBC 2.5

I'm not sure that anything was ever broken.

You are building the modules against a UML tree, with ARCH=um on the
make line?  I.e. you're not trying to load a host module into UML?

Jeff

-- 
Work email - jdike at linux dot intel dot com

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] /dev/random problems _not_ solved in 2.6.26

2008-08-05 Thread Stanislav Meduna
Jeff Dike wrote:

> If nothing else works, I suppose a nasty workaround might be to
> replace /dev/random with dev/urandom, but that has security
> implications.

I am aware of the implications, but unfortunately it did
not help either.

# ls -l /dev/*random*
crw-rw-rw- 1 root root 1, 8 2008-08-05 17:41 /dev/oldrandom
lrwxrwxrwx 1 root root7 2008-08-05 17:41 /dev/random -> urandom
crw-rw-rw- 1 root root 1, 9 2008-08-05 17:42 /dev/urandom

# grep random /var/log/auth.log
Aug  5 19:53:50 dirk sshd[3117]: fatal: Couldn't obtain random bytes (error 
604389476)

# cat /proc/sys/kernel/random/entropy_avail
335

I am now talking to the host owner - he is running quite
a few UML guests, each in chroot environment, and one of the
problems is that his entropy gets sucked out...

Now he has replaced random with urandom in my chroot jail,
so the UML's random is his urandom. Let's see what happens...

-- 
 Stano


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 2/14] uml: fix bad NTP interaction with clock

2008-08-05 Thread Jeff Dike
>From cfd28f6695d0fc047478480791a21bdd4967f98e

UML's supposed nanosecond clock interacts badly with NTP when NTP
decides that the clock has drifted ahead and needs to be slowed down.
Slowing down the clock is done by decrementing the cycle-to-nanosecond
multiplier, which is 1.  Decrementing that gives you 0 and time is
stopped.

This is fixed by switching to a microsecond clock, with a multiplier
of 1000.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Cc: WANG Cong <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/kernel/time.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index e066e84..5036c81 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -74,7 +74,7 @@ static irqreturn_t um_timer(int irq, void *dev)
 
 static cycle_t itimer_read(void)
 {
-   return os_nsecs();
+   return os_nsecs() / 1000;
 }
 
 static struct clocksource itimer_clocksource = {
@@ -82,7 +82,7 @@ static struct clocksource itimer_clocksource = {
.rating = 300,
.read   = itimer_read,
.mask   = CLOCKSOURCE_MASK(64),
-   .mult   = 1,
+   .mult   = 1000,
.shift  = 0,
.flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 12/14] [UML] fix gcc ICEs and unresolved externs

2008-08-05 Thread Jeff Dike
>From 4f81c5350b44bcc501ab6f8a089b16d064b4d2f6

There are various constraints on the use of unit-at-a-time:
 - i386 uses no-unit-at-a-time for pre-4.0 (not 4.3)
 - x86_64 uses unit-at-a-time always

Uli reported a crash on x86_64 with gcc 4.1.2 with unit-at-a-time,
resulting in commit c0a18111e571138747a98af18b3a2124df56a0d1

Ingo reported a gcc internal error with gcc 4.3 with no-unit-at-a-timem,
resulting in 22eecde2f9034764a3fd095eecfa3adfb8ec9a98

Benny Halevy is seeing extern inlines not resolved with gcc 4.3 with
no-unit-at-a-time

This patch reintroduces unit-at-a-time for gcc >= 4.0, bringing back the
possibility of Uli's crash.  If that happens, we'll debug it.

I started seeing both the internal compiler errors and unresolved
inlines on Fedora 9.  This patch fixes both problems, without so far
reintroducing the crash reported by Uli.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Cc: Benny Halevy <[EMAIL PROTECTED]>
Cc: Adrian Bunk <[EMAIL PROTECTED]>
Cc: Ingo Molnar <[EMAIL PROTECTED]>
Cc: Ulrich Drepper <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/Makefile|1 -
 arch/um/Makefile-i386   |7 +++
 arch/um/Makefile-x86_64 |3 +++
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/arch/um/Makefile b/arch/um/Makefile
index dbeab15..ca40397 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -77,7 +77,6 @@ include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
 KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask 
\
 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES))
 KBUILD_CFLAGS += $(KERNEL_DEFINES)
-KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,)
 
 PHONY += linux
 
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 561e373..302cbe5 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -32,4 +32,11 @@ cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
 # an unresolved reference.
 cflags-y += -ffreestanding
 
+# Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use
+# a lot more stack due to the lack of sharing of stacklots.  Also, gcc
+# 4.3.0 needs -funit-at-a-time for extern inline functions.
+KBUILD_CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then \
+   echo $(call cc-option,-fno-unit-at-a-time); \
+   else echo $(call cc-option,-funit-at-a-time); fi ;)
+
 KBUILD_CFLAGS += $(cflags-y)
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index 8ed362f..a9cd7e7 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -21,3 +21,6 @@ HEADER_ARCH := x86
 
 LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64
 LINK-y += -m64
+
+# Do unit-at-a-time unconditionally on x86_64, following the host
+KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 4/14] uml: track and make up lost ticks

2008-08-05 Thread Jeff Dike
>From fe2cc53ee013a4d4d0317d418e7019fe6533a5a8
Alarm delivery could be noticably late in the !CONFIG_NOHZ case because lost
ticks weren't being taken into account.  This is now treated more carefully,
with the time between ticks being calculated and the appropriate number of
ticks delivered to the timekeeping system.

Cc: Nix <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/include/process.h |4 +-
 arch/um/os-Linux/signal.c |1 +
 arch/um/os-Linux/time.c   |   54 +---
 3 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/arch/um/include/process.h b/arch/um/include/process.h
index 5af9157..348f8a3 100644
--- a/arch/um/include/process.h
+++ b/arch/um/include/process.h
@@ -8,8 +8,8 @@
 
 #include 
 
-extern void sig_handler(int sig, struct sigcontext sc);
-extern void alarm_handler(int sig, struct sigcontext sc);
+extern void sig_handler(int sig, struct sigcontext *sc);
+extern void alarm_handler(int sig, struct sigcontext *sc);
 
 #endif
 
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 3f1694b..5aade60 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -12,6 +12,7 @@
 #include "as-layout.h"
 #include "kern_util.h"
 #include "os.h"
+#include "process.h"
 #include "sysdep/barrier.h"
 #include "sysdep/sigcontext.h"
 #include "user.h"
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index e492805..bee98f4 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -9,7 +9,9 @@
 #include 
 #include 
 #include "kern_constants.h"
+#include "kern_util.h"
 #include "os.h"
+#include "process.h"
 #include "user.h"
 
 int set_interval(void)
@@ -58,12 +60,17 @@ static inline long long timeval_to_ns(const struct timeval 
*tv)
 long long disable_timer(void)
 {
struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } });
+   int remain, max = UM_NSEC_PER_SEC / UM_HZ;
 
if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0)
printk(UM_KERN_ERR "disable_timer - setitimer failed, "
   "errno = %d\n", errno);
 
-   return timeval_to_ns(&time.it_value);
+   remain = timeval_to_ns(&time.it_value);
+   if (remain > max)
+   remain = max;
+
+   return remain;
 }
 
 long long os_nsecs(void)
@@ -79,7 +86,44 @@ static int after_sleep_interval(struct timespec *ts)
 {
return 0;
 }
+
+static void deliver_alarm(void)
+{
+   alarm_handler(SIGVTALRM, NULL);
+}
+
+static unsigned long long sleep_time(unsigned long long nsecs)
+{
+   return nsecs;
+}
+
 #else
+unsigned long long last_tick;
+unsigned long long skew;
+
+static void deliver_alarm(void)
+{
+   unsigned long long this_tick = os_nsecs();
+   int one_tick = UM_NSEC_PER_SEC / UM_HZ;
+
+   if (last_tick == 0)
+   last_tick = this_tick - one_tick;
+
+   skew += this_tick - last_tick;
+
+   while (skew >= one_tick) {
+   alarm_handler(SIGVTALRM, NULL);
+   skew -= one_tick;
+   }
+
+   last_tick = this_tick;
+}
+
+static unsigned long long sleep_time(unsigned long long nsecs)
+{
+   return nsecs > skew ? nsecs - skew : 0;
+}
+
 static inline long long timespec_to_us(const struct timespec *ts)
 {
return ((long long) ts->tv_sec * UM_USEC_PER_SEC) +
@@ -102,6 +146,8 @@ static int after_sleep_interval(struct timespec *ts)
 */
if (start_usecs > usec)
start_usecs = usec;
+
+   start_usecs -= skew / UM_NSEC_PER_USEC;
tv = ((struct timeval) { .tv_sec  = start_usecs / UM_USEC_PER_SEC,
 .tv_usec = start_usecs % UM_USEC_PER_SEC });
interval = ((struct itimerval) { { 0, usec }, tv });
@@ -113,8 +159,6 @@ static int after_sleep_interval(struct timespec *ts)
 }
 #endif
 
-extern void alarm_handler(int sig, struct sigcontext *sc);
-
 void idle_sleep(unsigned long long nsecs)
 {
struct timespec ts;
@@ -126,10 +170,12 @@ void idle_sleep(unsigned long long nsecs)
 */
if (nsecs == 0)
nsecs = UM_NSEC_PER_SEC / UM_HZ;
+
+   nsecs = sleep_time(nsecs);
ts = ((struct timespec) { .tv_sec   = nsecs / UM_NSEC_PER_SEC,
  .tv_nsec  = nsecs % UM_NSEC_PER_SEC });
 
if (nanosleep(&ts, &ts) == 0)
-   alarm_handler(SIGVTALRM, NULL);
+   deliver_alarm();
after_sleep_interval(&ts);
 }
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___

[uml-devel] [PATCH 6/14] uml: deal with host time going backwards

2008-08-05 Thread Jeff Dike
>From 06e1e4ffbd1932e288839b3140cda6b8141eb684

Protection against the host's time going backwards (eg, ntp activity on
the host) by keeping track of the time at the last tick and if it's
greater than the current time, keep time stopped until the host catches
up.

Cc: Nix <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/os-Linux/time.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index bee98f4..dec5678 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -106,6 +106,10 @@ static void deliver_alarm(void)
unsigned long long this_tick = os_nsecs();
int one_tick = UM_NSEC_PER_SEC / UM_HZ;
 
+   /* Protection against the host's time going backwards */
+   if ((last_tick != 0) && (this_tick < last_tick))
+   this_tick = last_tick;
+
if (last_tick == 0)
last_tick = this_tick - one_tick;
 
@@ -148,6 +152,9 @@ static int after_sleep_interval(struct timespec *ts)
start_usecs = usec;
 
start_usecs -= skew / UM_NSEC_PER_USEC;
+   if (start_usecs < 0)
+   start_usecs = 0;
+
tv = ((struct timeval) { .tv_sec  = start_usecs / UM_USEC_PER_SEC,
 .tv_usec = start_usecs % UM_USEC_PER_SEC });
interval = ((struct itimerval) { { 0, usec }, tv });
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 8/14] missing export of csum_partial() on uml/amd64

2008-08-05 Thread Jeff Dike
>From 3e3b48e5198544dd90e27265a70c1a834139e025

From: Al Viro <[EMAIL PROTECTED]>

Signed-off-by: Al Viro <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/sys-x86_64/ksyms.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/um/sys-x86_64/ksyms.c b/arch/um/sys-x86_64/ksyms.c
index 12c5936..08f63e2 100644
--- a/arch/um/sys-x86_64/ksyms.c
+++ b/arch/um/sys-x86_64/ksyms.c
@@ -14,3 +14,4 @@ EXPORT_SYMBOL(__up_wakeup);
 
 /*XXX: we need them because they would be exported by x86_64 */
 EXPORT_SYMBOL(__memcpy);
+EXPORT_SYMBOL(csum_partial);
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 7/14] uml: deal with inaccessible address space start

2008-08-05 Thread Jeff Dike
>From 40fb16a360d9c6459afee91dc793c1e3374feb94

From: Tom Spink <[EMAIL PROTECTED]>

This patch makes os_get_task_size locate the bottom of the address space,
as well as the top.  This is for systems which put a lower limit on mmap
addresses.  It works by manually scanning pages from zero onwards until a
valid page is found.

Because the bottom of the address space may not be zero, it's not
sufficient to assume the top of the address space is the size of the
address space.  The size is the difference between the top address and
bottom address.

[EMAIL PROTECTED]: changed the name to reflect that this function is
supposed to return the top of the process address space, not its size and
changed the return value to reflect that.  Also some minor formatting
changes]
Signed-off-by: Tom Spink <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/include/os.h|2 +-
 arch/um/kernel/um_arch.c|2 +-
 arch/um/os-Linux/sys-i386/task_size.c   |   38 +++---
 arch/um/os-Linux/sys-x86_64/task_size.c |2 +-
 4 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 32c799e..2d0a2a6 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -298,6 +298,6 @@ extern int os_arch_prctl(int pid, int code, unsigned long 
*addr);
 extern int get_pty(void);
 
 /* sys-$ARCH/task_size.c */
-extern unsigned long os_get_task_size(void);
+extern unsigned long os_get_top_address(void);
 
 #endif
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 9cecb42..d1fe222 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -273,7 +273,7 @@ int __init linux_main(int argc, char **argv)
if (have_root == 0)
add_arg(DEFAULT_COMMAND_LINE);
 
-   host_task_size = os_get_task_size();
+   host_task_size = os_get_top_address();
/*
 * TASK_SIZE needs to be PGDIR_SIZE aligned or else exit_mmap craps
 * out
diff --git a/arch/um/os-Linux/sys-i386/task_size.c 
b/arch/um/os-Linux/sys-i386/task_size.c
index 48d211b..4d26d5d 100644
--- a/arch/um/os-Linux/sys-i386/task_size.c
+++ b/arch/um/os-Linux/sys-i386/task_size.c
@@ -63,7 +63,7 @@ static int page_ok(unsigned long page)
return ok;
 }
 
-unsigned long os_get_task_size(void)
+unsigned long os_get_top_address(void)
 {
struct sigaction sa, old;
unsigned long bottom = 0;
@@ -76,9 +76,9 @@ unsigned long os_get_task_size(void)
 * hosts, but shouldn't hurt otherwise.
 */
unsigned long top = 0xd000 >> UM_KERN_PAGE_SHIFT;
-   unsigned long test;
+   unsigned long test, original;
 
-   printf("Locating the top of the address space ... ");
+   printf("Locating the bottom of the address space ... ");
fflush(stdout);
 
/*
@@ -88,14 +88,32 @@ unsigned long os_get_task_size(void)
sa.sa_handler = segfault;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_NODEFER;
-   sigaction(SIGSEGV, &sa, &old);
+   if (sigaction(SIGSEGV, &sa, &old)) {
+   perror("os_get_top_address");
+   exit(1);
+   }
 
-   if (!page_ok(bottom)) {
-   fprintf(stderr, "Address 0x%x no good?\n",
-   bottom << UM_KERN_PAGE_SHIFT);
+   /* Manually scan the address space, bottom-up, until we find
+* the first valid page (or run out of them).
+*/
+   for (bottom = 0; bottom < top; bottom++) {
+   if (page_ok(bottom))
+   break;
+   }
+
+   /* If we've got this far, we ran out of pages. */
+   if (bottom == top) {
+   fprintf(stderr, "Unable to determine bottom of address "
+   "space.\n");
exit(1);
}
 
+   printf("0x%x\n", bottom << UM_KERN_PAGE_SHIFT);
+   printf("Locating the top of the address space ... ");
+   fflush(stdout);
+
+   original = bottom;
+
/* This could happen with a 4G/4G split */
if (page_ok(top))
goto out;
@@ -110,8 +128,10 @@ unsigned long os_get_task_size(void)
 
 out:
/* Restore the old SIGSEGV handling */
-   sigaction(SIGSEGV, &old, NULL);
-
+   if (sigaction(SIGSEGV, &old, NULL)) {
+   perror("os_get_top_address");
+   exit(1);
+   }
top <<= UM_KERN_PAGE_SHIFT;
printf("0x%x\n", top);
fflush(stdout);
diff --git a/arch/um/os-Linux/sys-x86_64/task_size.c 
b/arch/um/os-Linux/sys-x86_64/task_size.c
index fad6f57..26a0dd1 100644
--- a/arch/um/os-Linux/sys-x86_64/task_size.c
+++ b/arch/um/os-Linux/sys-x86_64/task_size.c
@@ -1,4 +1,4 @@
-unsigned long os_get_task_size(unsigned long shift)
+unsigned long os_get_top_address(unsigned long shift)
 {
/* The old value of CONFIG_TOP_ADDR */
   

[uml-devel] [PATCH 5/14] missed kmalloc() in pcap_user.c

2008-08-05 Thread Jeff Dike
>From 296cd66f7f6e130fe08e6880ecb13c3fc615a8db

From: Al Viro <[EMAIL PROTECTED]>

Signed-off-by: Al Viro <[EMAIL PROTECTED]>
Acked-by: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/drivers/pcap_user.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c
index e980935..5f90358 100644
--- a/arch/um/drivers/pcap_user.c
+++ b/arch/um/drivers/pcap_user.c
@@ -50,7 +50,7 @@ static int pcap_open(void *data)
return -EIO;
}
 
-   pri->compiled = kmalloc(sizeof(struct bpf_program),
+   pri->compiled = uml_kmalloc(sizeof(struct bpf_program),
UM_GFP_KERNEL);
if (pri->compiled == NULL) {
printk(UM_KERN_ERR "pcap_open : kmalloc failed\n");
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 0/14] UML 2.6.25.x patchset resend

2008-08-05 Thread Jeff Dike
Here's my 2.6.25 patchset again.  I've rebased against 2.6.25.14 and
included the correct commit ids this time.

Jeff

-- 
Work email - jdike at linux dot intel dot com

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 1/14] uml: fix build when SLOB is enabled

2008-08-05 Thread Jeff Dike
>From 43f5b3085fdd27c4edf535d938b2cb0ccead4f75

Reintroduce uml_kmalloc for the benefit of UML libc code.  The
previous tactic of declaring __kmalloc so it could be called directly
from the libc side of the house turned out to be getting too intimate
with slab, and it doesn't work with slob.

So, the uml_kmalloc wrapper is back.  It calls kmalloc or whatever
that translates into, and libc code calls it.

kfree is left alone since that still works, leaving a somewhat
inconsistent API.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Cc: WANG Cong <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/drivers/chan_user.c  |1 +
 arch/um/drivers/cow_sys.h|2 +-
 arch/um/drivers/daemon_user.c|4 ++--
 arch/um/drivers/fd.c |2 +-
 arch/um/drivers/mcast_user.c |3 ++-
 arch/um/drivers/net_user.c   |2 +-
 arch/um/drivers/port_user.c  |2 +-
 arch/um/drivers/pty.c|2 +-
 arch/um/drivers/slip_user.c  |2 +-
 arch/um/drivers/tty.c|2 +-
 arch/um/drivers/xterm.c  |2 +-
 arch/um/include/um_malloc.h  |9 +++--
 arch/um/kernel/mem.c |5 +
 arch/um/os-Linux/drivers/ethertap_user.c |4 ++--
 arch/um/os-Linux/helper.c|4 ++--
 arch/um/os-Linux/main.c  |2 +-
 arch/um/os-Linux/sigio.c |4 ++--
 17 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 0257640..cfeb3f4 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include "chan_user.h"
+#include "kern_constants.h"
 #include "os.h"
 #include "um_malloc.h"
 #include "user.h"
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h
index ca8c9e1..f5701fd 100644
--- a/arch/um/drivers/cow_sys.h
+++ b/arch/um/drivers/cow_sys.h
@@ -8,7 +8,7 @@
 
 static inline void *cow_malloc(int size)
 {
-   return kmalloc(size, UM_GFP_KERNEL);
+   return uml_kmalloc(size, UM_GFP_KERNEL);
 }
 
 static inline void cow_free(void *ptr)
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index f23c109..f8e85e0 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -34,7 +34,7 @@ static struct sockaddr_un *new_addr(void *name, int len)
 {
struct sockaddr_un *sun;
 
-   sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
+   sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
if (sun == NULL) {
printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
   "failed\n");
@@ -83,7 +83,7 @@ static int connect_to_switch(struct daemon_data *pri)
goto out_close;
}
 
-   sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
+   sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
if (sun == NULL) {
printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
   "failed\n");
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
index 0a2bb5b..f5a981a 100644
--- a/arch/um/drivers/fd.c
+++ b/arch/um/drivers/fd.c
@@ -40,7 +40,7 @@ static void *fd_init(char *str, int device, const struct 
chan_opts *opts)
return NULL;
}
 
-   data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
+   data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
if (data == NULL)
return NULL;
 
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
index 5f647d7..ee19e91 100644
--- a/arch/um/drivers/mcast_user.c
+++ b/arch/um/drivers/mcast_user.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include "kern_constants.h"
 #include "mcast.h"
 #include "net_user.h"
 #include "um_malloc.h"
@@ -24,7 +25,7 @@ static struct sockaddr_in *new_addr(char *addr, unsigned 
short port)
 {
struct sockaddr_in *sin;
 
-   sin = kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
+   sin = uml_kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
if (sin == NULL) {
printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in "
   "failed\n");
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index abf2653..9415dd9 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -222,7 +222,7 @@ static void change(char *dev, char *what, unsigned char 
*addr,
netmask[2], netmask[3]);
 
output_len = UM_KERN_PAGE_SIZE;
-   output = kmalloc(output_len, UM_GFP_KERNEL);
+   output = uml_kmalloc(output_len, UM_GFP_KERNEL);
if (output == NULL)
printk(UM_KERN_ERR "change : failed to allocate output "
   "buff

[uml-devel] [PATCH 11/14] uml: work around broken host PTRACE_SYSEMU

2008-08-05 Thread Jeff Dike
>From f1ef9167ca4494a8c6d71d0031c73e9c8841eadd

Fedora broke PTRACE_SYSEMU again, and UML crashes as a result when it
doesn't need to.  This patch makes the PTRACE_SYSEMU check fail gracefully
and makes UML fall back to PTRACE_SYSCALL.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/os-Linux/start_up.c |   25 -
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index b616e15..fd71bdb 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -122,8 +122,10 @@ static int stop_ptraced_child(int pid, int exitcode, int 
mustexit)
 {
int status, n, ret = 0;
 
-   if (ptrace(PTRACE_CONT, pid, 0, 0) < 0)
-   fatal_perror("stop_ptraced_child : ptrace failed");
+   if (ptrace(PTRACE_CONT, pid, 0, 0) < 0) {
+   perror("stop_ptraced_child : ptrace failed");
+   return -1;
+   }
CATCH_EINTR(n = waitpid(pid, &status, 0));
if (!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) {
int exit_with = WEXITSTATUS(status);
@@ -203,7 +205,7 @@ static void __init check_sysemu(void)
if (n < 0)
fatal_perror("check_sysemu : wait failed");
if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
-   fatal("check_sysemu : expected SIGTRAP, got status = %d",
+   fatal("check_sysemu : expected SIGTRAP, got status = %d\n",
  status);
 
if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
@@ -245,9 +247,11 @@ static void __init check_sysemu(void)
 
if (WIFSTOPPED(status) &&
(WSTOPSIG(status) == (SIGTRAP|0x80))) {
-   if (!count)
-   fatal("check_ptrace : SYSEMU_SINGLESTEP "
- "doesn't singlestep");
+   if (!count) {
+   non_fatal("check_ptrace : SYSEMU_SINGLESTEP "
+ "doesn't singlestep");
+   goto fail;
+   }
n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET,
   os_getpid());
if (n < 0)
@@ -257,9 +261,12 @@ static void __init check_sysemu(void)
}
else if (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGTRAP))
count++;
-   else
-   fatal("check_ptrace : expected SIGTRAP or "
- "(SIGTRAP | 0x80), got status = %d", status);
+   else {
+   non_fatal("check_ptrace : expected SIGTRAP or "
+ "(SIGTRAP | 0x80), got status = %d\n",
+ status);
+   goto fail;
+   }
}
if (stop_ptraced_child(pid, 0, 0) < 0)
goto fail_stopped;
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 13/14] UML - Fix boot crash

2008-08-05 Thread Jeff Dike
>From 7c1fed03b9fa32d4323d5caa6a9c7dcdd7eba767

My copying of linux/init.h didn't go far enough.  The definition of
__used singled out gcc minor version 3, but didn't care what the major
version was.  This broke when unit-at-a-time was added and gcc started
throwing out initcalls.

This results in an early boot crash when ptrace tries to initialize a
process with an empty, uninitialized register set.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/include/init.h |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/um/include/init.h b/arch/um/include/init.h
index b00a957..37dd097 100644
--- a/arch/um/include/init.h
+++ b/arch/um/include/init.h
@@ -45,6 +45,8 @@ typedef void (*exitcall_t)(void);
 # define __section(S) __attribute__ ((__section__(#S)))
 #endif
 
+#if __GNUC__ == 3
+
 #if __GNUC_MINOR__ >= 3
 # define __used__attribute__((__used__))
 #else
@@ -52,6 +54,12 @@ typedef void (*exitcall_t)(void);
 #endif
 
 #else
+#if __GNUC__ == 4
+# define __used__attribute__((__used__))
+#endif
+#endif
+
+#else
 #include 
 #endif
 /* These are for everybody (although not all archs will actually
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 14/14] uml: PATH_MAX needs limits.h

2008-08-05 Thread Jeff Dike
>From b6d8adf477439e7086224bc9674c6b6638780783

From: Ingo Molnar <[EMAIL PROTECTED]>

Include limits.h to get a definition of PATH_MAX.

Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/os-Linux/helper.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index 679acce..b6b1096 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "kern_constants.h"
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 3/14] uml: physical memory shouldn't include initial stack

2008-08-05 Thread Jeff Dike
>From 60a2988aea701a6424809a5432bf068667aac177

The top of physical memory should be below the initial process stack, not the
top of the address space, at least for as long as the stack isn't known to the
kernel VM system and appropriately reserved.

Cc: "Christopher S. Aker" <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Cc: WANG Cong <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/kernel/um_arch.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index a6c1dd1..9cecb42 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -259,6 +259,7 @@ int __init linux_main(int argc, char **argv)
unsigned long avail, diff;
unsigned long virtmem_size, max_physmem;
unsigned int i, add;
+   unsigned long stack;
char * mode;
 
for (i = 1; i < argc; i++) {
@@ -347,7 +348,9 @@ int __init linux_main(int argc, char **argv)
}
 
virtmem_size = physmem_size;
-   avail = TASK_SIZE - start_vm;
+   stack = (unsigned long) argv;
+   stack &= ~(1024 * 1024 - 1);
+   avail = stack - start_vm;
if (physmem_size > avail)
virtmem_size = avail;
end_vm = start_vm + virtmem_size;
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 9/14] uml: memcpy export needs to follow host declaration

2008-08-05 Thread Jeff Dike
>From 8bfd04b974689f700bbd053ad6e66b0a95fb80c9

x86_64 defines either memcpy or __memcpy depending on the gcc version, and
it looks like UML needs to follow that in its exporting.

Cc: Gabriel C <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/sys-x86_64/ksyms.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/um/sys-x86_64/ksyms.c b/arch/um/sys-x86_64/ksyms.c
index 08f63e2..467879a 100644
--- a/arch/um/sys-x86_64/ksyms.c
+++ b/arch/um/sys-x86_64/ksyms.c
@@ -13,5 +13,9 @@ EXPORT_SYMBOL(__down_failed_trylock);
 EXPORT_SYMBOL(__up_wakeup);
 
 /*XXX: we need them because they would be exported by x86_64 */
+#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
+EXPORT_SYMBOL(memcpy);
+#else
 EXPORT_SYMBOL(__memcpy);
+#endif
 EXPORT_SYMBOL(csum_partial);
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 10/14] uml: stub needs to tolerate SIGWINCH

2008-08-05 Thread Jeff Dike
>From 3d5ede6f776bdb1483bcd086f79c3bf41fed3865

We lost the marking of SIGWINCH as being OK to receive during stub
execution, causing a panic should that happen.

Cc: Benedict Verheyen <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/um/os-Linux/skas/process.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 1e8cba6..2328098 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -55,7 +55,7 @@ static int ptrace_dump_regs(int pid)
  * Signals that are OK to receive in the stub - we'll just continue it.
  * SIGWINCH will happen when UML is inside a detached screen.
  */
-#define STUB_SIG_MASK (1 << SIGVTALRM)
+#define STUB_SIG_MASK ((1 << SIGVTALRM) | (1 << SIGWINCH))
 
 /* Signals that the stub will finish with - anything else is an error */
 #define STUB_DONE_MASK (1 << SIGTRAP)
-- 
1.5.5.1


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] /dev/random problems _not_ solved in 2.6.26

2008-08-05 Thread Brock, Anthony - NET
> -Original Message-
> I am aware of the implications, but unfortunately it did
> not help either.
> 
> # ls -l /dev/*random*
> crw-rw-rw- 1 root root 1, 8 2008-08-05 17:41 /dev/oldrandom
> lrwxrwxrwx 1 root root7 2008-08-05 17:41 /dev/random -> urandom
> crw-rw-rw- 1 root root 1, 9 2008-08-05 17:42 /dev/urandom
> 
> # grep random /var/log/auth.log
> Aug  5 19:53:50 dirk sshd[3117]: fatal: Couldn't obtain random bytes
> (error 604389476)
> 
> # cat /proc/sys/kernel/random/entropy_avail
> 335
> 
> I am now talking to the host owner - he is running quite
> a few UML guests, each in chroot environment, and one of the
> problems is that his entropy gets sucked out...
> 
> Now he has replaced random with urandom in my chroot jail,
> so the UML's random is his urandom. Let's see what happens...

Please keep me appraised of what you find. Our servers never had this
problem until upgrading to a 2.6.2x version of the kernel. SSHD, Apache
and several other software packages worked fine under previous versions
(and still do when we downgrade them). Its also worth noting that this
behavior has never been exhibited on the host system. We've only seen it
on our virtual systems.

I keep meaning to go back and search for exactly which version
introduced the changed behavior, but I don't have time. Instead we now
have scripts that automatically restart processes that use OpenSSL when
they die. We tried shifting to urandom earlier to see if it would
resolve the issue, but didn't see a change in behavior. I'm interested
in knowing if your approach will function better.

Tony


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel