[uml-devel] [GIT PULL] UML changes for 3.5-rc1

2012-05-22 Thread Richard Weinberger
Linus,

Please pull the latest for-linus tree from:

  git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git for-linus

  HEAD: 2ccf62b36097aa88e0ea152d6ef0c0ca2d3884e6:
  Merge branch 'for-um' of 
git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal into for-3.5 
(2012-05-21 23:25:37 +0200)

Most changes are bug fixes and cleanups.

Thanks,
//richard



Al Viro (7):
  um: ->restart_block.fn needs to be reset on sigreturn
  um: add TIF_NOTIFY_RESUME
  um: wrong sigmask saved in case of multiple sigframes
  um: bury unused _TIF_RESTORE_SIGMASK
  um/x86: merge (and trim) 32- and 64-bit variants of ptrace.h
  um: stub_rt_sigsuspend isn't needed these days anymore
  um: missing checks of __put_user()/__get_user() return values

Richard Weinberger (9):
  um: Remove unused variables
  um: Add BUG() to do_ops()'s error path
  um: Implement a custom pte_same() function
  um: Fix __swp_type()
  um: Implement um_free_irq()
  um: Remove usage of irq_chip->release()
  um: Remove CONFIG_IRQ_RELEASE_METHOD
  irq: Remove irq_chip->release()
  Merge branch 'for-um' of git://git.kernel.org/.../viro/signal 
into for-3.5

 arch/um/Kconfig.common|5 --
 arch/um/defconfig |1 -
 arch/um/drivers/chan_kern.c   |9 +--
 arch/um/drivers/line.c|2 +-
 arch/um/drivers/net_kern.c|4 +-
 arch/um/drivers/port_kern.c   |2 +-
 arch/um/drivers/xterm_kern.c  |2 +-
 arch/um/include/asm/pgtable.h |   10 +++-
 arch/um/include/asm/thread_info.h |2 +-
 arch/um/include/shared/irq_kern.h |2 +-
 arch/um/kernel/irq.c  |9 ++-
 arch/um/kernel/process.c  |   10 +++-
 arch/um/kernel/signal.c   |   14 ++---
 arch/um/kernel/skas/syscall.c |2 +-
 arch/um/kernel/tlb.c  |1 +
 arch/um/os-Linux/skas/mem.c   |   10 
 arch/x86/um/asm/elf.h |   42 +++---
 arch/x86/um/asm/ptrace.h  |   34 +++
 arch/x86/um/asm/ptrace_32.h   |   23 
 arch/x86/um/asm/ptrace_64.h   |   26 -
 arch/x86/um/shared/sysdep/ptrace.h|   67 --
 arch/x86/um/shared/sysdep/ptrace_32.h |   92 
+++---
 arch/x86/um/shared/sysdep/ptrace_64.h |  101 
++---
 arch/x86/um/signal.c  |   29 +-
 arch/x86/um/sys_call_table_64.c   |1 -
 arch/x86/um/syscalls_32.c |   12 ++--
 arch/x86/um/sysrq_32.c|8 +--
 arch/x86/um/sysrq_64.c|8 +--
 arch/x86/um/tls_32.c  |2 +-
 include/linux/irq.h   |5 --
 kernel/irq/manage.c   |6 --
 31 files changed, 201 insertions(+), 340 deletions(-)


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] UML: Please help with __module_text_address crashing

2012-05-25 Thread Richard Weinberger
On 25.05.2012 11:19, Boaz Harrosh wrote:
> Whats keeping this patch from hitting mainline? to much ugliness?
> Is there a way to work without it (somehow)
>

UML's tty driver is a corner case. (It is a console but does not support
virtual consoles, etc...)
TTY folks are currently moving most drivers to the new tty_port 
interface. UML has also to use tty_port. But as of writing of the my 
tty-patch tty_port was not fully ready for consoles.
Anyway, I'll checkout what's the current state of tty_port is and 
rewrite UML's TTY mess^Wdriver again. :)

Thanks,
//richard

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] [PATCH 13/24] TTY: um/line, use tty from tty_port

2012-06-04 Thread Richard Weinberger
Jiri,

Thanks a lot for fixing this!

I have two questions:
1. Are these patches also usable on 3.4 and 3.3 or do they depend on 3.5's TTY 
changes?
2. Why didn't you use tty_port_open()/close()/etc. as Alan suggested my in [1]?

Thanks,
//richard

[1] http://lkml.indiana.edu/hypermail/linux/kernel/1201.3/01705.html

Am 04.06.2012 13:35, schrieb Jiri Slaby:
> This means switching to the tty refcounted model so that we will not
> race with interrupts.
> 
> Signed-off-by: Jiri Slaby 
> Cc: Jeff Dike 
> Cc: Richard Weinberger 
> Cc: user-mode-linux-devel@lists.sourceforge.net
> ---
>  arch/um/drivers/chan_kern.c |4 +++-
>  arch/um/drivers/line.c  |   25 ++---
>  arch/um/drivers/line.h  |1 -
>  3 files changed, 21 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
> index 45e248c..87eebfe 100644
> --- a/arch/um/drivers/chan_kern.c
> +++ b/arch/um/drivers/chan_kern.c
> @@ -150,9 +150,11 @@ void chan_enable_winch(struct chan *chan, struct 
> tty_struct *tty)
>  static void line_timer_cb(struct work_struct *work)
>  {
>   struct line *line = container_of(work, struct line, task.work);
> + struct tty_struct *tty = tty_port_tty_get(&line->port);
>  
>   if (!line->throttled)
> - chan_interrupt(line, line->tty, line->driver->read_irq);
> + chan_interrupt(line, tty, line->driver->read_irq);
> + tty_kref_put(tty);
>  }
>  
>  int enable_chan(struct line *line)
> diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
> index 482a7bd..fb6e4ea 100644
> --- a/arch/um/drivers/line.c
> +++ b/arch/um/drivers/line.c
> @@ -19,9 +19,11 @@ static irqreturn_t line_interrupt(int irq, void *data)
>  {
>   struct chan *chan = data;
>   struct line *line = chan->line;
> + struct tty_struct *tty = tty_port_tty_get(&line->port);
>  
>   if (line)
> - chan_interrupt(line, line->tty, irq);
> + chan_interrupt(line, tty, irq);
> + tty_kref_put(tty);
>   return IRQ_HANDLED;
>  }
>  
> @@ -333,7 +335,7 @@ static irqreturn_t line_write_interrupt(int irq, void 
> *data)
>  {
>   struct chan *chan = data;
>   struct line *line = chan->line;
> - struct tty_struct *tty = line->tty;
> + struct tty_struct *tty;
>   int err;
>  
>   /*
> @@ -352,10 +354,13 @@ static irqreturn_t line_write_interrupt(int irq, void 
> *data)
>   }
>   spin_unlock(&line->lock);
>  
> + tty = tty_port_tty_get(&line->port);
>   if (tty == NULL)
>   return IRQ_NONE;
>  
>   tty_wakeup(tty);
> + tty_kref_put(tty);
> +
>   return IRQ_HANDLED;
>  }
>  
> @@ -409,7 +414,7 @@ int line_open(struct line *lines, struct tty_struct *tty)
>  
>   BUG_ON(tty->driver_data);
>   tty->driver_data = line;
> - line->tty = tty;
> + tty_port_tty_set(&line->port, tty);
>  
>   err = enable_chan(line);
>   if (err) /* line_close() will be called by our caller */
> @@ -449,7 +454,7 @@ void line_close(struct tty_struct *tty, struct file * 
> filp)
>   if (--line->port.count)
>   goto out_unlock;
>  
> - line->tty = NULL;
> + tty_port_tty_set(&line->port, NULL);
>   tty->driver_data = NULL;
>  
>   if (line->sigio) {
> @@ -610,9 +615,15 @@ int line_get_config(char *name, struct line *lines, 
> unsigned int num, char *str,
>   mutex_lock(&line->count_lock);
>   if (!line->valid)
>   CONFIG_CHUNK(str, size, n, "none", 1);
> - else if (line->tty == NULL)
> - CONFIG_CHUNK(str, size, n, line->init_str, 1);
> - else n = chan_config_string(line, str, size, error_out);
> + else {
> + struct tty_struct *tty = tty_port_tty_get(&line->port);
> + if (tty == NULL) {
> + CONFIG_CHUNK(str, size, n, line->init_str, 1);
> + } else {
> + n = chan_config_string(line, str, size, error_out);
> + tty_kref_put(tty);
> + }
> + }
>   mutex_unlock(&line->count_lock);
>  
>   return n;
> diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h
> index 0e06a1f..5b3d4fb 100644
> --- a/arch/um/drivers/line.h
> +++ b/arch/um/drivers/line.h
> @@ -33,7 +33,6 @@ struct line_driver {
>  
>  struct line {
>   struct tty_port port;
> - struct tty_struct *tty;
>   struct mutex count_lock;
>   int valid;
>  




signature.asc
Description: OpenPGP

Re: [uml-devel] [PATCH 13/24] TTY: um/line, use tty from tty_port

2012-06-04 Thread Richard Weinberger
Hi!

Am 04.06.2012 17:20, schrieb Jiri Slaby:
> On 06/04/2012 02:01 PM, Richard Weinberger wrote:
>> I have two questions: 1. Are these patches also usable on 3.4 and
>> 3.3 or do they depend on 3.5's TTY changes?
> 
> Hi, I don't think they depend on any changes.

Nice.

>> 2. Why didn't you use tty_port_open()/close()/etc. as Alan
>> suggested my in [1]?
> 
> This was not intended to fix anything particular. If it does, it is a
> pure coincidence... These patches are a minimalistic subset to ensure
> every driver has its own tty_port for each tty. We will need this
> pairing later.

It looks like that it solves UML's TTY issues with systemd distros. :-)

> So the switch of the driver to the new tty port API, as suggested by
> Alan, is still needed. I might do that later if I learn how to make
> UML work. (The conversion is by definition invasive and needs runtime
> testing.)

Two days ago I did so but still faced the problems described here:
https://lkml.org/lkml/2012/3/10/163

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] [PATCH 13/24] TTY: um/line, use tty from tty_port

2012-06-04 Thread Richard Weinberger
Am 04.06.2012 17:41, schrieb Jiri Slaby:
> Hmm, I remember. I suggest you to split the patch into several pieces.
> For example moving the code from ->open into ->install can be done
> separately. Otherwise it's hard to tell what's wrong with the patch as
> a whole.
> 
> Also, it would be good to see the patch rebased on the top of my
> patch, because tty_port_set/get pieces would be gone from your patch too.

Okay, I'll redo it!
I've a much cleaner version in my local queue.

Thanks,
//richard




signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] [PATCH 13/24] TTY: um/line, use tty from tty_port

2012-06-04 Thread Richard Weinberger
Am 04.06.2012 18:27, schrieb Boaz Harrosh:
> On 06/04/2012 06:42 PM, Richard Weinberger wrote:
> 
>> Am 04.06.2012 17:41, schrieb Jiri Slaby:
>>> Hmm, I remember. I suggest you to split the patch into several pieces.
>>> For example moving the code from ->open into ->install can be done
>>> separately. Otherwise it's hard to tell what's wrong with the patch as
>>> a whole.
>>>
>>> Also, it would be good to see the patch rebased on the top of my
>>> patch, because tty_port_set/get pieces would be gone from your patch too.
>>
>> Okay, I'll redo it!
>> I've a much cleaner version in my local queue.
>>
> 
> 
> Can you send it my way, I'm still running broken, 3.4 Based ?
> 

Can you please first give Jiri's patches a try?

[PATCH 12/24] TTY: um/line, add tty_port
[PATCH 13/24] TTY: um/line, use tty from tty_port

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] [PATCH 13/24] TTY: um/line, use tty from tty_port

2012-06-04 Thread Richard Weinberger
Am 04.06.2012 18:55, schrieb Boaz Harrosh:
> No still crashing the same, way. BTW I do not have a systemd Distro. It's
> plain old FC12. Though in the lab I have the same crash with FC15.
> 
> The crash is immediately after I login at the initial prompt. (every time)

Okay, I'll test my patches with FC12 too. :-\

> Here is the crash print, what ever that is worth in UML.
> (Can we make the crash dump stack trace a bit less terrible?)

-ENOPATCH. :-)
Feel free to send one.

Thanks,
//richard




signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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 5/6] um: fully use tty_port

2012-06-04 Thread Richard Weinberger
... use all tty_port helpers

Signed-off-by: Richard Weinberger 
---
 arch/um/drivers/line.c  |  102 +--
 arch/um/drivers/line.h  |6 ++-
 arch/um/drivers/ssl.c   |   15 ++
 arch/um/drivers/stdio_console.c |   20 
 4 files changed, 65 insertions(+), 78 deletions(-)

diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 131129a..95d5e78 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -296,43 +296,14 @@ int line_setup_irq(int fd, int input, int output, struct 
line *line, void *data)
return err;
 }
 
-/*
- * Normally, a driver like this can rely mostly on the tty layer
- * locking, particularly when it comes to the driver structure.
- * However, in this case, mconsole requests can come in "from the
- * side", and race with opens and closes.
- *
- * mconsole config requests will want to be sure the device isn't in
- * use, and get_config, open, and close will want a stable
- * configuration.  The checking and modification of the configuration
- * is done under a spinlock.  Checking whether the device is in use is
- * line->tty->count > 1, also under the spinlock.
- *
- * line->count serves to decide whether the device should be enabled or
- * disabled on the host.  If it's equal to 0, then we are doing the
- * first open or last close.  Otherwise, open and close just return.
- */
-
-int line_open(struct line *lines, struct tty_struct *tty)
+static int line_activate(struct tty_port *port, struct tty_struct *tty)
 {
-   struct line *line = &lines[tty->index];
-   int err = -ENODEV;
-
-   mutex_lock(&line->count_lock);
-   if (!line->valid)
-   goto out_unlock;
-
-   err = 0;
-   if (line->port.count++)
-   goto out_unlock;
-
-   BUG_ON(tty->driver_data);
-   tty->driver_data = line;
-   tty_port_tty_set(&line->port, tty);
+   int ret;
+   struct line *line = tty->driver_data;
 
-   err = enable_chan(line);
-   if (err) /* line_close() will be called by our caller */
-   goto out_unlock;
+   ret = enable_chan(line);
+   if (ret)
+   return ret;
 
if (!line->sigio) {
chan_enable_winch(line->chan_out, tty);
@@ -340,44 +311,60 @@ int line_open(struct line *lines, struct tty_struct *tty)
}
 
chan_window_size(line, &tty->winsize.ws_row,
-&tty->winsize.ws_col);
-out_unlock:
-   mutex_unlock(&line->count_lock);
-   return err;
+   &tty->winsize.ws_col);
+
+   return 0;
 }
 
-static void unregister_winch(struct tty_struct *tty);
+static const struct tty_port_operations line_port_ops = {
+   .activate = line_activate,
+};
 
-void line_close(struct tty_struct *tty, struct file * filp)
+int line_open(struct tty_struct *tty, struct file *filp)
 {
struct line *line = tty->driver_data;
 
-   /*
-* If line_open fails (and tty->driver_data is never set),
-* tty_open will call line_close.  So just return in this case.
-*/
-   if (line == NULL)
-   return;
+   return tty_port_open(&line->port, tty, filp);
+}
 
-   /* We ignore the error anyway! */
-   flush_buffer(line);
+int line_install(struct tty_driver *driver, struct tty_struct *tty,
+struct line *line)
+{
+   int ret;
 
-   mutex_lock(&line->count_lock);
-   BUG_ON(!line->valid);
+   ret = tty_standard_install(driver, tty);
+   if (ret)
+   return ret;
+
+   tty->driver_data = line;
 
-   if (--line->port.count)
-   goto out_unlock;
+   return 0;
+}
+
+static void unregister_winch(struct tty_struct *tty);
 
-   tty_port_tty_set(&line->port, NULL);
-   tty->driver_data = NULL;
+void line_cleanup(struct tty_struct *tty)
+{
+   struct line *line = tty->driver_data;
 
if (line->sigio) {
unregister_winch(tty);
line->sigio = 0;
}
+}
 
-out_unlock:
-   mutex_unlock(&line->count_lock);
+void line_close(struct tty_struct *tty, struct file * filp)
+{
+   struct line *line = tty->driver_data;
+
+   tty_port_close(&line->port, tty, filp);
+}
+
+void line_hangup(struct tty_struct *tty)
+{
+   struct line *line = tty->driver_data;
+
+   tty_port_hangup(&line->port);
 }
 
 void close_lines(struct line *lines, int nlines)
