Re: [uml-devel] Re: TLS support - status - need for re-testing

2006-03-24 Thread Antoine Martin
On Thu, 2006-03-23 at 20:51 -0500, Jeff Dike wrote:
> On Fri, Mar 24, 2006 at 12:44:05AM +0100, Blaisorblade wrote:
> > Yes, that is true, but meanwhile give a testing to them, especially 
> > regressio
> > test the new patches. I can't merge new patches in until I'm sure they 
> > don't 
> > cause regressions.
> 
> OK, I give it a thumbs-up on a first boot - it's running my FC5
> filesystem without any trouble.  I'll keep playing with it and let you
> know of any trouble.
I haven't been able to run FC4/FC5 x86 filesystems with any of the
patches floating around. (on amd64 host)

> Attached is a tarball of the patches merged after the patches I have
> planned for 2.6.17.  Nothing major, just some fuzz, some Makefile
> rejections, and rejections from some whitespace cleanup in
> kernel/skas/process_kern.c.
I couldn't figure out in which order I need to apply these (no series
file) and I've ran out of time.

Antoine


signature.asc
Description: This is a digitally signed message part


Re: [uml-devel] Re: TLS support - status - need for re-testing

2006-03-24 Thread Blaisorblade
On Friday 24 March 2006 05:17, Jeff Dike wrote:
> On Fri, Mar 24, 2006 at 12:44:05AM +0100, Blaisorblade wrote:
> > Yes, that is true, but meanwhile give a testing to them, especially
> > regression test the new patches. I can't merge new patches in until
> > I'm sure they don't cause regressions.
>
> I took a quick look through the patches - here are some comments:
>
> uml-clean-arch_switch -
>
> This chunk is strange:
>
> @@ -141,7 +148,6 @@ static void new_thread_handler(int sig)
>   set_cmdline("(kernel thread)");
>
>   change_sig(SIGUSR1, 1);
> - change_sig(SIGVTALRM, 1);
>   change_sig(SIGPROF, 1);
>   local_irq_enable();
>   if(!run_kernel_thread(fn, arg, ¤t->thread.exec_buf))
>
> If you're fixing a bug, you should say what it is.

We discussed this time ago, and read the description of the patch:

# Also, as suggested by Jeff, remove a redundant enabling of SIGVTALRM,
# comprised in the subsequent local_irq_enable(). I'm just a bit dubious if
# ordering matters there...

Note this pre-dates soft interrupts, however.

> uml-add-tls-support -

> copy_thread - OK for now, but we should move the CLONE_TLS bit into
> arch code.

> arch_ptrace - Do all arches have PTRACE_[GS]ET_THREAD_AREA, maybe move
> inside an ifdef PTRACE_GET_THREAD_AREA

No, only x86. x86_64 already is different (supports that only for emulated 
processes).

> Any patches that change new files should be merged into this, I
> think.  That basically means that the stack will mostly collapse into
> this one patch.  I didn't see any patches which add new bits of
> functionality which would make sense standalone.

> global-ldt-sem - We should be using mutexes now, not semaphores

That's your patch, but below I drop this.

> detect-2_4-host - is there no more direct way to detect TLS support?

Yes, there is. I'll fix this when I do x86/x86_64 host distinction.

> undo-global-ldt-sem - what's so horrible about the global?  it won't
> be highly contended, so making a single mutex saves memory from every
> ldt.

For memory: 500 existing processes (a huge number in practice) * 20 byte (and 
I think a semaphore is smaller) = 10 Kbyte. We waste more for the kernel 
stack of 1 thread.

For reason: the compilation problem can be avoided differently (and the 
subsequent patch also merges duplicated code).

I didn't like global_ldt_sem because I felt it unclean; if done for memory 
usage it's another story, but still we need to check this creates no locking 
problem (almost surely no, but I want to look at the code well).
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade





___ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] Re: TLS support - status - need for re-testing

2006-03-24 Thread Blaisorblade
On Friday 24 March 2006 02:51, Jeff Dike wrote:
> On Fri, Mar 24, 2006 at 12:44:05AM +0100, Blaisorblade wrote:
> > Yes, that is true, but meanwhile give a testing to them, especially
> > regressio test the new patches. I can't merge new patches in until I'm
> > sure they don't cause regressions.

> OK, I give it a thumbs-up on a first boot - it's running my FC5
> filesystem without any trouble.  I'll keep playing with it and let you
> know of any trouble.

With the x86-64 host hack, it works here too.

To do good stress-testing, I've actually noticed the existing problems when I 
started running apache benchmark (with apache using multithreading, i.e. 
mpm_worker_thread).

I run it like:

ab2 -n 100 -c 10 -t 30 -v 1 Sarge/

where -n, -c and -t are simple parameters which can be tuned at will. (It 
could be simply ab on your distro).

> Attached is a tarball of the patches merged after the patches I have
> planned for 2.6.17.  Nothing major, just some fuzz, some Makefile
> rejections, and rejections from some whitespace cleanup in
> kernel/skas/process_kern.c.

Will look at.
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade


___ 
Yahoo! Messenger with Voice: chiama da PC a telefono a tariffe esclusive 
http://it.messenger.yahoo.com



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] Re: TLS support - status - need for re-testing

2006-03-24 Thread Blaisorblade
On Friday 24 March 2006 11:39, Antoine Martin wrote:
> On Thu, 2006-03-23 at 20:51 -0500, Jeff Dike wrote:
> > On Fri, Mar 24, 2006 at 12:44:05AM +0100, Blaisorblade wrote:
> > > Yes, that is true, but meanwhile give a testing to them, especially
> > > regressio test the new patches. I can't merge new patches in until I'm
> > > sure they don't cause regressions.
> >
> > OK, I give it a thumbs-up on a first boot - it's running my FC5
> > filesystem without any trouble.  I'll keep playing with it and let you
> > know of any trouble.
>
> I haven't been able to run FC4/FC5 x86 filesystems with any of the
> patches floating around. (on amd64 host)

I can inform you it's not FC4/FC5 but it's the amd64 host.

I missed this because I hadn't time for proper tests before, however:

add on top of 2.6.15-bb6 the attached patch. (It should more or less work 
against any other tls patchset, but I tested it like this).

Don't compile the resulting kernel for x86, and don't run the UML you get on 
x86 host!

As you can see (it touches include/asm-i386 only), this patch is an quick hack 
made for testing, but I know how to fix it, and I'm going to code it.

> > Attached is a tarball of the patches merged after the patches I have
> > planned for 2.6.17.  Nothing major, just some fuzz, some Makefile
> > rejections, and rejections from some whitespace cleanup in
> > kernel/skas/process_kern.c.

> I couldn't figure out in which order I need to apply these (no series
> file) and I've ran out of time.
Guess it's -bb6 series file (or I won't be able to apply them).
> Antoine

-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
Only for testing on x86_64 hosts.

Index: linux-2.6.15/include/asm-i386/segment.h
===
--- linux-2.6.15.orig/include/asm-i386/segment.h
+++ linux-2.6.15/include/asm-i386/segment.h
@@ -46,7 +46,7 @@
  *  31 - TSS for double fault handler
  */
 #define GDT_ENTRY_TLS_ENTRIES	3
-#define GDT_ENTRY_TLS_MIN	6
+#define GDT_ENTRY_TLS_MIN	12
 #define GDT_ENTRY_TLS_MAX 	(GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1)
 
 #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8)


[uml-devel] Re: (implementation idea) Re: uml and nonstandard memory splits?

2006-03-24 Thread Blaisorblade
On Friday 24 March 2006 03:30, Jeff Dike wrote:
> On Fri, Mar 24, 2006 at 01:56:32AM +0100, Blaisorblade wrote:
> > I don't think it's easy - however, it can be done. Below my idea - Jeff,
> > please comment on this

> > In assembly.
> > It goes like this:

> > call label /*this is coded like a relative jump, i.e. call +1*/
> > label: pop $eax /*we got the saved EIP*/
> >
> > /* Now we can round EIP and subtract an offset to calculate the data page
> > location.
> > */

> How does this give us the location of the data page?

The EIP is inside the stub code page, and the two pages are one near the 
other.

> You really want to know the end of the process address space, which
> you can do by taking the address of a convenient local and rounding up
> to the nearest 1G or .5G or so.

You can't do that in the stub; however, what you suggest or something similar 
is probably needed outside the stub, from the kernel code, when you need to 
map it somewhere inside the process memory.

However, currently, the rounding can't be 0.5G, it must be 0.25G with the 
current code, and it's still fragile if the host code is changed.

(arch/i386/Kconfig)
config PAGE_OFFSET
hex
default 0xB000 if VMSPLIT_3G_OPT
default 0x7800 if VMSPLIT_2G
default 0x4000 if VMSPLIT_1G
default 0xC000

-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade





___ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] Resend: how to debug module on UML kernel 2.6.15.6 + SKAS mode?

2006-03-24 Thread Blaisorblade
On Friday 24 March 2006 04:25, Mikado wrote:
> - How can I debug loadable modules at run time?
>
> Here is my way:
>
>   ( /tmp/mymodule.ko exists on both [Host] and [UML] )
>   + [Host] # gdb linux
>   + [Host] (gdb) ...
>   + [Host] (gdb) r 
>   + [UML] # insmod /tmp/mymodule.ko
>   + [UML] # cat /sys/module/mymodule/sections/{.text,.bss,.data}
>   + [Host] (gdb) add-symbol-file /tmp/mymodule.ko <.text_addr> -s .bss
> <.bss_addr> -s .data <.data_addr>
>   + ...
>
> Tell me if I was wrong, thanks!
>
> - How can I set breakpoint at module's init function?
>
> After add module's symbol, I set breakpoint at init function then
> 'rmmod' then re-'insmod' but gdb didn't break at init function. What was
> wrong?

gdb modifies the program code to set breakpoints, but the code is reloaded on 
module reload.

So, break on the caller of the module init function, and step from there. 
Maybe Bahi's mail refers to 2.4, I'm not sure, but the concepts are the same.

Most module-related code is in kernel/module.c, as for instance
static LIST_HEAD(modules);

which is the new name for module_list.

> - Sometimes gdb can't follow source codes in '.h' header files. Did I
> miss something?

What happens? Maybe gdb is stepping there but the calls are inlined and it's 
not apparent that it's looking at source code. However I've not clear what 
you describe, anyway.
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade




___ 
Yahoo! Messenger with Voice: chiama da PC a telefono a tariffe esclusive 
http://it.messenger.yahoo.com



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] Re: (implementation idea) Re: uml and nonstandard memory splits?

