From nobody@FreeBSD.org  Sun Feb  3 04:37:24 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	by hub.freebsd.org (Postfix) with ESMTP id CB5396EE
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  3 Feb 2013 04:37:24 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id A4FA4681
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  3 Feb 2013 04:37:24 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r134bNZw046995
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 3 Feb 2013 04:37:23 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r134bNMR046994;
	Sun, 3 Feb 2013 04:37:23 GMT
	(envelope-from nobody)
Message-Id: <201302030437.r134bNMR046994@red.freebsd.org>
Date: Sun, 3 Feb 2013 04:37:23 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: modfind(2) doesn't understand modules with underscores
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         175793
>Category:       kern
>Synopsis:       [libc] modfind(2) doesn't understand modules with underscores
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    antoine
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 03 04:40:00 UTC 2013
>Closed-Date:    Thu May 23 16:00:07 UTC 2013
>Last-Modified:  Thu May 23 16:00:07 UTC 2013
>Originator:     Garrett Cooper
>Release:        9.1-STABLE
>Organization:
EMC Isilon
>Environment:
FreeBSD bayonetta.local 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 r+39e5635: Tue Dec 11 08:55:27 PST 2012     gcooper@bayonetta.local:/usr/obj/scratch/git/github/yaneurabeya-freebsd-stable-9/sys/BAYONETTA  amd64
>Description:
Tried to use kldstat -m to determine whether or not a networking module is loaded, and FWIW it appears to not work as expected:

$ kldstat 
Id Refs Address            Size     Name
 1   30 0xffffffff80200000 91e2d8   kernel
 2    1 0xffffffff80b1f000 264378   zfs.ko
 3    5 0xffffffff80d84000 25e38    krpc.ko
 4    2 0xffffffff80daa000 60d8     opensolaris.ko
 5    1 0xffffffff80e12000 7afb     aio.ko
 6    1 0xffffffff80e1a000 a5bf     if_re.ko
 7    1 0xffffffff80e25000 303fd    nfsd.ko
 8    1 0xffffffff80e56000 110b8    nfscommon.ko
 9    2 0xffffffff80e68000 3ff      nfssvc.ko
10    2 0xffffffff80e69000 faf      nfslock.ko
11    1 0xffffffff80e6a000 e235     nfslockd.ko
12    1 0xffffffff80e79000 2860a    kqemu.ko
$ kldstat -m if_re
kldstat: can't find module if_re: No such file or directory
$ kldstat -m kqemu
Id  Refs Name
198    1 kqemu
$ kldstat -m re   
kldstat: can't find module re: No such file or directory

Not sure why, but this code in kern_module appears to be broken, or just doesn't represent data consistent to expectations from the printouts provided by kldstat:

From kern_module.c:

217 module_t
218 module_lookupbyname(const char *name)
219 {
220         module_t mod;
221         int err;
222 
223         MOD_LOCK_ASSERT;
224 
225         TAILQ_FOREACH(mod, &modules, link) {
226                 err = strcmp(mod->name, name);
227                 if (err == 0)
228                         return (mod);
229         }
230         return (NULL);
231 }

From if_re.c:

 337 DRIVER_MODULE(re, pci, re_driver, re_devclass, 0, 0);

I've seen similar issues with bge(4) on a work machine, so I don't think it's isolated to re(4)...
>How-To-Repeat:
kldstat -m if_<foo>
>Fix:


>Release-Note:
>Audit-Trail:

From: Garrett Cooper <yaneurabeya@gmail.com>
To: bug-followup@FreeBSD.org,
 yaneurabeya@gmail.com
Cc:  
Subject: Re: bin/175793: modfind(2) doesn&#39;t understand modules with underscores
Date: Sat, 2 Feb 2013 20:41:40 -0800

 	Weird. It just appears to be some networking modules, but not =
 others (in particular, if_bge, if_em, if_igb, if_re). if_firewire and =
 mpt_cam on the otherhand function as expected :/.
 Thanks,
 -Garrett=

From: Glen Barber <gjb@FreeBSD.org>
To: Garrett Cooper <yaneurabeya@gmail.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/175793: modfind(2) doesn't understand modules with
 underscores
Date: Sat, 2 Feb 2013 23:50:46 -0500

 --cWoXeonUoKmBZSoM
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Sun, Feb 03, 2013 at 04:37:23AM +0000, Garrett Cooper wrote:
 > I've seen similar issues with bge(4) on a work machine, so I don't think it's isolated to re(4)...
 
 Definitely not isolated to re(4), nor networking drivers alone.
 
 gjb@nucleus:~ % kldstat -m acpi_asus
 kldstat: can't find module acpi_asus: No such file or directory
 gjb@nucleus:~ % kldstat -m geom_eli
 kldstat: can't find module geom_eli: No such file or directory
 gjb@nucleus:~ % kldstat | egrep "(acpi_asus|geom_eli)"
  4    1 0xffffffff81220000 1fc48    geom_eli.ko
  9    1 0xffffffff8138b000 8b10     acpi_asus.ko
 
 Glen
 
 
 --cWoXeonUoKmBZSoM
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (FreeBSD)
 
 iQEcBAEBCAAGBQJRDeymAAoJEFJPDDeguUajxPsH/3S6+Z4hZWkqAKH8nB+FbphZ
 F9XOjIHXbtKUezUx8oh0bGnsUnlf5N5zOEKEswFULz9xIkVIHkUCU8MgdQRoCXzv
 fQjOtPzL2ePCh31ulliBk1Fiqp6TlNDDpeHH2qWhXJSAhbx4KjcQ2vxCeWhi+NM8
 vyC/GsFDv1NPE14MVR0rTIKc7UyEJI8vAhisC9OFZL4vZXHNwX4Vu3K+ikWKlasQ
 duFdtngMJFR+7EvpBWGngbkN5C/jRS4RuovAtqaWTUWIQO7ZOy4rOG/jO6vohZhM
 RgxibizLVVwGBmFhcH4OkuEDxD7UJzqYqkVb9Z8hY8Lquj0n8Wrf/+klxMy9ePY=
 =EFlM
 -----END PGP SIGNATURE-----
 
 --cWoXeonUoKmBZSoM--

From: Garrett Cooper <yaneurabeya@gmail.com>
To: Glen Barber <gjb@FreeBSD.org>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/175793: modfind(2) doesn't understand modules with underscores
Date: Sat, 2 Feb 2013 20:56:53 -0800

 	Yeah.. it's a bit unexpected. I would need to do more digging, =
 but my guess is that it's an inconsistency in module naming and =
 representation as the loop I showed in the original bug report is simple =
 enough >_>=85
 Thanks for the info though!
 -Garrett=
State-Changed-From-To: open->closed 
State-Changed-By: antoine 
State-Changed-When: Thu May 23 15:57:15 UTC 2013 
State-Changed-Why:  
Close: 
there is no bug 
For drivers using DRIVER_MODULE, the module name is #busname "/" #name 
so for instance pci/re 
% kldstat -m pci/re 
Id  Refs Name 
242    1 pci/re 


Responsible-Changed-From-To: freebsd-bugs->antoine 
Responsible-Changed-By: antoine 
Responsible-Changed-When: Thu May 23 15:57:15 UTC 2013 
Responsible-Changed-Why:  
Track 

http://www.freebsd.org/cgi/query-pr.cgi?pr=175793 
>Unformatted:
