Leonard Norrgård | 1 Mar 2007 06:08
Picon

[PATCH] fix misleading error message in tools/tunctl/tunctl.c

Fix misleading error message.

Signed-off-by: Leonard Norrgard <vinsci <at> refactor.fi>

Index: tunctl/tunctl.c
===================================================================
RCS file: /cvsroot/user-mode-linux/tools/tunctl/tunctl.c,v
retrieving revision 1.4
diff -u -r1.4 tunctl.c
--- tunctl/tunctl.c	2 Nov 2002 19:34:19 -0000	1.4
+++ tunctl/tunctl.c	1 Mar 2007 05:04:58 -0000
 <at>  <at>  -101,7 +101,7  <at>  <at> 
       exit(1);
     }
     if(ioctl(tap_fd, TUNSETOWNER, owner) < 0){
-      perror("TUNSETPERSIST");
+      perror("TUNSETOWNER");
       exit(1);
     } 
     if(brief)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Felipe T. | 1 Mar 2007 17:02
Picon

Install Sebek 3 in Kernel Uml

Hi!
Somebody has achieved to installar SEBEK 3 into a Kernel UML?

 I have tried it by long time, but I have problems with the sources within Kernel UML.

any recommendation?

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Blaisorblade | 2 Mar 2007 00:58
Picon
Favicon

Re: [PATCH] fix misleading error message in tools/tunctl/tunctl.c

On Thursday 01 March 2007 06:08, Leonard Norrgård wrote:
> Fix misleading error message.
>
> Signed-off-by: Leonard Norrgard <vinsci <at> refactor.fi>
>
> Index: tunctl/tunctl.c
> ===================================================================
> RCS file: /cvsroot/user-mode-linux/tools/tunctl/tunctl.c,v
> retrieving revision 1.4
> diff -u -r1.4 tunctl.c
> --- tunctl/tunctl.c	2 Nov 2002 19:34:19 -0000	1.4
> +++ tunctl/tunctl.c	1 Mar 2007 05:04:58 -0000
>  <at>  <at>  -101,7 +101,7  <at>  <at> 
>        exit(1);
>      }
>      if(ioctl(tap_fd, TUNSETOWNER, owner) < 0){
> -      perror("TUNSETPERSIST");
> +      perror("TUNSETOWNER");
>        exit(1);
>      }
>      if(brief)
>

Applied in my tree, thanks.
--

-- 
Inform me of my mistakes, so I can add them to my list!
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Blaisorblade | 4 Mar 2007 19:50
Picon
Favicon

Re: [uml-user] [PATCH] uml hostfs: fix interaction between hostfs=path1 and -o path2 at mount time (was: Re: hostfs kernel parameter fail?)

On Sunday 04 March 2007 17:50, Sylvain Beucler wrote:
> On Sat, Mar 03, 2007 at 07:32:46PM +0100, Blaisorblade wrote:
> Hi,
>
> I tested and it works.
>
> Thanks,

You'll probably also see that -o .. allows bypassing the 'hostfs jail', and 
I've just implemented a fix to that. The question is whether this should be 
merged.

Indeed, the root user inside UML can bypass that anyway, if he modifies the 
hostfs module, compiles and loads it. So the host admin really needs to run 
UML in a chroot if he needs real security.

What do you all think?
--

-- 
Inform me of my mistakes, so I can add them to my list!
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade

Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Blaisorblade | 4 Mar 2007 20:13
Picon
Favicon

Re: When opening /tmp/uml.ctl fails, what do we get?

On Thursday 22 February 2007 20:59, Jeff Dike wrote:
> On Thu, Feb 22, 2007 at 12:54:04AM +0100, Blaisorblade wrote:
> > I started uml_daemon as root by mistake, so /tmp/uml.ctl even if
> > /dev/net/tun was world-readable. Ok, I did it. This is the result (after
> > trying many times to do 'ifconfig eth0 up' inside UML):
>
> I don't see your irq stuff here when I try that, but there were
> multiple problems, which I hope are fixed by the patch below:
> 	style violations - this made the patch much bigger, and needs
> to be split out