@@ -589,6 +576,7 @@ int register_lines(struct line_driver *line_driver,

for (i = 0; i < nlines; i++) {
tty_port_init(&lines[i].port);
+   lines[i].port.ops = &line_port_ops;
spin_lock_init(&lines[i].lock);
mutex_init(&lines[i].count_lock);
lines[i].drive

[uml-devel] [PATCH 3/6] um: remove line_ioctl()

2012-06-04 Thread Richard Weinberger
line_ioctl() has no real function.

Signed-off-by: Richard Weinberger 
---
 arch/um/drivers/line.c  |   86 ---
 arch/um/drivers/line.h  |2 -
 arch/um/drivers/ssl.c   |1 -
 arch/um/drivers/stdio_console.c |1 -
 4 files changed, 0 insertions(+), 90 deletions(-)

diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index fb6e4ea..131129a 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -221,92 +221,6 @@ void line_set_termios(struct tty_struct *tty, struct 
ktermios * old)
/* nothing */
 }
 
-static const struct {
-   int  cmd;
-   char *level;
-   char *name;
-} tty_ioctls[] = {
-   /* don't print these, they flood the log ... */
-   { TCGETS,  NULL,   "TCGETS"  },
-   { TCSETS,  NULL,   "TCSETS"  },
-   { TCSETSW, NULL,   "TCSETSW" },
-   { TCFLSH,  NULL,   "TCFLSH"  },
-   { TCSBRK,  NULL,   "TCSBRK"  },
-
-   /* general tty stuff */
-   { TCSETSF, KERN_DEBUG, "TCSETSF" },
-   { TCGETA,  KERN_DEBUG, "TCGETA"  },
-   { TIOCMGET,KERN_DEBUG, "TIOCMGET"},
-   { TCSBRKP, KERN_DEBUG, "TCSBRKP" },
-   { TIOCMSET,KERN_DEBUG, "TIOCMSET"},
-
-   /* linux-specific ones */
-   { TIOCLINUX,   KERN_INFO,  "TIOCLINUX"   },
-   { KDGKBMODE,   KERN_INFO,  "KDGKBMODE"   },
-   { KDGKBTYPE,   KERN_INFO,  "KDGKBTYPE"   },
-   { KDSIGACCEPT, KERN_INFO,  "KDSIGACCEPT" },
-};
-
-int line_ioctl(struct tty_struct *tty, unsigned int cmd,
-   unsigned long arg)
-{
-   int ret;
-   int i;
-
-   ret = 0;
-   switch(cmd) {
-#ifdef TIOCGETP
-   case TIOCGETP:
-   case TIOCSETP:
-   case TIOCSETN:
-#endif
-#ifdef TIOCGETC
-   case TIOCGETC:
-   case TIOCSETC:
-#endif
-#ifdef TIOCGLTC
-   case TIOCGLTC:
-   case TIOCSLTC:
-#endif
-   /* Note: these are out of date as we now have TCGETS2 etc but this
-  whole lot should probably go away */
-   case TCGETS:
-   case TCSETSF:
-   case TCSETSW:
-   case TCSETS:
-   case TCGETA:
-   case TCSETAF:
-   case TCSETAW:
-   case TCSETA:
-   case TCXONC:
-   case TCFLSH:
-   case TIOCOUTQ:
-   case TIOCINQ:
-   case TIOCGLCKTRMIOS:
-   case TIOCSLCKTRMIOS:
-   case TIOCPKT:
-   case TIOCGSOFTCAR:
-   case TIOCSSOFTCAR:
-   return -ENOIOCTLCMD;
-#if 0
-   case TCwhatever:
-   /* do something */
-   break;
-#endif
-   default:
-   for (i = 0; i < ARRAY_SIZE(tty_ioctls); i++)
-   if (cmd == tty_ioctls[i].cmd)
-   break;
-   if (i == ARRAY_SIZE(tty_ioctls)) {
-   printk(KERN_ERR "%s: %s: unknown ioctl: 0x%x\n",
-  __func__, tty->name, cmd);
-   }
-   ret = -ENOIOCTLCMD;
-   break;
-   }
-   return ret;
-}
-
 void line_throttle(struct tty_struct *tty)
 {
struct line *line = tty->driver_data;
diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h
index 5b3d4fb..6c3b252 100644
--- a/arch/um/drivers/line.h
+++ b/arch/um/drivers/line.h
@@ -69,8 +69,6 @@ extern int line_chars_in_buffer(struct tty_struct *tty);
 extern void line_flush_buffer(struct tty_struct *tty);
 extern void line_flush_chars(struct tty_struct *tty);
 extern int line_write_room(struct tty_struct *tty);
-extern int line_ioctl(struct tty_struct *tty, unsigned int cmd,
-   unsigned long arg);
 extern void line_throttle(struct tty_struct *tty);
 extern void line_unthrottle(struct tty_struct *tty);
 
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index e09801a..a39d53e 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -129,7 +129,6 @@ static const struct tty_operations ssl_ops = {
.flush_buffer   = line_flush_buffer,
.flush_chars= line_flush_chars,
.set_termios= line_set_termios,
-   .ioctl  = line_ioctl,
.throttle   = line_throttle,
.unthrottle = line_unthrottle,
 #if 0
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 7663541..5cefdba 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -112,7 +112,6 @@ static const struct tty_operations console_ops = {
.flush_buffer   = line_flush_buffer,
.flush_chars= line_flush_chars,
.set_termios= line_set_termios,
-   .ioctl  = line_ioctl,
.throttle   = line_throttl

[uml-devel] um: TTY fixes (?)

2012-06-04 Thread Richard Weinberger
This patch set moves the UML console driver to the new TTY port interface.
It does ref counting and uses the tty_port_*-helpers.
Please note, it's not yet UML mconsole safe!

Anyway, I see some really strange things and I'm not sure whether my patch
is sane or not...

If I implement tty_operations->hangup() the following happens:

FC12:
Login on tty0 works fine.
On all other ttys login works but bash dies because of of -EIO.
After vhangup() the tty returns -EIO upon read()/write().
FC16:
Login broken on all ttys (bash dies with EIO like on FC12).
If I start UML with rootfs read-only login works on tty0. - WTF?!
Debian 6.0:
Login works perfectly fine on all ttys

Without tty_operations->hangup() the following happens:
FC12:
Login on tty0 works fine.
mingetty is unable to start on anything else than tty0.
It exits after a few seconds.
FC16:
Unable to start any mingetty (like on FC12 it exits after a few seconds)
With read-only rootfs mingetty starts at least on tty0 and login works. 
(Again, WTF?)
Debian 6.0
Login works perfectly fine on all ttys.

I have no idea what's the root cause of this, there seems to be a lot of black 
magic
involved.
Alan, do you think the issues are caused by Fedora's broken user space?
How can we fix this?

Thanks,
//richard (wearing a voodoo priests robe)

[PATCH 1/6] TTY: um/line, add tty_port
[PATCH 2/6] TTY: um/line, use tty from tty_port
[PATCH 3/6] um: remove line_ioctl()
[PATCH 4/6] um: Remove dead code
[PATCH 5/6] um: fully use tty_port
[PATCH 6/6] um: remove count_lock

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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/6] um: Remove dead code

2012-06-04 Thread Richard Weinberger
Signed-off-by: Richard Weinberger 
---
 arch/um/drivers/ssl.c |   26 --
 1 files changed, 0 insertions(+), 26 deletions(-)

diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index a39d53e..cba95d9 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -98,27 +98,6 @@ static int ssl_open(struct tty_struct *tty, struct file 
*filp)
return err;
 }
 
-#if 0
-static void ssl_flush_buffer(struct tty_struct *tty)
-{
-   return;
-}
-
-static void ssl_stop(struct tty_struct *tty)
-{
-   printk(KERN_ERR "Someone should implement ssl_stop\n");
-}
-
-static void ssl_start(struct tty_struct *tty)
-{
-   printk(KERN_ERR "Someone should implement ssl_start\n");
-}
-
-void ssl_hangup(struct tty_struct *tty)
-{
-}
-#endif
-
 static const struct tty_operations ssl_ops = {
.open   = ssl_open,
.close  = line_close,
@@ -131,11 +110,6 @@ static const struct tty_operations ssl_ops = {
.set_termios= line_set_termios,
.throttle   = line_throttle,
.unthrottle = line_unthrottle,
-#if 0
-   .stop   = ssl_stop,
-   .start  = ssl_start,
-   .hangup = ssl_hangup,
-#endif
 };
 
 /* Changed by ssl_init and referenced by ssl_exit, which are both serialized
-- 
1.7.7.3


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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/6] TTY: um/line, add tty_port

2012-06-04 Thread Richard Weinberger
From: Jiri Slaby 

And use count from there.

Signed-off-by: Jiri Slaby 
Cc: Jeff Dike 
Cc: Richard Weinberger 
Cc: user-mode-linux-devel@lists.sourceforge.net
Signed-off-by: Richard Weinberger 
---
 arch/um/drivers/line.c |7 ---
 arch/um/drivers/line.h |2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index acfd0e0..482a7bd 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -404,7 +404,7 @@ int line_open(struct line *lines, struct tty_struct *tty)
goto out_unlock;
 
err = 0;
-   if (line->count++)
+   if (line->port.count++)
goto out_unlock;
 
BUG_ON(tty->driver_data);
@@ -446,7 +446,7 @@ void line_close(struct tty_struct *tty, struct file * filp)
mutex_lock(&line->count_lock);
BUG_ON(!line->valid);
 
-   if (--line->count)
+   if (--line->port.count)
goto out_unlock;
 
line->tty = NULL;
@@ -478,7 +478,7 @@ int setup_one_line(struct line *lines, int n, char *init,
 
mutex_lock(&line->count_lock);
 
-   if (line->count) {
+   if (line->port.count) {
*error_out = "Device is already open";
goto out;
}
@@ -663,6 +663,7 @@ int register_lines(struct line_driver *line_driver,
driver->init_termios = tty_std_termios;

for (i = 0; i < nlines; i++) {
+   tty_port_init(&lines[i].port);
spin_lock_init(&lines[i].lock);
mutex_init(&lines[i].count_lock);
lines[i].driver = line_driver;
diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h
index 0a18347..0e06a1f 100644
--- a/arch/um/drivers/line.h
+++ b/arch/um/drivers/line.h
@@ -32,9 +32,9 @@ struct line_driver {
 };
 
 struct line {
+   struct tty_port port;
struct tty_struct *tty;
struct mutex count_lock;
-   unsigned long count;
int valid;
 
char *init_str;
-- 
1.7.7.3


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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 6/6] um: remove count_lock

2012-06-04 Thread Richard Weinberger
this lock is no longer needed.

Signed-off-by: Richard Weinberger 
---
 arch/um/drivers/line.c |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 95d5e78..555ccfc 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -382,8 +382,6 @@ int setup_one_line(struct line *lines, int n, char *init,
struct tty_driver *driver = line->driver->driver;
int err = -EINVAL;
 
-   mutex_lock(&line->count_lock);
-
if (line->port.count) {
*error_out = "Device is already open";
goto out;
@@ -425,7 +423,6 @@ int setup_one_line(struct line *lines, int n, char *init,
}
}
 out:
-   mutex_unlock(&line->count_lock);
return err;
 }
 
@@ -513,7 +510,6 @@ int line_get_config(char *name, struct line *lines, 
unsigned int num, char *str,
 
line = &lines[dev];
 
-   mutex_lock(&line->count_lock);
if (!line->valid)
CONFIG_CHUNK(str, size, n, "none", 1);
else {
@@ -525,7 +521,6 @@ int line_get_config(char *name, struct line *lines, 
unsigned int num, char *str,
tty_kref_put(tty);
}
}
-   mutex_unlock(&line->count_lock);
 
return n;
 }
@@ -578,7 +573,6 @@ int register_lines(struct line_driver *line_driver,
tty_port_init(&lines[i].port);
lines[i].port.ops = &line_port_ops;
spin_lock_init(&lines[i].lock);
-   mutex_init(&lines[i].count_lock);
lines[i].driver = line_driver;
INIT_LIST_HEAD(&lines[i].chan_list);
}
-- 
1.7.7.3


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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/6] TTY: um/line, use tty from tty_port

2012-06-04 Thread Richard Weinberger
From: Jiri Slaby 

This means switching to the tty refcounted model so that we will not
race with interrupts.

Signed-off-by: Jiri Slaby 
Cc: Jeff Dike 
Cc: Richard Weinberger 
Cc: user-mode-linux-devel@lists.sourceforge.net
Signed-off-by: Richard Weinberger 
---
 arch/um/drivers/chan_kern.c |4 +++-
 arch/um/drivers/line.c  |   25 ++---
 arch/um/drivers/line.h  |1 -
 3 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 45e248c..87eebfe 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -150,9 +150,11 @@ void chan_enable_winch(struct chan *chan, struct 
tty_struct *tty)
 static void line_timer_cb(struct work_struct *work)
 {
struct line *line = container_of(work, struct line, task.work);
+   struct tty_struct *tty = tty_port_tty_get(&line->port);
 
if (!line->throttled)
-   chan_interrupt(line, line->tty, line->driver->read_irq);
+   chan_interrupt(line, tty, line->driver->read_irq);
+   tty_kref_put(tty);
 }
 
 int enable_chan(struct line *line)
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 482a7bd..fb6e4ea 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -19,9 +19,11 @@ static irqreturn_t line_interrupt(int irq, void *data)
 {
struct chan *chan = data;
struct line *line = chan->line;
+   struct tty_struct *tty = tty_port_tty_get(&line->port);
 
if (line)
-   chan_interrupt(line, line->tty, irq);
+   chan_interrupt(line, tty, irq);
+   tty_kref_put(tty);
return IRQ_HANDLED;
 }
 
@@ -333,7 +335,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
 {
struct chan *chan = data;
struct line *line = chan->line;
-   struct tty_struct *tty = line->tty;
+   struct tty_struct *tty;
int err;
 
/*
@@ -352,10 +354,13 @@ static irqreturn_t line_write_interrupt(int irq, void 
*data)
}
spin_unlock(&line->lock);
 
+   tty = tty_port_tty_get(&line->port);
if (tty == NULL)
return IRQ_NONE;
 
tty_wakeup(tty);
+   tty_kref_put(tty);
+
return IRQ_HANDLED;
 }
 
@@ -409,7 +414,7 @@ int line_open(struct line *lines, struct tty_struct *tty)
 
BUG_ON(tty->driver_data);
tty->driver_data = line;
-   line->tty = tty;
+   tty_port_tty_set(&line->port, tty);
 
err = enable_chan(line);
if (err) /* line_close() will be called by our caller */
@@ -449,7 +454,7 @@ void line_close(struct tty_struct *tty, struct file * filp)
if (--line->port.count)
goto out_unlock;
 
-   line->tty = NULL;
+   tty_port_tty_set(&line->port, NULL);
tty->driver_data = NULL;
 
if (line->sigio) {
@@ -610,9 +615,15 @@ int line_get_config(char *name, struct line *lines, 
unsigned int num, char *str,
mutex_lock(&line->count_lock);
if (!line->valid)
CONFIG_CHUNK(str, size, n, "none", 1);
-   else if (line->tty == NULL)
-   CONFIG_CHUNK(str, size, n, line->init_str, 1);
-   else n = chan_config_string(line, str, size, error_out);
+   else {
+   struct tty_struct *tty = tty_port_tty_get(&line->port);
+   if (tty == NULL) {
+   CONFIG_CHUNK(str, size, n, line->init_str, 1);
+   } else {
+   n = chan_config_string(line, str, size, error_out);
+   tty_kref_put(tty);
+   }
+   }
mutex_unlock(&line->count_lock);
 
return n;
diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h
index 0e06a1f..5b3d4fb 100644
--- a/arch/um/drivers/line.h
+++ b/arch/um/drivers/line.h
@@ -33,7 +33,6 @@ struct line_driver {
 
 struct line {
struct tty_port port;
-   struct tty_struct *tty;
struct mutex count_lock;
int valid;
 
-- 
1.7.7.3


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] um: TTY fixes (?)

2012-06-04 Thread Richard Weinberger
Am 04.06.2012 23:17, schrieb Alan Cox:
>>  On all other ttys login works but bash dies because of of -EIO.
>>  After vhangup() the tty returns -EIO upon read()/write().
> 
> You can't re-open the tty because a process is holding on to it, not
> closing it and not killable. Fedora shouldn't be holding these devices
> open this way. The behaviour we have of refusing to reopen them why this
> is the case is both a) what the spec seems to say b) good security.

Hmm, there seems to be a bug in util-linux's login.
login-utils/login.c::init_tty() does:
...
   /* Kill processes left on this tty */
tcsetattr(0, TCSAFLUSH, &ttt);

signal(SIGHUP, SIG_IGN);/* so vhangup() wont kill us */
vhangup();
signal(SIGHUP, SIG_DFL);

/* open stdin,stdout,stderr to the tty */
open_tty(cxt->tty_path);

/* restore tty modes */
tcsetattr(0, TCSAFLUSH, &tt);
...

By calling vhangup() it kills all other programs on the current tty.
open_tty() opens the tty again but it's still open because stdin, stdout and 
stderr
belongs to it.

If I add:
fclose(stdin);
fclose(stdout);
fclose(stderr);
before the call to vhangup() login works like charm. :-)

Karel, what do you think?

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] um: TTY fixes (?)

2012-06-05 Thread Richard Weinberger
Am 05.06.2012 13:15, schrieb Alan Cox:
> Actually I'd prefer a clever solution which can spot all the fds are the
> same process so we can keep compatibility but I've not found a sensible
> way to do that.

Me too.

For UML users the current situation is odd.
They have to select between:
- Having a UML that crashes randomly on some distros.
- Applying the TTY fix and break login on every distro that uses util-linux's 
login.
- Applying the TTY fix and patch util-linux too.

Thanks,
//richard





signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] um: TTY fixes (?)

2012-06-06 Thread Richard Weinberger
Am 04.06.2012 23:17, schrieb Alan Cox:
> We can half ignore it on console for the simple reason that you don't
> "dial in" to the console. I suspect it may be abusable but I've not found
> a way to do so.
> 

BTW: Can't we add such a mode to tty_port?
E.g. tty_port->non_dialin_console. 8)

Nobody dials-in on a UML console...

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] um: TTY fixes (?)

2012-06-07 Thread Richard Weinberger
Am 07.06.2012 09:35, schrieb Boaz Harrosh:
> 
> OK I've run with these for a few days and they are doing
> the Job perfectly. Not a single problem.

Good to know.

> You may add tested-by: Boaz Harrosh 
> on all patches if you'd like.
> 
> Please push them ASAP to Linus. They fix a real life breakage
> that's there since v3.3. At least now we are back to
> the problems that where there for a long time.
> 
> Please also CC: Stable Tree  for 3.4
> as clearly 3.4 is unusable at all right now.

We cannot push this patch to Linus or -stable.
The problem is that will break other things.
E.g. login on non-tty0 terminals will break if the distro uses
util-linux's login.

> I wish they would be sent to older stables as well, but
> they won't patch, so it's not worth the effort.
> 
>>> mingetty is unable to start on anything else than tty0.
>>> It exits after a few seconds.
> 
> 
> I suspect this was always so since forever. I don't even know
> how to configure such a thing. I know that the console I run
> vmlinux from becomes tty0, until I halt (or crash). How do
> you open more tty(s) and attach them to console windows?
> I just use ssh for that.

con=pts is very nice.
UML allocates a pts for each tty on the *host* side.
Then you can attach to this tty using screen.
See: http://user-mode-linux.sourceforge.net/old/input.html

> (The setup of tty(s) for UML on Fedora is always such a pain
>  and it changed 4 times since FC10, I always have to mount
>  the image, figure out how to make tty1 a tty0, and delete
>  all the other tty(s). perhaps I'm just clueless. Is there an
>  easier way? Is there a way to tell UML to make tty0 be a tty1?
>  Because in fedora tty0 is not defined.)

AFAIK no. But you can tell Fedora to use tty0.
Even with systemd this is possible. :-)

> But please do not delay these patches because of old problems.
> These can be solved later.

Breaking existing applications is a no-go, sorry.

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] um: TTY fixes (?)

2012-06-07 Thread Richard Weinberger
Am 07.06.2012 11:19, schrieb Alan Cox:
> On Thu, 07 Jun 2012 01:17:24 +0200
> Richard Weinberger  wrote:
> 
>> Am 04.06.2012 23:17, schrieb Alan Cox:
>>> We can half ignore it on console for the simple reason that you
>>> don't "dial in" to the console. I suspect it may be abusable but
>>> I've not found a way to do so.
>>>
>>
>> BTW: Can't we add such a mode to tty_port?
>> E.g. tty_port->non_dialin_console. 8)
> 
> That is basically what you are doing when you omit a hangup method. The
> security consequences on a multi-user box run deeper however so in the
> end we need to fix the util-linux code.

Okay, than I have to find out why getty does not start if I omit ->hangup.

Thanks,
//richard




signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] um: TTY fixes (?)

2012-06-07 Thread Richard Weinberger
Am 07.06.2012 12:14, schrieb Boaz Harrosh:
> On 06/07/2012 12:22 PM, Alan Cox wrote:
>> On 06/07/2012 11:45 AM, Richard Weinberger wrote:
> 
>>>
>>> We cannot push this patch to Linus or -stable.
>>> The problem is that will break other things.
>>> E.g. login on non-tty0 terminals will break if the distro uses
>>> util-linux's login.
>>>
> 
> 
> I don't understand. Current code does not work at all even for
> tty0. as well as ttyX. Since 3-4 Kernels ago. I've been running with
> your patch for a long time.

Depends on your userspace.
On my setups it's very hard to trigger the bug.

> I really don't get it. You have not broken anything new. Only
> not fixed all of the problems. Current code does not work for "non-tty0
> terminals" as well right?

No, it works fine.

> I don't see Alan's comment at all. This is not a regression it was always
> like that. Ever since Fedora was working on UML, But these fixes are real
> live regression crashes.
> 
> And I don't see the all "leaving other vendors systems insecure". It just
> a freaking UML tty. You need to be root 5 times before you have access
> to all these, and it's only the UML that's compromised not the "all system"
> And surely the current plain tty0 crash is much less secure then this thing.

The "TTY problem" is not UML specific.

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] um: TTY fixes (?)

2012-06-07 Thread Richard Weinberger
Alan, Jiri!

If I omit ->hangup(), mingetty (And all other getty implementations) are unable 
to open /dev/ttyX.
open() returns -EIO.
Currently I'm testing it on FC12.
Also if I do something like "echo foo >/dev/tty1" it fails with -EIO.
And now the strange thing, opening and writing an unknown (unknown to this 
upstart rubbish) tty works.
E.g.: echo foo >/dev/tty10.

Any ideas what's going wrong?

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] um: TTY fixes (?)

2012-06-07 Thread Richard Weinberger
Am 07.06.2012 18:37, schrieb Alan Cox:
> Yes I know exactly what is going on. However getting a more tolerant
> behaviour is going to take a couple more kernels.
> 

So, then please tell me what's the proper way to fix the UML console driver?

- tty_port plus ->hangup() works only with a patched util-linux
- tty_port without ->hangup() seems to work only if *getty does not call 
vhangup()

Thanks,
//richard




signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] um: TTY fixes (?)

2012-06-07 Thread Richard Weinberger
Am 07.06.2012 18:50, schrieb Alan Cox:
> On Thu, 07 Jun 2012 18:32:42 +0200
> Richard Weinberger  wrote:
> 
>> Am 07.06.2012 18:37, schrieb Alan Cox:
>>> Yes I know exactly what is going on. However getting a more tolerant
>>> behaviour is going to take a couple more kernels.
>>>
>>
>> So, then please tell me what's the proper way to fix the UML console
>> driver?
>>
>> - tty_port plus ->hangup() works only with a patched util-linux
>> - tty_port without ->hangup() seems to work only if *getty does not
>> call vhangup()
> 
> There isn't a nice one. It'll have to wait until 3.6/7 or so to get
> fixed nicely and it won't backport either.
> 

Hmm, that's odd.
What about the not nice ways?
Having a ugly driver until 3.7 is better than having no driver...

I'm wondering why does drivers/tty/vt/vt.c work?
Can't I model the UML driver after it?

Thanks,
//richard





signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] [PATCH] um: pass siginfo to guest process

2012-06-07 Thread Richard Weinberger
Am 07.06.2012 22:59, schrieb Martin Pärtel:
> Signal handlers in UML guest processes now get correct siginfo_t fields
> for SIGTRAP, SIGFPE, SIGILL and SIGBUS. Specifically, si_addr and si_code
> are now correct where previously they were si_addr = NULL and si_code = 128.

What exactly is broken?
In my SIGSEGV test case si_addr is not NULL, it contains the correct faulting 
address.

> +
> + ptrace(PTRACE_GETSIGINFO, pid, 0, &si);
> +

Doesn't this leak the host siginfo_t into the guest?

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] [PATCH] um: pass siginfo to guest process

2012-06-07 Thread Richard Weinberger
Am 07.06.2012 23:39, schrieb Martin Pärtel:
> On 06/08/2012 12:26 AM, Richard Weinberger wrote:
> 
>> Am 07.06.2012 22:59, schrieb Martin Pärtel:
>>> Signal handlers in UML guest processes now get correct siginfo_t fields
>>> for SIGTRAP, SIGFPE, SIGILL and SIGBUS. Specifically, si_addr and si_code
>>> are now correct where previously they were si_addr = NULL and si_code = 128.
>>
>> What exactly is broken?
>> In my SIGSEGV test case si_addr is not NULL, it contains the correct 
>> faulting address.
>>
> 
> 
> SIGSEGV is probably fine. At least SIGFPE is not. Test program below.
> 
>>> +
>>> +ptrace(PTRACE_GETSIGINFO, pid, 0,&si);
>>> +
>>
>> Doesn't this leak the host siginfo_t into the guest?
>>
> 
> 
> Docs for PTRACE_GETSIGINFO say `si' gets a copy. After that, `si' is not used 
> for anything other than giving it to the guest. But I really can't say I
> understand the surrounding code too well so please review carefully :)

I was not talking about a memory leak.
What I meant was a information leak.
Using the host siginfo_t a guest process may get it's UID, PID, memory 
location, etc... on the host side.

