Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Dec 2002 13:32:36 +0300
From:      Fred Souza <cseg@storming.org>
To:        hackers@freebsd.org
Subject:   libkvm breakage?
Message-ID:  <20021212103236.GA19236@torment.storming.org>

next in thread | raw e-mail | index | archive | help

--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello,

  I've written a small daemon that simply keeps scaning a set of ttys.
  Whenever it sees that a tty has no processes attached to it, the
  daemon set the tty's owner:group to whatever was specified. The reason
  for which I wrote this is that sometimes processes leave orphan ttys
  (for instance, portupgrade insists on doing it on my system).

  To gather the list of processes attached to each tty, I use the
  function kvm_getprocs(3), giving it KERN_PROC_TTY as its "op"
  argument, so it returns the number of processes using a given tty.

  My system is currently 5.0-RC, upgraded from a 4.7-STABLE. This
  daemon, orphanage (http://www.storminng.org/projects/src/orphanage/)
  used to run just fine. I just tried it on another 4.6-STABLE and it
  ran fine, but on 5.0-RC it does not. Following is the output of me
  running the daemon and then gdb with its core.

  [root@torment][~cseg/Projects/orphanage] make
  rm -f orphanage
  cc -O2 -pipe -march=3Dk6-2 -I/usr/local/include -L/usr/local/lib -W
  -Wall -o orphanage orphanage.c -lkvm
  [root@torment][~cseg/Projects/orphanage] ./orphanage -dv ttyp*
  orphanage in free(): error: junk pointer, too high to make sense
  Abort (core dumped)
  [root@torment][~cseg/Projects/orphanage] gdb orphanage orphanage.core=20
  GNU gdb 5.2.1 (FreeBSD)
  Copyright 2002 Free Software Foundation, Inc.
  GDB is free software, covered by the GNU General Public License, and
  you are
  welcome to change it and/or distribute copies of it under certain
  conditions.
  Type "show copying" to see the conditions.
  There is absolutely no warranty for GDB.  Type "show warranty" for
  details.
  This GDB was configured as "i386-undermydesk-freebsd"...
  (no debugging symbols found)...
  Core was generated by `orphanage'.
  Program terminated with signal 6, Aborted.
  Reading symbols from /usr/lib/libkvm.so.2...(no debugging symbols
  found)...
  done.
  Loaded symbols for /usr/lib/libkvm.so.2
  Reading symbols from /usr/lib/libc.so.5...(no debugging symbols
  found)...done.
  Loaded symbols for /usr/lib/libc.so.5
  Reading symbols from /usr/libexec/ld-elf.so.1...(no debugging symbols
  found)...
  done.
  Loaded symbols for /usr/libexec/ld-elf.so.1
  #0  0x280b6f63 in kill () from /usr/lib/libc.so.5
  (gdb) where
  #0  0x280b6f63 in kill () from /usr/lib/libc.so.5
  #1  0x2811657a in abort () from /usr/lib/libc.so.5
  #2  0x28114ea0 in tcflow () from /usr/lib/libc.so.5
  #3  0x28114eec in tcflow () from /usr/lib/libc.so.5
  #4  0x28115af1 in free () from /usr/lib/libc.so.5
  #5  0x2806e09e in kvm_getprocs () from /usr/lib/libkvm.so.2
  #6  0x08049166 in free ()
  #7  0x08048bce in free ()

  --- End

  Can anyone else reproduce this? Or better yet, does anyone know what's
  the problem and how to fix it? :-)


  Thanks,
  Fred


--=20
"A hypothetical paradox:
   What would happen in a battle between an Enterprise security	team, who
   always get killed soon after appearing, and a squad of Imperial
   Stormtroopers, who can't hit the broad side of a planet?"
		-- Tom Galloway

--17pEHd4RhPHOinZp
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE9+GXEKbRS1GgW4fYRArOrAJ9pfdglms4g9z7D+DhkWiCkl1ZRagCcCOwH
YysTgdz2sJACBJYJfQENFMA=
=LtYX
-----END PGP SIGNATURE-----

--17pEHd4RhPHOinZp--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021212103236.GA19236>