Indeed, sigh. However I'm now convinced that if this just causes delays in 
patch merging without review benefit, it's not a good thing. It should be 
easy to split this away, and I have the patch about errno and am going to 
merge it (I hope to give a flush to my patch queue tomorrow).

However you still add new ones:

+       if(platform_device_register(&device->pdev))
+               goto out_free_netdev;

> 	the user init routines now return success or failure

Good.

> 	some major cleaning of the failure paths through eth_configure
> 		device was never freed
> 		sysfs_unregister was never called, adding the same
> interface again successfully would result in nasty error messages
> 		device stuck in the devices list regardless, so adding
> the same interface again would fail
> 		the return from platform_device_register was not
> checked

> 		I moved the register_netdev call until almost the end
> of the function

Have you checked if other calls require that register_netdev was already 
called?

> Let me know what you think about this.
>
> And about your thought of merging the _init into _open, my excuse for
> keeping them separate deserves some scrutiny.  Every transport besides
> the switch does all of its work in _open, and the _init routine just
> initializes data.  So, I would say that if a transport has separate
> plug-it-in and bring-it-up operations, maybe they should be separated
> more than they are now.  If the switch is the odd one, maybe we should
> merge _init into _open.

Hmm, I'm really not sure about what to do about this. However I'd leave that 
for a future cleanup and just add a comment about this.
And the reason for which init now returns a value is that pcap_init _can_ 
fail, so the switch transport is not the only odd one.

Another note:
+       /*
+        * This overallocates by sizeof(int) since the last field in
+        * uml_net_private is used to access the transport-specific
+        * data, so that user field is the first 4 bytes of the
+        * transport data.
+        */
+       size = transport->private_size + sizeof(struct uml_net_private);

There is a simple and standard solution in Linux style:

struct uml_net_private {
-        int user[1];
+        char user[0];
};