Anyway, thanks for the test case!
This seems to be really broken.
I had only a few minutes to look at the issue but I think the correct way to 
fix is changing
arch/um/kernel/trap.c:relay_signal() to use force_sig_info() instead of 
force_sig().
Create siginfo_t and fill by hand like segv() does.

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] [PATCH] um: pass siginfo to guest process

2012-06-07 Thread Richard Weinberger
Am 08.06.2012 00:42, schrieb Martin Pärtel:
> Oh, darn, indeed. Well, getting si_code right fixed my immediate problem, but 
> I might look at this again some time next week unless you've fixed it
> yourself by then. Thanks!
> 

I can wait for your patch.
No need to hurry. :)

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] [PATCH] um: fix ubd_file_size for read-only files

2012-06-07 Thread Richard Weinberger
Am 07.06.2012 16:39, schrieb Martin Pärtel:
> Made ubd_file_size not request write access. Fixes use of read-only images.
> 
> Signed-off-by: Martin Pärtel 

Applied!

Thanks,
//richard

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] um: TTY fixes (?)

2012-07-12 Thread Richard Weinberger
Am Thu, 12 Jul 2012 16:49:28 +0200
schrieb Karel Zak :
>  I just fixed login(1) and agetty (--hangup option). The change will
>  be available in util-linux v2.23 (rc1 will be this month).
> 

Thank you!

//richard


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] feature-removal-schedule entry from 2009

2012-07-17 Thread Richard Weinberger
Am Tue, 17 Jul 2012 17:29:46 -0400
schrieb Theodore Ts'o :

> On Tue, Jul 17, 2012 at 12:19:38PM -0500, Rob Landley wrote:
> > That should be over on _this_ list then...
> > 
> > (Discussion of IRQF_SAMPLE_RANDOM removal.)
> 
> I took a closer look at the arch/um code, and it wasn't as hard as I
> thought.  I have a proposed set of patches to completely remove
> IRQF_SAMPLE_RANDOM that I will be sending out shortly
> 

I'll happily test them, please CC me.

BTW: On UML we have anyway CONFIG_UML_RANDOM to get good random numbers.
It reads from thes host's /dev/random.

Thanks,
//richard

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] [PATCH v3] um: pass siginfo to guest process

2012-07-31 Thread Richard Weinberger
On 31.07.2012 14:05, Martin Pärtel wrote:
> What's the status with this?
>

Oh sorry, I forgot you to answer.
It's queued for 3.6 and will be pushed to Linus tomorrow with all other 
patches.

Thanks,
//richard

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] [GIT PULL] UML fixes for 3.6-rc1

2012-08-01 Thread Richard Weinberger
Linus,

The following changes since commit 28a33cbc24e4256c143dce96c7d93bf423229f92:

   Linux 3.5 (2012-07-21 13:58:29 -0700)

are available in the git repository at:
   git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git for-linus-3.6-rc1

---
This patch set contains mostly fixes and cleanups.
The UML tty driver uses now tty_port and is no longer broken
like hell. :-)
---

Al Viro (3):
   um: switch UPT_SET_RETURN_VALUE and regs_return_value to pt_regs
   um: split syscall_trace(), pass pt_regs to it
   um: pull interrupt_end() into userspace()

Jiri Slaby (2):
   TTY: um/line, add tty_port
   TTY: um/line, use tty from tty_port

Martin Pärtel (2):
   um: fix ubd_file_size for read-only files
   um: pass siginfo to guest process

Richard Weinberger (6):
   um: remove line_ioctl()
   um: Remove dead code
   um: fully use tty_port
   um: remove count_lock
   um: set BLK_CGROUP=y in defconfig
   um: Add arch/x86/um to MAINTAINERS

  MAINTAINERS  |1 +
  arch/um/defconfig|2 +-
  arch/um/drivers/chan_kern.c  |4 +-
  arch/um/drivers/line.c   |  218 ++
  arch/um/drivers/line.h   |   12 +-
  arch/um/drivers/ssl.c|   42 +--
  arch/um/drivers/stdio_console.c  |   21 ++--
  arch/um/drivers/ubd_kern.c   |2 +-
  arch/um/include/asm/ptrace-generic.h |2 +
  arch/um/include/shared/as-layout.h   |3 +-
  arch/um/include/shared/irq_user.h|3 +-
  arch/um/include/shared/kern_util.h   |   13 +-
  arch/um/kernel/irq.c |2 +-
  arch/um/kernel/process.c |   13 +--
  arch/um/kernel/ptrace.c  |   71 +---
  arch/um/kernel/skas/syscall.c|6 +-
  arch/um/kernel/time.c|2 +-
  arch/um/kernel/trap.c|   39 +-
  arch/um/os-Linux/internal.h  |2 +-
  arch/um/os-Linux/signal.c|   26 +++--
  arch/um/os-Linux/skas/process.c  |   16 ++-
  arch/um/os-Linux/time.c  |2 +-
  arch/x86/um/asm/ptrace.h |6 +-
  23 files changed, 206 insertions(+), 302 deletions(-)

Thanks,
//richard

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] [PATCH] um: fix missing include with glibc 2.16

2012-08-01 Thread Richard Weinberger
On 31.07.2012 10:28, Vianney le Clément de Saint-Marcq wrote:
> From: Vianney le Clément de Saint-Marcq 
>
> As of glibc 2.16, sys/wait.h does no longer include sys/resource.h,
> which is needed for getrlimit(). This patch fixes compiling UML with
> glibc 2.16.
>
> Signed-off-by: Vianney le Clément de Saint-Marcq 

Sorry, I cannot apply this patch.
It's base64 encoded.

Can you please send it using git?

Thanks,
//richard


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] [patch] 3.6rc1 tracehook

2012-08-06 Thread Richard Weinberger
Am 06.08.2012 17:37, schrieb Renzo Davoli:
> ---
> diff -Naur linux-3.6-rc1/arch/um/include/asm/ptrace-generic.h 
> linux-3.6-rc1.tracehook/arch/um/include/asm/ptrace-generic.h
> --- linux-3.6-rc1/arch/um/include/asm/ptrace-generic.h2012-08-03 
> 01:38:10.0 +0200
> +++ linux-3.6-rc1.tracehook/arch/um/include/asm/ptrace-generic.h  
> 2012-08-06 14:43:01.0 +0200
> @@ -37,7 +37,7 @@
>  
>  extern int arch_copy_tls(struct task_struct *new);
>  extern void clear_flushed_tls(struct task_struct *task);
> -extern void syscall_trace_enter(struct pt_regs *regs);
> +extern int syscall_trace_enter(struct pt_regs *regs);
>  extern void syscall_trace_leave(struct pt_regs *regs);
>  
>  #endif
> diff -Naur linux-3.6-rc1/arch/um/include/shared/kern_util.h 
> linux-3.6-rc1.tracehook/arch/um/include/shared/kern_util.h
> --- linux-3.6-rc1/arch/um/include/shared/kern_util.h  2012-08-03 
> 01:38:10.0 +0200
> +++ linux-3.6-rc1.tracehook/arch/um/include/shared/kern_util.h
> 2012-08-06 14:43:40.0 +0200
> @@ -57,7 +57,6 @@
>  extern unsigned long to_irq_stack(unsigned long *mask_out);
>  extern unsigned long from_irq_stack(int nested);
>  
> -extern void syscall_trace(struct uml_pt_regs *regs, int entryexit);
>  extern int singlestepping(void *t);
>  
>  extern void segv_handler(int sig, struct siginfo *unused_si, struct 
> uml_pt_regs *regs);
> diff -Naur linux-3.6-rc1/arch/um/kernel/ptrace.c 
> linux-3.6-rc1.tracehook/arch/um/kernel/ptrace.c
> --- linux-3.6-rc1/arch/um/kernel/ptrace.c 2012-08-03 01:38:10.0 
> +0200
> +++ linux-3.6-rc1.tracehook/arch/um/kernel/ptrace.c   2012-08-06 
> 14:45:07.0 +0200
> @@ -163,7 +163,7 @@
>   * XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and
>   * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check
>   */
> -void syscall_trace_enter(struct pt_regs *regs)
> +int syscall_trace_enter(struct pt_regs *regs)
>  {
>   audit_syscall_entry(HOST_AUDIT_ARCH,
>   UPT_SYSCALL_NR(®s->regs),
> @@ -173,9 +173,9 @@
>   UPT_SYSCALL_ARG4(®s->regs));
>  
>   if (!test_thread_flag(TIF_SYSCALL_TRACE))
> - return;
> + return 0;
>  
> - tracehook_report_syscall_entry(regs);
> + return tracehook_report_syscall_entry(regs);
>  }
>  
>  void syscall_trace_leave(struct pt_regs *regs)
> diff -Naur linux-3.6-rc1/arch/um/kernel/skas/syscall.c 
> linux-3.6-rc1.tracehook/arch/um/kernel/skas/syscall.c
> --- linux-3.6-rc1/arch/um/kernel/skas/syscall.c   2012-08-03 
> 01:38:10.0 +0200
> +++ linux-3.6-rc1.tracehook/arch/um/kernel/skas/syscall.c 2012-08-06 
> 14:46:35.0 +0200
> @@ -18,23 +18,24 @@
>   long result;
>   int syscall;
>  
> - syscall_trace_enter(regs);
> + if (syscall_trace_enter(regs) == 0)
> + {
> + /*
> +  * This should go in the declaration of syscall, but when I do 
> that,
> +  * strace -f -c bash -c 'ls ; ls' breaks, sometimes not tracing
> +  * children at all, sometimes hanging when bash doesn't see the 
> first
> +  * ls exit.
> +  * The assembly looks functionally the same to me.  This is
> +  * gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)
> +  * in case it's a compiler bug.
> +  */
> + syscall = UPT_SYSCALL_NR(r);
> + if ((syscall >= NR_SYSCALLS) || (syscall < 0))
> + result = -ENOSYS;
> + else result = EXECUTE_SYSCALL(syscall, regs);
>  
> - /*
> -  * This should go in the declaration of syscall, but when I do that,
> -  * strace -f -c bash -c 'ls ; ls' breaks, sometimes not tracing
> -  * children at all, sometimes hanging when bash doesn't see the first
> -  * ls exit.
> -  * The assembly looks functionally the same to me.  This is
> -  * gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)
> -  * in case it's a compiler bug.
> -  */
> - syscall = UPT_SYSCALL_NR(r);
> - if ((syscall >= NR_SYSCALLS) || (syscall < 0))
> - result = -ENOSYS;
> - else result = EXECUTE_SYSCALL(syscall, regs);
> -
> - PT_REGS_SET_SYSCALL_RETURN(regs, result);
> + PT_REGS_SET_SYSCALL_RETURN(regs, result);
> + }
>  
>   syscall_trace_leave(regs);

Hmm, is it a good idea to call syscall_trace_leave() in any case?
E.g. if syscall_trace_enter() fails for whatever reason...

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Re: [uml-devel] linux-next: Tree for July 26 (uml)

2012-08-14 Thread Richard Weinberger
Am 14.08.2012 16:26, schrieb David Howells:
> Rusty Russell  wrote:
> 
   CC  arch/x86/um/../kernel/module.o
 arch/x86/um/../kernel/module.c:96:5: error: redefinition of 
 'apply_relocate_add'
 include/linux/moduleloader.h:64:19: note: previous definition of 
 'apply_relocate_add' was here
 make[2]: *** [arch/x86/um/../kernel/module.o] Error 1
> 
> Hmmm...  I'm not sure how to deal with this.  The problem is that UML doesn't
> draw the:
> 
>   select MODULES_USE_ELF_REL if X86_32
>   select MODULES_USE_ELF_RELA if X86_64
> 
> definitions from arch/foo/Kconfig that tell it what modules will look like.
> 
> Should I just enable both REL and RELA in UML, or is there a better way to do
> this?

Is there no way to get this information from the UML subarch?
Which is currently X86_32 or X86_64.

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] linux-next: Tree for July 26 (uml)

2012-08-14 Thread Richard Weinberger
Am 14.08.2012 16:51, schrieb David Howells:
> Richard Weinberger  wrote:
> 
>> Is there no way to get this information from the UML subarch?
>> Which is currently X86_32 or X86_64.
> 
> Or ppc or ia64?  Or are those defunct?

Those are defunct.
AFAIK viro is working on UML/ppc64.

> I can certainly try pasting the lines from x86/Kconfig to uml/Kconfig.common
> to switch the REL/RELA bits, but it would be nice to get this from the actual
> arch if possible to reduce redundancy.

The issue happens only on -next, right?
I can have a closer look at the issue tomorrow.

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] linux-next: Tree for July 26 (uml)

2012-08-14 Thread Richard Weinberger
Am 14.08.2012 16:54, schrieb David Howells:
> David Howells  wrote:
> 
>> I can certainly try pasting the lines from x86/Kconfig to uml/Kconfig.common
>> to switch the REL/RELA bits, but it would be nice to get this from the actual
>> arch if possible to reduce redundancy.
> 
> The attached patch works.
> 
> David
> ---
> diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
> index cb837c2..0463e48 100644
> --- a/arch/um/Kconfig.common
> +++ b/arch/um/Kconfig.common
> @@ -11,6 +11,8 @@ config UML
>   select GENERIC_CPU_DEVICES
>   select GENERIC_IO
>   select GENERIC_CLOCKEVENTS
> + select MODULES_USE_ELF_REL if X86_32
> + select MODULES_USE_ELF_RELA if X86_64

I think arch/x86/um/Kconfig makes more sense.

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] linux-next: Tree for July 26 (uml)

2012-08-14 Thread Richard Weinberger
Am 14.08.2012 17:06, schrieb David Howells:
> Richard Weinberger  wrote:
> 
>> I think arch/x86/um/Kconfig makes more sense.
> 
> warthog>ls arch/um
> defconfig Kconfig.common  Kconfig.um Makefile-os-Linux  scripts/
> drivers/  Kconfig.debug   kernel/Makefile-ppc   sys-ia64/
> include/  Kconfig.net Makefile   Makefile-skas  sys-ppc/
> Kconfig.char  Kconfig.restMakefile-ia64  os-Linux/
> 
> It doesn't exist.  Should I create it?

arch/x86/um, not arch/um.

arch/um/ contains the generic UML stuff.
arch/x86/um/ the x86 specific UML stuff.

Thanks,
//richard




signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] linux-next: Tree for July 26 (uml)

2012-08-14 Thread Richard Weinberger
Am 14.08.2012 17:15, schrieb David Howells:
> How about this then?
> 
> David
> ---
> diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig
> index 9926e11..a4b0c10 100644
> --- a/arch/x86/um/Kconfig
> +++ b/arch/x86/um/Kconfig
> @@ -21,9 +21,11 @@ config 64BIT
>  config X86_32
>   def_bool !64BIT
>   select HAVE_AOUT
> + select MODULES_USE_ELF_REL
>  
>  config X86_64
>   def_bool 64BIT
> + select MODULES_USE_ELF_RELA
>  
>  config RWSEM_XCHGADD_ALGORITHM
>   def_bool X86_XADD && 64BIT

Looks sane.

Acked-by: Richard Weinberger 

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] build error on 3.6-rc1 and later

2012-08-20 Thread Richard Weinberger
Am 20.08.2012 18:49, schrieb Sage Weil:
> I'm getting
> 
> arch/um/os-Linux/time.c: In function 'deliver_alarm':
> arch/um/os-Linux/time.c:117:3: error: too few arguments to function 
> 'alarm_handler'
> In file included from arch/um/os-Linux/time.c:13:0:
> arch/um/os-Linux/internal.h:1:6: note: declared here
> 
> on 3.6-rc1 and later.  FWIW I blindly added an extra NULL argument and it 
> seems to behave:
> 
> diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
> index f602385..0748fe0 100644
> --- a/arch/um/os-Linux/time.c
> +++ b/arch/um/os-Linux/time.c
> @@ -114,7 +114,7 @@ static void deliver_alarm(void)
> skew += this_tick - last_tick;
>  
> while (skew >= one_tick) {
> -   alarm_handler(SIGVTALRM, NULL);
> +   alarm_handler(SIGVTALRM, NULL, NULL);
> skew -= one_tick;
> }
>  

Martin,

looks like you've introduced this regression.
Can you please have a look?

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] Emulate I2C subsystem/slaves

2012-09-03 Thread Richard Weinberger
Am 02.09.2012 22:45, schrieb Peter Hüwe:
> I'm curious if there have ever been any attempts to emulate i2c devices under 
> uml in order to facilitate driver development by using stub drivers.

I know none.

> If there weren't any attemps yet, what to you thing would be the best 
> strategy  
> to achieve this goal?
> Are there any good starting points? 
> The main thing I'm lacking is a good idea how to register the 'stub devices'.

Look at any i2c driver. Implement the i2c driver interface and instead of 
directly
writing to hardware registers write to something else.
Same for read...
E.g. Your i2c emulator could have a TCP back-end.
Host<->Guest i2c pass-through is also possible.
BTW: All this is not UML specific. Iff it makes sense for only UML we can
put it into arch/um/drivers/.
Otherwise drivers/ is fine.

> Or is this something that is not really desired by the uml project?

If there is a use case, why not. :-)

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] Emulate I2C subsystem/slaves

2012-09-09 Thread Richard Weinberger
Am 09.09.2012 14:15, schrieb Peter Hüwe:
> Am Sonntag, 9. September 2012, 13:28:38 schrieb Jean Delvare:
>> Thanks for the info. I thought UML was no longer used with all the
>> virtualization solutions available, but apparently I was wrong.
> I guess it's mainly used for sandboxing, testing and development ;)

It's mostly used where KVM does not work.
For example low end i586 servers in schools.
Using UML you can still run 10+ instances on a P3 with 512MiB ram.

> 
>> My bet is that all I2C bus drivers do use I/O or memory mapped
>> operations directly or indirectly, except i2c-stub. So it would
>> probably make more sense, and be a less intrusive change, to move the
>> HAS_IOMEM dependency to drivers/i2c/busses, and move (logically or for
>> real) i2c-stub out of it.
>>
>> Or are there really other I2C bus drivers which make sense to enable
>> under UML?
> The only other available in UML which doesn't rely on HAS_IOMEM is the 
> PARPORT_LIGHT which relies on direct io access - so I guess this one doesn't 
> make sense either.
> 
> I created a patch for your proposed solution, I moved the stub driver to the 
> end in order to have only one big if HAS_IOMEM.

UML does not have IO_MEM but some sub-systems have "depend HAS_IOMEM" which is
often too coarse grained.
To deal with that I've introduced GENERIC_IO some time ago to support MTD (and 
nandsim)
on UML.
Maybe some parts of the I2C sub-system can also just depend on GENERIC_IO 
instead of
HAS_IOMEM.
An arch has GENERIC_IO=y if it supports everything defined in generic-asm/io.h 
which is
more than enough for most stub drivers.

Please look at this patch series:
https://lkml.org/lkml/2012/2/6/489

I'm sure it will help you in bringing I2C to UML.

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] Emulate I2C subsystem/slaves

2012-09-09 Thread Richard Weinberger
Am 09.09.2012 14:52, schrieb Peter Hüwe:
> Am Sonntag, 9. September 2012, 14:23:06 schrieb Richard Weinberger: 
>> UML does not have IO_MEM but some sub-systems have "depend HAS_IOMEM" which
>> is often too coarse grained.
>> To deal with that I've introduced GENERIC_IO some time ago to support MTD
>> (and nandsim) on UML.
>> Maybe some parts of the I2C sub-system can also just depend on GENERIC_IO
>> instead of HAS_IOMEM.
>> An arch has GENERIC_IO=y if it supports everything defined in
>> generic-asm/io.h which is more than enough for most stub drivers.
> 
> The only thing which seems to be missing on UML is the ioremap function 
> family 
> ;/

Why do you need ioremap() in a stub driver?
This sounds strange.

Thanks,
//richard




signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] Emulate I2C subsystem/slaves

2012-09-09 Thread Richard Weinberger
Am 09.09.2012 14:52, schrieb Peter Hüwe:
> Am Sonntag, 9. September 2012, 14:23:06 schrieb Richard Weinberger: 
>> UML does not have IO_MEM but some sub-systems have "depend HAS_IOMEM" which
>> is often too coarse grained.
>> To deal with that I've introduced GENERIC_IO some time ago to support MTD
>> (and nandsim) on UML.
>> Maybe some parts of the I2C sub-system can also just depend on GENERIC_IO
>> instead of HAS_IOMEM.
>> An arch has GENERIC_IO=y if it supports everything defined in
>> generic-asm/io.h which is more than enough for most stub drivers.
> 
> The only thing which seems to be missing on UML is the ioremap function 
> family 
> ;/

BTW: What about io_remap_pfn_range()?

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] Emulate I2C subsystem/slaves

2012-09-09 Thread Richard Weinberger
Am 09.09.2012 15:11, schrieb Peter Hüwe:
 Maybe some parts of the I2C sub-system can also just depend on
 GENERIC_IO instead of HAS_IOMEM.
 An arch has GENERIC_IO=y if it supports everything defined in
 generic-asm/io.h which is more than enough for most stub drivers.
>>>
>>> The only thing which seems to be missing on UML is the ioremap function
>>> family ;/
>>
>> Why do you need ioremap() in a stub driver?
>> This sounds strange.
> 
> 
> This was a misunderstanding - the main part of the I2C subsystem doesn't 
> depend at all on HAS_IOMEM, only the main part of the i2c/busses section.
> And almost all of those drivers use ioremap.

Sure. They need real hardware. :-)