2006-03-24 Thread Jason Lunz
[EMAIL PROTECTED] said:
> However, currently, the rounding can't be 0.5G, it must be 0.25G with the 
> current code, and it's still fragile if the host code is changed.
>
> (arch/i386/Kconfig)
> config PAGE_OFFSET
> hex
> default 0xB000 if VMSPLIT_3G_OPT
> default 0x7800 if VMSPLIT_2G
> default 0x4000 if VMSPLIT_1G
> default 0xC000

Yes, I don't think other choices are too unlikely in the future.
0xB000 was only chosen because it prevents a typical 32-bit machine
with 1G of ram from having 1/8 of it in a little 128M highmem zone. In
the future, "typical" could likely be something else.

Jason



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] Re: TLS support - status - need for re-testing

2006-03-24 Thread Jeff Dike
On Fri, Mar 24, 2006 at 12:43:33PM +0100, Blaisorblade wrote:
> We discussed this time ago, and read the description of the patch:
> 
> # Also, as suggested by Jeff, remove a redundant enabling of SIGVTALRM,
> # comprised in the subsequent local_irq_enable(). I'm just a bit dubious if
> # ordering matters there...

Oops, nevermind.

> Note this pre-dates soft interrupts, however.

Shouldn't matter.

> > global-ldt-sem - We should be using mutexes now, not semaphores
> 
> That's your patch, but below I drop this.

My patch predates mutexes.

But you still use semaphores, and that should be updated.

> > undo-global-ldt-sem - what's so horrible about the global?  it won't
> > be highly contended, so making a single mutex saves memory from every
> > ldt.
> 
> For memory: 500 existing processes (a huge number in practice) * 20 byte (and
> I think a semaphore is smaller) = 10 Kbyte. We waste more for the kernel 
> stack of 1 thread.
> 
> For reason: the compilation problem can be avoided differently (and the 
> subsequent patch also merges duplicated code).
> 
> I didn't like global_ldt_sem because I felt it unclean; if done for memory 
> usage it's another story, but still we need to check this creates no locking 
> problem (almost surely no, but I want to look at the code well).

It's simpler.  A single global lock is simpler than a lock in every 
datastructure.

Jeff



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] Re: (implementation idea) Re: uml and nonstandard memory splits?

2006-03-24 Thread Jeff Dike
On Fri, Mar 24, 2006 at 03:34:01PM +0100, Blaisorblade wrote:
> The EIP is inside the stub code page, and the two pages are one near the 
> other.

I think you're going to have to talk more slowly and use shorter words.

The problem is that we need to figure out at runtime where to put the
stub pages, correct?  And we can't use the code stub page to figure out 
where it is, because we haven't mapped it yet, because we don't know where
to put it, correct?

> However, currently, the rounding can't be 0.5G, it must be 0.25G with the 
> current code, and it's still fragile if the host code is changed.
> 
> (arch/i386/Kconfig)
> config PAGE_OFFSET
> hex
> default 0xB000 if VMSPLIT_3G_OPT
> default 0x7800 if VMSPLIT_2G
> default 0x4000 if VMSPLIT_1G
> default 0xC000

How much can stack randomization vary?  If it can vary more than the
split varies, which I would expect, then rounding the stack pointer
isn't going to work.

Another approach is to start with the current top of stack and try
mapping pages at increments equal to the smallest split granularity
that we think we are going to see, until one fails.

Jeff


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 4/16] UML - Move libc-dependent irq code to os-Linux

2006-03-24 Thread Jeff Dike
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves all systemcalls from irq_user.c file under os-Linux dir

Signed-off-by: Gennady Sharapov <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.16/arch/um/include/irq_user.h
===
--- linux-2.6.16.orig/arch/um/include/irq_user.h2006-03-23 
18:40:30.0 -0500
+++ linux-2.6.16/arch/um/include/irq_user.h 2006-03-23 18:52:10.0 
-0500
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2001, 2002 Jeff Dike ([EMAIL PROTECTED])
  * Licensed under the GPL
  */
@@ -6,6 +6,17 @@
 #ifndef __IRQ_USER_H__
 #define __IRQ_USER_H__
 
+struct irq_fd {
+   struct irq_fd *next;
+   void *id;
+   int fd;
+   int type;
+   int irq;
+   int pid;
+   int events;
+   int current_events;
+};
+
 enum { IRQ_READ, IRQ_WRITE };
 
 extern void sigio_handler(int sig, union uml_pt_regs *regs);