With fgrep [0] include/linux/* I found quite a few examples (like in 
include/linux/ethtool.h) - even if it is not fully ISO C conforming it's gcc 
conforming.

A proof-of-concept (i.e. untested and applying on vanilla) patch for this is 
attached, with name remember-zero-array-net.diff.

Another note: before of this patch, you should please apply the attached two 
ones.

*) The first (net-mac-check-cleanup.diff) checks the validity of assigned MAC 
address, but to print a meaningful error message requires adding a local 
buffer.
*) The second (net_kern-eth_configure...) allows avoiding this local buffer by 
moving code around.

I think I'm excessively paranoid about these two patches and about not yet 
merging them, so please give a look and merge them.
-- 
Inform me of my mistakes, so I can add them to my list!
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Antoine Martin | 4 Mar 2007 23:53
Picon
Favicon

Re: [uml-user] [PATCH] uml hostfs: fix interaction between hostfs=path1 and -o path2 at mount time

Blaisorblade wrote:
> On Sunday 04 March 2007 17:50, Sylvain Beucler wrote:
>> On Sat, Mar 03, 2007 at 07:32:46PM +0100, Blaisorblade wrote:
>> Hi,
>>
>> I tested and it works.
>>
>> Thanks,
> 
> You'll probably also see that -o .. allows bypassing the 'hostfs jail', and 
> I've just implemented a fix to that. The question is whether this should be 
> merged.
> 
> Indeed, the root user inside UML can bypass that anyway, if he modifies the 
> hostfs module, compiles and loads it.
If security is at stake then the host admin should use non-modular 
kernels to prevent such tampering.

> So the host admin really needs to run 
> UML in a chroot if he needs real security.
chroot isn't totally foolproof (see chroot-again issue), but when 
chrooting + changing user (like compartment does), it should be pretty safe.

Antoine

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Jeff Dike | 5 Mar 2007 16:51

Re: When opening /tmp/uml.ctl fails, what do we get?

On Sun, Mar 04, 2007 at 08:13:39PM +0100, Blaisorblade wrote:
> Have you checked if other calls require that register_netdev was already 
> called?

Just did, nothing else depends on it.

> Hmm, I'm really not sure about what to do about this. However I'd leave that 
> for a future cleanup and just add a comment about this.
> And the reason for which init now returns a value is that pcap_init _can_ 
> fail, so the switch transport is not the only odd one.

Yeah, that slipped my mind.

> struct uml_net_private {
> -        int user[1];
> +        char user[0];
> };

Neat, that used to be illegal.

> Another note: before of this patch, you should please apply the attached two 
> ones.
> 
> *) The first (net-mac-check-cleanup.diff) checks the validity of assigned MAC 
> address, but to print a meaningful error message requires adding a local 
> buffer.
> *) The second (net_kern-eth_configure...) allows avoiding this local buffer by 
> moving code around.
> 
> I think I'm excessively paranoid about these two patches and about not yet 
> merging them, so please give a look and merge them.

I just dropped them in - they look OK at a first glance.

				Jeff

--

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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Blaisorblade | 5 Mar 2007 19:24
Picon
Favicon

2.6.21-rc CONFIG_DEBUG_SHIRQ breaks UML

I've seen UML 2.6.21-rc crashing at boot due to CONFIG_DEBUG_SHIRQ. Below I've 
written the diagnosis, without a resolution.

The problem is in mconsole_init() with CONFIG_DEBUG_SHIRQ - it registers the 
mconsole IRQ. CONFIG_DEBUG_SHIRQ triggers a fake IRQ at registration time, to 
catch device drivers not yet ready to handle the IRQ - but our 
mconsole_interrupt() handler calls recvfrom which never returns, after 
creating the socket.

This was introduced (as debug stuff) in commit 
a304e1b82808904c561b7b149b467e338c53fcce.

I thought that it was correct for UML to do this - but I just realized that 
SHIRQ means exactly that another device may register together with us, so 
spurious IRQs may happen coming from the other device. The fix is to remove 
IRQF_SHARED from registration, since it's not needed.

However, this cannot be done for other IRQs which may actually be shared, like 
the console IRQ (which is shared among multiple consoles). I noted this on an 
UML where only one getty is started, which is strange, however this message 
convinced me (just at a glance) that multiple IRQ were being registered.

IRQ handler type mismatch for IRQ 2
current handler: console
Call Trace:
60fd3b78:  [<6004ce5a>] setup_irq+0x1b2/0x1cf
60fd3ba8:  [<600133c4>] line_interrupt+0x0/0x26
60fd3bb8:  [<6004d06b>] request_irq+0xdc/0xfd
60fd3bf8:  [<6000d049>] um_request_irq+0x25/0x47
60fd3c28:  [<600139c8>] line_setup_irq+0x47/0x93
60fd3c78:  [<6001262c>] enable_chan+0x4b/0x59
60fd3c98:  [<60013a7a>] line_open+0x66/0xeb
60fd3cc8:  [<600120aa>] con_open+0x11/0x13
60fd3cd8:  [<60108cf6>] tty_open+0x14f/0x2ba

The proper fix there may be to avoid blocking on read (i.e. using 
O_NONBLOCK) - and in that case I'd suggest deferring it since it does not 
seem me a bug which can be actually hit.

However, I'm not sure about this. What do you think, Jeff?

Mconsole backtrace:
(gdb) where
#0  0x000000006017d165 in __recvfrom_nocancel () at swab.h:134
#1  0x00000000600186d7 in mconsole_get_request (fd=7, req=0x602e3ac0) 
at /home/paolo/Admin/kernel/6/VCS/linux-2.6.git/arch/um/drivers/mconsole_user.c:90
#2  0x00000000600175aa in mconsole_interrupt (irq=7, dev_id=0x602e3b50) at 
list.h:50
#3  0x000000006004d04d in request_irq (irq=9, handler=0x60017501 
<mconsole_interrupt>, irqflags=1, devname=0x60218252 "mconsole", dev_id=0x7)
    at /home/paolo/Admin/kernel/6/VCS/linux-2.6.git/kernel/irq/manage.c:550
#4  0x000000006000d049 in um_request_irq (irq=9, fd=7, type=0, 
handler=0x602e3b50 <req.1+144>, irqflags=524, devname=0xffffffffffffffff 
<Address 0xffffffffffffffff out of bounds>,
    dev_id=0x7) 
at /home/paolo/Admin/kernel/6/VCS/linux-2.6.git/arch/um/kernel/irq.c:374
#5  0x00000000600183c7 in mconsole_init () 
at /home/paolo/Admin/kernel/6/VCS/linux-2.6.git/arch/um/drivers/mconsole_kern.c:817
#6  0x00000000600007fb in do_initcalls () 
at /home/paolo/Admin/kernel/6/VCS/linux-2.6.git/init/main.c:672
#7  0x00000000600008d4 in do_basic_setup () 
at /home/paolo/Admin/kernel/6/VCS/linux-2.6.git/init/main.c:712
#8  0x000000006000094d in init (unused=0x7) 
at /home/paolo/Admin/kernel/6/VCS/linux-2.6.git/init/main.c:803
#9  0x000000006001e77b in run_kernel_thread (fn=0x600008e6 <init>, arg=0x0, 
jmp_ptr=0x20c) 
at /home/paolo/Admin/kernel/6/VCS/linux-2.6.git/arch/um/os-Linux/process.c:292
#10 0x0000000060011343 in new_thread_handler () at thread_info.h:46

Original commit:

Commit: a304e1b82808904c561b7b149b467e338c53fcce
Author: David Woodhouse <dwmw2 <at> infradead.org> Mon, 12 Feb 2007 00:52:00 -0800

    [PATCH] Debug shared irqs

    Drivers registering IRQ handlers with SA_SHIRQ really ought to be able to
    handle an interrupt happening before request_irq() returns.  They also
    ought to be able to handle an interrupt happening during the start of 
their
    call to free_irq().  Let's test that hypothesis....

--

-- 
Inform me of my mistakes, so I can add them to my list!
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Blaisorblade | 5 Mar 2007 19:27
Picon
Favicon

Re: When opening /tmp/uml.ctl fails, what do we get?

On Monday 05 March 2007 16:51, Jeff Dike wrote:
> On Sun, Mar 04, 2007 at 08:13:39PM +0100, Blaisorblade wrote:
> > Have you checked if other calls require that register_netdev was already
> > called?
>
> Just did, nothing else depends on it.
Fine.
> > Hmm, I'm really not sure about what to do about this. However I'd leave
> > that for a future cleanup and just add a comment about this.
> > And the reason for which init now returns a value is that pcap_init _can_
> > fail, so the switch transport is not the only odd one.
>
> Yeah, that slipped my mind.
>
> > struct uml_net_private {
> > -        int user[1];
> > +        char user[0];
> > };
>
> Neat, that used to be illegal.

If you use -pedantic (-ansi -std=c89 doesn't suffice) you'll learn that ISO C 
prohibits that; however, ethtool.h is quite a good example I guess, so GCC 
3.2 supports that; and the code is anyway simpler that way.

--

-- 
Inform me of my mistakes, so I can add them to my list!
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Blaisorblade | 5 Mar 2007 19:29
Picon
Favicon

Re: [uml-user] [PATCH] uml hostfs: fix interaction between hostfs=path1 and -o path2 at mount time

On Sunday 04 March 2007 23:53, Antoine Martin wrote:
> Blaisorblade wrote:
> > On Sunday 04 March 2007 17:50, Sylvain Beucler wrote:
> >> On Sat, Mar 03, 2007 at 07:32:46PM +0100, Blaisorblade wrote:
> >> Hi,
> >>
> >> I tested and it works.
> >>
> >> Thanks,
> >
> > You'll probably also see that -o .. allows bypassing the 'hostfs jail',
> > and I've just implemented a fix to that. The question is whether this
> > should be merged.
> >
> > Indeed, the root user inside UML can bypass that anyway, if he modifies
> > the hostfs module, compiles and loads it.
>
> If security is at stake then the host admin should use non-modular
> kernels to prevent such tampering.

I know /dev/kmem allows bypassing that, but I don't know of any kmem-insmod 
out there (and that would make the issue quite practical).
--

-- 
Inform me of my mistakes, so I can add them to my list!
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Gmane