> For my stub driver I don't need any of that, I'd be fine with the move of 
> HAS_IOMEM as proposed by Jean.

IMHO you should replace the HAS_IOMEM with GENERIC_IO.
Otherwise you may break the build on s390.

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] Emulate I2C subsystem/slaves

2012-09-09 Thread Richard Weinberger


Geert Uytterhoeven  schrieb:

>On Sun, Sep 9, 2012 at 3:27 PM, Richard Weinberger 
>wrote:
>>> For my stub driver I don't need any of that, I'd be fine with the
>move of
>>> HAS_IOMEM as proposed by Jean.
>>
>> IMHO you should replace the HAS_IOMEM with GENERIC_IO.
>> Otherwise you may break the build on s390.
>
>s390 has neither of HAS_IOMEM and GENERIC_IO, so it won't break their
>build.
>
>Gr{oetje,eeting}s,
>
>Geert
>
>--
>Geert Uytterhoeven -- There's lots of Linux beyond ia32 --
>ge...@linux-m68k.org
>
>In personal conversations with technical people, I call myself a
>hacker. But
>when I'm talking to journalists I just say "programmer" or something
>like that.
>-- Linus Torvalds

That's why it may break. If you remove the depends on HAS_IOMEM, it will be 
built on s390 and fail if that codes uses io memory functions. Depending on 
GENERIC_IO fixes that.

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] [PATCH/RFC] um: Preinclude include/linux/kern_levels.h

2012-09-09 Thread Richard Weinberger
Am 09.09.2012 17:09, schrieb Joe Perches:
> On Sun, 2012-09-09 at 10:33 +0200, Geert Uytterhoeven wrote:
>> Ping?
> 
> Richard?  Are you going to pick up this patch?
> It seems sensible.
> 
> Geert, I suggest sending it directly to Linus as a fix
> if Richard doesn't respond in a few days.

I'll pick up.
I'm still on vacation and therefore a bit slow. :)

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] Emulate I2C subsystem/slaves

2012-09-09 Thread Richard Weinberger
Am 09.09.2012 21:12, schrieb Peter Hüwe:
>> That's why it may break. If you remove the depends on HAS_IOMEM, it will be
>> built on s390 and fail if that codes uses io memory functions. Depending
>> on GENERIC_IO fixes that.
> 
> Everything I can select in I2C subsystem compiles fine on s390.
> (using defconfig + menuconfig).
> Just compiled it.

Very good. :-)

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
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] Emulate I2C subsystem/slaves

2012-09-11 Thread Richard Weinberger
Am Mon, 10 Sep 2012 21:21:52 +0200
schrieb Peter Hüwe :

> Am Montag, 10. September 2012, 09:29:18 schrieb Jean Delvare: 
> > If everybody is happy with this, I'll queue it up for 3.7.
> 
> I'm happy with this ;)
> 

As no UML specific changes are needed I'm also fine.^^

Thanks,
//richard

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] [PATCH/resend/bypass] um: Preinclude include/linux/kern_levels.h

2012-09-25 Thread Richard Weinberger
Am Tue, 25 Sep 2012 22:37:13 +0200
schrieb Geert Uytterhoeven :

> On Tue, Sep 25, 2012 at 9:43 PM, Al Viro 
> wrote:
> > On Tue, Sep 25, 2012 at 12:20:55PM -0700, Linus Torvalds wrote:
> >> IOW, this part of the patch:
> >>
> >> -   c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include user.h
> >> $(CFLAGS_$(basetarget).o)
> >> +   c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include
> >> $(srctree)/include/linux/kern_levels.h -include user.h
> >> $(CFLAGS_$(basetarget).o)
> >>
> >> just makes me go want to puke. The user.h file already has other
> >> #include's in it, so I really don't see why you create this insane
> >> special case.
> >>
> >> And why does UM have those "UM_KERN_XYZ" defines in the first
> >> place? Why isn't it just using KERN_XYZ directly? Is it because
> >> kern_levels.h didn't use to exist, so it was some kind of "let's
> >> create our own that we can hide in our special headers".
> >
> > Because user.h is included *without* kernel headers in include path.
> 
> Indeed.
> 
> > It's for the stuff that is compiled with host libc headers.  Keep in
> > mind that UML talks to libc like normal architecture would talk to
> > hardware.  IOW, analogs of asm glue are in (host) userland C.  And
> > they need libc headers instead of the kernel ones.  That's what that
> > USER_OBJ thing is about.  Kernel-side constants, etc. are delivered
> > to that sucker using the same mechanism we normally use to give them
> > to assembler - asm-offsets.c.  And here, of course, slapping ifndef
> > __ASSEMBLER__ around the tricky bits will not work - the header
> > itself is just fine, but getting kernel headers in the search path
> > really isn't.
> >
> > I agree that proposed solution is ugly.  What we can do is
> > copy the damn header into include/generated and #include
> >  from user.h.  And kill UM_KERN_...
> > stuff.  Objections?
> 
> My first submission had "We may convert all UM_KERN_* users to KERN_*
> and drop the extra defines?" as a suggestion, but so far I haven't
> found time to implement that...
> 
> Still, no one came up with a better patch, and this is a regression.

Yeah, I'd like to take the "ugly" patch to get rid of the regresion.
Later we can get rid of UM_KERN_*, which is IMHO also very ugly.

Thanks,
//richard

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
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] [GIT PULL] UML fixes for 3.6-final

2012-09-27 Thread Richard Weinberger
The following changes since commit 
5e19997a742c7c8203be628a7a69babc3bcf01a4:

  Merge tag 'for-linus' of 
git://linux-c6x.org/git/projects/linux-c6x-upstreaming (2012-09-26 
14:28:17 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git 
for-linus-3.6-rc-final

Al Viro (4):
  um: take cleaning singlestep to start_thread()
  um: don't leak floating point state and segment registers on 
execve()
  um: let signal_delivered() do SIGTRAP on singlestepping into 
handler
  um: kill thread->forking

Geert Uytterhoeven (1):
  um: Preinclude include/linux/kern_levels.h

Richard Weinberger (1):
  um: Fix IPC on um

 arch/um/include/asm/processor-generic.h|9 -
 arch/um/include/shared/common-offsets.h|   10 --
 arch/um/include/shared/user.h  |   11 +++
 arch/um/kernel/exec.c  |   25 
++---
 arch/um/kernel/process.c   |8 
 arch/um/kernel/signal.c|6 +-
 arch/um/kernel/syscall.c   |   24 

 arch/um/scripts/Makefile.rules |2 +-
 arch/x86/um/Kconfig|1 +
 arch/x86/um/shared/sysdep/kernel-offsets.h |3 ---
 arch/x86/um/shared/sysdep/syscalls.h   |2 ++
 arch/x86/um/signal.c   |6 --
 arch/x86/um/sys_call_table_32.c|2 +-
 arch/x86/um/syscalls_32.c  |   27 
+++
 arch/x86/um/syscalls_64.c  |   23 
+++
 15 files changed, 53 insertions(+), 106 deletions(-)


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
___
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] [GIT PULL] UML changes for 3.7-rc1

2012-10-09 Thread Richard Weinberger
Linus,

please issue the following pull request.

UML receives this time only cleanups.
The most outstanding change is the 'include "foo.h"' do 'include 
'
conversion done by Al Viro.
It touches many files, that's why the diffstat is rather big.

Thanks,
//richard


The following changes since commit 
a0d271cbfed1dd50278c6b06bead3d00ba0a88f9:

  Linux 3.6 (2012-09-30 16:47:46 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git 
for-linus-37rc1

for you to fetch changes up to 
062d52672446014222942cae6934d97769b329f0:

  typo in UserModeLinux-HOWTO (2012-10-09 22:35:24 +0200)


Al Viro (4):
  um/x86: merge 32 and 64bit variants of checksum.h
  um/x86: merge 32 and 64 bit variants of ptrace.h
  um: move sysrq.h out of include/shared
  um: get rid of pointless include "..." where include <...> will 
do

Marco Stornelli (1):
  hostfs: drop vmtruncate

Richard Genoud (1):
  typo in UserModeLinux-HOWTO

Wei Yongjun (1):
  hppfs: fix the return value of get_inode()

 Documentation/virtual/uml/UserModeLinux-HOWTO.txt |   2 +-
 arch/um/drivers/chan_kern.c   |   4 ++--
 arch/um/drivers/chan_user.c   |   4 ++--
 arch/um/drivers/chan_user.h   |   2 +-
 arch/um/drivers/cow_sys.h |   6 +++---
 arch/um/drivers/daemon.h  |   2 +-
 arch/um/drivers/daemon_kern.c |   4 ++--
 arch/um/drivers/daemon_user.c |   6 +++---
 arch/um/drivers/fd.c  |   4 ++--
 arch/um/drivers/harddog_user.c|   2 +-
 arch/um/drivers/hostaudio_kern.c  |  18 
-
 arch/um/drivers/line.c|  16 
+++
 arch/um/drivers/line.h|  12 ++--
 arch/um/drivers/mconsole.h|   2 +-
 arch/um/drivers/mconsole_kern.c   |  10 +-
 arch/um/drivers/mconsole_kern.h   |   2 +-
 arch/um/drivers/mmapper_kern.c|   2 +-
 arch/um/drivers/net_kern.c|  10 +-
 arch/um/drivers/net_user.c|   6 +++---
 arch/um/drivers/null.c|   2 +-
 arch/um/drivers/pcap_kern.c   |   4 ++--
 arch/um/drivers/pcap_user.c   |   4 ++--
 arch/um/drivers/pcap_user.h   |   2 +-
 arch/um/drivers/port_kern.c   |  20 
+--
 arch/um/drivers/port_user.c   |   4 ++--
 arch/um/drivers/pty.c |   4 ++--
 arch/um/drivers/random.c  |   4 ++--
 arch/um/drivers/slip_common.c |   2 +-
 arch/um/drivers/slip_kern.c   |   2 +-
 arch/um/drivers/slip_user.c   |   6 +++---
 arch/um/drivers/slirp_kern.c  |   6 +++---
 arch/um/drivers/slirp_user.c  |   4 ++--
 arch/um/drivers/ssl.c |  22 
++---
 arch/um/drivers/stdio_console.c   |  36 
+-
 arch/um/drivers/tty.c |   4 ++--
 arch/um/drivers/ubd_kern.c|   8 
 arch/um/drivers/ubd_user.c|   2 +-
 arch/um/drivers/umcast.h  |   2 +-
 arch/um/drivers/umcast_kern.c |   4 ++--
 arch/um/drivers/umcast_user.c |   4 ++--
 arch/um/drivers/vde_kern.c|   6 +++---
 arch/um/drivers/vde_user.c|   4 ++--
 arch/um/drivers/xterm.c   |   4 ++--
 arch/um/drivers/xterm_kern.c  |   4 ++--
 arch/um/include/asm/dma.h |   2 +-
 arch/um/include/asm/mmu.h |   2 +-
 arch/um/include/asm/page.h|   2 +-
 arch/um/include/asm/pgtable.h |   4 ++--
 arch/um/include/asm/processor-generic.h   |   6 +++---
 arch/um/include/asm/ptrace-generic.h  |   2 +-
 arch/um/include/asm/smp.h |   6 +++---
 arch/um/include/{shared => asm}/sysrq.h   |   0
 arch/um/include/shared/arch.h |   2 +-
 arch/um/include/shared/as-layout.h|   2 +-
 arch/um/include/shared/irq_kern.h |   4 ++--
 arch/um/include/shared/irq_user.h |   2 +-
 arch/um/include/shared/kern_util.h|   4 ++--
 arch/um/include/shared/longjmp.h  |   4 ++--
 arch/um/include/shared/os.h   |   6 +++---
 arch/um/include/shared/registers.h|   4 ++--
 arch/um/include/shared/skas/skas.h|   2 +-
 arch

Re: [uml-devel] linux-3.6.x ARCH=um will not build

2012-10-13 Thread Richard Weinberger
Am 13.10.2012 15:13, schrieb Dave Humphreys (Bob):
> Apologies if this repeats any previous attempts made by me: problems with 
> something called 'gmane'
> 
> ===
>  ...
>   CC  arch/um/os-Linux/signal.o
> arch/um/os-Linux/signal.c:18:8: error: conflicting types for 'sig_info'
> /nfs4xp/software/krn/linux-3.6.x/linux-3.6.2-um64/arch/um/include/shared/as-
> layout.h:64:15: note: previous declaration of 'sig_info' was here
> 
> I get the above error when trying to build both linux-3.6 and linux-3.6.2 in 
> both x86 (gcc-4.7.2) and x86_64 (gcc-4.6.3) environments.
> 
> Since both files involved in the conflict are part of the source 
> distribution, 
> I don't think that it can be a fault with my environment; but then I don't 
> understand why it obviously works for others.
> 
> arch/um/os-Linux/signal.c:18:8
> arch/um/include/shared/as-layout.h:64:15

Already known and fixed. :)
http://www.spinics.net/lists/mm-commits/msg91703.html

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
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] [PATCH] UM: linux/coredump.h needs siginfo_t

2012-10-15 Thread Richard Weinberger
Am 15.10.2012 15:10, schrieb David Howells:
> linux/coredump.h should #include asm/siginfo.h for the siginfo_t type.
> 
> Without this the following error occurs when compiling UM defconfig:
> 
>   include/linux/coredump.h:15:25: error: unknown type name 'siginfo_t'
> 
> Signed-off-by: David Howells 

This fix is already in -mm.

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
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] linux-3.6.x ARCH=um will not build

2012-10-20 Thread Richard Weinberger
On 20.10.2012 22:33, Lekensteyn wrote:
> On Sat, Oct 13, 2012 at 1:27 PM, Richard Weinberger wrote:
>> Am 13.10.2012 15:13, schrieb Dave Humphreys (Bob):
>>> arch/um/os-Linux/signal.c:18:8: error: conflicting types for 'sig_info'
>>> /nfs4xp/software/krn/linux-3.6.x/linux-3.6.2-
> um64/arch/um/include/shared/as-
>>> layout.h:64:15: note: previous declaration of 'sig_info' was here
>>>
>>> I get the above error when trying to build both linux-3.6 and linux-3.6.2
> in
>>> both x86 (gcc-4.7.2) and x86_64 (gcc-4.6.3) environments.
>>>
>>
>> Already known and fixed. :)
>> http://www.spinics.net/lists/mm-commits/msg91703.html
>
> Linux 3.6.2 and v3.7-rc1-330-g198190a are still affected:
>
> arch/um/os-Linux/signal.c:18:8: error: conflicting types for ‘sig_info’
> In file included from arch/um/os-Linux/signal.c:12:0:
> /tmp/linux-3.7/arch/um/include/shared/as-layout.h:64:15: note: previous
> declaration of ‘sig_info’ was here
> arch/um/os-Linux/signal.c:19:2: warning: initialization from incompatible
> pointer type [enabled by default]
> arch/um/os-Linux/signal.c:19:2: warning: (near initialization for
> ‘sig_info[5]’) [enabled by default]
> arch/um/os-Linux/signal.c:20:2: warning: initialization from incompatible
> pointer type [enabled by default]
> arch/um/os-Linux/signal.c:20:2: warning: (near initialization for
> ‘sig_info[8]’) [enabled by default]
> arch/um/os-Linux/signal.c:21:2: warning: initialization from incompatible
> pointer type [enabled by default]
> arch/um/os-Linux/signal.c:21:2: warning: (near initialization for
> ‘sig_info[4]’) [enabled by default]
> arch/um/os-Linux/signal.c:22:2: warning: initialization from incompatible
> pointer type [enabled by default]
> ...
>
> The mismatching declaration/definition was introduced with:
>
> commit d3c1cfcdb43e023ab1b1c7a555cd9e929026500a
> Author: Martin Pärtel 
> Date:   Thu Aug 2 00:49:17 2012 +0200
>
>  um: pass siginfo to guest process
>
>  UML guest processes now get correct siginfo_t for SIGTRAP, SIGFPE,
>  SIGILL and SIGBUS. Specifically, si_addr and si_code are now correct
>  where previously they were si_addr = NULL and si_code = 128.
>
>  Signed-off-by: Martin Pärtel 
>  Signed-off-by: Richard Weinberger 
>
>
> In arch/um/include/shared/as-layout.h, Martin did:
> -extern void (*sig_info[])(int, struct uml_pt_regs *);
> +struct siginfo;
> +extern void (*sig_info[])(int, struct siginfo *si, struct uml_pt_regs *);
>
> but in arch/um/os-Linux/signal.c, the definition is completely different:
> -void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
> +void (*sig_info[NSIG])(int, siginfo_t *, struct uml_pt_regs *) = {
>
> I wanted to fix it, but I do not know what the correct type should be.
> siginfo_t is declared in signal.h. I tried replacing all "struct siginfo"s by
> siginfo_t, but that did not help (signal.h is not included)
>
>
> The second build error I get is:
> arch/um/os-Linux/start_up.c: In function ‘check_coredump_limit’:
> arch/um/os-Linux/start_up.c:338:16: error: storage size of ‘lim’ isn’t known
> arch/um/os-Linux/start_up.c:339:2: error: implicit declaration of function
> ‘getrlimit’ [-Werror=implicit-function-declaration]
> arch/um/os-Linux/start_up.c:339:22: error: ‘RLIMIT_CORE’ undeclared (first use
> in this function)
> arch/um/os-Linux/start_up.c:339:22: note: each undeclared identifier is
> reported only once for each function it appears in
> arch/um/os-Linux/start_up.c:347:22: error: ‘RLIM_INFINITY’ undeclared (first
> use in this function)
> arch/um/os-Linux/start_up.c:338:16: warning: unused variable ‘lim’ [-Wunused-
> variable]
>
> This can be fixed by adding the following to arch/um/os-Linux/start_up.c:
> #include 
> (tested with 3.7)
>
> No special configuration, just "make ARCH=um defconfig" and "make ARCH=um". 
> GCC
> 4.7.2 64-bit.

Is this glibc-2.17?

I've an idea whats going on.

Thanks,
//richard


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
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] [PATCH] hostfs: fix a not needed double check

2012-11-24 Thread Richard Weinberger
Am Sat, 24 Nov 2012 10:02:32 +0100
schrieb Marco Stornelli :

> Il 18/11/2012 09:59, Marco Stornelli ha scritto:
> > Il 20/10/2012 12:02, Marco Stornelli ha scritto:
> >> With the commit 3be2be0a32c18b0fd6d623cda63174a332ca0de1 we removed
> >> vmtruncate,
> >> but actaully there is no need to call inode_newsize_ok() because
> >> the checks are
> >> already done in inode_change_ok() at the begin of the function.
> >>
> >> Signed-off-by: Marco Stornelli 
> 
> I didn't receive any feedback from Weinberger, could you consider
> this patch for next -rc?

Whoops. Sorry. -ENOMAL.

I can carry this patch through uml.git

Thanks,
//richard

--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
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] [PATCH] net : enable tx time stamping in the vde driver.

2012-12-06 Thread Richard Weinberger


Richard Cochran  schrieb:

>On Thu, Dec 06, 2012 at 04:25:05PM +0100, Paul Chavent wrote:
>> This new version moves the skb_tx_timestamp in the main uml
>> driver. This should avoid the need to call this function in each
>> transport (vde, slirp, tuntap, ...). It also add support for ethtool
>> get_ts_info.
>> 
>> Signed-off-by: Paul Chavent 
>
>Acked-by: Richard Cochran 

Queued for 3.8.

Thanks,
//richard

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
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] [PATCH 2/2] um: fix build failure due to mess-up of sig_info protorype

2012-12-30 Thread Richard Weinberger
Am Sun, 30 Dec 2012 01:37:31 +0300
schrieb Sergei Trofimovich :

> arch/um/os-Linux/signal.c:18:8: error: conflicting types for
> 'sig_info' In file included
> from /home/slyfox/linux-2.6/arch/um/os-Linux/signal.c:12:0:
> arch/um/include/shared/as-layout.h:64:15: note: previous declaration
> of 'sig_info' was here
> 
> Signed-off-by: Sergei Trofimovich 
> CC: Jeff Dike 
> CC: Richard Weinberger 
> CC: "Martin Pärtel" 
> CC: Al Viro 
> CC: user-mode-linux-devel@lists.sourceforge.net
> CC: user-mode-linux-u...@lists.sourceforge.net
> CC: linux-ker...@vger.kernel.org
> ---

I think both patches need to be backported to -stable.
I'll add the tag and push the patches ASAP to Linus.

Thanks,
//richard

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
___
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] UML Network Related Crashing

2013-01-06 Thread Richard Weinberger
Am Sun, 06 Jan 2013 12:16:02 +
schrieb "Dave Humphreys (Bob)" :

> I note that my message sent yesterday ended up heavily truncated, so
> I have turned on the line-wrap for this one. Sorry about that.

Now it passed my spamfilter. ;-)
CC'in Al, maybe he has an idea.

Does the crash only happen with mcast or does it also happen e.g with
tuntap?

Thanks,
//richard

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
___
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] File corruption with hostfs and GNU Gold linker

2013-01-07 Thread Richard Weinberger
Am Mon, 7 Jan 2013 17:55:29 -0800
schrieb Tristan Schmelcher :

