amd64/88249: getdents syscall fails for devfs on amd64 linuxalator

Devon O'Dell dodell at
Fri Nov 4 20:30:22 PST 2005

The following reply was made to PR amd64/88249; it has been noted by GNATS.

From: "Devon O'Dell" <dodell at>
To: freebsd-gnats-submit at,
        "Arno J. Klaassen" <arno at>
Subject: Re: amd64/88249: getdents syscall fails for devfs on amd64 linuxalator
Date: Fri, 4 Nov 2005 20:27:40 -0800

 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 I tested this issue and had the same result in FreeBSD 7-CURRENT/amd64.
 The attached patch fixes the issue, but I'm not sure if it is the
 correct solution. I'm sort of unfamiliar with the codepath leading up
 to the fix.
 Can someone please look at this?
 > /compat/linux/bin/bash
 bash-2.05b$ tty
 bash-2.05b$ ls /dev
 acd0     ata         dsp0.1    io      net4     stderr      ttyv1  ttyvd
 acd0t01  audio0.0    dspW0.0   kbd0    network  stdin       ttyv2  ttyve
 acpi     audio0.1    dspW0.1   klog    nfs4     stdout      ttyv3  ttyvf
 ad4      console     dspr0.1   kmem    nfslock  sysmouse    ttyv4  ukbd0
 ad4s1    consolectl  dumpdev   log     null     ttyd0       ttyv5  ums0
 ad4s1a   ctty        fd        mdctl   pci      ttyd0.init  ttyv6  urandom
 ad4s1b   cuad0       fido      mem     ptyp0    ttyd0.lock  ttyv7  usb
 ad4s1c   cuad0.init  fw0       mixer0  ptyp1    ttyp0       ttyv8  usb0
 ad4s1d   cuad0.lock  fw0.0     net     ptyp2    ttyp1       ttyv9  usb1
 ad4s1e   devctl      fwmem0    net1    ptyp3    ttyp2       ttyva  xpt0
 ad4s1f   devstat     fwmem0.0  net2    random   ttyp3       ttyvb  zero
 ad4s2    dsp0.0      geom.ctl  net3    sndstat  ttyv0       ttyvc
 bash-2.05b$ uname -a
 Linux 2.4.2 FreeBSD 7.0-CURRENT #0: Fri Nov  4 20:11:34 PST 2005 i686 i686 i386 GNU/Linux
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="linux_getdents_panic.patch"
 --- sys/kern/vfs_subr.c	Mon Oct 31 07:41:25 2005
 +++ sys/kern/vfs_subr.c	Fri Nov  4 20:22:47 2005
 @@ -3873,7 +3873,7 @@
  		return (error);
 -	if (ap->a_ncookies == NULL)
 +	if (ap->a_ncookies == NULL || *ap->a_cookies == NULL)
  		return (0);
  	*ap->a_cookies = realloc(*ap->a_cookies,
  	    (*ap->a_ncookies + 1) * sizeof(u_long), M_TEMP, M_WAITOK | M_ZERO);

More information about the freebsd-amd64 mailing list