NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/47806 ("Abort trap" when running Linux lddconfig)

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

From: Sergio Lopez <>
Subject: Re: kern/47806 ("Abort trap" when running Linux lddconfig)
Date: Tue, 27 Aug 2013 22:14:39 +0000

 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 ldconfig uses dirent's d_type to determine whether an entry is a
 regular file or a link, and it's getting confused by bogus values on
 said field.
 The emulation code puts d_type just after the d_name string, but glibc
 expects to find it at the end of the record, which, as the structure
 is ALIGN'ed, could be at a different offset.
 Something like the change in the attached diff should make the trick.
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="linux_dtype.diff"
 Index: linux_misc.c
 RCS file: /cvsroot/src/sys/compat/linux/common/linux_misc.c,v
 retrieving revision 1.224
 diff -u -r1.224 linux_misc.c
 --- linux_misc.c       11 Aug 2013 09:07:15 -0000      1.224
 +++ linux_misc.c       27 Aug 2013 21:01:06 -0000
 @@ -786,7 +786,7 @@
                        idb.d_reclen = (u_short)linux_reclen;
                strcpy(idb.d_name, bdp->d_name);
 -              idb.d_name[strlen(idb.d_name) + 1] = bdp->d_type;
 +              *((char *)&idb + idb.d_reclen - 1) = bdp->d_type;
                if ((error = copyout((void *)&idb, outp, linux_reclen)))
                        goto out;
                /* advance past this real entry */

Home | Main Index | Thread Index | Old Index