> Hello,
> 
> I am using UML as part of a hermetic build system and I have
> encountered an odd file corruption problem with the GNU Gold linker.
> When linking a binary inside a UML VM with Gold, if the output path
> is on a hostfs mount then all bytes in the output file produced by
> Gold are zero. However, the size of the output file is correct and
> the debugging output from running gold with --debug suggests that
> everything is working, so it seems like the content is being produced
> by Gold correctly but the file ends up containing all zeros instead.
> It has happened 100% of the time so far and it seems to be
> independent of the linker command line or input files.
> 
> Are there any known issues where hostfs file content could end up as
> all zeros?

Is the file corrupted or does it *always* contain zeros?
If yes, the write command seems to fail.

I'm wondering how gold writes a file.
Can you find out the system call sequence? (E.g using strace).

Thanks,
//richard

--
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
___
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] File corruption with hostfs and GNU Gold linker

2013-01-08 Thread Richard Weinberger
Am Tue, 8 Jan 2013 13:30:09 -0800
schrieb Tristan Schmelcher :

> Here's a minimal test program that repros the problem.

I wrote already a test program. :)
Currently fixing hostfs...

Thanks,
//richard

--
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
___
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] [PATCH 2/2] um: fix build failure due to mess-up of sig_info protorype

2013-01-11 Thread Richard Weinberger
Am Sat, 12 Jan 2013 00:55:17 +0300
schrieb Sergei Trofimovich :

> On Sun, 30 Dec 2012 10:40:43 +0100
> Richard Weinberger  wrote:
> 
> > Am Sun, 30 Dec 2012 01:37:31 +0300
> > schrieb Sergei Trofimovich :
> > 
> > > arch/um/os-Linux/signal.c:18:8: error: conflicting types for
> > > 'sig_info' In file included
> > > from /home/slyfox/linux-2.6/arch/um/os-Linux/signal.c:12:0:
> > > arch/um/include/shared/as-layout.h:64:15: note: previous
> > > declaration of 'sig_info' was here
> > > 
> > > Signed-off-by: Sergei Trofimovich 
> > > CC: Jeff Dike 
> > > CC: Richard Weinberger 
> > > CC: "Martin Pärtel" 
> > > CC: Al Viro 
> > > CC: user-mode-linux-devel@lists.sourceforge.net
> > > CC: user-mode-linux-u...@lists.sourceforge.net
> > > CC: linux-ker...@vger.kernel.org
> > > ---
> > 
> > I think both patches need to be backported to -stable.
> > I'll add the tag and push the patches ASAP to Linus.
> 
> Seems to have got lost.

Yeah. Sorry for that. I'm currently very busy.
This weekend I'll have some time to prepare all my patches.

Thanks,
//richard

--
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
___
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] "Couldn't grant pty"

2013-01-12 Thread Richard Weinberger
Am Sat, 12 Jan 2013 09:55:05 +
schrieb "Dave (Bob)" :

> Maybe someone can help me with this...
> 
> I have been trying to tie down an issue that I have with "UML Network
> Related Crashing" so that Richard can reproduce my problem.
> 
> I am currently trying to use both a 32 bit UML and a 64 bit UML to run
> Debian root filesystems, 32 bit and 64 bit respectively.
> 
> I am running on a 64 bit machine, with 64 bit kernel incorporating 32
> bit compatibility.
> 
> The 32 bit environment that I am working in for the compilation of 32
> bit UML kernels and running them is a place to which I bind
> mount /dev, /sys, /proc to their primary locations; chroot to the top
> of this structure; execute 'linux32'; and then work as though I was
> on a 32 bit machine.
> 
> When I try to run the 32 bit UML kernel with the 32 bit Debian root
> filesystem image, it boots to the login prompt, but I can't type
> anything at the prompt. The UML kernel is displaying messages:
> 
> "Couldn't grant pty - errno = -2"

Please show us the full boot log.
Maybe something else failed.
 
Thanks,
//richard

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
___
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] "Couldn't grant pty"

2013-01-12 Thread Richard Weinberger
Am Sat, 12 Jan 2013 19:34:34 +0700
schrieb Antoine Martin :

> > DEB1-32 login: get_pty : Couldn't grant pty - errno = -2
> > open_pts : Failed to open pts
> > get_pty : Couldn't grant pty - errno = -2
> > open_pts : Failed to open pts
> > get_pty : Couldn't grant pty - errno = -2
> > open_pts : Failed to open pts
> > get_pty : Couldn't grant pty - errno = -2
> > open_pts : Failed to open pts
> > get_pty : Couldn't grant pty - errno = -2
> > open_pts : Failed to open pts
> > get_pty : Couldn't grant pty - errno = -2
> > open_pts : Failed to open pts
> > get_pty : Couldn't grant pty - errno = -2
> > open_pts : Failed to open pts
> > get_pty : Couldn't grant pty - errno = -2
> > open_pts : Failed to open pts
> > get_pty : Couldn't grant pty - errno = -2
> > open_pts : Failed to open pts
> > INIT: Id "s0" respawning too fast: disabled for 5 minutes
> Since I made this root_fs, I guess I need to update the webpage as the
> this one is supposed to boot ok with UML, without any tty issues.
> 
> Note however that I rarely use those filesystems with UML anymore, and
> many distros have repeatedly moved/changed/broken tty initialization
> in so many undocumented ways that I stopped caring a long time ago.
> That said, if someone finds the solution, I'll gladly apply it.

I test most of your filesystems on UML.
Mostly the Debian ones on both x86_64 and x86.

Bob, what exactly are you doing?
I just did:

make defconfig ARCH=um SUBARCH=x86
make linux ARCH=um SUBARCH=x86
# Image from
http://fs.devloop.org.uk/filesystems/Debian-Squeeze/Debian-Squeeze-x86-root_fs.bz2^C
 ./linux
ubda=Debian-Squeeze-x86-root_fs root=/dev/ubda mem=512M

It boots like charm.

*confused*,
//richard

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
___
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] "Couldn't grant pty"

2013-01-12 Thread Richard Weinberger
Am Sat, 12 Jan 2013 16:51:52 +0100 (CET)
> The difference in the boot-up log is:
> 
> Checking for host processor cmov support...Yes
> Checking that host ptys support output SIGIO...Yes
> Checking that host ptys support SIGIO on close...No, enabling
> workaround devtmpfs: initialized
> 
> as opposed to:
> 
> Checking for host processor cmov support...Yes
> check_one_sigio failed, errno = 2
> check_one_sigio failed, errno = 2
> devtmpfs: initialized
> 
> Why would this be?
> 
> I will now push on and attempt to either understand why I am getting
> my 'Network Related UML Crashing', or show how to reproduce it.
> 
> However, understanding why this issue with my chroot'ed 32 bit method
> gives problems would be really advantageous (educational).
> 
> The 32 bit kernel was built in the chroot'ed environment and is
> obviously linked with a 32 bit glibc. The default is not to link
> static, therefore I need the 32 bit glibc installed and working in
> the 64 world. If I remove the /lib/ld-linux.so.2 then the 32 bit
> kernel doesn't work (as expected). 

Sounds like your chroot environment is incomplete. Maybe no /dev/
or /dev/pts/.

Thanks,
//richard

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
___
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] "Couldn't grant pty"

2013-01-12 Thread Richard Weinberger
Am Sat, 12 Jan 2013 18:05:28 +0100 (CET)
schrieb "Dave Humphreys (Bob)" :
> 
> Richard,
> 
> In the 64 bit environment (with additional 32 bit glibc) that works,
> I do: (/uml_test is a mount point for a filesystem)
> 
> mount --bind /dev //dev
> mount --bind /proc //proc
> mount --bind /sys //sys
> mount --bind /uml_test /uml_test

What about /dev/pts?
Why the chroot anyways?

Thanks,
//richard

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
___
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] Network related UML Crashing

2013-01-12 Thread Richard Weinberger
Am Sat, 12 Jan 2013 19:31:13 +0100 (CET)
schrieb "Dave Humphreys (Bob)" :

> Re: [uml-devel] "Couldn't grant pty"
> 
> Now that I have been able to run the Debiam 32 bit root_fs, I have
> returned to the network related crashing.
> 
> This is by way of a status update, I will do more to tie down what is
> required to demonstrate the problem as simply as possible.
> 
> However:
> 
> root@DEB1-32:~# rsync --archive --progress
> 10.0.10.30:/var/imap/ /var/imap/ The authenticity of host '10.0.10.30
> (10.0.10.30)' can't be established. RSA key fingerprint is
> ce:e4:0d:88:c0:07:01:8d:10:f8:91:52:b5:4b:e1:53. Are you sure you
> want to continue connecting (yes/no)? yes Warning: Permanently added
> '10.0.10.30' (RSA) to the list of known hosts. receiving incremental
> file list ./
> .bash_history
> 1970 100%1.88MB/s0:00:00 (xfer#1, to-check=1005/1007)
> config/
> config/annotations.db
>  144 100%0.23kB/s0:00:00 (xfer#2, to-check=1356/1362)
> config/deliver.db
>0   0%0.00kB/s0:00:00  [ cut here
> ]
> 
> 
> This is what happened on the Debian 32 bit system with the 3.8.0-rc3
> UML kernel.
> 
> The DEB1 UML is now completely dead and locked up, no further
> messages escaped after this point.
> 
> If I try to kick it with uml_mconsole:
> 
> bash-4.1# uml_mconsole DEB1
> (DEB1) halt
> 
> and nothing more happens.
> 
> 10.0.10.30 is another 32 bit UML.
> 
> DEB1-32 is the Debian UML, with an IP address of 10.0.10.31.
> 
> Networking is via mcast.
> 
> This behaviour is consistent with what I have found all along.
> 
> I have seen the same on a 32 bit UML running on a genuinely 32 bit
> machine that is remote to my current location and which I access via
> the Internet, so the problem arises using real ethernet (via tun-tap)
> as well as mcast; and in a genuine 32 bit environment.
> 
> I will try to characterise this more fully, and simplify the method
> of causing failure as much as possible.

Thanks a lot for the detailed report.
Does UML consume 100% on the host side?

Thanks,
//richard

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
___
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] File corruption with hostfs and GNU Gold linker

2013-01-25 Thread Richard Weinberger
Hi!

Am Fri, 25 Jan 2013 14:27:21 -0800
schrieb Tristan Schmelcher :

> Hello again, Richard. Wondering if you have a rough patch that you'd
> like me to try out. If not, I'd be happy to work on the fix if you
> could give me some pointers to where the issue is in the hostfs code.

Not really.
I think it's time to involve some vfs guys.
What I know so far: Writeback of mmap()'ed pages does not happen.
Calling msync() by hand causes the writeback.
The pages get correctly marked as dirty, the bdi code is also sane.

Thanks,
//richard

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
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] [PATCH] UM: fix make headers_install after UAPI header installation

2013-03-19 Thread Richard Weinberger
Am Tue, 19 Mar 2013 16:03:40 +0100
schrieb Florian Fainelli :

> Richard, Jeff, David,
> 
> Does the following fix look valid to you? Thanks!

Please give me more than 48h to review a patch. :)
I'm very busy with $DAYJOB and UML is currently only a private project.

Thanks,
//richard

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
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] [PATCH] UM: fix make headers_install after UAPI header installation

2013-04-04 Thread Richard Weinberger
Am 04.04.2013 16:09, schrieb David Howells:
> Florian Fainelli  wrote:
>
>> David, am I completely irrelevant here or do you think this should indeed 
>> need
>> fixing?
>
> I think headers installation for UM is pointless, but that's just my opinion.

Same here. :)

Florian, does it break something for you?

Thanks,
//richard

--
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
___
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] BUG: failure at block/blk-core.c:2985/blk_flush_plug_list()

2013-04-05 Thread Richard Weinberger
Am Wed, 3 Apr 2013 00:11:18 -0400 (EDT)
schrieb "Peter Butler" :

> Running UML from vanilla kernel 3.8.5 compiled with default kernel
> configuration and booted with Fedora 18 root fs (as downloaded from
> http://fs.devloop.org.uk/).  Boots fine about 3/4 of the time, the
> rest of the time it crashes - see output below for an example.
> 
> 
> 
> command line:
> 
> ./linux ubd0=Fedora18-AMD64-root_fs rw mem=4096M con0=fd:0,fd:1
> 
> 
> 
> source code BUG() line:
> 
> BUG_ON(plug->magic != PLUG_MAGIC);

Does it always crash exactly here?
Can you please retry with Linus' tree.


Thanks,
//richard

--
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
___
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] BUG: failure at block/blk-core.c:2985/blk_flush_plug_list()

2013-04-06 Thread Richard Weinberger
Am 06.04.2013 04:26, schrieb Peter Butler:
> Looks like the mainline fails early in the build process (?)
>
> after 'make mrproper' and 'make defconfig' I get this:
>
> bash $ make ARCH=um linux

Please try with "make ARCH=um linux SUBARCH=x86" or "make ARCH=um linux 
SUBARCH=x86_64".

Thanks,
//richard

--
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
___
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] um: Use generic idle loop

2013-04-15 Thread Richard Weinberger
Signed-off-by: Richard Weinberger 
---
 arch/um/Kconfig.common   |  1 +
 arch/um/kernel/process.c | 27 ++-
 2 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index bceee66..5783406 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
@@ -12,6 +12,7 @@ config UML
select GENERIC_CPU_DEVICES
select GENERIC_IO
select GENERIC_CLOCKEVENTS
+   select GENERIC_IDLE_LOOP
select TTY # Needed for line.c
 
 config MMU
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index b462b13..4d64860 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -210,33 +210,10 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
kmalloc_ok = save_kmalloc_ok;
 }
 
-void default_idle(void)
-{
-   unsigned long long nsecs;
-
-   while (1) {
-   /* endless idle loop with no priority at all */
-
-   /*
-* although we are an idle CPU, we do not want to
-* get into the scheduler unnecessarily.
-*/
-   if (need_resched())
-   schedule();
-
-   tick_nohz_idle_enter();
-   rcu_idle_enter();
-   nsecs = disable_timer();
-   idle_sleep(nsecs);
-   rcu_idle_exit();
-   tick_nohz_idle_exit();
-   }
-}
-
-void cpu_idle(void)
+void arch_cpu_idle(void)
 {
cpu_tasks[current_thread_info()->cpu].pid = os_getpid();
-   default_idle();
+   local_irq_enable();
 }
 
 int __cant_sleep(void) {
-- 
1.8.1.4


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
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] um: Use generic idle loop

2013-04-16 Thread Richard Weinberger
Signed-off-by: Richard Weinberger 
---
 arch/um/Kconfig.common   |  1 +
 arch/um/kernel/process.c | 27 ---
 2 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index bceee66..5783406 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
@@ -12,6 +12,7 @@ config UML
select GENERIC_CPU_DEVICES
select GENERIC_IO
select GENERIC_CLOCKEVENTS
+   select GENERIC_IDLE_LOOP
select TTY # Needed for line.c
 
 config MMU
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index b462b13..bbcef52 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -210,33 +210,14 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
kmalloc_ok = save_kmalloc_ok;
 }
 
-void default_idle(void)
+void arch_cpu_idle(void)
 {
unsigned long long nsecs;
 
-   while (1) {
-   /* endless idle loop with no priority at all */
-
-   /*
-* although we are an idle CPU, we do not want to
-* get into the scheduler unnecessarily.
-*/
-   if (need_resched())
-   schedule();
-
-   tick_nohz_idle_enter();
-   rcu_idle_enter();
-   nsecs = disable_timer();
-   idle_sleep(nsecs);
-   rcu_idle_exit();
-   tick_nohz_idle_exit();
-   }
-}
-
-void cpu_idle(void)
-{
cpu_tasks[current_thread_info()->cpu].pid = os_getpid();
-   default_idle();
+   nsecs = disable_timer();
+   idle_sleep(nsecs);
+   local_irq_enable();
 }
 
 int __cant_sleep(void) {
-- 
1.8.1.4


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
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] [PATCHv2] uml: Fix which_tmpdir failure when /dev/shm is a symlink, and in other edge cases

2013-06-20 Thread Richard Weinberger
Am 20.06.2013 15:36, schrieb Tristan Schmelcher:
> *sigh* found another bug. Gonna sit on the patch for a bit before
> sending v3, just in case I find more issues.

No need to hurry. :-)
As the patch is non-trivial it's 3.11 material anyway.

Thanks,
//richard



--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] [PATCH] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Am 26.06.2013 11:33, schrieb Chen Gang:
> On 06/26/2013 05:03 PM, Richard Weinberger wrote:
>> Am 26.06.2013 10:58, schrieb Chen Gang:
>>>> On 06/26/2013 04:39 PM, Richard Weinberger wrote:
>>>>>>>>>>>>>>>>>>>>>> The drivers internal code has already check the related 
>>>>>>>>>>>>>>>>>>>>>> return value,
>>>>>>>>>>>>>>>>>>>>>> so it is the architecture's duty to 'tell' the driver 
>>>>>>>>>>>>>>>>>>>>>> whether support
>>>>>>>>>>>>>>>>>>>>>> io memory (e.g. define ioremap, but return NULL).
>>>>>>>>>>>>>> It does so already by setting CONFIG_HAS_IOMEM=n
>>>>>>>>>>
>>>>>>>>>> Excuse me, I use "grep -rn ioremap *" under "include/" and "arch/um/"
>>>>>>>>>> directory, but can not find the related definition for 'ioremap'.
>>>>>>>>>>
>>>>>>>>>> Is there another declaration or definition way which I don't know ?
>>>>>>>>>> (maybe it is).
>>>>>> Both UML and s390 (in the !CONFIG_PCI) do not define ioremap() because
>>>>>> without io memory you cannot have a ioremap().
>>>>>>
>>>>
>>>> I assume if ioremap() return NULL, it means "without io memory", is it
>>>> correct ?
>>>>
>>>> If it is correct, "define a dummy ioremap(), and return NULL" is just
>>>> the meaning that you mentioned above.
>>>>
>>>> If so, for UML, it is not requirement, but recommend to define a dummy
>>>> ioremap() which return NULL, so can be generic enough to mach all cases.
>> No.
>> Not setting CONFIG_HAS_IOMEM=y means "This arch has no io memory and 
>> therefore no
>> functions to mess with it".
>>
> 
> Since the API itself already contents the meaning: "return NULL means
> the arch has no related io memory",
> 
> Why not define a generic dummy one in "include/asm-generic/io.h" instead
> of "HAS_IOMEM" (which has already spread many various places, and also,
> most of new drivers have to know about it).
> 
> e.g: in "include/asm-generic/io.h", if "CONFIG_HAS_IOMEM=n", define a
> dummy ioremap() which return NULL ... (also need consider more details).

Because we don't even want to build these drivers and not make them fail while
executing io memory related functions.

> 
> All together, I think: it is the duty of "asm-generic/io.h" to process
> this issue, not the duty of many drivers and some architectures.
> 
> 
>> Let's get back to the real problem,
>> drivers/ptp/ptp_pch.c does not build on UML (and I'm very sure also not on 
>> S390).
>> Fix the issue by making it depend on HAS_IOMEM.
>>
> 
> At least now, it seems it is the only suitable way to fix this issue.  :-(
> 
> 
>> Btw: Did you actually look at this driver? There is *zero* reason to have it 
>> on UML.
>> ..like 99.9% of all other drivers which use io memory.
> 
> Excuse me, I did not look at the details of this driver. Maybe it just
> like you said above.

It is.

Thanks,
//richard


--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] [PATCH] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Am 26.06.2013 10:34, schrieb Chen Gang:
> On 06/26/2013 04:05 PM, Richard Weinberger wrote:
>>>>>>>> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
>>>>>>>> index d5afe96..e80331d 100644
>>>>>>>> --- a/include/asm-generic/io.h
>>>>>>>> +++ b/include/asm-generic/io.h
>>>>>>>> @@ -303,10 +303,10 @@ static inline void *phys_to_virt(unsigned long 
>>>>>>>> address)
>>>>>>>>  /*
>>>>>>>>   * Change "struct page" to physical address.
>>>>>>>>   *
>>>>>>>> - * This implementation is for the no-MMU case only... if you have an 
>>>>>>>> MMU
>>>>>>>> + * This implementation is for the no-MMU or UML case only... if you 
>>>>>>>> have an MMU
>>>>>>>>   * you'll need to provide your own definitions.
>>>>>>>>   */
>>>>>>>> -#ifndef CONFIG_MMU
>>>>>>>> +#if !CONFIG_MMU || CONFIG_UML
>>>>>>>>  static inline void __iomem *ioremap(phys_addr_t offset, unsigned long 
>>>>>>>> size)
>>>>>>>>  {
>>>>>>>>return (void __iomem*) (unsigned long)offset;
>>>>>>>> @@ -325,7 +325,7 @@ static inline void __iomem *ioremap(phys_addr_t 
>>>>>>>> offset, unsigned long size)
>>>>>>>>  static inline void iounmap(void __iomem *addr)
>>>>>>>>  {
>>>>>>>>  }
>>>>>>>> -#endif /* CONFIG_MMU */
>>>>>>>> +#endif /* !CONFIG_MMU || CONFIG_UML */
>>>>>>>>  
>>>>>>>>  #ifdef CONFIG_HAS_IOPORT
>>>>>>>>  #ifndef CONFIG_GENERIC_IOMAP
>>>>>>>>
>>>>>>
>>>>>> UML has no io memory but a MMU, so I'd argue that you better fix 
>>>>>> drivers/ptp/ptp_pch.c dependencies.
>>>>>> _If_ ptp_pch.c really works without real io memory, you can look what I 
>>>>>> did in my GENERIC_IO series[1]
>>>>>> to make nandsim work on UML. Maybe this helps.
>>>>>>
>>>>
>>>> But "no io memory" is not the excuse to not define the related dummy
>>>> function.
>> UML has no io memory, period.
>> Same applies for s390, it also includes asm-generic/io.h in the !CONFIG_PCI
>> case.
>> UML and s390 are very special here.
>>
> 
> Oh, yes, really the same.
> 
>>>> The drivers internal code has already check the related return value,
>>>> so it is the architecture's duty to 'tell' the driver whether support
>>>> io memory (e.g. define ioremap, but return NULL).
>> It does so already by setting CONFIG_HAS_IOMEM=n
> 
> Excuse me, I use "grep -rn ioremap *" under "include/" and "arch/um/"
> directory, but can not find the related definition for 'ioremap'.
> 
> Is there another declaration or definition way which I don't know ?
> (maybe it is).

Both UML and s390 (in the !CONFIG_PCI) do not define ioremap() because
without io memory you cannot have a ioremap().

> For our case, the ".config" file does not define 'CONFIG_HAS_IOMEM', can
> I assume it means "CONFIG_HAS_IOMEM=n" ?

If I'm not mistaken it works the other way around.
All archs except UML and s390 set CONFIG_HAS_IOMEM=y.

Thanks,
//richard

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] [PATCH] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Am 26.06.2013 12:01, schrieb Chen Gang:
> On 06/26/2013 05:48 PM, Geert Uytterhoeven wrote:
>> On Wed, Jun 26, 2013 at 11:38 AM, Richard Weinberger  wrote:
>>>>>> Since the API itself already contents the meaning: "return NULL means
>>>>>> the arch has no related io memory",
>> No, NULL means it could not map the I/O memory.
>>
> 
> "it could not map the I/O memory" includes "has no related io memory".
> So it is enough for our case.
> 
>>>>>> Why not define a generic dummy one in "include/asm-generic/io.h" instead
>>>>>> of "HAS_IOMEM" (which has already spread many various places, and also,
>>>>>> most of new drivers have to know about it).
>>>>>>
>>>>>> e.g: in "include/asm-generic/io.h", if "CONFIG_HAS_IOMEM=n", define a
>>>>>> dummy ioremap() which return NULL ... (also need consider more details).
>>>>
>>>> Because we don't even want to build these drivers and not make them fail 
>>>> while
>>>> executing io memory related functions.
>> Indeed, it doesn't make sense to build drivers that cannot work.
>> And they may fail in a very bad way.
> 
> That is our 'platform' guys feeling, not the 'module' guys, as
> 'platform' guys, it is better to provide the choice to 'module' guys,
> and let them decide by themselves, not forced by us.