@@ -16,8 +27,6 @@ extern void reactivate_fd(int fd, int ir
 extern void deactivate_fd(int fd, int irqnum);
 extern int deactivate_all_fds(void);
 extern void forward_interrupts(int pid);
-extern void init_irq_signals(int on_sigstack);
-extern void forward_ipi(int fd, int pid);
 extern int activate_ipi(int fd, int pid);
 extern unsigned long irq_lock(void);
 extern void irq_unlock(unsigned long flags);
Index: linux-2.6.16/arch/um/include/misc_constants.h
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.16/arch/um/include/misc_constants.h   2006-03-23 
18:51:20.0 -0500
@@ -0,0 +1,6 @@
+#ifndef __MISC_CONSTANT_H_
+#define __MISC_CONSTANT_H_
+
+#include 
+
+#endif
Index: linux-2.6.16/arch/um/include/os.h
===
--- linux-2.6.16.orig/arch/um/include/os.h  2006-03-23 18:40:30.0 
-0500
+++ linux-2.6.16/arch/um/include/os.h   2006-03-23 18:51:20.0 -0500
@@ -12,6 +12,7 @@
 #include "sysdep/ptrace.h"
 #include "kern_util.h"
 #include "skas/mm_id.h"
+#include "irq_user.h"
 
 #define OS_TYPE_FILE 1 
 #define OS_TYPE_DIR 2 
@@ -198,6 +199,8 @@ extern void os_flush_stdout(void);
 /* tt.c
  * for tt mode only (will be deleted in future...)
  */
+extern void forward_ipi(int fd, int pid);
+extern void kill_child_dead(int pid);
 extern void stop(void);
 extern int wait_for_stop(int pid, int sig, int cont_type, void *relay);
 extern int protect_memory(unsigned long addr, unsigned long len,
@@ -294,4 +297,17 @@ extern void initial_thread_cb_skas(void 
 extern void halt_skas(void);
 extern void reboot_skas(void);
 
+/* irq.c */
+extern int os_waiting_for_events(struct irq_fd *active_fds);
+extern int os_isatty(int fd);
+extern int os_create_pollfd(int fd, int events, void *tmp_pfd, int 
size_tmpfds);
+extern void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg,
+   struct irq_fd *active_fds, struct irq_fd ***last_irq_ptr2);
+extern void os_free_irq_later(struct irq_fd *active_fds,
+   int irq, void *dev_id);
+extern int os_get_pollfd(int i);
+extern void os_set_pollfd(int i, int fd);
+extern void os_set_ioignore(void);
+extern void init_irq_signals(int on_sigstack);
+
 #endif
Index: linux-2.6.16/arch/um/kernel/irq_user.c
===
--- linux-2.6.16.orig/arch/um/kernel/irq_user.c 2006-03-23 18:40:30.0 
-0500
+++ linux-2.6.16/arch/um/kernel/irq_user.c  2006-03-23 18:51:20.0 
-0500
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2000 Jeff Dike ([EMAIL PROTECTED])
  * Licensed under the GPL
  */
@@ -18,53 +18,25 @@
 #include "sigio.h"
 #include "irq_user.h"
 #include "os.h"
+#include "misc_constants.h"
 
-struct irq_fd {
-   struct irq_fd *next;
-   void *id;
-   int fd;
-   int type;
-   int irq;
-   int pid;
-   int events;
-   int current_events;
-};
-
-static struct irq_fd *active_fds = NULL;
+struct irq_fd *active_fds = NULL;
 static struct irq_fd **last_irq_ptr = &active_fds;
 
-static struct pollfd *pollfds = NULL;
-static int pollfds_num = 0;
-static int pollfds_size = 0;
-
-extern int io_count, intr_count;
-
 extern void free_irqs(void);
 
 void sigio_handler(int sig, union uml_pt_regs *regs)
 {
struct irq_fd *irq_fd;
-   int i, n;
+   int n;
 
if(smp_sigio_handler()) return;
while(1){
-   n = poll(pollfds, pollfds_num, 0);
-   if(n < 0){
-   if(errno == EINTR) continue;
-   printk("sigio_handler : poll returned %d, "
-  "errno = %d\n", n, errno);
-   break;
-   }
-   if(n == 0) break;
-
-   irq_fd = active_fds;
-   for(i = 0; i < pollfds_num; i++){
-   if(pollfds[i].revents != 0){
-   irq_fd->current_eve

[uml-devel] [PATCH 5/16] UML - Merge irq_user.c and irq.c

2006-03-24 Thread Jeff Dike
The serial UML OS-abstraction layer patch (um/kernel dir).

This joins irq_user.c and irq.c files.

Signed-off-by: Gennady Sharapov <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.16/arch/um/kernel/Makefile
===
--- linux-2.6.16.orig/arch/um/kernel/Makefile   2006-03-23 18:40:30.0 
-0500
+++ linux-2.6.16/arch/um/kernel/Makefile2006-03-23 18:54:20.0 
-0500
@@ -7,7 +7,7 @@ extra-y := vmlinux.lds
 clean-files :=
 
 obj-y = config.o exec_kern.o exitcode.o \
-   init_task.o irq.o irq_user.o ksyms.o mem.o physmem.o \
+   init_task.o irq.o ksyms.o mem.o physmem.o \
process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \
signal_kern.o smp.o syscall_kern.o sysrq.o \
time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o
Index: linux-2.6.16/arch/um/kernel/irq.c
===
--- linux-2.6.16.orig/arch/um/kernel/irq.c  2006-03-23 18:40:30.0 
-0500
+++ linux-2.6.16/arch/um/kernel/irq.c   2006-03-23 18:55:15.0 -0500
@@ -31,6 +31,8 @@
 #include "irq_user.h"
 #include "irq_kern.h"
 #include "os.h"
+#include "sigio.h"
+#include "misc_constants.h"
 
 /*
  * Generic, controller-independent functions:
@@ -77,6 +79,298 @@ skip:
return 0;
 }
 
+struct irq_fd *active_fds = NULL;
+static struct irq_fd **last_irq_ptr = &active_fds;
+
+extern void free_irqs(void);
+
+void sigio_handler(int sig, union uml_pt_regs *regs)
+{
+   struct irq_fd *irq_fd;
+   int n;
+
+   if(smp_sigio_handler()) return;
+   while(1){
+   n = os_waiting_for_events(active_fds);
+   if (n <= 0) {
+   if(n == -EINTR) continue;
+   else break;
+   }
+
+   for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
+   if(irq_fd->current_events != 0){
+   irq_fd->current_events = 0;
+   do_IRQ(irq_fd->irq, regs);
+   }
+   }
+   }
+
+   free_irqs();
+}
+
+static void maybe_sigio_broken(int fd, int type)
+{
+   if(os_isatty(fd)){
+   if((type == IRQ_WRITE) && !pty_output_sigio){
+   write_sigio_workaround();
+   add_sigio_fd(fd, 0);
+   }
+   else if((type == IRQ_READ) && !pty_close_sigio){
+   write_sigio_workaround();
+   add_sigio_fd(fd, 1);
+   }
+   }
+}
+
+
+int activate_fd(int irq, int fd, int type, void *dev_id)
+{
+   struct pollfd *tmp_pfd;
+   struct irq_fd *new_fd, *irq_fd;
+   unsigned long flags;
+   int pid, events, err, n;
+
+   pid = os_getpid();
+   err = os_set_fd_async(fd, pid);
+   if(err < 0)
+   goto out;
+
+   new_fd = um_kmalloc(sizeof(*new_fd));
+   err = -ENOMEM;
+   if(new_fd == NULL)
+   goto out;
+
+   if(type == IRQ_READ) events = UM_POLLIN | UM_POLLPRI;
+   else events = UM_POLLOUT;
+   *new_fd = ((struct irq_fd) { .next  = NULL,
+.id= dev_id,
+.fd= fd,
+.type  = type,
+.irq   = irq,
+.pid   = pid,
+.events= events,
+.current_events= 0 } );
+
+   /* Critical section - locked by a spinlock because this stuff can
+* be changed from interrupt handlers.  The stuff above is done
+* outside the lock because it allocates memory.
+*/
+
+   /* Actually, it only looks like it can be called from interrupt
+* context.  The culprit is reactivate_fd, which calls
+* maybe_sigio_broken, which calls write_sigio_workaround,
+* which calls activate_fd.  However, write_sigio_workaround should
+* only be called once, at boot time.  That would make it clear that
+* this is called only from process context, and can be locked with
+* a semaphore.
+*/
+   flags = irq_lock();
+   for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
+   if((irq_fd->fd == fd) && (irq_fd->type == type)){
+   printk("Registering fd %d twice\n", fd);
+   printk("Irqs : %d, %d\n", irq_fd->irq, irq);
+   printk("Ids : 0x%p, 0x%p\n", irq_fd->id, dev_id);
+   goto out_unlock;
+   }
+   }
+
+   /*-*/
+   if(type == IRQ_WRITE)
+   fd = -1;
+
+   tmp_pfd = NULL;
+   n = 0;
+
+   while(1){
+   n = o

[uml-devel] [PATCH 6/16] UML - Move SIGIO startup code to os-Linux/start_up.c

2006-03-24 Thread Jeff Dike
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves all startup code from sigio_user.c file under os-Linux dir

Signed-off-by: Gennady Sharapov <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.16/arch/um/include/os.h
===
--- linux-2.6.16.orig/arch/um/include/os.h  2006-03-23 17:23:18.0 
-0500
+++ linux-2.6.16/arch/um/include/os.h   2006-03-23 17:23:54.0 -0500
@@ -161,6 +161,7 @@ extern int os_lock_file(int fd, int excl
 /* start_up.c */
 extern void os_early_checks(void);
 extern int can_do_skas(void);
+extern void os_check_bugs(void);
 
 /* Make sure they are clear when running in TT mode. Required by
  * SEGV_MAYBE_FIXABLE */
Index: linux-2.6.16/arch/um/include/sigio.h
===
--- linux-2.6.16.orig/arch/um/include/sigio.h   2006-03-23 17:23:18.0 
-0500
+++ linux-2.6.16/arch/um/include/sigio.h2006-03-23 17:23:54.0 
-0500
@@ -8,7 +8,6 @@
 
 extern int write_sigio_irq(int fd);
 extern int register_sigio_fd(int fd);
-extern int read_sigio_fd(int fd);
 extern int add_sigio_fd(int fd, int read);
 extern int ignore_sigio_fd(int fd);
 extern void sigio_lock(void);
Index: linux-2.6.16/arch/um/kernel/sigio_kern.c
===
--- linux-2.6.16.orig/arch/um/kernel/sigio_kern.c   2006-03-23 
17:23:18.0 -0500
+++ linux-2.6.16/arch/um/kernel/sigio_kern.c2006-03-23 17:23:54.0 
-0500
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2002 - 2003 Jeff Dike ([EMAIL PROTECTED])
  * Licensed under the GPL
  */
@@ -12,13 +12,16 @@
 #include "sigio.h"
 #include "irq_user.h"
 #include "irq_kern.h"
+#include "os.h"
 
 /* Protected by sigio_lock() called from write_sigio_workaround */
 static int sigio_irq_fd = -1;
 
 static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused)
 {
-   read_sigio_fd(sigio_irq_fd);
+   char c;
+
+   os_read_file(sigio_irq_fd, &c, sizeof(c));
reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ);
return(IRQ_HANDLED);
 }
@@ -51,6 +54,9 @@ void sigio_unlock(void)
spin_unlock(&sigio_spinlock);
 }
 
+extern void sigio_cleanup(void);
+__uml_exitcall(sigio_cleanup);
+
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
  * Emacs will notice this stuff at the end of the file and automatically
Index: linux-2.6.16/arch/um/kernel/sigio_user.c
===
--- linux-2.6.16.orig/arch/um/kernel/sigio_user.c   2006-03-23 
17:23:18.0 -0500
+++ linux-2.6.16/arch/um/kernel/sigio_user.c2006-03-23 17:25:36.0 
-0500
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2002 Jeff Dike ([EMAIL PROTECTED])
  * Licensed under the GPL
  */
@@ -20,127 +20,6 @@
 #include "sigio.h"
 #include "os.h"
 
-/* Changed during early boot */
-int pty_output_sigio = 0;
-int pty_close_sigio = 0;
-
-/* Used as a flag during SIGIO testing early in boot */
-static volatile int got_sigio = 0;
-
-void __init handler(int sig)
-{
-   got_sigio = 1;
-}
-
-struct openpty_arg {
-   int master;
-   int slave;
-   int err;
-};
-
-static void openpty_cb(void *arg)
-{
-   struct openpty_arg *info = arg;
-
-   info->err = 0;
-   if(openpty(&info->master, &info->slave, NULL, NULL, NULL))
-   info->err = -errno;
-}
-
-void __init check_one_sigio(void (*proc)(int, int))
-{
-   struct sigaction old, new;
-   struct openpty_arg pty = { .master = -1, .slave = -1 };
-   int master, slave, err;
-
-   initial_thread_cb(openpty_cb, &pty);
-   if(pty.err){
-   printk("openpty failed, errno = %d\n", -pty.err);
-   return;
-   }
-
-   master = pty.master;
-   slave = pty.slave;
-
-   if((master == -1) || (slave == -1)){
-   printk("openpty failed to allocate a pty\n");
-   return;
-   }
-
-   /* Not now, but complain so we now where we failed. */
-   err = raw(master);
-   if (err < 0)
-   panic("check_sigio : __raw failed, errno = %d\n", -err);
-
-   err = os_sigio_async(master, slave);
-   if(err < 0)
-   panic("tty_fds : sigio_async failed, err = %d\n", -err);
-
-   if(sigaction(SIGIO, NULL, &old) < 0)
-   panic("check_sigio : sigaction 1 failed, errno = %d\n", errno);
-   new = old;
-   new.sa_handler = handler;
-   if(sigaction(SIGIO, &new, NULL) < 0)
-   panic("check_sigio : sigaction 2 failed, errno = %d\n", errno);
-
-   got_sigio = 0;
-   (*proc)(master, slave);
-   
-   os_close_file(master);
-   os_close_file(slave);
-
-   if(sigaction(SIGIO, &old, NULL) < 0)
-   panic("check_sigio : sigaction 3 failed, errno = %d\n", errno);
-}
-
-static void tty_output(int master, int slave)
-{
-   

[uml-devel] [PATCH 1/16] UML - Fix build warnings in __get_user

2006-03-24 Thread Jeff Dike
Fix a gcc warning about losing qualifiers to the first argument of
copy_from_user.  The typeof change for correctness, and fixes a lot
of the warnings, but there are some cases where x has some extra
qualifiers, like volatile, which copy_from_user can't know about.
For these, the void * cast seems to be necessary.

Also cleaned up some of the whitespace and got rid of the emacs comment
at the bottom.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.16/include/asm-um/uaccess.h
===
--- linux-2.6.16.orig/include/asm-um/uaccess.h  2006-03-23 17:49:25.0 
-0500
+++ linux-2.6.16/include/asm-um/uaccess.h   2006-03-23 18:41:57.0 
-0500
@@ -41,16 +41,16 @@
 
 #define __get_user(x, ptr) \
 ({ \
-const __typeof__(ptr) __private_ptr = ptr; \
-__typeof__(*(__private_ptr)) __private_val; \
-int __private_ret = -EFAULT; \
-(x) = (__typeof__(*(__private_ptr)))0; \
-   if (__copy_from_user(&__private_val, (__private_ptr), \
-   sizeof(*(__private_ptr))) == 0) {\
-   (x) = (__typeof__(*(__private_ptr))) __private_val; \
-   __private_ret = 0; \
-   } \
-__private_ret; \
+   const __typeof__(ptr) __private_ptr = ptr;  \
+   __typeof__(x) __private_val;\
+   int __private_ret = -EFAULT;\
+   (x) = (__typeof__(*(__private_ptr)))0;  \
+   if (__copy_from_user((void *) &__private_val, (__private_ptr),  \
+sizeof(*(__private_ptr))) == 0) {  \
+   (x) = (__typeof__(*(__private_ptr))) __private_val; \
+   __private_ret = 0;  \
+   }   \
+   __private_ret;  \
 }) 
 
 #define get_user(x, ptr) \
@@ -89,14 +89,3 @@ struct exception_table_entry
 };
 
 #endif
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---
- * Local variables:
- * c-file-style: "linux"
- * End:
- */



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 10/16] UML - OS header cleanups

2006-03-24 Thread Jeff Dike
This rearranges the OS declarations by moving some declarations into os.h.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.16/arch/um/include/os.h
===
--- linux-2.6.16.orig/arch/um/include/os.h  2006-03-23 17:35:34.0 
-0500
+++ linux-2.6.16/arch/um/include/os.h   2006-03-23 17:35:56.0 -0500
@@ -122,6 +122,7 @@ static inline struct openflags of_cloexe
return(flags); 
 }
   
+/* file.c */
 extern int os_stat_file(const char *file_name, struct uml_stat *buf);
 extern int os_stat_fd(const int fd, struct uml_stat *buf);
 extern int os_access(const char *file, int mode);
@@ -157,6 +158,15 @@ extern int os_connect_socket(char *name)
 extern int os_file_type(char *file);
 extern int os_file_mode(char *file, struct openflags *mode_out);
 extern int os_lock_file(int fd, int excl);
+extern void os_flush_stdout(void);
+extern int os_stat_filesystem(char *path, long *bsize_out,
+ long long *blocks_out, long long *bfree_out,
+ long long *bavail_out, long long *files_out,
+ long long *ffree_out, void *fsid_out,
+ int fsid_size, long *namelen_out,
+ long *spare_out);
+extern int os_change_dir(char *dir);
+extern int os_fchange_dir(int fd);
 
 /* start_up.c */
 extern void os_early_checks(void);
@@ -316,4 +326,8 @@ extern void write_sigio_workaround(void)
 extern int add_sigio_fd(int fd, int read);
 extern int ignore_sigio_fd(int fd);
 
+/* skas/trap */
+extern void sig_handler_common_skas(int sig, void *sc_ptr);
+extern void user_signal(int sig, union uml_pt_regs *regs, int pid);
+
 #endif
Index: linux-2.6.16/arch/um/include/skas/mode-skas.h
===
--- linux-2.6.16.orig/arch/um/include/skas/mode-skas.h  2006-03-23 
17:35:34.0 -0500
+++ linux-2.6.16/arch/um/include/skas/mode-skas.h   2006-03-23 
17:35:49.0 -0500
@@ -13,7 +13,6 @@ extern unsigned long exec_fp_regs[];
 extern unsigned long exec_fpx_regs[];
 extern int have_fpx_regs;
 
-extern void sig_handler_common_skas(int sig, void *sc_ptr);
 extern void kill_off_processes_skas(void);
 
 #endif
Index: linux-2.6.16/arch/um/include/skas/skas.h
===
--- linux-2.6.16.orig/arch/um/include/skas/skas.h   2006-03-23 
17:35:34.0 -0500
+++ linux-2.6.16/arch/um/include/skas/skas.h2006-03-23 17:35:49.0 
-0500
@@ -17,7 +17,6 @@ extern int user_thread(unsigned long sta
 extern void new_thread_proc(void *stack, void (*handler)(int sig));
 extern void new_thread_handler(int sig);
 extern void handle_syscall(union uml_pt_regs *regs);
-extern void user_signal(int sig, union uml_pt_regs *regs, int pid);
 extern int new_mm(unsigned long stack);
 extern void get_skas_faultinfo(int pid, struct faultinfo * fi);
 extern long execute_syscall_skas(void *r);



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 2/16] UML - Fix declaration of exit()

2006-03-24 Thread Jeff Dike
This fixes a conflict between a header and what gcc "knows" the declaration'
to be.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.15-mm/arch/um/include/kern.h
===
--- linux-2.6.15-mm.orig/arch/um/include/kern.h 2006-02-21 16:02:19.0 
-0500
+++ linux-2.6.15-mm/arch/um/include/kern.h  2006-02-21 16:15:14.0 
-0500
@@ -29,7 +29,7 @@ extern int getuid(void);
 extern int getgid(void);
 extern int pause(void);
 extern int write(int, const void *, int);
-extern int exit(int);
+extern void exit(int);
 extern int close(int);
 extern int read(unsigned int, char *, int);
 extern int pipe(int *);



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 3/16] UML - Fix some printf formats

2006-03-24 Thread Jeff Dike
Some printf formats are incorrect for large memory sizes.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.15-mm/arch/um/kernel/um_arch.c
===
--- linux-2.6.15-mm.orig/arch/um/kernel/um_arch.c   2006-02-21 
17:40:12.0 -0500
+++ linux-2.6.15-mm/arch/um/kernel/um_arch.c2006-02-21 17:59:39.0 
-0500
@@ -421,7 +421,7 @@ int linux_main(int argc, char **argv)
 #ifndef CONFIG_HIGHMEM
highmem = 0;
printf("CONFIG_HIGHMEM not enabled - physical memory shrunk "
-  "to %lu bytes\n", physmem_size);
+  "to %Lu bytes\n", physmem_size);
 #endif
}
 
