Subject: Re: kern/29133: Fault in Kernelfunction findsym
To: None <gnats-bugs@netbsd.org>
From: Quentin Garnier <cube@cubidou.net>
List: netbsd-bugs
Date: 01/27/2005 18:09:48
--hm39DdI+xc+0zcX9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Jan 27, 2005 at 01:54:00PM +0000, kessi@teles.de wrote:
> >Number:         29133
> >Category:       kern
> >Synopsis:       Fault in Kernelfunction findsym
[...]
> >Description:
> Loading LKMs with symbols, netstat -inv (/etc/daily) faults in
> Kernelfunction findsym (kern_ksyms.c).
>=20
> After changing the Function (see below, KESSI is not defined), the system=
 is able to netstat -inv. Is this really a Fix?
>=20
> static Elf_Sym *
> findsym(char *name, struct symtab *table, int userreq)
> {
> 	Elf_Sym *start =3D table->sd_symstart;
> 	int i, sz =3D table->sd_symsize/sizeof(Elf_Sym);
> 	char *np;
> #ifdef KESSI
> 	caddr_t realstart =3D table->sd_strstart - (userreq ? 0 : table->sd_usro=
ffset);
> #else
> caddr_t realstart =3D table->sd_strstart - table->sd_usroffset;
> #endif

Well, it's a workaround more than a fix, and underlines the bug.

I was obviously completely confused about the meaning of all those
offsets when I wrote that tiny piece of code.  I'll work on a fix
tonight.

It's weird that this bug has waited for that long to show up.  I
guess it depends on which LKMs are loaded.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"Commala-come-five! / Even when the shadows rise!
To see the world and walk the world / Makes ya glad to be alive."
Susannah's Song, The Dark Tower VI, Stephen King, 2004.

--hm39DdI+xc+0zcX9
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQfkgXNgoQloHrPnoAQJC9wf/RBQ5RLCQvO3lMBSbEkFvICZFBW2OuOQb
Y22Gdfr6g6wpWwznwkmuuXBiFGzXIXOcyAJKRTYjHJNIFSScQM8P9yXZMbX87MvR
T0xj4QwRHKAsOVMNaIjUKUioRAF6neTYSrmlzZ7J/bV+6xGbPYhjocr+SLFbKTDO
xRBM9SVhSCD+sQrfGV7nLXR7kItfNf6RJ0BamvTPhLMBEbUnhvA6bz+gnJ8Lq5hW
wkdd/e4nd+cFmAPHSdvDNpCTSEiHp2cGmgBdosjgGpMBdXrcyxtW/HgwGz6z0089
D4njskh9k2u7jgVkIno9sTKydmScU/cxWmPJWFttgfBcxeoTfF9DOg==
=PIB0
-----END PGP SIGNATURE-----

--hm39DdI+xc+0zcX9--