FYI, this is my last reply to this thread.

As Geert and I said, drivers which need io memory have to depend on HAS_IOMEM=y.
If an arch does not have io memory these drivers cannot work and therefore we 
don't
want them built.

Over and out,
//richard

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] [PATCH] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Am 26.06.2013 10:58, schrieb Chen Gang:
> On 06/26/2013 04:39 PM, Richard Weinberger wrote:
>>>>>>>>>> The drivers internal code has already check the related return value,
>>>>>>>>>> so it is the architecture's duty to 'tell' the driver whether support
>>>>>>>>>> io memory (e.g. define ioremap, but return NULL).
>>>>>> It does so already by setting CONFIG_HAS_IOMEM=n
>>>>
>>>> Excuse me, I use "grep -rn ioremap *" under "include/" and "arch/um/"
>>>> directory, but can not find the related definition for 'ioremap'.
>>>>
>>>> Is there another declaration or definition way which I don't know ?
>>>> (maybe it is).
>> Both UML and s390 (in the !CONFIG_PCI) do not define ioremap() because
>> without io memory you cannot have a ioremap().
>>
> 
> I assume if ioremap() return NULL, it means "without io memory", is it
> correct ?
> 
> If it is correct, "define a dummy ioremap(), and return NULL" is just
> the meaning that you mentioned above.
> 
> If so, for UML, it is not requirement, but recommend to define a dummy
> ioremap() which return NULL, so can be generic enough to mach all cases.

No.
Not setting CONFIG_HAS_IOMEM=y means "This arch has no io memory and therefore 
no
functions to mess with it".

Let's get back to the real problem,
drivers/ptp/ptp_pch.c does not build on UML (and I'm very sure also not on 
S390).
Fix the issue by making it depend on HAS_IOMEM.

Btw: Did you actually look at this driver? There is *zero* reason to have it on 
UML.
...like 99.9% of all other drivers which use io memory.

Thanks,
//richard

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] [PATCH] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Hi!

Am 26.06.2013 08:31, schrieb Chen Gang:
> For "User Mode Linux", it may enable 'MMU', but not need implement
> ioremap and iounmap, so "include/asm-generic/io.h" need notice this
> case to keep itself 'generic'.
> 
> The related error (with allmodconfig, without pcap):
> 
> CC [M]  drivers/ptp/ptp_pch.o
>   drivers/ptp/ptp_pch.c: In function ‘pch_remove’:
>   drivers/ptp/ptp_pch.c:571:3: error: implicit declaration of function 
> ‘iounmap’ [-Werror=implicit-function-declaration]
>   drivers/ptp/ptp_pch.c: In function ‘pch_probe’:
>   drivers/ptp/ptp_pch.c:621:2: error: implicit declaration of function 
> ‘ioremap’ [-Werror=implicit-function-declaration]
>   drivers/ptp/ptp_pch.c:621:13: warning: assignment makes pointer from 
> integer without a cast [enabled by default]
>   cc1: some warnings being treated as errors
> 
> 
> Signed-off-by: Chen Gang 
> ---
>  arch/um/include/asm/Kbuild |1 +
>  include/asm-generic/io.h   |6 +++---
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
> index b30f34a..a34ea5d 100644
> --- a/arch/um/include/asm/Kbuild
> +++ b/arch/um/include/asm/Kbuild
> @@ -3,3 +3,4 @@ generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h 
> topology.h xor.h
>  generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h
>  generic-y += switch_to.h clkdev.h
>  generic-y += trace_clock.h
> +generic-y += io.h

We include that file already. See three lines above.

> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> index d5afe96..e80331d 100644
> --- a/include/asm-generic/io.h
> +++ b/include/asm-generic/io.h
> @@ -303,10 +303,10 @@ static inline void *phys_to_virt(unsigned long address)
>  /*
>   * Change "struct page" to physical address.
>   *
> - * This implementation is for the no-MMU case only... if you have an MMU
> + * This implementation is for the no-MMU or UML case only... if you have an 
> MMU
>   * you'll need to provide your own definitions.
>   */
> -#ifndef CONFIG_MMU
> +#if !CONFIG_MMU || CONFIG_UML
>  static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
>  {
>   return (void __iomem*) (unsigned long)offset;
> @@ -325,7 +325,7 @@ static inline void __iomem *ioremap(phys_addr_t offset, 
> unsigned long size)
>  static inline void iounmap(void __iomem *addr)
>  {
>  }
> -#endif /* CONFIG_MMU */
> +#endif /* !CONFIG_MMU || CONFIG_UML */
>  
>  #ifdef CONFIG_HAS_IOPORT
>  #ifndef CONFIG_GENERIC_IOMAP
> 

UML has no io memory but a MMU, so I'd argue that you better fix 
drivers/ptp/ptp_pch.c dependencies.
_If_ ptp_pch.c really works without real io memory, you can look what I did in 
my GENERIC_IO series[1]
to make nandsim work on UML. Maybe this helps.

Thanks,
//richard

[1] http://lists.infradead.org/pipermail/linux-mtd/2012-February/039701.html


--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] [PATCH] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Hi!

Am 26.06.2013 09:56, schrieb Chen Gang:
> On 06/26/2013 02:54 PM, Richard Weinberger wrote:
>> Hi!
>>
>> Am 26.06.2013 08:31, schrieb Chen Gang:
>>> For "User Mode Linux", it may enable 'MMU', but not need implement
>>> ioremap and iounmap, so "include/asm-generic/io.h" need notice this
>>> case to keep itself 'generic'.
>>>
>>> The related error (with allmodconfig, without pcap):
>>>
>>> CC [M]  drivers/ptp/ptp_pch.o
>>>   drivers/ptp/ptp_pch.c: In function �pch_remove�:
>>>   drivers/ptp/ptp_pch.c:571:3: error: implicit declaration of function 
>>> �iounmap� [-Werror=implicit-function-declaration]
>>>   drivers/ptp/ptp_pch.c: In function �pch_probe�:
>>>   drivers/ptp/ptp_pch.c:621:2: error: implicit declaration of function 
>>> �ioremap� [-Werror=implicit-function-declaration]
>>>   drivers/ptp/ptp_pch.c:621:13: warning: assignment makes pointer from 
>>> integer without a cast [enabled by default]
>>>   cc1: some warnings being treated as errors
>>>
>>>
>>> Signed-off-by: Chen Gang 
>>> ---
>>>  arch/um/include/asm/Kbuild |1 +
>>>  include/asm-generic/io.h   |6 +++---
>>>  2 files changed, 4 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
>>> index b30f34a..a34ea5d 100644
>>> --- a/arch/um/include/asm/Kbuild
>>> +++ b/arch/um/include/asm/Kbuild
>>> @@ -3,3 +3,4 @@ generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h 
>>> sections.h topology.h xor.h
>>>  generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h
>>>  generic-y += switch_to.h clkdev.h
>>>  generic-y += trace_clock.h
>>> +generic-y += io.h
>>
>> We include that file already. See three lines above.
>>
> 
> Oh, really it is, thanks.
> 
>>> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
>>> index d5afe96..e80331d 100644
>>> --- a/include/asm-generic/io.h
>>> +++ b/include/asm-generic/io.h
>>> @@ -303,10 +303,10 @@ static inline void *phys_to_virt(unsigned long 
>>> address)
>>>  /*
>>>   * Change "struct page" to physical address.
>>>   *
>>> - * This implementation is for the no-MMU case only... if you have an MMU
>>> + * This implementation is for the no-MMU or UML case only... if you have 
>>> an MMU
>>>   * you'll need to provide your own definitions.
>>>   */
>>> -#ifndef CONFIG_MMU
>>> +#if !CONFIG_MMU || CONFIG_UML
>>>  static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
>>>  {
>>> return (void __iomem*) (unsigned long)offset;
>>> @@ -325,7 +325,7 @@ static inline void __iomem *ioremap(phys_addr_t offset, 
>>> unsigned long size)
>>>  static inline void iounmap(void __iomem *addr)
>>>  {
>>>  }
>>> -#endif /* CONFIG_MMU */
>>> +#endif /* !CONFIG_MMU || CONFIG_UML */
>>>  
>>>  #ifdef CONFIG_HAS_IOPORT
>>>  #ifndef CONFIG_GENERIC_IOMAP
>>>
>>
>> UML has no io memory but a MMU, so I'd argue that you better fix 
>> drivers/ptp/ptp_pch.c dependencies.
>> _If_ ptp_pch.c really works without real io memory, you can look what I did 
>> in my GENERIC_IO series[1]
>> to make nandsim work on UML. Maybe this helps.
>>
> 
> But "no io memory" is not the excuse to not define the related dummy
> function.

UML has no io memory, period.
Same applies for s390, it also includes asm-generic/io.h in the !CONFIG_PCI
case.
UML and s390 are very special here.


> The drivers internal code has already check the related return value,
> so it is the architecture's duty to 'tell' the driver whether support
> io memory (e.g. define ioremap, but return NULL).

It does so already by setting CONFIG_HAS_IOMEM=n

Thanks,
//richard

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] [PATCHv3] uml: Fix which_tmpdir failure when /dev/shm is a symlink, and in other edge cases

2013-07-08 Thread Richard Weinberger
Am 08.07.2013 22:19, schrieb Tristan Schmelcher:
> From: Tristan Schmelcher 
> 
> which_tmpdir did the wrong thing if /dev/shm was a symlink (e.g., to 
> /run/shm),
> if there were multiple mounts on top of each other, if the mount(s) were
> obscured by a later mount, or if /dev/shm was a prefix of another mount point.
> This fixes these cases. Applies to 3.9.6.
> 
> Signed-off-by: Tristan Schmelcher 

Is this just a resend or did your alter the patch you sent me already?
I'm about to send my UML patches to Linus tomorrow.

Thanks,
//richard

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] [PULL] UML fixes for 3.11-rc2

2013-07-19 Thread Richard Weinberger
Linus,

please pull from:

  git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git for-linus

Special thanks goes to Toralf Föster for continuously testing UML and reporting 
issues!

Thanks,
//richard


Richard Weinberger (5):
  um: Fix return value of strnlen_user()
  um: Mark stub pages mapping with VM_PFNMAP
  um: Fix wait_stub_done() error handling
  um: siginfo cleanup
  um: remove dead code

Tristan Schmelcher (1):
  uml: Fix which_tmpdir failure when /dev/shm is a symlink, and in other 
edge cases

 arch/um/include/shared/frame_kern.h |   8 +-
 arch/um/kernel/signal.c |   4 +-
 arch/um/kernel/skas/mmu.c   |   2 +-
 arch/um/kernel/skas/uaccess.c   |   2 +-
 arch/um/os-Linux/mem.c  | 230 +---
 arch/um/os-Linux/signal.c   |   8 +-
 arch/um/os-Linux/skas/process.c |  19 +--
 arch/x86/um/signal.c|   1 -
 8 files changed, 213 insertions(+), 61 deletions(-)

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
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] [PATCH] um: Accept /dev/fd/* uml block devices

2013-07-28 Thread Richard Weinberger
Am 27.07.2013 17:23, schrieb Gabriel de Perthuis:
> Useful for
> * limiting privileges
> * opening block devices O_EXCL

So, the goal of this patch is to allow passing a file descriptor
number as block device instead of a file?

I assume you have already a wrapper around UML which exec()'s it such that
it can reuse a fd?

> Use dup to work around the fact /proc/self/fd
> can't be opened after dropping privileges.
> This proc behaviour doesn't match TLPI and might be a bug.
> 
> Qemu has a slightly more complex fdset approach
> that provides fds with different access permissions.

I really don't like that you patch os_open_file(), this is a
generic function.

What about this one?
Allow ubda= (and all other UML block device kernel parameters) to
accept arguments like file:/foo/bar and fd:N.
Where N is a number and file: is default such that we do not break
old kernels.

Thanks,
//richard

> Signed-off-by: Gabriel de Perthuis 
> ---
>  arch/um/os-Linux/file.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
> index c17bd6f..cee65ba 100644
> --- a/arch/um/os-Linux/file.c
> +++ b/arch/um/os-Linux/file.c
> @@ -169,11 +169,11 @@ int os_file_mode(const char *file, struct openflags 
> *mode_out)
>   return err;
>  }
>  
>  int os_open_file(const char *file, struct openflags flags, int mode)
>  {
> - int fd, err, f = 0;
> + int fd, fd0, err, f = 0;
>  
>   if (flags.r && flags.w)
>   f = O_RDWR;
>   else if (flags.r)
>   f = O_RDONLY;
> @@ -190,11 +190,15 @@ int os_open_file(const char *file, struct openflags 
> flags, int mode)
>   if (flags.e)
>   f |= O_EXCL;
>   if (flags.a)
>   f |= O_APPEND;
>  
> - fd = open64(file, f, mode);
> + if (!strncmp(file, "/dev/fd/", 8)
> + && sscanf(file, "/dev/fd/%d", &fd0) == 1)
> + fd = dup(fd0);
> + else
> + fd = open64(file, f, mode);
>   if (fd < 0)
>   return -errno;
>  
>   if (flags.cl && fcntl(fd, F_SETFD, 1)) {
>   err = -errno;
> @@ -280,11 +284,11 @@ int os_file_size(const char *file, unsigned long long 
> *size_out)
>  
>   if (S_ISBLK(buf.ust_mode)) {
>   int fd;
>   long blocks;
>  
> - fd = open(file, O_RDONLY, 0);
> + fd = os_open_file(file, of_read(OPENFLAGS()), 0);
>   if (fd < 0) {
>   err = -errno;
>   printk(UM_KERN_ERR "Couldn't open \"%s\", "
>  "errno = %d\n", file, errno);
>   return err;
> 


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
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] Using UML in libguestfs

2013-08-09 Thread Richard Weinberger
Am 09.08.2013 23:15, schrieb Richard W.M. Jones:
> On Fri, Aug 09, 2013 at 09:43:55PM +0100, Richard W.M. Jones wrote:
>> * I'm trying to use a serial port to communicate between guest and
>> host, using ssl3=fd:.  This causes the Linux process to crash soon
>> (but not immediately) after the guest has opened /dev/ttyS3:
>>
>>   spurious interrupt in ubd_handler, err = -4
> 
> So I realized this is caused by a coding mistake by me.  I had set to
> O_CLOEXEC flag on the file descriptor, so it was being closed across
> the exec of vmlinux.
> 
> It still doesn't quite work, but the error above has gone away.

So you are still facing the crash are reported in your first mail?

Thanks,
//richard


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
___
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] How to reliably kill all vmlinux processes for a single VM?

2013-08-13 Thread Richard Weinberger
Am 13.08.2013 12:36, schrieb Richard W.M. Jones:
> On Mon, Aug 12, 2013 at 09:53:00AM +0100, Richard W.M. Jones wrote:
>> On Mon, Aug 12, 2013 at 10:15:24AM +0200, richard -rw- weinberger wrote:
>>> Found the root cause, patch is on the way.
>>
>> I can test patches if you CC me on them.
> 
> I'm still available to test patches :-)  Didn't see anything on
> this list nor on LKML.

I'm currently on the road...

> In particular I'm having a problem where it looks as if vmlinux is
> sending a signal to its parent process on shutdown.
>

Really?
If so, why does it not kill my shell if I run it directly?

Thanks,
//richard

> I can reliably reproduce this, although not with anything very
> minimal.  But if you run the libguestfs test suite like this you'll
> see it:
> 
>   make -C tests/regressions check TESTS=rhbz914931
> 
> The parent process (a C program which for unrelated reasons is called
> 'rhbz914931') receives a SIGTERM.  I checked the siginfo struct for
> this signal, and it appears to come from the vmlinux main process,
> which should not be happening.
> 
> So .. possibly there's something awry with how vmlinux delivers
> signals to its child processes on shutdown which is causing it both to
> miss out some children, and to kill other unrelated processes.  Or
> maybe this is just a coincidence.
> 
> Rich.
> 


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
___
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] [PATCH] print_worker_info: Handle pointer with more care

2013-08-16 Thread Richard Weinberger
Am 16.08.2013 18:28, schrieb Tejun Heo:
> On Fri, Aug 16, 2013 at 06:15:07PM +0200, Richard Weinberger wrote:
>> On UML I hit the case that pwq is NULL.
>> Then we oops at &pwq->wq...
> 
> Hmmm?  I'm confused.  &pwq->wq is pwq's pointer + wq's offset in pwq.
> It doesn't involve dereferencing pwq->wq.  Maybe uml isn't
> implementing probe_kernel_thread()?  Now that I think about it, I'm
> not sure how it could.
> 
> cc'ing uml people.  Hey, guys, workqueue uses proble_kernel_read() to
> print out workqueue related information during oops because those
> events are completely asynchronous and workqueue states may not be
> consistently accessible.  It seems like uml doesn't implement
> probe_kernel_read() and tries direct derference of incorrect pointers
> leading to its own oops.  Maybe uml should check whether the memory is
> mapped from probe_kernel_read()?

You are already talking to UML people. ;)
Anyway, I'll investigate into that.
What I see so far is that pwq is NULL after probe_kernel_read().

Thanks,
//richard

--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
___
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] [PATCH] print_worker_info: Handle pointer with more care

2013-08-16 Thread Richard Weinberger
Am 16.08.2013 18:45, schrieb Tejun Heo:
> Hello,
> 
> On Fri, Aug 16, 2013 at 06:38:58PM +0200, Richard Weinberger wrote:
>>> cc'ing uml people.  Hey, guys, workqueue uses proble_kernel_read() to
>>> print out workqueue related information during oops because those
>>> events are completely asynchronous and workqueue states may not be
>>> consistently accessible.  It seems like uml doesn't implement
>>> probe_kernel_read() and tries direct derference of incorrect pointers
>>> leading to its own oops.  Maybe uml should check whether the memory is
>>> mapped from probe_kernel_read()?
>>
>> You are already talking to UML people. ;)
> 
> Ooh... :)
> 
>> Anyway, I'll investigate into that.
>> What I see so far is that pwq is NULL after probe_kernel_read().
> 
> Yeah, and that should be fine.  &pwq->wq would be just an offset of wq

Yep. Now my brain also parsed the C notation correctly.
Sorry for the completely wrong patch.

> from NULL which is an invalid pointer but probe_kernel_read() should
> be able to handle that and probably just return 0 or -1 (all bits
> set).  I *think* what's necessary is making probe_kernel_read() use
> mincore() to fine out whether the requested address is mapped (it
> should return -EFAULT if not) and try to dereference the address iff
> it's mapped.

UML needs a custom probe_kernel_read()? Fine. :)

Thanks,
//richard


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
___
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] [PATCH] print_worker_info: Handle pointer with more care

2013-08-16 Thread Richard Weinberger
Am 16.08.2013 18:53, schrieb Richard Weinberger:
>> Yeah, and that should be fine.  &pwq->wq would be just an offset of wq
> 
> Yep. Now my brain also parsed the C notation correctly.
> Sorry for the completely wrong patch.
> 
>> from NULL which is an invalid pointer but probe_kernel_read() should
>> be able to handle that and probably just return 0 or -1 (all bits
>> set).  I *think* what's necessary is making probe_kernel_read() use
>> mincore() to fine out whether the requested address is mapped (it
>> should return -EFAULT if not) and try to dereference the address iff
>> it's mapped.
> 
> UML needs a custom probe_kernel_read()? Fine. :)

With my own probe_kernel_read() that uses mincore()
it works fine so far. :-)

Thanks,
//richard


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
___
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] um: Implement probe_kernel_read()

2013-08-16 Thread Richard Weinberger
UML needs it's own probe_kernel_read() to handle kernel
mode faults correctly.
The implementation uses mincore() on the host side to detect
whether a page is owned by the UML kernel process.

This fixes also a possible crash when sysrq-t is used.
Starting with 3.10 sysrq-t calls probe_kernel_read() to
read details from the kernel workers. As kernel worker are
completely async pointers may turn NULL while reading them.

Cc: 
Cc:  # 3.10.x
Signed-off-by: Richard Weinberger 
---
 arch/um/include/shared/os.h |  1 +
 arch/um/kernel/Makefile |  2 +-
 arch/um/kernel/maccess.c| 24 +
 arch/um/os-Linux/process.c  | 52 +
 4 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 arch/um/kernel/maccess.c

diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 95feaa4..c70a234 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -200,6 +200,7 @@ extern int os_unmap_memory(void *addr, int len);
 extern int os_drop_memory(void *addr, int length);
 extern int can_drop_memory(void);
 extern void os_flush_stdout(void);
+extern int os_mincore(void *addr, unsigned long len);
 
 /* execvp.c */
 extern int execvp_noalloc(char *buf, const char *file, char *const argv[]);
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index babe218..d8b78a0 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -13,7 +13,7 @@ clean-files :=
 obj-y = config.o exec.o exitcode.o irq.o ksyms.o mem.o \
