Re: pstat segfault

2014-12-20 Thread Ted Unangst
On Fri, Dec 19, 2014 at 20:56, Fred wrote:
 On 12/19/14 18:12, Ted Unangst wrote:
 On Fri, Dec 19, 2014 at 13:04, Stuart Cassoff wrote:
 On 12/19/14 07:18, Stuart Cassoff wrote:
 $ pstat -T
 221/7030 open files
 Segmentation fault

 I suppose more info from me is desired.

 I think that was sufficient. It should be fixed now.

 
 Hi Ted,
 
 It's fixed, but if I run pstat as an ordinary user I get:
 
 port:fred /usr/src/usr.sbin/pstat ./pstat -T
 pstat: kvm_openfiles: /dev/mem: Permission denied

As expected. pstat needs to be setgid.



pstat segfault

2014-12-19 Thread Stuart Cassoff
$ pstat -T
221/7030 open files
Segmentation fault



Re: pstat segfault

2014-12-19 Thread Stuart Cassoff
On 12/19/14 07:18, Stuart Cassoff wrote:
 $ pstat -T
 221/7030 open files
 Segmentation fault

I suppose more info from me is desired.


$ gdb pstat
GNU gdb 6.3
Copyright 2004 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-unknown-openbsd5.6...
(no debugging symbols found)

(gdb) run -T
Starting program: /usr/sbin/pstat -T
(no debugging symbols found)
205/7030 open files

Program received signal SIGSEGV, Segmentation fault.
kvm_read (kd=0x0, kva=0, buf=0xcfbc72c4, len=8)
at /usr/src/lib/libkvm/kvm.c:845
845 if (ISALIVE(kd)) {
(gdb) bt
#0  kvm_read (kd=0x0, kva=0, buf=0xcfbc72c4, len=8)
at /usr/src/lib/libkvm/kvm.c:845
#1  0x181e9ce0 in ?? () from /usr/sbin/pstat
#2  0x in ?? ()



OpenBSD 5.6-current (GENERIC) #605: Thu Dec 18 01:56:16 MST 2014
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel(R) Pentium(R) 4 CPU 3.00GHz (GenuineIntel 686-class) 3 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,CNXT-ID,xTPR,PERF
real mem  = 2683277312 (2558MB)
avail mem = 2627121152 (2505MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 02/23/04, BIOS32 rev. 0 @ 0xffe90, SMBIOS 
rev. 2.3 @ 0xf0450 (65 entries)
bios0: vendor Dell Computer Corporation version A05 date 02/23/2004
bios0: Dell Computer Corporation Dimension 8300
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP SSDT APIC BOOT
acpi0: wakeup devices VBTN(S4) PCI0(S3) USB0(S3) USB1(S3) USB2(S3) USB3(S3) 
PCI1(S5) KBD_(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 199MHz
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 1
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 2 (PCI1)
acpicpu0 at acpi0
acpibtn0 at acpi0: VBTN
bios0: ROM list: 0xc/0xf800 0xcf800/0x1800! 0xd1000/0x3000
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 Intel 82875P Host rev 0x02
intelagp0 at pchb0
agp0 at intelagp0: aperture at 0xd000, size 0x1000
ppb0 at pci0 dev 1 function 0 Intel 82875P AGP rev 0x02
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 NVIDIA GeForce FX 5200 rev 0xa1
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
uhci0 at pci0 dev 29 function 0 Intel 82801EB/ER USB rev 0x02: apic 1 int 16
uhci1 at pci0 dev 29 function 1 Intel 82801EB/ER USB rev 0x02: apic 1 int 19
uhci2 at pci0 dev 29 function 2 Intel 82801EB/ER USB rev 0x02: apic 1 int 18
uhci3 at pci0 dev 29 function 3 Intel 82801EB/ER USB rev 0x02: apic 1 int 16
ehci0 at pci0 dev 29 function 7 Intel 82801EB/ER USB2 rev 0x02: apic 1 int 23
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
ppb1 at pci0 dev 30 function 0 Intel 82801BA Hub-to-PCI rev 0xc2
pci2 at ppb1 bus 2
fxp0 at pci2 dev 8 function 0 Intel PRO/100 VE rev 0x02, i82562: apic 1 int 
20, address 00:0c:f1:cd:b7:8d
inphy0 at fxp0 phy 1: i82562ET 10/100 PHY, rev. 0
ichpcib0 at pci0 dev 31 function 0 Intel 82801EB/ER LPC rev 0x02
pciide0 at pci0 dev 31 function 1 Intel 82801EB/ER IDE rev 0x02: DMA, channel 
0 configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: ST380011A
wd0: 16-sector PIO, LBA48, 76293MB, 15625 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
atapiscsi0 at pciide0 channel 1 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: SAMSUNG, DVD-ROM SD-616E, F501 ATAPI 5/cdrom 
removable
cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2
pciide1 at pci0 dev 31 function 2 Intel 82801EB SATA rev 0x02: DMA, channel 0 
configured to native-PCI, channel 1 configured to native-PCI
pciide1: using apic 1 int 18 for native-PCI interrupt
ichiic0 at pci0 dev 31 function 3 Intel 82801EB/ER SMBus rev 0x02: apic 1 int 
17
iic0 at ichiic0
spdmem0 at iic0 addr 0x50: 256MB DDR SDRAM non-parity PC3200CL3.0
spdmem1 at iic0 addr 0x51: 1GB DDR SDRAM non-parity PC3200CL3.0
spdmem2 at iic0 addr 0x52: 256MB DDR SDRAM non-parity PC3200CL3.0
spdmem3 at iic0 addr 0x53: 1GB DDR SDRAM non-parity PC3200CL3.0
auich0 at pci0 dev 31 function 5 Intel 82801EB/ER AC97 rev 0x02: apic 1 int 
17, ICH5 AC97
ac97: codec id 0x41445370 (Analog Devices AD1980)
ac97: codec features headphone, 20 bit DAC, No 3D Stereo
audio0 at auich0
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 Intel UHCI root hub rev 1.00/1.00 addr 1

Re: pstat segfault

2014-12-19 Thread Ted Unangst
On Fri, Dec 19, 2014 at 13:04, Stuart Cassoff wrote:
 On 12/19/14 07:18, Stuart Cassoff wrote:
 $ pstat -T
 221/7030 open files
 Segmentation fault
 
 I suppose more info from me is desired.

I think that was sufficient. It should be fixed now.



Re: pstat segfault

2014-12-19 Thread Fred

On 12/19/14 18:12, Ted Unangst wrote:

On Fri, Dec 19, 2014 at 13:04, Stuart Cassoff wrote:

On 12/19/14 07:18, Stuart Cassoff wrote:

$ pstat -T
221/7030 open files
Segmentation fault


I suppose more info from me is desired.


I think that was sufficient. It should be fixed now.



Hi Ted,

It's fixed, but if I run pstat as an ordinary user I get:

port:fred /usr/src/usr.sbin/pstat ./pstat -T
pstat: kvm_openfiles: /dev/mem: Permission denied

rather than:

port:fred /usr/src/usr.sbin/pstat sudo ./pstat -T
Password:
1477/7030 open files
  34681 vnodes
0M/8311M swap space

But pstat -f works as expected as an ordinary user.

Cheers

Fred
PS This with pstat.c patched to 1.96