HEADS UP - DEVFS ON MASTER

YONETANI Tomokazu qhwt+dfly at les.ath.cx
Wed Aug 5 07:50:19 PDT 2009


On Wed, Aug 05, 2009 at 12:44:01PM +0200, Simon 'corecode' Schubert wrote:
> YONETANI Tomokazu wrote:
>> diff --git a/sys/platform/vkernel/platform/init.c b/sys/platform/vkernel/platform/init.c
>> index 2d3fd72..7caaf5b 100644
>> --- a/sys/platform/vkernel/platform/init.c
>> +++ b/sys/platform/vkernel/platform/init.c
>> @@ -955,9 +955,7 @@ netif_open_tap(const char *netif, int *tap_unit, int s)
>>  	 */
>>  	failed = 1;
>>  	if (fstat(tap_fd, &st) == 0 && S_ISCHR(st.st_mode) &&
>> -	    TAPDEV_MAJOR(st.st_rdev) == TAP_CDEV_MAJOR) {
>> -		*tap_unit = TAPDEV_MINOR(st.st_rdev);
>> -
>> +	    sscanf(tap_dev, "/dev/tap%d", tap_unit) == 1) {
>>  		/*
>>  		 * Bring up the corresponding tap(4) interface
>>  		 */
>
> That seems strange.  Shouldn't be tap be cloning, i.e. just open  
> /dev/tap, and then use devname(fd) (to retrieve the ifname) or ioctl()  
> (to set the ifname)?

Oh, I won't call that patch a `fix', it was just a bandaid for me.
However, just opening /dev/tap results in a kernel panic (at least
on an unpatched vkernel).

vkernel# dd if=/dev/tap of=/dev/null count=0


Fatal trap 12: page fault while in kernel mode
mp_lock = 00000000; cpuid = 0
fault virtual address   = 0x44
fault code              = supervisor write, page not present
instruction pointer     = 0x1f:0x8139df0
stack pointer           = 0x10:0x5a6e8720
frame pointer           = 0x10:0x5a6e8a28
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 722 (dd)
current thread          = pri 6
 <- SMP: XXX
kernel: type 12 trap, code=6

CPU0 stopping CPUs: 0x00000002
 stopped
Stopped at      0x8139df0:      movl    %esi,0x44
db> trace
pppioctl(831a134,0,5a6e8a68,81d401e,5a6e8a44) at 0x8139df0
pppioctl(5a6e8a44,88,0,0,5ab0ed88) at 0x8139efb
devfs_clone(50c40d58,5a6e8a9c,5a6e8aa0,1,5ab0ed88) at 0x81d401e
devfs_create_device_node(5a6e8ac0,8279e14,55b770d0,585c9b48,1) at 0x81d680e
vop_open(55b770d0,59409468,1,5ab0ed88,5a70ed48) at 0x81164de
vn_open(5a6e8c30,5a70ed48,1,0,5a8daa30) at 0x811564f
kern_open(5a6e8c30,0,0,5a6e8ca0,0) at 0x811270e
sys_open(5a6e8ca0,6,0,0,5a802058) at 0x8112937
syscall2(5a6e8d40,6,5a802058,0,0) at 0x821d0bc
user_trap(5a6e8d40,5a8daa30,821c6d4,0,821d9ca) at 0x821d2eb
go_user(5a6e8d38,0,0,7b,0) at 0x821d6fb





More information about the Kernel mailing list