physmem.o process.o ptrace.o reboot.o sigio.o \
signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \
-   um_arch.o umid.o skas/
+   um_arch.o umid.o maccess.o skas/
 
 obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
 obj-$(CONFIG_GPROF)+= gprof_syms.o
diff --git a/arch/um/kernel/maccess.c b/arch/um/kernel/maccess.c
new file mode 100644
index 000..214e2e0
--- /dev/null
+++ b/arch/um/kernel/maccess.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2013 Richard Weinberger 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+
+long probe_kernel_read(void *dst, const void *src, size_t size)
+{
+   void *psrc = (void *)rounddown((u64)src, PAGE_SIZE);
+
+   if ((u64)src < PAGE_SIZE || size <= 0)
+   return -EFAULT;
+
+   if (os_mincore(psrc, size) <= 0)
+   return -EFAULT;
+
+   return __probe_kernel_read(dst, src, size);
+}
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index b8f34c9..67b9c8f 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -232,6 +233,57 @@ out:
return ok;
 }
 
+static int os_page_mincore(void *addr)
+{
+   char vec[2];
+   int ret;
+
+   ret = mincore(addr, UM_KERN_PAGE_SIZE, vec);
+   if (ret < 0) {
+   if (errno == ENOMEM || errno == EINVAL)
+   return 0;
+   else
+   return -errno;
+   }
+
+   return vec[0] & 1;
+}
+
+int os_mincore(void *addr, unsigned long len)
+{
+   char *vec;
+   int ret, i;
+
+   if (len <= UM_KERN_PAGE_SIZE)
+   return os_page_mincore(addr);
+
+   vec = calloc(1, (len + UM_KERN_PAGE_SIZE - 1) / UM_KERN_PAGE_SIZE);
+   if (!vec)
+   return -ENOMEM;
+
+   ret = mincore(addr, UM_KERN_PAGE_SIZE, vec);
+   if (ret < 0) {
+   if (errno == ENOMEM || errno == EINVAL)
+   ret = 0;
+   else
+   ret = -errno;
+
+   goto out;
+   }
+
+   for (i = 0; i < ((len + UM_KERN_PAGE_SIZE - 1) / UM_KERN_PAGE_SIZE); 
i++) {
+   if (!(vec[i] & 1)) {
+   ret = 0;
+   goto out;
+   }
+   }
+
+   ret = 1;
+out:
+   free(vec);
+   return ret;
+}
+
 void init_new_thread_signals(void)
 {
set_handler(SIGSEGV);
-- 
1.8.3.1


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
___
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] [PATCH] um: Implement probe_kernel_read()

