Date: Mon, 14 May 2007 22:54:53 GMT From: Ludovico Gardenghi<osd@cs.unibo.it> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/112672: [if_tap] stat /dev/tapN leads to panic for N >= 2G Message-ID: <200705142254.l4EMsrYI020438@www.freebsd.org> Resent-Message-ID: <200705142300.l4EN0D2P016673@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 112672 >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:12 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@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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705142254.l4EMsrYI020438>