kern/112670: [if_tap] stat /dev/tapN leads to panic for N >= 2G
Remko Lodder
remko at elvandar.org
Tue May 15 18:10:16 UTC 2007
The following reply was made to PR kern/112670; it has been noted by GNATS.
From: Remko Lodder <remko at elvandar.org>
To: Ludovico Gardenghi <osd at cs.unibo.it>
Cc: freebsd-gnats-submit at FreeBSD.org
Subject: Re: kern/112670: [if_tap] stat /dev/tapN leads to panic for N >=
2G
Date: Tue, 15 May 2007 20:08:05 +0200
Ludovico Gardenghi wrote:
>> Number: 112670
>> Category: kern
>> Synopsis: [if_tap] stat /dev/tapN leads to panic for N >= 2G
>> Confidential: no
>> Severity: serious
>> Priority: medium
>> Responsible: freebsd-bugs
>> State: open
>> Quarter:
>> Keywords:
>> Date-Required:
>> Class: sw-bug
>> Submitter-Id: current-users
>> Arrival-Date: Mon May 14 23:00:11 GMT 2007
>> Closed-Date:
>> Last-Modified:
>> Originator: Ludovico Gardenghi
>> Release: 6.2-RELEASE
>> Organization:
> Virtual Square Team
>> Environment:
> FreeBSD devil.localdomain 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 10:40:27 UTC 2007 root at dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>> Description:
> Trying to access a tap device in /dev leads to a kernel panic ("foo") if the tap name is tapN when N is greater or equal than 2^31 and less than 2^32-1.
>
> This is probably due to a bad conversion between unsigned and signed in dev_stdclone (kern_conf.c:750). The tap name is converted from string to integer with a loop (lines 762--765) and stored in the signed int variable 'u'; if the resulting value is greater than 2G, u becomes negative and the check at line 766 (if (u > 0xffffff)) fails, but the original value is in fact greater than that value and should be rejected.
>> How-To-Repeat:
> shammash at devil:~$ ls -l /dev/tap2147483648
>
> (the following is in /var/log/messages)
>
> May 10 13:57:12 devil kernel: dev 0xc370a000 (tap-1530494977) is on clonelist
> May 10 13:57:12 devil kernel: unit=-1530494977, low=0, extra=0x0
> May 10 13:57:12 devil kernel: 0xc36b4b00 tap0
> May 10 13:57:12 devil kernel: 0xc36f1500 tap255
> May 10 13:57:12 devil kernel: 0xc34f2000 tap256
> May 10 13:57:12 devil kernel: 0xc32aee00 tap65537
> May 10 13:57:12 devil kernel: 0xc36f1a00 tap1
> May 10 13:57:12 devil kernel: 0xc36f1600 tap2
> May 10 13:57:12 devil kernel: 0xc370a000 tap-1530494977
> May 10 13:57:12 devil kernel: panic: foo
> May 10 13:57:12 devil kernel: Uptime: 35m24s
> May 10 13:57:12 devil kernel: Cannot dump. No dump device defined.
> May 10 13:57:12 devil kernel: Automatic reboot in 15 seconds - press a key on the console to abort
> May 10 13:57:12 devil kernel: Rebooting...
>> Fix:
> It should be enough to change 'int' to 'unsigned int' inside the functions involved in tap creation, mainly dev_stdclone() in kern/kern_conf.c.
>> Release-Note:
>> Audit-Trail:
>> Unformatted:
> _______________________________________________
> freebsd-bugs at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
> To unsubscribe, send any mail to "freebsd-bugs-unsubscribe at freebsd.org"
Can you try obtaining us a kernel dump as mentioned in the developers
handbook?
Thanks!
--
Kind regards,
Remko Lodder ** remko at elvandar.org
FreeBSD ** remko at FreeBSD.org
/* Quis custodiet ipsos custodes */
More information about the freebsd-bugs
mailing list