2013-08-16 Thread Richard Weinberger
Am 16.08.2013 21:44, schrieb Richard Weinberger:
> UML needs it's own probe_kernel_read() to handle kernel
> mode faults correctly.
> The implementation uses mincore() on the host side to detect
> whether a page is owned by the UML kernel process.
> 
> This fixes also a possible crash when sysrq-t is used.
> Starting with 3.10 sysrq-t calls probe_kernel_read() to
> read details from the kernel workers. As kernel worker are
> completely async pointers may turn NULL while reading them.
> 
> Cc: 
> Cc:  # 3.10.x
> Signed-off-by: Richard Weinberger 
> ---
>  arch/um/include/shared/os.h |  1 +
>  arch/um/kernel/Makefile |  2 +-
>  arch/um/kernel/maccess.c| 24 +
>  arch/um/os-Linux/process.c  | 52 
> +
>  4 files changed, 78 insertions(+), 1 deletion(-)
>  create mode 100644 arch/um/kernel/maccess.c
> 
> diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
> index 95feaa4..c70a234 100644
> --- a/arch/um/include/shared/os.h
> +++ b/arch/um/include/shared/os.h
> @@ -200,6 +200,7 @@ extern int os_unmap_memory(void *addr, int len);
>  extern int os_drop_memory(void *addr, int length);
>  extern int can_drop_memory(void);
>  extern void os_flush_stdout(void);
> +extern int os_mincore(void *addr, unsigned long len);
>  
>  /* execvp.c */
>  extern int execvp_noalloc(char *buf, const char *file, char *const argv[]);
> diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
> index babe218..d8b78a0 100644
> --- a/arch/um/kernel/Makefile
> +++ b/arch/um/kernel/Makefile
> @@ -13,7 +13,7 @@ clean-files :=
>  obj-y = config.o exec.o exitcode.o irq.o ksyms.o mem.o \
>   physmem.o process.o ptrace.o reboot.o sigio.o \
>   signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \
> - um_arch.o umid.o skas/
> + um_arch.o umid.o maccess.o skas/
>  
>  obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
>  obj-$(CONFIG_GPROF)  += gprof_syms.o
> diff --git a/arch/um/kernel/maccess.c b/arch/um/kernel/maccess.c
> new file mode 100644
> index 000..214e2e0
> --- /dev/null
> +++ b/arch/um/kernel/maccess.c
> @@ -0,0 +1,24 @@
> +/*
> + * Copyright (C) 2013 Richard Weinberger 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +long probe_kernel_read(void *dst, const void *src, size_t size)
> +{
> + void *psrc = (void *)rounddown((u64)src, PAGE_SIZE);
> +
> + if ((u64)src < PAGE_SIZE || size <= 0)
> + return -EFAULT;
> +

*grrr*, while pressing the send button I realized that it should be 
s/u64/unsigned long/g.

> + if (os_mincore(psrc, size) <= 0)
> + return -EFAULT;
> +
> + return __probe_kernel_read(dst, src, size);
> +}
> diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
> index b8f34c9..67b9c8f 100644
> --- a/arch/um/os-Linux/process.c
> +++ b/arch/um/os-Linux/process.c
> @@ -4,6 +4,7 @@
>   */
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -232,6 +233,57 @@ out:
>   return ok;
>  }
>  
> +static int os_page_mincore(void *addr)
> +{
> + char vec[2];
> + int ret;
> +
> + ret = mincore(addr, UM_KERN_PAGE_SIZE, vec);
> + if (ret < 0) {
> + if (errno == ENOMEM || errno == EINVAL)
> + return 0;
> + else
> + return -errno;
> + }
> +
> + return vec[0] & 1;
> +}
> +
> +int os_mincore(void *addr, unsigned long len)
> +{
> + char *vec;
> + int ret, i;
> +
> + if (len <= UM_KERN_PAGE_SIZE)
> + return os_page_mincore(addr);
> +
> + vec = calloc(1, (len + UM_KERN_PAGE_SIZE - 1) / UM_KERN_PAGE_SIZE);
> + if (!vec)
> + return -ENOMEM;
> +
> + ret = mincore(addr, UM_KERN_PAGE_SIZE, vec);
> + if (ret < 0) {
> + if (errno == ENOMEM || errno == EINVAL)
> + ret = 0;
> + else
> + ret = -errno;
> +
> + goto out;
> + }
> +
> + for (i = 0; i < ((len + UM_KERN_PAGE_SIZE - 1) / UM_KERN_PAGE_SIZE); 
> i++) {
> + if (!(vec[i] & 1)) {
> + ret = 0;
> + goto out;
> + }
> + }
> +
> + ret = 1;
> +out:
> + free(vec);
> + return ret;
> +}
> +
>  void init_new_thread_signals(void)
>  {
>   set_handler(

[uml-devel] [PATCH v2] um: Implement probe_kernel_read()

2013-08-17 Thread Richard Weinberger
UML needs it's own probe_kernel_read() to handle kernel
mode faults correctly.
The implementation uses mincore() on the host side to detect
whether a page is owned by the UML kernel process.

This fixes also a possible crash when sysrq-t is used.
Starting with 3.10 sysrq-t calls probe_kernel_read() to
read details from the kernel workers. As kernel worker are
completely async pointers may turn NULL while reading them.

Cc: 
Cc: 
Cc:  # 3.10.x
Signed-off-by: Richard Weinberger 
---
 arch/um/include/shared/os.h |  1 +
 arch/um/kernel/Makefile |  2 +-
 arch/um/kernel/maccess.c| 24 +
 arch/um/os-Linux/process.c  | 52 +
 4 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 arch/um/kernel/maccess.c

diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 95feaa4..c70a234 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -200,6 +200,7 @@ extern int os_unmap_memory(void *addr, int len);
 extern int os_drop_memory(void *addr, int length);
 extern int can_drop_memory(void);
 extern void os_flush_stdout(void);
+extern int os_mincore(void *addr, unsigned long len);
 
 /* execvp.c */
 extern int execvp_noalloc(char *buf, const char *file, char *const argv[]);
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index babe218..d8b78a0 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -13,7 +13,7 @@ clean-files :=
 obj-y = config.o exec.o exitcode.o irq.o ksyms.o mem.o \
physmem.o process.o ptrace.o reboot.o sigio.o \
signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \
-   um_arch.o umid.o skas/
+   um_arch.o umid.o maccess.o skas/
 
 obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
 obj-$(CONFIG_GPROF)+= gprof_syms.o
diff --git a/arch/um/kernel/maccess.c b/arch/um/kernel/maccess.c
new file mode 100644
index 000..1f3d5c4
--- /dev/null
+++ b/arch/um/kernel/maccess.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2013 Richard Weinberger 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+
+long probe_kernel_read(void *dst, const void *src, size_t size)
+{
+   void *psrc = (void *)rounddown((unsigned long)src, PAGE_SIZE);
+
+   if ((unsigned long)src < PAGE_SIZE || size <= 0)
+   return -EFAULT;
+
+   if (os_mincore(psrc, size + src - psrc) <= 0)
+   return -EFAULT;
+
+   return __probe_kernel_read(dst, src, size);
+}
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index b8f34c9..67b9c8f 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -232,6 +233,57 @@ out:
return ok;
 }
 
+static int os_page_mincore(void *addr)
+{
+   char vec[2];
+   int ret;
+
+   ret = mincore(addr, UM_KERN_PAGE_SIZE, vec);
+   if (ret < 0) {
+   if (errno == ENOMEM || errno == EINVAL)
+   return 0;
+   else
+   return -errno;
+   }
+
+   return vec[0] & 1;
+}
+
+int os_mincore(void *addr, unsigned long len)
+{
+   char *vec;
+   int ret, i;
+
+   if (len <= UM_KERN_PAGE_SIZE)
+   return os_page_mincore(addr);
+
+   vec = calloc(1, (len + UM_KERN_PAGE_SIZE - 1) / UM_KERN_PAGE_SIZE);
+   if (!vec)
+   return -ENOMEM;
+
+   ret = mincore(addr, UM_KERN_PAGE_SIZE, vec);
+   if (ret < 0) {
+   if (errno == ENOMEM || errno == EINVAL)
+   ret = 0;
+   else
+   ret = -errno;
+
+   goto out;
+   }
+
+   for (i = 0; i < ((len + UM_KERN_PAGE_SIZE - 1) / UM_KERN_PAGE_SIZE); 
i++) {
+   if (!(vec[i] & 1)) {
+   ret = 0;
+   goto out;
+   }
+   }
+
+   ret = 1;
+out:
+   free(vec);
+   return ret;
+}
+
 void init_new_thread_signals(void)
 {
set_handler(SIGSEGV);
-- 
1.8.3.1


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
___
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] um: ubd: Add REQ_FLUSH suppport

2013-08-17 Thread Richard Weinberger
UML's block device driver does not support write barriers,
to support this this patch adds REQ_FLUSH suppport.
Every time the block layer sends a REQ_FLUSH we fsync() now
our backing file to guarantee data consistency.

Cc: rjo...@redhat.com
Signed-off-by: Richard Weinberger 
---
 arch/um/drivers/ubd_kern.c  | 41 -
 arch/um/include/shared/os.h |  1 +
 arch/um/os-Linux/file.c |  9 +
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 879990c..d27c703 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -41,7 +41,7 @@
 #include 
 #include "cow.h"
 
-enum ubd_req { UBD_READ, UBD_WRITE };
+enum ubd_req { UBD_READ, UBD_WRITE, UBD_FLUSH };
 
 struct io_thread_req {
struct request *req;
@@ -866,6 +866,7 @@ static int ubd_add(int n, char **error_out)
goto out;
}
ubd_dev->queue->queuedata = ubd_dev;
+   blk_queue_flush(ubd_dev->queue, REQ_FLUSH);
 
blk_queue_max_segments(ubd_dev->queue, MAX_SG);
err = ubd_disk_register(UBD_MAJOR, ubd_dev->size, n, &ubd_gendisk[n]);
@@ -1239,6 +1240,19 @@ static void prepare_request(struct request *req, struct 
io_thread_req *io_req,
 }
 
 /* Called with dev->lock held */
+static void prepare_flush_request(struct request *req,
+ struct io_thread_req *io_req)
+{
+   struct gendisk *disk = req->rq_disk;
+   struct ubd *ubd_dev = disk->private_data;
+
+   io_req->req = req;
+   io_req->fds[0] = (ubd_dev->cow.file != NULL) ? ubd_dev->cow.fd :
+   ubd_dev->fd;
+   io_req->op = UBD_FLUSH;
+}
+
+/* Called with dev->lock held */
 static void do_ubd_request(struct request_queue *q)
 {
struct io_thread_req *io_req;
@@ -1259,6 +1273,20 @@ static void do_ubd_request(struct request_queue *q)
}
 
req = dev->request;
+
+   if (req->cmd_flags & REQ_FLUSH) {
+   io_req = kmalloc(sizeof(struct io_thread_req),
+GFP_ATOMIC);
+   if (io_req == NULL) {
+   if (list_empty(&dev->restart))
+   list_add(&dev->restart, &restart);
+   return;
+   }
+   prepare_flush_request(req, io_req);
+   os_write_file(thread_fd, &io_req,
+ sizeof(struct io_thread_req *));
+   }
+
while(dev->start_sg < dev->end_sg){
struct scatterlist *sg = &dev->sg[dev->start_sg];
 
@@ -1367,6 +1395,17 @@ static void do_io(struct io_thread_req *req)
int err;
__u64 off;
 
+   if (req->op == UBD_FLUSH) {
+   /* fds[0] is always either the rw image or our cow file */
+   n = os_sync_file(req->fds[0]);
+   if (n != 0) {
+   printk("do_io - sync failed err = %d "
+  "fd = %d\n", -n, req->fds[0]);
+   req->error = 1;
+   }
+   return;
+   }
+
nsectors = req->length / req->sectorsize;
start = 0;
do {
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 95feaa4..04859b7 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -141,6 +141,7 @@ extern int os_seek_file(int fd, unsigned long long offset);
 extern int os_open_file(const char *file, struct openflags flags, int mode);
 extern int os_read_file(int fd, void *buf, int len);
 extern int os_write_file(int fd, const void *buf, int count);
+extern int os_sync_file(int fd);
 extern int os_file_size(const char *file, unsigned long long *size_out);
 extern int os_file_modtime(const char *file, unsigned long *modtime);
 extern int os_pipe(int *fd, int stream, int close_on_exec);
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index c17bd6f..07a7501 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -266,6 +266,15 @@ int os_write_file(int fd, const void *buf, int len)
return n;
 }
 
+int os_sync_file(int fd)
+{
+   int n = fsync(fd);
+
+   if (n < 0)
+   return -errno;
+   return n;
+}
+
 int os_file_size(const char *file, unsigned long long *size_out)
 {
struct uml_stat buf;
-- 
1.8.3.1


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minu

[uml-devel] [PATCH 4/4] um: Run UML in it's own session.

2013-08-18 Thread Richard Weinberger
If UML is not run by a shell it can happen that UML
will kill unrelated proceses upon a fatal exit because
it issues a kill(0, ...).
To prevent such oddities we create a new session in main().

Cc: rjo...@redhat.com
Reported-by: Richard W.M. Jones 
Signed-off-by: Richard Weinberger 
---
 arch/um/os-Linux/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index 749c96d..e1704ff 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -123,6 +123,8 @@ int __init main(int argc, char **argv, char **envp)
 
setup_env_path();
 
+   setsid();
+
new_argv = malloc((argc + 1) * sizeof(char *));
if (new_argv == NULL) {
perror("Mallocing argv");
-- 
1.8.3.1


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
___
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/4] um: ubd: Introduce submit_request()

2013-08-18 Thread Richard Weinberger
Just a clean-up patch to remove the open coded
variants and to ensure that all requests are submitted the
same way.

Signed-off-by: Richard Weinberger 
---
 arch/um/drivers/ubd_kern.c | 32 +++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index d27c703..1812bc8 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1252,12 +1252,28 @@ static void prepare_flush_request(struct request *req,
io_req->op = UBD_FLUSH;
 }
 
+static bool submit_request(struct io_thread_req *io_req, struct ubd *dev)
+{
+   int n = os_write_file(thread_fd, &io_req,
+sizeof(io_req));
+   if (n != sizeof(io_req)) {
+   if (n != -EAGAIN)
+   printk("write to io thread failed, "
+  "errno = %d\n", -n);
+   else if (list_empty(&dev->restart))
+   list_add(&dev->restart, &restart);
+
+   kfree(io_req);
+   return false;
+   }
+   return true;
+}
+
 /* Called with dev->lock held */
 static void do_ubd_request(struct request_queue *q)
 {
struct io_thread_req *io_req;
struct request *req;
-   int n;
 
while(1){
struct ubd *dev = q->queuedata;
@@ -1283,8 +1299,7 @@ static void do_ubd_request(struct request_queue *q)
return;
}
prepare_flush_request(req, io_req);
-   os_write_file(thread_fd, &io_req,
- sizeof(struct io_thread_req *));
+   submit_request(io_req, dev);
}
 
while(dev->start_sg < dev->end_sg){
@@ -1301,17 +1316,8 @@ static void do_ubd_request(struct request_queue *q)
(unsigned long long)dev->rq_pos << 9,
sg->offset, sg->length, sg_page(sg));
 
-   n = os_write_file(thread_fd, &io_req,
- sizeof(struct io_thread_req *));
-   if(n != sizeof(struct io_thread_req *)){
-   if(n != -EAGAIN)
-   printk("write to io thread failed, "
-  "errno = %d\n", -n);
-   else if(list_empty(&dev->restart))
-   list_add(&dev->restart, &restart);
-   kfree(io_req);
+   if (submit_request(io_req, dev) == false)
return;
-   }
 
dev->rq_pos += sg->length >> 9;
dev->start_sg++;
-- 
1.8.3.1


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
___
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/4] um: Cleanup SIGTERM handling

2013-08-18 Thread Richard Weinberger
Richard reported that some UML processes survive if the UML
main process receives a SIGTERM.
This issue was caused by a wrongly placed signal(SIGTERM, SIG_DFL)
in init_new_thread_signals().
It disabled the UML exit handler accidently for some processes.
The correct solution is to disable the fatal handler for all
UML helper threads/processes.
Such that last_ditch_exit() does not get called multiple times
and all processes can exit due to SIGTERM.

Cc: rjo...@redhat.com
Reported-by: Richard W.M. Jones 
Signed-off-by: Richard Weinberger 
---
 arch/um/drivers/ubd.h   |  1 -
 arch/um/drivers/ubd_kern.c  |  3 ++-
 arch/um/drivers/ubd_user.c  |  5 -
 arch/um/include/shared/os.h |  1 +
 arch/um/os-Linux/aio.c  |  5 ++---
 arch/um/os-Linux/process.c  |  1 -
 arch/um/os-Linux/sigio.c|  2 +-
 arch/um/os-Linux/util.c | 10 ++
 8 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/arch/um/drivers/ubd.h b/arch/um/drivers/ubd.h
index 3845051..3b48cd2 100644
--- a/arch/um/drivers/ubd.h
+++ b/arch/um/drivers/ubd.h
@@ -7,7 +7,6 @@
 #ifndef __UM_UBD_USER_H
 #define __UM_UBD_USER_H
 
-extern void ignore_sigwinch_sig(void);
 extern int start_io_thread(unsigned long sp, int *fds_out);
 extern int io_thread(void *arg);
 extern int kernel_fd;
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 1812bc8..3716e69 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1476,7 +1476,8 @@ int io_thread(void *arg)
struct io_thread_req *req;
int n;
 
-   ignore_sigwinch_sig();
+   os_fix_helper_signals();
+
while(1){
n = os_read_file(kernel_fd, &req,
 sizeof(struct io_thread_req *));
diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c
index a703e45..e376f9b 100644
--- a/arch/um/drivers/ubd_user.c
+++ b/arch/um/drivers/ubd_user.c
@@ -21,11 +21,6 @@
 #include "ubd.h"
 #include 
 
-void ignore_sigwinch_sig(void)
-{
-   signal(SIGWINCH, SIG_IGN);
-}
-
 int start_io_thread(unsigned long sp, int *fd_out)
 {
int pid, fds[2], err;
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 04859b7..24d8077 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -234,6 +234,7 @@ extern void setup_machinename(char *machine_out);
 extern void setup_hostinfo(char *buf, int len);
 extern void os_dump_core(void) __attribute__ ((noreturn));
 extern void um_early_printk(const char *s, unsigned int n);
+extern void os_fix_helper_signals(void);
 
 /* time.c */
 extern void idle_sleep(unsigned long long nsecs);
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index 3a6bc2a..014eb35 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -104,8 +104,7 @@ static int aio_thread(void *arg)
struct io_event event;
int err, n, reply_fd;
 
-   signal(SIGWINCH, SIG_IGN);
-
+   os_fix_helper_signals();
while (1) {
n = io_getevents(ctx, 1, 1, &event, NULL);
if (n < 0) {
@@ -173,7 +172,7 @@ static int not_aio_thread(void *arg)
struct aio_thread_reply reply;
int err;
 
-   signal(SIGWINCH, SIG_IGN);
+   os_fix_helper_signals();
while (1) {
err = read(aio_req_fd_r, &req, sizeof(req));
if (err != sizeof(req)) {
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index b8f34c9..7cd61ea 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -242,5 +242,4 @@ void init_new_thread_signals(void)
signal(SIGHUP, SIG_IGN);
set_handler(SIGIO);
signal(SIGWINCH, SIG_IGN);
-   signal(SIGTERM, SIG_DFL);
 }
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index 8b61cc0..46e762f 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -55,7 +55,7 @@ static int write_sigio_thread(void *unused)
int i, n, respond_fd;
char c;
 
-   signal(SIGWINCH, SIG_IGN);
+   os_fix_helper_signals();
fds = ¤t_poll;
while (1) {
n = poll(fds->poll, fds->used, -1);
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index 492ef5e..faee55e 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -94,6 +94,16 @@ static inline void __attribute__ ((noreturn)) uml_abort(void)
exit(127);
 }
 
+/*
+ * UML helper threads must not handle SIGWINCH/INT/TERM
+ */
+void os_fix_helper_signals(void)
+{
+   signal(SIGWINCH, SIG_IGN);
+   signal(SIGINT, SIG_DFL);
+   signal(SIGTERM, SIG_DFL);
+}
+
 void os_dump_core(void)
 {
int pid;
-- 
1.8.3.1


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 

[uml-devel] [PATCH 1/4] um: ubd: Add REQ_FLUSH suppport

2013-08-18 Thread Richard Weinberger
UML's block device driver does not support write barriers,
to support this this patch adds REQ_FLUSH suppport.
Every time the block layer sends a REQ_FLUSH we fsync() now
our backing file to guarantee data consistency.

Cc: rjo...@redhat.com
Reported-by: Richard W.M. Jones 
Signed-off-by: Richard Weinberger 
---
 arch/um/drivers/ubd_kern.c  | 41 -
 arch/um/include/shared/os.h |  1 +
 arch/um/os-Linux/file.c |  9 +
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 879990c..d27c703 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -41,7 +41,7 @@
 #include 
 #include "cow.h"
 
-enum ubd_req { UBD_READ, UBD_WRITE };
+enum ubd_req { UBD_READ, UBD_WRITE, UBD_FLUSH };
 
 struct io_thread_req {
struct request *req;
@@ -866,6 +866,7 @@ static int ubd_add(int n, char **error_out)
goto out;
}
ubd_dev->queue->queuedata = ubd_dev;
+   blk_queue_flush(ubd_dev->queue, REQ_FLUSH);
 
blk_queue_max_segments(ubd_dev->queue, MAX_SG);
err = ubd_disk_register(UBD_MAJOR, ubd_dev->size, n, &ubd_gendisk[n]);
@@ -1239,6 +1240,19 @@ static void prepare_request(struct request *req, struct 
io_thread_req *io_req,
 }
 
 /* Called with dev->lock held */
+static void prepare_flush_request(struct request *req,
+ struct io_thread_req *io_req)
+{
+   struct gendisk *disk = req->rq_disk;
+   struct ubd *ubd_dev = disk->private_data;
+
+   io_req->req = req;
+   io_req->fds[0] = (ubd_dev->cow.file != NULL) ? ubd_dev->cow.fd :
+   ubd_dev->fd;
+   io_req->op = UBD_FLUSH;
+}
+
+/* Called with dev->lock held */
 static void do_ubd_request(struct request_queue *q)
 {
struct io_thread_req *io_req;
@@ -1259,6 +1273,20 @@ static void do_ubd_request(struct request_queue *q)
}
 
req = dev->request;
+
+   if (req->cmd_flags & REQ_FLUSH) {
+   io_req = kmalloc(sizeof(struct io_thread_req),
+GFP_ATOMIC);
+   if (io_req == NULL) {
+   if (list_empty(&dev->restart))
+   list_add(&dev->restart, &restart);
+   return;
+   }
+   prepare_flush_request(req, io_req);
+   os_write_file(thread_fd, &io_req,
+ sizeof(struct io_thread_req *));
+   }
+
while(dev->start_sg < dev->end_sg){
struct scatterlist *sg = &dev->sg[dev->start_sg];
 
@@ -1367,6 +1395,17 @@ static void do_io(struct io_thread_req *req)
int err;
__u64 off;
 
+   if (req->op == UBD_FLUSH) {
+   /* fds[0] is always either the rw image or our cow file */
+   n = os_sync_file(req->fds[0]);
+   if (n != 0) {
+   printk("do_io - sync failed err = %d "
+  "fd = %d\n", -n, req->fds[0]);
+   req->error = 1;
+   }
+   return;
+   }
+
nsectors = req->length / req->sectorsize;
start = 0;
do {
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 95feaa4..04859b7 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -141,6 +141,7 @@ extern int os_seek_file(int fd, unsigned long long offset);
 extern int os_open_file(const char *file, struct openflags flags, int mode);
 extern int os_read_file(int fd, void *buf, int len);
 extern int os_write_file(int fd, const void *buf, int count);
+extern int os_sync_file(int fd);
 extern int os_file_size(const char *file, unsigned long long *size_out);
 extern int os_file_modtime(const char *file, unsigned long *modtime);
 extern int os_pipe(int *fd, int stream, int close_on_exec);
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index c17bd6f..07a7501 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -266,6 +266,15 @@ int os_write_file(int fd, const void *buf, int len)
return n;
 }
 
+int os_sync_file(int fd)
+{
+   int n = fsync(fd);
+
+   if (n < 0)
+   return -errno;
+   return n;
+}
+
 int os_file_size(const char *file, unsigned long long *size_out)
 {
struct uml_stat buf;
-- 
1.8.3.1


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get s

Re: [uml-devel] [PATCH 4/4] um: Run UML in it's own session.

2013-08-19 Thread Richard Weinberger
Am 19.08.2013 11:30, schrieb Richard W.M. Jones:
> On Sun, Aug 18, 2013 at 01:30:09PM +0200, Richard Weinberger wrote:
>> If UML is not run by a shell it can happen that UML
>> will kill unrelated proceses upon a fatal exit because
>> it issues a kill(0, ...).
>> To prevent such oddities we create a new session in main().
>>
>> Cc: rjo...@redhat.com
>> Reported-by: Richard W.M. Jones 
>> Signed-off-by: Richard Weinberger 
> 
> I tested this using the "debug segv" test script that I previously
> posted on the user-mode-linux mailing list, and this problem is now
> fixed.  Therefore:
> 
> Tested-by: Richard W.M. Jones 
> 
> Thanks for these great fixes!

Thanks for testing. :-)
I'll add all patches to uml-next.git in a few days (maybe someone finds a bug).
Expect them in v3.12.

Thanks,
//richard


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
___
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/8] unicore32: Do not use SUBARCH

2013-08-21 Thread Richard Weinberger
Forces the user to specify CROSS_COMPILE at compile time instead
of automatically selecting more or less randomly a cross compiler

Signed-off-by: Richard Weinberger 
---
 arch/unicore32/Makefile | 5 -
 1 file changed, 5 deletions(-)

diff --git a/arch/unicore32/Makefile b/arch/unicore32/Makefile
index b6f5c4c..fae00c8 100644
--- a/arch/unicore32/Makefile
+++ b/arch/unicore32/Makefile
@@ -10,11 +10,6 @@
 #
 # Copyright (C) 2002~2010 by Guan Xue-tao
 #
-ifneq ($(SUBARCH),$(ARCH))
-   ifeq ($(CROSS_COMPILE),)
-   CROSS_COMPILE := $(call cc-cross-prefix, unicore32-linux-)
-   endif
-endif
 
 LDFLAGS_vmlinux:= -p --no-undefined -X
 
-- 
1.8.1.4


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
___
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/8] um: Remove old defconfig

2013-08-21 Thread Richard Weinberger
The old unified defconfig is no longer needed.

Signed-off-by: Richard Weinberger 
---
 arch/um/defconfig | 901 --
 1 file changed, 901 deletions(-)
 delete mode 100644 arch/um/defconfig

diff --git a/arch/um/defconfig b/arch/um/defconfig
deleted file mode 100644
index 08107a7..000
--- a/arch/um/defconfig
+++ /dev/null
@@ -1,901 +0,0 @@
-#
-# Automatically generated file; DO NOT EDIT.
-# User Mode Linux/i386 3.3.0 Kernel Configuration
-#
-CONFIG_DEFCONFIG_LIST="arch/$ARCH/defconfig"
-CONFIG_UML=y
-CONFIG_MMU=y
-CONFIG_NO_IOMEM=y
-# CONFIG_TRACE_IRQFLAGS_SUPPORT is not set
-CONFIG_LOCKDEP_SUPPORT=y
-# CONFIG_STACKTRACE_SUPPORT is not set
-CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_HZ=100
-
-#
-# UML-specific options
-#
-
-#
-# Host processor type and features
-#
-# CONFIG_M486 is not set
-# CONFIG_M586 is not set
-# CONFIG_M586TSC is not set
-# CONFIG_M586MMX is not set
-CONFIG_M686=y
-# CONFIG_MPENTIUMII is not set
-# CONFIG_MPENTIUMIII is not set
-# CONFIG_MPENTIUMM is not set
-# CONFIG_MPENTIUM4 is not set
-# CONFIG_MK6 is not set
-# CONFIG_MK7 is not set
-# CONFIG_MK8 is not set
-# CONFIG_MCRUSOE is not set
-# CONFIG_MEFFICEON is not set
-# CONFIG_MWINCHIPC6 is not set
-# CONFIG_MWINCHIP3D is not set
-# CONFIG_MELAN is not set
-# CONFIG_MGEODEGX1 is not set
-# CONFIG_MGEODE_LX is not set
-# CONFIG_MCYRIXIII is not set
-# CONFIG_MVIAC3_2 is not set
-# CONFIG_MVIAC7 is not set
-# CONFIG_MCORE2 is not set
-# CONFIG_MATOM is not set
-# CONFIG_X86_GENERIC is not set
-CONFIG_X86_INTERNODE_CACHE_SHIFT=5
-CONFIG_X86_CMPXCHG=y
-CONFIG_X86_L1_CACHE_SHIFT=5
-CONFIG_X86_XADD=y
-CONFIG_X86_PPRO_FENCE=y
-CONFIG_X86_WP_WORKS_OK=y
-CONFIG_X86_INVLPG=y
-CONFIG_X86_BSWAP=y
-CONFIG_X86_POPAD_OK=y
-CONFIG_X86_USE_PPRO_CHECKSUM=y
-CONFIG_X86_TSC=y
-CONFIG_X86_CMPXCHG64=y
-CONFIG_X86_CMOV=y
-CONFIG_X86_MINIMUM_CPU_FAMILY=5
-CONFIG_CPU_SUP_INTEL=y
-CONFIG_CPU_SUP_CYRIX_32=y
-CONFIG_CPU_SUP_AMD=y
-CONFIG_CPU_SUP_CENTAUR=y
-CONFIG_CPU_SUP_TRANSMETA_32=y
-CONFIG_CPU_SUP_UMC_32=y
-CONFIG_UML_X86=y
-# CONFIG_64BIT is not set
-CONFIG_X86_32=y
-# CONFIG_X86_64 is not set
-# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_3_LEVEL_PGTABLES is not set
-CONFIG_ARCH_HAS_SC_SIGNALS=y
-CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y
-CONFIG_GENERIC_HWEIGHT=y
-# CONFIG_STATIC_LINK is not set
-CONFIG_SELECT_MEMORY_MODEL=y
-CONFIG_FLATMEM_MANUAL=y
-CONFIG_FLATMEM=y
-CONFIG_FLAT_NODE_MEM_MAP=y
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_SPLIT_PTLOCK_CPUS=4
-# CONFIG_COMPACTION is not set
-# CONFIG_PHYS_ADDR_T_64BIT is not set
-CONFIG_ZONE_DMA_FLAG=0
-CONFIG_VIRT_TO_BUS=y
-# CONFIG_KSM is not set
-CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
-CONFIG_NEED_PER_CPU_KM=y
-# CONFIG_CLEANCACHE is not set
-CONFIG_TICK_ONESHOT=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_LD_SCRIPT_DYN=y
-CONFIG_BINFMT_ELF=y
-CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
-CONFIG_HAVE_AOUT=y
-# CONFIG_BINFMT_AOUT is not set
-CONFIG_BINFMT_MISC=m
-CONFIG_HOSTFS=y
-# CONFIG_HPPFS is not set
-CONFIG_MCONSOLE=y
-CONFIG_MAGIC_SYSRQ=y
-CONFIG_KERNEL_STACK_ORDER=0
-# CONFIG_MMAPPER is not set
-CONFIG_NO_DMA=y
-
-#
-# General setup
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_BROKEN_ON_SMP=y
-CONFIG_INIT_ENV_ARG_LIMIT=128
-CONFIG_CROSS_COMPILE=""
-CONFIG_LOCALVERSION=""
-CONFIG_LOCALVERSION_AUTO=y
-CONFIG_DEFAULT_HOSTNAME="(none)"
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-CONFIG_SYSVIPC_SYSCTL=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_POSIX_MQUEUE_SYSCTL=y
-CONFIG_BSD_PROCESS_ACCT=y
-# CONFIG_BSD_PROCESS_ACCT_V3 is not set
-# CONFIG_FHANDLE is not set
-# CONFIG_TASKSTATS is not set
-# CONFIG_AUDIT is not set
-CONFIG_HAVE_GENERIC_HARDIRQS=y
-
-#
-# IRQ subsystem
-#
-CONFIG_GENERIC_HARDIRQS=y
-CONFIG_GENERIC_IRQ_SHOW=y
-
-#
-# RCU Subsystem
-#
-CONFIG_TINY_RCU=y
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_RCU_TRACE is not set
-# CONFIG_TREE_RCU_TRACE is not set
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CGROUPS=y
-# CONFIG_CGROUP_DEBUG is not set
-CONFIG_CGROUP_FREEZER=y
-CONFIG_CGROUP_DEVICE=y
-CONFIG_CPUSETS=y
-CONFIG_PROC_PID_CPUSET=y
-CONFIG_CGROUP_CPUACCT=y
-CONFIG_RESOURCE_COUNTERS=y
-CONFIG_CGROUP_MEMCG=y
-CONFIG_CGROUP_MEMCG_SWAP=y
-# CONFIG_CGROUP_MEMCG_SWAP_ENABLED is not set
-# CONFIG_CGROUP_MEMCG_KMEM is not set
-CONFIG_CGROUP_SCHED=y
-CONFIG_FAIR_GROUP_SCHED=y
-# CONFIG_CFS_BANDWIDTH is not set
-# CONFIG_RT_GROUP_SCHED is not set
-CONFIG_BLK_CGROUP=y
-# CONFIG_DEBUG_BLK_CGROUP is not set
-# CONFIG_CHECKPOINT_RESTORE is not set
-CONFIG_NAMESPACES=y
-CONFIG_UTS_NS=y
-CONFIG_IPC_NS=y
-# CONFIG_USER_NS is not set
-# CONFIG_PID_NS is not set
-CONFIG_NET_NS=y
-# CONFIG_SCHED_AUTOGROUP is not set
-CONFIG_MM_OWNER=y
-CONFIG_SYSFS_DEPRECATED=y
-# CONFIG_SYSFS_DEPRECATED_V2 is not set
-# CONFIG_RELAY is not set
-# CONFIG_BLK_DEV_INITRD is not set
-CONFIG_CC_OPTIMIZE_FOR_SIZE=

[uml-devel] [PATCH 2/8] um: Do not use SUBARCH

2013-08-21 Thread Richard Weinberger
>From now on UML does no longer depend on SUBARCH and will
never silently change CONFIG_64BIT.

"make defconfig ARCH=um" produces now a .config with is suitable
for your host arch.

"make i386_defconfig ARCH=um" replaces "make defconfig ARCH=um SUBARCH=i386"
"and make x86_64_defconfig ARCH=um" replaces "make defconfig ARCH=um 
SUBARCH=x86_64"

Finally a "make ARCH=um" will produce an UML as described in your .config and 
you
don't have to worry about setting the correct SUBARCH.

This patch is based on: https://lkml.org/lkml/2013/7/4/396

Cc: Ramkumar Ramachandra 
Signed-off-by: Richard Weinberger 
---
 arch/um/Kconfig.common |  4 
 arch/um/Makefile   | 21 +++--
 arch/x86/Makefile.um   |  2 +-
 arch/x86/um/Kconfig|  6 +++---
 4 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index bceee66..a7ef0b4 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
@@ -58,7 +58,3 @@ config GENERIC_BUG
 config HZ
int
default 100
-
-config SUBARCH
-   string
-   option env="SUBARCH"
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 133f7de..5bc7892 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -8,6 +8,8 @@
 
 ARCH_DIR := arch/um
 OS := $(shell uname -s)
+OS_ARCH := $(shell uname -m)
+
 # We require bash because the vmlinux link and loader script cpp use bash
 # features.
 SHELL := /bin/bash
@@ -20,15 +22,14 @@ core-y  += $(ARCH_DIR)/kernel/  
\
 
 MODE_INCLUDE   += -I$(srctree)/$(ARCH_DIR)/include/shared/skas
 
-HEADER_ARCH:= $(SUBARCH)
-
-# Additional ARCH settings for x86
-ifeq ($(SUBARCH),i386)
-HEADER_ARCH := x86
-endif
-ifeq ($(SUBARCH),x86_64)
-HEADER_ARCH := x86
-   KBUILD_CFLAGS += -mcmodel=large
+# Currently we support only i386 and x86_64, if you port UML to another arch
+# add another if branch...
+ifeq ($(OS_ARCH),x86_64)
+   HEADER_ARCH := x86
+   KBUILD_DEFCONFIG := x86_64_defconfig
+else
+   HEADER_ARCH := x86
+   KBUILD_DEFCONFIG := i386_defconfig
 endif
 
 HOST_DIR := arch/$(HEADER_ARCH)
@@ -155,4 +156,4 @@ endef
 include/generated/user_constants.h: $(HOST_DIR)/um/user-offsets.s
$(call filechk,gen-asm-offsets)
 
-export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH
+export USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH
diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
index 36b62bc..91d088c 100644
--- a/arch/x86/Makefile.um
+++ b/arch/x86/Makefile.um
@@ -40,7 +40,7 @@ else
 
 START := 0x6000
 
-KBUILD_CFLAGS += -fno-builtin -m64 
+KBUILD_CFLAGS += -fno-builtin -m64 -mcmodel=large
 
 CHECKFLAGS  += -m64 -D__x86_64__
 KBUILD_AFLAGS += -m64
diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig
index 14ef8d1..bb6df67 100644
--- a/arch/x86/um/Kconfig
+++ b/arch/x86/um/Kconfig
@@ -1,4 +1,4 @@
-mainmenu "User Mode Linux/$SUBARCH $KERNELVERSION Kernel Configuration"
+mainmenu "User Mode Linux $KERNELVERSION Kernel Configuration"
 
 source "arch/um/Kconfig.common"
 
@@ -15,8 +15,8 @@ config UML_X86
select GENERIC_FIND_FIRST_BIT
 
 config 64BIT
-   bool "64-bit kernel" if SUBARCH = "x86"
-   default SUBARCH != "i386"
+   bool "64-bit kernel"
+   default n
 
 config X86_32
def_bool !64BIT
-- 
1.8.1.4


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


<    1   2   3   4   5   6   7   8   9   >