@@ -433,8 +433,8 @@ int linux_main(int argc, char **argv)
 
setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
if(init_maps(physmem_size, iomem_size, highmem)){
-   printf("Failed to allocate mem_map for %lu bytes of physical "
-  "memory and %lu bytes of highmem\n", physmem_size,
+   printf("Failed to allocate mem_map for %Lu bytes of physical "
+  "memory and %Lu bytes of highmem\n", physmem_size,
   highmem);
exit(1);
}



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 13/16] UML - Fix segfault on signal delivery

2006-03-24 Thread Jeff Dike
This fixes a process segfault where a signal was being delivered
such that a new stack page needed to be allocated to hold the signal
frame.  This was tripping some logic in the page fault handler which
wouldn't allocate the page if the faulting address was more that 32
bytes lower than the current stack pointer.  Since a signal frame is
greater than 32 bytes, this exercised that case.
It's fixed by updating the SP in the pt_regs before starting to copy
the signal frame.  Since those are the registers that will be copied
on to the stack, we have to be careful to put the original SP, not
the new one which points to the signal frame, on the stack.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.15/arch/um/sys-i386/signal.c
===
--- linux-2.6.15.orig/arch/um/sys-i386/signal.c 2006-03-23 12:12:36.0 
-0500
+++ linux-2.6.15/arch/um/sys-i386/signal.c  2006-03-23 12:31:01.0 
-0500
@@ -58,7 +58,7 @@ static int copy_sc_from_user_skas(struct
 }
 
 int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
- struct pt_regs *regs)
+ struct pt_regs *regs, unsigned long sp)
 {
struct sigcontext sc;
unsigned long fpregs[HOST_FP_SIZE];
@@ -72,7 +72,7 @@ int copy_sc_to_user_skas(struct sigconte
sc.edi = REGS_EDI(regs->regs.skas.regs);
sc.esi = REGS_ESI(regs->regs.skas.regs);
sc.ebp = REGS_EBP(regs->regs.skas.regs);
-   sc.esp = REGS_SP(regs->regs.skas.regs);
+   sc.esp = sp;
sc.ebx = REGS_EBX(regs->regs.skas.regs);
sc.edx = REGS_EDX(regs->regs.skas.regs);
sc.ecx = REGS_ECX(regs->regs.skas.regs);
@@ -132,7 +132,7 @@ int copy_sc_from_user_tt(struct sigconte
 }
 
 int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
-  struct sigcontext *from, int fpsize)
+  struct sigcontext *from, int fpsize, unsigned long sp)
 {
struct _fpstate *to_fp, *from_fp;
int err;
@@ -140,11 +140,18 @@ int copy_sc_to_user_tt(struct sigcontext
to_fp = (fp ? fp : (struct _fpstate *) (to + 1));
from_fp = from->fpstate;
err = copy_to_user(to, from, sizeof(*to));
+
+   /* The SP in the sigcontext is the updated one for the signal
+* delivery.  The sp passed in is the original, and this needs
+* to be restored, so we stick it in separately.
+*/
+   err |= copy_to_user(&SC_SP(to), sp, sizeof(sp));
+
if(from_fp != NULL){
err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate));
err |= copy_to_user(to_fp, from_fp, fpsize);
}
-   return(err);
+   return err;
 }
 #endif
 
@@ -159,11 +166,11 @@ static int copy_sc_from_user(struct pt_r
 }
 
 static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
-  struct pt_regs *from)
+  struct pt_regs *from, unsigned long sp)
 {
return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
- sizeof(*fp)),
-   copy_sc_to_user_skas(to, fp, from)));
+ sizeof(*fp), sp),
+   copy_sc_to_user_skas(to, fp, from, sp)));
 }
 
 static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp,
@@ -174,7 +181,7 @@ static int copy_ucontext_to_user(struct 
err |= put_user(current->sas_ss_sp, &uc->uc_stack.ss_sp);
err |= put_user(sas_ss_flags(sp), &uc->uc_stack.ss_flags);
err |= put_user(current->sas_ss_size, &uc->uc_stack.ss_size);
-   err |= copy_sc_to_user(&uc->uc_mcontext, fp, ¤t->thread.regs);
+   err |= copy_sc_to_user(&uc->uc_mcontext, fp, ¤t->thread.regs, sp);
err |= copy_to_user(&uc->uc_sigmask, set, sizeof(*set));
return(err);
 }
@@ -207,6 +214,7 @@ int setup_signal_stack_sc(unsigned long 
 {
struct sigframe __user *frame;
void *restorer;
+   unsigned long save_sp = PT_REGS_SP(regs);
int err = 0;
 
stack_top &= -8UL;
@@ -218,9 +226,19 @@ int setup_signal_stack_sc(unsigned long 
if(ka->sa.sa_flags & SA_RESTORER)
restorer = ka->sa.sa_restorer;
 
+   /* Update SP now because the page fault handler refuses to extend
+* the stack if the faulting address is too far below the current
+* SP, which frame now certainly is.  If there's an error, the original
+* value is restored on the way out.
+* When writing the sigcontext to the stack, we have to write the
+* original value, so that's passed to copy_sc_to_user, which does
+* the right thing with it.
+*/
+   PT_REGS_SP(regs) = (unsigned long) frame;
+
err |= __put_user(restorer, &frame->pretcode);
err |= __put_user(sig, &frame->sig);
-   err |= copy_sc_to_user(&frame->sc, N

[uml-devel] [PATCH 9/16] UML - Move tty logging to os-Linux

2006-03-24 Thread Jeff Dike
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves all systemcalls from tty_log.c file under os-Linux dir

Signed-off-by: Gennady Sharapov <[EMAIL PROTECTED]>

Index: linux-2.6.16/arch/um/kernel/exec_kern.c
===
--- linux-2.6.16.orig/arch/um/kernel/exec_kern.c2006-03-23 
17:15:05.0 -0500
+++ linux-2.6.16/arch/um/kernel/exec_kern.c 2006-03-23 17:31:59.0 
-0500
@@ -30,8 +30,6 @@ void start_thread(struct pt_regs *regs, 
CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp);
 }
 
-extern void log_exec(char **argv, void *tty);
-
 static long execve1(char *file, char __user * __user *argv,
char __user *__user *env)
 {
Index: linux-2.6.16/arch/um/kernel/tty_log.c
===
--- linux-2.6.16.orig/arch/um/kernel/tty_log.c  2006-03-23 17:15:05.0 
-0500
+++ /dev/null   1970-01-01 00:00:00.0 +
@@ -1,230 +0,0 @@
-/* 
- * Copyright (C) 2002 Jeff Dike ([EMAIL PROTECTED]) and 
- * geoffrey hing <[EMAIL PROTECTED]>
- * Licensed under the GPL
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "init.h"
-#include "user.h"
-#include "kern_util.h"
-#include "os.h"
-
-#define TTY_LOG_DIR "./"
-
-/* Set early in boot and then unchanged */
-static char *tty_log_dir = TTY_LOG_DIR;
-static int tty_log_fd = -1;
-
-#define TTY_LOG_OPEN 1
-#define TTY_LOG_CLOSE 2
-#define TTY_LOG_WRITE 3
-#define TTY_LOG_EXEC 4
-
-#define TTY_READ 1
-#define TTY_WRITE 2
-
-struct tty_log_buf {
-   int what;
-   unsigned long tty;
-   int len;
-   int direction;
-   unsigned long sec;
-   unsigned long usec;
-};
-
-int open_tty_log(void *tty, void *current_tty)
-{
-   struct timeval tv;
-   struct tty_log_buf data;
-   char buf[strlen(tty_log_dir) + sizeof("01234567890-01234567\0")];
-   int fd;
-
-   gettimeofday(&tv, NULL);
-   if(tty_log_fd != -1){
-   data = ((struct tty_log_buf) { .what= TTY_LOG_OPEN,
-  .tty  = (unsigned long) tty,
-  .len  = sizeof(current_tty),
-  .direction = 0,
-  .sec = tv.tv_sec,
-  .usec = tv.tv_usec } );
-   os_write_file(tty_log_fd, &data, sizeof(data));
-   os_write_file(tty_log_fd, ¤t_tty, data.len);
-   return(tty_log_fd);
-   }
-
-   sprintf(buf, "%s/%0u-%0u", tty_log_dir, (unsigned int) tv.tv_sec, 
-   (unsigned int) tv.tv_usec);
-
-   fd = os_open_file(buf, of_append(of_create(of_rdwr(OPENFLAGS(,
- 0644);
-   if(fd < 0){
-   printk("open_tty_log : couldn't open '%s', errno = %d\n",
-  buf, -fd);
-   }
-   return(fd);
-}
-
-void close_tty_log(int fd, void *tty)
-{
-   struct tty_log_buf data;
-   struct timeval tv;
-
-   if(tty_log_fd != -1){
-   gettimeofday(&tv, NULL);
-   data = ((struct tty_log_buf) { .what= TTY_LOG_CLOSE,
-  .tty  = (unsigned long) tty,
-  .len  = 0,
-  .direction = 0,
-  .sec = tv.tv_sec,
-  .usec = tv.tv_usec } );
-   os_write_file(tty_log_fd, &data, sizeof(data));
-   return;
-   }
-   os_close_file(fd);
-}
-
-static int log_chunk(int fd, const char *buf, int len)
-{
-   int total = 0, try, missed, n;
-   char chunk[64];
-
-   while(len > 0){
-   try = (len > sizeof(chunk)) ? sizeof(chunk) : len;
-   missed = copy_from_user_proc(chunk, (char *) buf, try);
-   try -= missed;
-   n = os_write_file(fd, chunk, try);
-   if(n != try) {
-   if(n < 0)
-   return(n);
-   return(-EIO);
-   }
-   if(missed != 0)
-   return(-EFAULT);
-
-   len -= try;
-   total += try;
-   buf += try;
-   }
-
-   return(total);
-}
-
-int write_tty_log(int fd, const char *buf, int len, void *tty, int is_read)
-{
-   struct timeval tv;
-   struct tty_log_buf data;
-   int direction;
-
-   if(fd == tty_log_fd){
-   gettimeofday(&tv, NULL);
-   direction = is_read ? TTY_READ : TTY_WRITE;
-   data = ((struct tty_log_buf) { .what= TTY_LOG_WRITE,
-  .tty  = (unsigned long) tty,
-  .len  = len,
-   

[uml-devel] [PATCH 7/16] UML - Move sigio_user.c to os-Linux/sigio.c

2006-03-24 Thread Jeff Dike
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves sigio_user.c to os-Linux dir

Signed-off-by: Gennady Sharapov <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.16/arch/um/include/os.h
===
--- linux-2.6.16.orig/arch/um/include/os.h  2006-03-23 17:23:54.0 
-0500
+++ linux-2.6.16/arch/um/include/os.h   2006-03-23 17:26:25.0 -0500
@@ -311,4 +311,9 @@ extern void os_set_pollfd(int i, int fd)
 extern void os_set_ioignore(void);
 extern void init_irq_signals(int on_sigstack);
 
+/* sigio.c */
+extern void write_sigio_workaround(void);
+extern int add_sigio_fd(int fd, int read);
+extern int ignore_sigio_fd(int fd);
+
 #endif
Index: linux-2.6.16/arch/um/include/sigio.h
===
--- linux-2.6.16.orig/arch/um/include/sigio.h   2006-03-23 17:23:54.0 
-0500
+++ linux-2.6.16/arch/um/include/sigio.h2006-03-23 17:26:25.0 
-0500
@@ -8,8 +8,6 @@
 
 extern int write_sigio_irq(int fd);
 extern int register_sigio_fd(int fd);
-extern int add_sigio_fd(int fd, int read);
-extern int ignore_sigio_fd(int fd);
 extern void sigio_lock(void);
 extern void sigio_unlock(void);
 
Index: linux-2.6.16/arch/um/include/user_util.h
===
--- linux-2.6.16.orig/arch/um/include/user_util.h   2006-03-23 
17:15:05.0 -0500
+++ linux-2.6.16/arch/um/include/user_util.h2006-03-23 17:26:25.0 
-0500
@@ -58,7 +58,6 @@ extern int attach(int pid);
 extern void kill_child_dead(int pid);
 extern int cont(int pid);
 extern void check_sigio(void);
-extern void write_sigio_workaround(void);
 extern void arch_check_bugs(void);
 extern int cpu_feature(char *what, char *buf, int len);
 extern int arch_handle_signal(int sig, union uml_pt_regs *regs);
Index: linux-2.6.16/arch/um/kernel/Makefile
===
--- linux-2.6.16.orig/arch/um/kernel/Makefile   2006-03-23 17:15:05.0 
-0500
+++ linux-2.6.16/arch/um/kernel/Makefile2006-03-23 17:26:25.0 
-0500
@@ -8,7 +8,7 @@ clean-files :=
 
 obj-y = config.o exec_kern.o exitcode.o \
init_task.o irq.o ksyms.o mem.o physmem.o \
-   process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \
+   process_kern.o ptrace.o reboot.o resource.o sigio_kern.o \
signal_kern.o smp.o syscall_kern.o sysrq.o \
time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o
 
Index: linux-2.6.16/arch/um/os-Linux/Makefile
===
--- linux-2.6.16.orig/arch/um/os-Linux/Makefile 2006-03-23 17:15:05.0 
-0500
+++ linux-2.6.16/arch/um/os-Linux/Makefile  2006-03-23 17:26:25.0 
-0500
@@ -3,14 +3,15 @@
 # Licensed under the GPL
 #
 
-obj-y = aio.o elf_aux.o file.o helper.o irq.o main.o mem.o process.o signal.o \
-   start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o user_syms.o \
-   util.o drivers/ sys-$(SUBARCH)/
+obj-y = aio.o elf_aux.o file.o helper.o irq.o main.o mem.o process.o sigio.o \
+   signal.o start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o \
+   user_syms.o util.o drivers/ sys-$(SUBARCH)/
 
 obj-$(CONFIG_MODE_SKAS) += skas/
 
 USER_OBJS := aio.o elf_aux.o file.o helper.o irq.o main.o mem.o process.o \
-   signal.o start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o util.o
+   sigio.o signal.o start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o \
+   util.o
 
 elf_aux.o: $(ARCH_DIR)/kernel-offsets.h
 CFLAGS_elf_aux.o += -I$(objtree)/arch/um
Index: linux-2.6.16/arch/um/os-Linux/sigio.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.16/arch/um/os-Linux/sigio.c   2006-03-23 17:30:27.0 
-0500
@@ -0,0 +1,324 @@
+/*
+ * Copyright (C) 2002 Jeff Dike ([EMAIL PROTECTED])
+ * Licensed under the GPL
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "init.h"
+#include "user.h"
+#include "kern_util.h"
+#include "user_util.h"
+#include "sigio.h"
+#include "os.h"
+
+/* Protected by sigio_lock(), also used by sigio_cleanup, which is an
+ * exitcall.
+ */
+static int write_sigio_pid = -1;
+
+/* These arrays are initialized before the sigio thread is started, and
+ * the descriptors closed after it is killed.  So, it can't see them change.
+ * On the UML side, they are changed under the sigio_lock.
+ */
+static int write_sigio_fds[2] = { -1, -1 };
+static int sigio_private[2] = { -1, -1 };
+
+struct pollfds {
+   struct pollfd *poll;
+   int size;
+   int used;
+};
+
+/* Protected by sigio_lock().  Used by the sigio thread, but the UML thread
+ * synchronizes with it.
+ */
+struct pollfds current_poll = {
+   .poll   = NULL,
+

[uml-devel] [PATCH 8/16] UML - More carefully test whether we are in a system call

2006-03-24 Thread Jeff Dike
From: Bodo Stroesser <[EMAIL PROTECTED]>
 
For security reasons, UML in is_syscall() needs to have access to code
in vsyscall-page. The current implementation grants this access by
explicitly allowing access to vsyscall in access_ok_skas(). With this
change, copy_from_user() may be used to read the code.
Ptrace access to vsyscall-page for debugging already was implemented
in get_user_pages() by mainline.
In i386, copy_from_user can't access vsyscall-page, but returns EFAULT.
 
To make UML behave as i386 does, I changed is_syscall to use
access_process_vm(current) to read the code from vsyscall-page.
This doesn't hurt security, but simplifies the code and prepares
implementation of stub-vmas.

Signed-off-by: Bodo Stroesser <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.15/arch/um/sys-i386/ptrace.c
===
--- linux-2.6.15.orig/arch/um/sys-i386/ptrace.c 2005-08-28 19:41:01.0 
-0400
+++ linux-2.6.15/arch/um/sys-i386/ptrace.c  2006-03-23 12:17:52.0 
-0500
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include "linux/sched.h"
+#include "linux/mm.h"
 #include "asm/elf.h"
 #include "asm/ptrace.h"
 #include "asm/uaccess.h"
@@ -26,9 +27,17 @@ int is_syscall(unsigned long addr)
 
n = copy_from_user(&instr, (void __user *) addr, sizeof(instr));
if(n){
-   printk("is_syscall : failed to read instruction from 0x%lx\n",
-  addr);
-   return(0);
+   /* access_process_vm() grants access to vsyscall and stub,
+* while copy_from_user doesn't. Maybe access_process_vm is
+* slow, but that doesn't matter, since it will be called only
+* in case of singlestepping, if copy_from_user failed.
+*/
+   n = access_process_vm(current, addr, &instr, sizeof(instr), 0);
+   if(n != sizeof(instr)) {
+   printk("is_syscall : failed to read instruction from "
+  "0x%lx\n", addr);
+   return(1);
+   }
}
/* int 0x80 or sysenter */
return((instr == 0x80cd) || (instr == 0x340f));
Index: linux-2.6.15/arch/um/sys-x86_64/ptrace.c
===
--- linux-2.6.15.orig/arch/um/sys-x86_64/ptrace.c   2006-03-23 
12:50:15.0 -0500
+++ linux-2.6.15/arch/um/sys-x86_64/ptrace.c2006-03-23 12:50:23.0 
-0500
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -136,9 +137,28 @@ void arch_switch(void)
 */
 }
 
+/* XXX Mostly copied from sys-i386 */
 int is_syscall(unsigned long addr)
 {
-   panic("is_syscall");
+   unsigned short instr;
+   int n;
+
+   n = copy_from_user(&instr, (void __user *) addr, sizeof(instr));
+   if(n){
+   /* access_process_vm() grants access to vsyscall and stub,
+* while copy_from_user doesn't. Maybe access_process_vm is
+* slow, but that doesn't matter, since it will be called only
+* in case of singlestepping, if copy_from_user failed.
+*/
+   n = access_process_vm(current, addr, &instr, sizeof(instr), 0);
+   if(n != sizeof(instr)) {
+   printk("is_syscall : failed to read instruction from "
+  "0x%lx\n", addr);
+   return(1);
+   }
+   }
+   /* sysenter */
+   return(instr == 0x050f);
 }
 
 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu )



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 11/16] UML - Allow ubd devices to be shared in a cluster

2006-03-24 Thread Jeff Dike
This adds a 'c' option to the ubd switch which turns off host file locking
so that the device can be shared, as with a cluster.
There's also some whitespace cleanup while I was in this file.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.16/arch/um/drivers/ubd_kern.c
===
--- linux-2.6.16.orig/arch/um/drivers/ubd_kern.c2006-03-23 
17:15:05.0 -0500
+++ linux-2.6.16/arch/um/drivers/ubd_kern.c 2006-03-23 17:37:47.0 
-0500
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2000 Jeff Dike ([EMAIL PROTECTED])
  * Licensed under the GPL
  */
@@ -71,7 +71,7 @@ struct io_thread_req {
int error;
 };
 
-extern int open_ubd_file(char *file, struct openflags *openflags,
+extern int open_ubd_file(char *file, struct openflags *openflags, int shared,
 char **backing_file_out, int *bitmap_offset_out,
 unsigned long *bitmap_len_out, int *data_offset_out,
 int *create_cow_out);
@@ -137,7 +137,7 @@ static int fake_major = MAJOR_NR;
 
 static struct gendisk *ubd_gendisk[MAX_DEV];
 static struct gendisk *fake_gendisk[MAX_DEV];
- 
+
 #ifdef CONFIG_BLK_DEV_UBD_SYNC
 #define OPEN_FLAGS ((struct openflags) { .r = 1, .w = 1, .s = 1, .c = 0, \
 .cl = 1 })
@@ -168,6 +168,7 @@ struct ubd {
__u64 size;
struct openflags boot_openflags;
struct openflags openflags;
+   int shared;
int no_cow;
struct cow cow;
struct platform_device pdev;
@@ -189,6 +190,7 @@ struct ubd {
.boot_openflags =   OPEN_FLAGS, \
.openflags =OPEN_FLAGS, \
 .no_cow =   0, \
+   .shared =   0, \
 .cow = DEFAULT_COW, \
 }
 
@@ -305,7 +307,7 @@ static int ubd_setup_common(char *str, i
}
major = simple_strtoul(str, &end, 0);
if((*end != '\0') || (end == str)){
-   printk(KERN_ERR 
+   printk(KERN_ERR
   "ubd_setup : didn't parse major number\n");
return(1);
}
@@ -316,7 +318,7 @@ static int ubd_setup_common(char *str, i
printk(KERN_ERR "Can't assign a fake major twice\n");
goto out1;
}
- 
+
fake_major = major;
 
printk(KERN_INFO "Setting extra ubd major number to %d\n",
@@ -351,7 +353,7 @@ static int ubd_setup_common(char *str, i
if (index_out)
*index_out = n;
 
-   for (i = 0; i < 4; i++) {
+   for (i = 0; i < sizeof("rscd="); i++) {
switch (*str) {
case 'r':
flags.w = 0;
@@ -362,11 +364,14 @@ static int ubd_setup_common(char *str, i
case 'd':
dev->no_cow = 1;
break;
+   case 'c':
+   dev->shared = 1;
+   break;
case '=':
str++;
goto break_loop;
default:
-   printk(KERN_ERR "ubd_setup : Expected '=' or flag 
letter (r,s or d)\n");
+   printk(KERN_ERR "ubd_setup : Expected '=' or flag 
letter (r, s, c, or d)\n");
goto out;
}
str++;
@@ -515,7 +520,7 @@ static void ubd_handler(void)
spin_unlock(&ubd_io_lock);
return;
}
-
+
ubd_finish(rq, req.error);
reactivate_fd(thread_fd, UBD_IRQ);  
do_ubd_request(ubd_queue);
@@ -532,7 +537,7 @@ static int io_pid = -1;
 
 void kill_io_thread(void)
 {
-   if(io_pid != -1) 
+   if(io_pid != -1)
os_kill_process(io_pid, 1);
 }
 
@@ -567,14 +572,15 @@ static int ubd_open_dev(struct ubd *dev)
create_cow = 0;
create_ptr = (dev->cow.file != NULL) ? &create_cow : NULL;
back_ptr = dev->no_cow ? NULL : &dev->cow.file;
-   dev->fd = open_ubd_file(dev->file, &dev->openflags, back_ptr,
-   &dev->cow.bitmap_offset, &dev->cow.bitmap_len, 
-   &dev->cow.data_offset, create_ptr);
+   dev->fd = open_ubd_file(dev->file, &dev->openflags, dev->shared,
+   back_ptr, &dev->cow.bitmap_offset,
+   &dev->cow.bitmap_len, &dev->cow.data_offset,
+   create_ptr);
 
if((dev->fd == -ENOENT) && create_cow){
-   dev->fd = create_cow_file(dev->file, dev->cow.file, 
+   dev->fd = create_cow_file(dev->file, dev->cow.file,
  dev->openflags, 1 << 9, PAGE_SIZE,
- &dev->cow.bitmap_offset, 
+

[uml-devel] [PATCH 15/16] UML - Fix thread startup race

2006-03-24 Thread Jeff Dike
This fixes a race in the starting of write_sigio_thread.
Previously, some of the data needed by the thread was initialized
after the clone.  If the thread ran immediately, it would see the
uninitialized data, including an empty pollfds, which would cause it
to hang.
We move the data initialization to before the clone, and adjust the
error paths and cleanup accordingly.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.16/arch/um/os-Linux/sigio.c
===
--- linux-2.6.16.orig/arch/um/os-Linux/sigio.c  2006-03-23 18:55:38.0 
-0500
+++ linux-2.6.16/arch/um/os-Linux/sigio.c   2006-03-23 21:10:27.0 
-0500
@@ -29,8 +29,10 @@ static int write_sigio_pid = -1;
  * the descriptors closed after it is killed.  So, it can't see them change.
  * On the UML side, they are changed under the sigio_lock.
  */
-static int write_sigio_fds[2] = { -1, -1 };
-static int sigio_private[2] = { -1, -1 };
+#define SIGIO_FDS_INIT {-1, -1}
+
+static int write_sigio_fds[2] = SIGIO_FDS_INIT;
+static int sigio_private[2] = SIGIO_FDS_INIT;
 
 struct pollfds {
struct pollfd *poll;
@@ -270,49 +272,46 @@ void write_sigio_workaround(void)
/* Did we race? Don't try to optimize this, please, it's not so likely
 * to happen, and no more than once at the boot. */
if(write_sigio_pid != -1)
-   goto out_unlock;
-
-   write_sigio_pid = run_helper_thread(write_sigio_thread, NULL,
-   CLONE_FILES | CLONE_VM, &stack, 0);
+   goto out_free;
 
-   if (write_sigio_pid < 0)
-   goto out_clear;
+   current_poll = ((struct pollfds) { .poll= p,
+  .used= 1,
+  .size= 1 });
 
if (write_sigio_irq(l_write_sigio_fds[0]))
-   goto out_kill;
+   goto out_clear_poll;
 
-   /* Success, finally. */
memcpy(write_sigio_fds, l_write_sigio_fds, sizeof(l_write_sigio_fds));
memcpy(sigio_private, l_sigio_private, sizeof(l_sigio_private));
 
-   current_poll = ((struct pollfds) { .poll= p,
-  .used= 1,
-  .size= 1 });
+   write_sigio_pid = run_helper_thread(write_sigio_thread, NULL,
+   CLONE_FILES | CLONE_VM, &stack, 0);
 
-   sigio_unlock();
-   return;
+   if (write_sigio_pid < 0)
+   goto out_clear;
 
- out_kill:
-   l_write_sigio_pid = write_sigio_pid;
-   write_sigio_pid = -1;
sigio_unlock();
-   /* Going to call waitpid, avoid holding the lock. */
-   os_kill_process(l_write_sigio_pid, 1);
-   goto out_free;
+   return;
 
- out_clear:
+out_clear:
write_sigio_pid = -1;
- out_unlock:
-   sigio_unlock();
- out_free:
+   write_sigio_fds[0] = -1;
+   write_sigio_fds[1] = -1;
+   sigio_private[0] = -1;
+   sigio_private[1] = -1;
+out_clear_poll:
+   current_poll = ((struct pollfds) { .poll= NULL,
+  .size= 0,
+  .used= 0 });
+out_free:
kfree(p);
- out_close2:
+   sigio_unlock();
+out_close2:
close(l_sigio_private[0]);
close(l_sigio_private[1]);
- out_close1:
+out_close1:
close(l_write_sigio_fds[0]);
close(l_write_sigio_fds[1]);
-   return;
 }
 
 void sigio_cleanup(void)



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 14/16] UML - Prevent umid theft

2006-03-24 Thread Jeff Dike
Behavior when booting two UMLs with the same umid was broken.  The
second one would steal the umid.  This fixes that, making the second
UML take a random umid instead.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.15/arch/um/os-Linux/umid.c
===
--- linux-2.6.15.orig/arch/um/os-Linux/umid.c   2006-02-09 18:49:55.0 
-0500
+++ linux-2.6.15/arch/um/os-Linux/umid.c2006-02-10 14:11:28.0 
-0500
@@ -143,8 +143,10 @@ static int not_dead_yet(char *dir)
goto out_close;
}
 
-   if((kill(p, 0) == 0) || (errno != ESRCH))
+   if((kill(p, 0) == 0) || (errno != ESRCH)){
+   printk("umid \"%s\" is already in use by pid %d\n", umid, p);
return 1;
+   }
 
err = actually_do_remove(dir);
if(err)
@@ -234,33 +236,44 @@ int __init make_umid(void)
err = mkdir(tmp, 0777);
if(err < 0){
err = -errno;
-   if(errno != EEXIST)
+   if(err != -EEXIST)
goto err;
 
-   if(not_dead_yet(tmp) < 0)
+   /* 1   -> this umid is already in use
+* < 0 -> we couldn't remove the umid directory
+* In either case, we can't use this umid, so return -EEXIST.
+*/
+   if(not_dead_yet(tmp) != 0)
goto err;
 
err = mkdir(tmp, 0777);
}
-   if(err < 0){
-   printk("Failed to create '%s' - err = %d\n", umid, err);
-   goto err_rmdir;
+   if(err){
+   err = -errno;
+   printk("Failed to create '%s' - err = %d\n", umid, -errno);
+   goto err;
}
 
umid_setup = 1;
 
create_pid_file();
 
-   return 0;
-
- err_rmdir:
-   rmdir(tmp);
+   err = 0;
  err:
return err;
 }
 
 static int __init make_umid_init(void)
 {
+   if(!make_umid())
+   return 0;
+
+   /* If initializing with the given umid failed, then try again with
+* a random one.
+*/
+   printk("Failed to initialize umid \"%s\", trying with a random umid\n",
+  umid);
+   *umid = '\0';
make_umid();
 
return 0;



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 16/16] UML - Fix hostfs stack corruption

2006-03-24 Thread Jeff Dike
Noted by Oleg Drokin:
We initialized an extra slot of struct kstatfs.spare, sometimes
causing stack corruption.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.16/fs/hostfs/hostfs_user.c
===
--- linux-2.6.16.orig/fs/hostfs/hostfs_user.c   2006-03-23 16:49:38.0 
-0500
+++ linux-2.6.16/fs/hostfs/hostfs_user.c2006-03-23 17:46:09.0 
-0500
@@ -360,7 +360,6 @@ int do_statfs(char *root, long *bsize_ou
spare_out[2] = buf.f_spare[2];
spare_out[3] = buf.f_spare[3];
spare_out[4] = buf.f_spare[4];
-   spare_out[5] = buf.f_spare[5];
return(0);
 }
 



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 12/16] UML - Memory hotplug

2006-03-24 Thread Jeff Dike
This adds hotplug memory support to UML.  The mconsole syntax is
config mem=[+-]n[KMG]
In other words, add or subtract some number of kilobytes, megabytes, or
gigabytes.
 
Unplugged pages are allocated and then madvise(MADV_REMOVE), which is
a currently experimental madvise extension.  These pages are tracked so
they can be plugged back in later if the admin decides to give them back.
The first page to be unplugged is used to keep track of about 4M of other
pages.  A list_head is the first thing on this page.  The rest is filled
with addresses of other unplugged pages.  This first page is not madvised,
obviously.
When this page is filled, the next page is used in a similar way and linked
onto a list with the first page.  Etc.
This whole process reverses when pages are plugged back in.  When a tracking
page no longer tracks any unplugged pages, then it is next in line for
plugging, which is done by freeing pages back to the kernel.

This patch also removes checking for /dev/anon on the host, which is obsoleted
by MADVISE_REMOVE.

Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>

Index: linux-2.6.16/arch/um/drivers/mconsole_kern.c
===
--- linux-2.6.16.orig/arch/um/drivers/mconsole_kern.c   2006-03-23 
17:15:05.0 -0500
+++ linux-2.6.16/arch/um/drivers/mconsole_kern.c2006-03-23 
17:39:21.0 -0500
@@ -20,6 +20,8 @@
 #include "linux/namei.h"
 #include "linux/proc_fs.h"
 #include "linux/syscalls.h"
+#include "linux/list.h"
+#include "linux/mm.h"
 #include "linux/console.h"
 #include "asm/irq.h"
 #include "asm/uaccess.h"
@@ -347,6 +349,139 @@ static struct mc_device *mconsole_find_d
return(NULL);
 }
 
+#define UNPLUGGED_PER_PAGE \
+   ((PAGE_SIZE - sizeof(struct list_head)) / sizeof(unsigned long))
+
+struct unplugged_pages {
+   struct list_head list;
+   void *pages[UNPLUGGED_PER_PAGE];
+};
+
+static unsigned long long unplugged_pages_count = 0;
+static struct list_head unplugged_pages = LIST_HEAD_INIT(unplugged_pages);
+static int unplug_index = UNPLUGGED_PER_PAGE;
+
+static int mem_config(char *str)
+{
+   unsigned long long diff;
+   int err = -EINVAL, i, add;
+   char *ret;
+
+   if(str[0] != '=')
+   goto out;
+
+   str++;
+   if(str[0] == '-')
+   add = 0;
+   else if(str[0] == '+'){
+   add = 1;
+   }
+   else goto out;
+
+   str++;
+   diff = memparse(str, &ret);
+   if(*ret != '\0')
+   goto out;
+
+   diff /= PAGE_SIZE;
+
+   for(i = 0; i < diff; i++){
+   struct unplugged_pages *unplugged;
+   void *addr;
+
+   if(add){
+   if(list_empty(&unplugged_pages))
+   break;
+
+   unplugged = list_entry(unplugged_pages.next,
+  struct unplugged_pages, list);
+   if(unplug_index > 0)
+   addr = unplugged->pages[--unplug_index];
+   else {
+   list_del(&unplugged->list);
+   addr = unplugged;
+   unplug_index = UNPLUGGED_PER_PAGE;
+   }
+
+   free_page((unsigned long) addr);
+   unplugged_pages_count--;
+   }
+   else {
+   struct page *page;
+
+   page = alloc_page(GFP_ATOMIC);
+   if(page == NULL)
+   break;
+
+   unplugged = page_address(page);
+   if(unplug_index == UNPLUGGED_PER_PAGE){
+   INIT_LIST_HEAD(&unplugged->list);
+   list_add(&unplugged->list, &unplugged_pages);
+   unplug_index = 0;
+   }
+   else {
+   struct list_head *entry = unplugged_pages.next;
+   addr = unplugged;
+
+   unplugged = list_entry(entry,
+  struct unplugged_pages,
+  list);
+   unplugged->pages[unplug_index++] = addr;
+   err = os_drop_memory(addr, PAGE_SIZE);
+   if(err)
+   printk("Failed to release memory - "
+  "errno = %d\n", err);
+   }
+
+   unplugged_pages_count++;
+   }
+   }
+
+   err = 0;
+out:
+   return err;
+}
+
+static int mem_get_config(char *name, char *str, int size, char **error_out)
+{
+   char buf[sizeof("18446744073709551615\0")];
+   int len = 0;
+
+   

Re: [uml-devel] Re: TLS support - status - need for re-testing

2006-03-24 Thread Blaisorblade
On Friday 24 March 2006 18:32, Jeff Dike wrote:
> On Fri, Mar 24, 2006 at 12:43:33PM +0100, Blaisorblade wrote:
> > We discussed this time ago, and read the description of the patch:

> > > global-ldt-sem - We should be using mutexes now, not semaphores
> >
> > That's your patch, but below I drop this.
>
> My patch predates mutexes.
>
> But you still use semaphores, and that should be updated.

We'll do it at some time, there's no hurry for that; or they'll do it anyway 
before ripping out semaphores.

> It's simpler.  A single global lock is simpler than a lock in every
> datastructure.

My only doubt (I'd almost swear it doesn't happen) is if two locks of two 
different structures are ever taken. That would fail.

About locking, I've discovered that sigio_lock must use spin_lock_irqsave() 
instead of spin_lock; currently with Mutex debugging I get hangs on that 
spinlock, but on UP currently you get a race between process context and 
interrupt context.

The failing case is when that lock is taken in process context, then an 
interrupt is triggered whose handler takes again that. In fact, for mutual 
exclusion between process context and irq context an spin_lock_irq{,save} is 
_always_ recommended.

Only problem will be to check for sleepers in process context - there could be 
many ones.
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade





___ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] Re: [PATCH 12/16] UML - Memory hotplug

2006-03-24 Thread Andrew Morton
Jeff Dike <[EMAIL PROTECTED]> wrote:
>
> This adds hotplug memory support to UML.  The mconsole syntax is
>   config mem=[+-]n[KMG]
> In other words, add or subtract some number of kilobytes, megabytes, or
> gigabytes.
>  
> Unplugged pages are allocated and then madvise(MADV_REMOVE), which is
> a currently experimental madvise extension.  These pages are tracked so
> they can be plugged back in later if the admin decides to give them back.
> The first page to be unplugged is used to keep track of about 4M of other
> pages.  A list_head is the first thing on this page.  The rest is filled
> with addresses of other unplugged pages.  This first page is not madvised,
> obviously.
> When this page is filled, the next page is used in a similar way and linked
> onto a list with the first page.  Etc.
> This whole process reverses when pages are plugged back in.  When a tracking
> page no longer tracks any unplugged pages, then it is next in line for
> plugging, which is done by freeing pages back to the kernel.
> 
> This patch also removes checking for /dev/anon on the host, which is obsoleted
> by MADVISE_REMOVE.
> 
> ...
>
> +static unsigned long long unplugged_pages_count = 0;

The `= 0;' causes this to consume space in vmlinux's .data.  If we put it
in bss and let crt0.o take care of zeroing it, we save a little disk space.


> + page = alloc_page(GFP_ATOMIC);

That's potentially quite a few atomically-allocated pages.  I guess UML is
more resistant to oom than normal kernels (?) but it'd be nice to be able to
run page reclaim here.

> + char buf[sizeof("18446744073709551615\0")];

rofl.  We really ought to have a #define for "this architecture's maximum
length of an asciified int/long/s32/s64".  Generally people do
guess-and-giggle-plus-20%, or they just get it wrong.

> +#ifndef MADV_REMOVE
> +#define MADV_REMOVE  0x5 /* remove these pages & resources */
> +#endif
> +
> +int os_drop_memory(void *addr, int length)
> +{
> + int err;
> +
> + err = madvise(addr, length, MADV_REMOVE);
> + if(err < 0)
> + err = -errno;
> + return 0;
> +}

 * NOTE: Currently, only shmfs/tmpfs is supported for this operation.
 * Other filesystems return -ENOSYS.

Are you expecting that this memory is backed by tmpfs?



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] Fwd: Why uml-add-tls-support-debug-check-never-works is needed (was: Re: Fwd: Proposed additions to the ptrace(2) manpage, take 2)

2006-03-24 Thread Blaisorblade
Had sent it to the wrong address, resending.

--  Forwarded Message  --

Subject: Why uml-add-tls-support-debug-check-never-works is needed (was: Re: 
Fwd: Proposed additions to the ptrace(2) manpage, take 2)
Date: Saturday 25 March 2006 00:28
From: Blaisorblade <[EMAIL PROTECTED]>
To: Jeff Dike <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]

On Friday 24 March 2006 18:17, Jeff Dike wrote:
> On Fri, Mar 24, 2006 at 03:39:02PM +0100, Blaisorblade wrote:
> > Can you retest with my -bb6 tree? It should work, and it couldn't work in
> > you previous codebase. See below.
>
> Woohoo, it works.  The auditd crash is gone, too.
>
> > The special treatment of -EINVAL was bogus; for the call, I thought it
> > wasn't needed, but I tested removing that call on top of -bb6 and
> > everything thread-based stopped working in a _consistent_ way.
> >
> > So I'd like assurance that the bug was only that one, which would be a
> > welcome news.
>
> All of the failure cases I have are now fixed.

Ok, now I have the key: I have understood why this patch works and is needed
(and I hadn't when I wrote it!).

Time ago, in my mind was born the question: can a newly forked process start
running before that schedule does a switch_to() to it? I asked that because I
saw in debugging signs of this happening often; this meant that TLS weren't
flushed for newly born processes.

My answer was no. Your answer was no. It couldn't make sense. We even looked
at schedule() code! Well, we both were wrong.

The reasoning below shows detailedly why we were; however, the code is so
difficult that I thought I had understood why, then said "but no", then find
an even littler detail explaining the situations.

And as you noted, the TLS code failed on cases where (with CLONE_SETTLS) the
child is born with a TLS and it's immediately used - the TLS set inside UML
stays unflushed (i.e. not set on the host) only until the first schedule,
i.e. only for the 1st timeslice.

If a call to set_thread_area is done that's applied on the host immediately,
so that's not a problem.

Now, why were we wrong? It's because our copy_thread is very strange (wrt.
other archs).

Path:
(arch-independent) do_fork() -> copy_thread()->copy_thread_skas() ->
new_thread (..., fork_handler) ->

if (setjmp() == 0) new_thread_proc(..., fork_handler) else return
//At first time, this will return 0, letting us proceed into
 new_thread_proc()

finally new_thread_proc() calls fork_handler(), which will call userspace()
 on the new stack.

However, before calling userspace(), this threads suspends itself in
thread_wait; it will be resumed by a longjmp() to the switch_buf of the new
thread, i.e. by a switch_to! So, one thinks that the switch_to is called. But
it's called by the old thread! The new thread won't execute it, until the end
of its timeslice.

A normal ctx switch executes switch_threads() from the old thread and changes
EIP and ESP (and the rest) to point to the call to switch_threads() inside
switch_to_skas() in the new thread (it's well explained in the comment of
switch_to_tt(), even if the details of ctx switch are different).

At this point, the new thread continues executing switch_to_skas(). And calls
arch_switch_to_skas() and loads its TLS.

BUT, this context switch at the thread born is special: the thread being
switched away switches to a new thread not in the body of the new thread's
call to switch_to_skas->switch_threads(), but in the body of thread_wait()!
At that point, we lose the call to arch_switch_to_skas()!

Questions and notes:

*) Why does arch/um/os-Linux/skas/process.c has still one siglongjmp() call
and sigjmp_buf vars, and that has no comments?

*) Also, why thread_wait and thread_switch are almost identical, yet they're
two different functions?

*) Btw, the naming sucks - if I find better names for new_thread,
new_thread_proc and such, would they be accepted?

*) The same bug happens in TT mode fork_tramp()->finish_fork_handler():
suspend_new_thread waits with SIGSTOP (to wait for the debugger resuming it)
and on os_read_file on switch_pipe, like in switch_to_tt; but we don't do the
things we do in switch_to_tt (like killing it if dead - schedule_tail is not
the same thing).
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

---

-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade


___ 
Yahoo! Messenger with Voice: chiama da PC a telefono a tariffe esclusive 
http://it.messenger.yahoo.com



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into we

Re: [uml-devel] Re: [PATCH 12/16] UML - Memory hotplug

2006-03-24 Thread Blaisorblade
On Friday 24 March 2006 23:45, Andrew Morton wrote:
> Jeff Dike <[EMAIL PROTECTED]> wrote:

> > Unplugged pages are allocated and then madvise(MADV_REMOVE), 

> > This patch also removes checking for /dev/anon on the host, which is
> > obsoleted by MADVISE_REMOVE.

>  * NOTE: Currently, only shmfs/tmpfs is supported for this operation.
>  * Other filesystems return -ENOSYS.

> Are you expecting that this memory is backed by tmpfs?

Yes, that's the recommended configuration, and we're going to move the default 
position for the backing file to /dev/shm.

However, it's bogus to miss any error handling - possibly not returning err is 
wanted (dunno) because Jeff wants to pretend it succeeded anyway, but at 
least a printk() to inform the user that memory must lay on tmpfs is 
required.

> +int os_drop_memory(void *addr, int length)
> +{
> + int err;
> +
> + err = madvise(addr, length, MADV_REMOVE);
> + if(err < 0)
> + err = -errno;

Jeff, did you mean the "return _0_" rather than "return err" below? It's 
incoherent with the existance of the "err" local.

> + return 0;
> +}

-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade





___ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] Re: [PATCH 12/16] UML - Memory hotplug

2006-03-24 Thread Jeff Dike
On Fri, Mar 24, 2006 at 02:45:35PM -0800, Andrew Morton wrote:
> The `= 0;' causes this to consume space in vmlinux's .data.  If we put it
> in bss and let crt0.o take care of zeroing it, we save a little disk space.

Yup.

> > +   page = alloc_page(GFP_ATOMIC);
> 
> That's potentially quite a few atomically-allocated pages.  I guess UML is
> more resistant to oom than normal kernels (?) but it'd be nice to be able to
> run page reclaim here.

This is the big question with this patch.  How incestuous do I want to
get with the VM system in order to get it to free up pages?  For now,
I decided to be fairly hands-off, allocate as many pages as I can get,
and return the total number to the host.  The host, if it wasn't happy
with the results, can wait a bit while the UML notices that it is
really low on memory and frees some up, and then hit up the UML for
the remainder.

> > +   char buf[sizeof("18446744073709551615\0")];
> 
> rofl.  We really ought to have a #define for "this architecture's maximum
> length of an asciified int/long/s32/s64".  Generally people do
> guess-and-giggle-plus-20%, or they just get it wrong.

I can write one up.  I did some quick grepping, and there are a good
number of constant over-estimates, plus some which might be in danger
with an large number of devices, plus one (kallsyms.c) which actually
does some sane-looking approximate math to get a reasonable number (which
is then doubled).

>  * NOTE: Currently, only shmfs/tmpfs is supported for this operation.
>  * Other filesystems return -ENOSYS.
> 
> Are you expecting that this memory is backed by tmpfs?

Yes, but there should be some checking of this beforehand.

Drop this version for now, and I'll send a new one to cover these
problems plus the one that BlaisorBlade pointed out.

Jeff


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] Re: [PATCH 12/16] UML - Memory hotplug

2006-03-24 Thread Jeff Dike
On Sat, Mar 25, 2006 at 12:58:57AM +0100, Blaisorblade wrote:
> > +int os_drop_memory(void *addr, int length)
> > +{
> > + int err;
> > +
> > + err = madvise(addr, length, MADV_REMOVE);
> > + if(err < 0)
> > + err = -errno;
> 
> Jeff, did you mean the "return _0_" rather than "return err" below? It's 
> incoherent with the existance of the "err" local.
> 
> > + return 0;
> > +}

That's just a brain fart - will fix.

Jeff


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] Re: Why uml-add-tls-support-debug-check-never-works is needed

2006-03-24 Thread Jeff Dike
On Sat, Mar 25, 2006 at 12:28:09AM +0100, Blaisorblade wrote:
> BUT, this context switch at the thread born is special: the thread being 
> switched away switches to a new thread not in the body of the new thread's 
> call to switch_to_skas->switch_threads(), but in the body of thread_wait()! 
> At that point, we lose the call to arch_switch_to_skas()!

Yuck yuck yuck.  Nice spotting.

There's an obvious one-line fix for this, but I wonder if we ought to
try some restructuring to avoid this sort of thing in the future.

> Questions and notes:
> 
> *) Why does arch/um/os-Linux/skas/process.c has still one siglongjmp() call 
> and sigjmp_buf vars, and that has no comments?

I'm tempted to say that I just missed the call somehow.  I see no
reason for that to be different, especially since it's preceded by a
UML_SIGSETJMP.  As for the sigjmp_buf variables, I don't get your
point.  Those haven't changed.

> *) Also, why thread_wait and thread_switch are almost identical, yet they're 
> two different functions?

switch_threads?  In order to merge them, you'd have to pass in the 1
and the INIT_JMP_REMOVE_SIGSTACK, which I have conceptual problems
with.  First, that makes the callers know things that they probably
shouldn't.  Second, the 1 and the INIT_JMP_REMOVE_SIGSTACK have
completely different meanings.  One is a message to the initial thread
that it has to do something.  The 1 is a message to setjmp that is has
been longjmp-ed to.

> *) Btw, the naming sucks - if I find better names for new_thread, 
> new_thread_proc and such, would they be accepted?

Sure, good names are always appreciated.

Jeff


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel