usb device causes system crash (ucomstart: null oxfer)

2011-11-27 Thread Byron Klippert
I wrote a C program to talk to a I2C usb master device. On the surface
this program seems to work consistently. It wasn't until I wrapped the C
program in shell code and looped it, when a problem was exposed
ultimately crashing the system. I do not know whether my program is
causing the crash or if it's something related to ucom(4). 

The shell script runs for days at a time and then it fails with
"ucomstart: null oxfer". When I unplug the device the system hangs or if
I run usbdevs the system hangs, once hung the watchdog kicks in and
reboots the machine. The device is directly connected (no usb hub) and
is the only external usb device on the bus.

I'm very new to C so any criticisms are welcome.

dmesg:
OpenBSD 4.9 (GENERIC) #671: Wed Mar  2 07:09:00 MST 2011
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Geode(TM) Integrated Processor by AMD PCS ("AuthenticAMD"
586-class) 499 MHz
cpu0: FPU,DE,PSE,TSC,MSR,CX8,SEP,PGE,CMOV,CFLUSH,MMX
real mem  = 268009472 (255MB)
avail mem = 253493248 (241MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 11/05/08, BIOS32 rev. 0 @ 0xfd088
pcibios0 at bios0: rev 2.1 @ 0xf/0x1
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xe/0xa800
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 1 function 0 "AMD Geode LX" rev 0x33
glxsb0 at pci0 dev 1 function 2 "AMD Geode LX Crypto" rev 0x00: RNG AES
vr0 at pci0 dev 9 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 10,
address 00:0d:b9:1c:c9:48
ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI
0x004063, model 0x0034
glxpcib0 at pci0 dev 15 function 0 "AMD CS5536 ISA" rev 0x03: rev 3,
32-bit 3579545Hz timer, watchdog, gpio
gpio0 at glxpcib0: 32 pins
pciide0 at pci0 dev 15 function 2 "AMD CS5536 IDE" rev 0x01: DMA,
channel 0 wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: 
wd0: 1-sector PIO, LBA, 3831MB, 7847280 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 ignored (disabled)
ohci0 at pci0 dev 15 function 4 "AMD CS5536 USB" rev 0x02: irq 12,
version 1.0, legacy support
ehci0 at pci0 dev 15 function 5 "AMD CS5536 USB" rev 0x02: irq 12
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "AMD EHCI root hub" rev 2.00/1.00 addr 1
isa0 at glxpcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb1 at ohci0: USB revision 1.0
uhub1 at usb1 "AMD OHCI root hub" rev 1.00/1.00 addr 1
biomask fbe7 netmask ffe7 ttymask 
mtrr: K6-family MTRR support (2 registers)
nvram: invalid checksum
uftdi0 at uhub1 port 2 "FTDI FT232R USB UART" rev 2.00/6.00 addr 2
ucom0 at uftdi0 portno 1
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
root on wd0a swap on wd0b dump on wd0b
clock: unknown CMOS layout

---

usbdevs -v:
Controller /dev/usb0:
addr 1: high speed, self powered, config 1, EHCI root hub(0x),
AMD(0x1022), rev 1.00
 port 1 powered
 port 2 powered
 port 3 powered
 port 4 powered
Controller /dev/usb1:
addr 1: full speed, self powered, config 1, OHCI root hub(0x),
AMD(0x1022), rev 1.00
 port 1 powered
 port 2 addr 2: full speed, power 90 mA, config 1, FT232R USB
 UART(0x6001), FTDI(0x0403), rev 6.00, iSerialNumber A700etwC
 port 3 powered
 port 4 powered

---

I2C device info: 
http://www.robot-electronics.co.uk/htm/usb_i2c_tech.htm

---

C program "i2c.c":

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

int open_port(void);
void clearBuf(unsigned char bufType[], int nbytes);
void writeBuf(int fd, unsigned char command[], int nbytes);
void readBuf(int fd, int nbytes);

struct termios options;

int v = 0;  /* turn off verbose output */

int i, n, p, fd;
char *input, *string;

unsigned char wrBuf[4];
unsigned char rdBuf[64];

unsigned char blank[4]  = {0x5a, 0x00, 0x00, 0x00};
unsigned char version[4]= {0x5a, 0x01, 0x00, 0x00};
unsigned char led_on[4] = {0x5a, 0x10, 0x01, 0x00};
unsigned char led_off[4]= {0x5a, 0x10, 0x00, 0x00};
unsigned char set_pins_h[4] = {0x5a, 0x10, 0x0f, 0x00}; /* 3rd byte
= [ (3=I/O3) (2=I/O2) (1=Input1) (0=RedLED) ] */
unsigned char set_pins_l[4] = {0x5a, 0x10, 0x00, 0x00}; /* 3rd byte
= [ (3=I/O3) (2=I/O2) (1=Input1) (0=RedLED) ] */
unsigned char get_pins[4]   = {0x5a, 0x11, 0x00, 0x00};
unsigned char get_AD[4] = {0x5a, 0x12, 0x00, 0x00};

int
main(int argc, char *argv[]) {
if (argc < 2) {
errx(1, "Invalid command: Not enough arguments");
} else if (argc > 2) {
errx(1, "Invalid command: Too many arguments");
}
else {
  

FOSDEM 2012 - BSD Licensed Operating System Developers Room

2011-11-27 Thread Brooks Davis
We have a Devroom at FOSDEM 2012, which takes place on February 4-5
in Brussels, Belgium.  The Devroom will mainly cover topics for BSD
Licensed Operating System users, developers and contributors.  For more
information about the Devroom, please see:

http://wiki.freebsd.org/201202DevRoom

For more information about FOSDEM, please see the website at

http://www.fosdem.org/2012/.

We are now accepting proposals for talks.  Each session will last 30 to
60 minutes (including discussion).  Please note that we only
accept talks in English.

Talks about developments in particular operating systems are welcome
as are talks or forums on ways we can work together.  We also welcome
presentations on foundational technologies which are of interest to
developers of BSD licensed operating systems and presentations on
derivative operating systems such as Debian GNU/kFreeBSD.



misc@openbsd.org

2011-11-27 Thread Ing. Gabriela Sanchez
[IMAGE]
Pms de Mixico prestigiada firma de Capacitacisn presenta:
Planeacisn Maestra de la Produccisn
5 de Diciembre, Guadalajara, Jalisco. Experto consultor Lic. Ariel
Valero.
Obtenga las herramientas necesarias para alcanzar un sptimo desempeqo en
su funcisn.
Empresa Registrada ante la STPS
Smguenos en Twitter@pmscapacitacion o bien en Facebook PMS de Mixico.

!Solicite Mayores Informes! Por favor responda este e-mail con los datos
siguientes.
Empresa:
Nombre:
Telifono:
Email:
Nzmero de Interesados:
En breve recibira la informacisn completa de este inigualable evento.
Comunmquese a los telifonos y con gusto uno de nuestros ejecutivos le
atendera.
Telifonos: (0133) 8851-2365, (0133) 8851-2741.

Copyright (C) 2011, PMS Capacitacisn Efectiva de Mixico  S.C. Derechos
Reservados. PMS de Mixico, El logo de PMS de Mixico son marcas
registradas. ADVERTENCIA PMS de Mixico no cuenta con alianzas
estratigicas de ningzn tipo dentro de la Republica Mexicana. NO SE DEJE
ENGAQAR - DIGA NO A LA PIRATERIA. Todos los logotipos, marcas comerciales
e imagenes son propiedad de sus respectivas corporaciones y se utilizan
con fines informativos solamente.

Este Mensaje ha sido enviado a misc@openbsd.org como usuario de Pms de
Mixico o bien un usuario le refiris para recibir este boletmn.
Como usuario de Pms de Mixico, en este acto autoriza de manera expresa
que Pms de Mixico le puede contactar vma correo electrsnico u otros
medios.
Si usted ha recibido este mensaje por error, haga caso omiso de el y
reporte su cuenta respondiendo este correo con el subject BAJACOMP
Unsubscribe to this mailing list, reply a blank message with the subject
UNSUBSCRIBE BAJACOMP
Tenga en cuenta que la gestisn de nuestras bases de datos es de suma
importancia y no es intencisn de la empresa la inconformidad del
receptor.

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
image001.jpg]



Re: Single Stepping Process in Kernel

2011-11-27 Thread Luis Useche
On Sun, Nov 27, 2011 at 4:42 PM, Philip Guenther  wrote:
> On Sun, Nov 27, 2011 at 9:19 AM, Luis Useche  wrote:
> ...
>> The idea is to create this temporary mapping after we make sure the
>> access was valid but the page was not in memory.
> ...
>> I am not proposing to trace the fault handler. My idea is to single
>> step the last user-space instruction of the process in the fault
>> handler to obtain the data that it was trying to write and return so
>> the process can continue.
>>
>> Example:
>>
>> map_pte(cr2, tmp_page)
>> single_step(cur)
>> unmap_pte(cr2)
>
> I've read what you've read three times and I still don't understand
> what problem you're trying to solve.

OK. I guess I'm not the best explaining, but the problem is simple.

After the process is in the fault handler due to an access of a page
not in memory, the current fault handler would map the page, return
and the instruction that generated the fault re-executed.

What I need is to keep control in kernel after re-executing the
instruction. My idea was to single step by disassembling this
instruction instead of returning to user space.

In any case, I found a solution today. In x86 the TF flag repeat the
current instruction and generates a debug trap that is caught by the
kernel. This is how I get the control back after executing the
instruction that generated the fault.

I think I have the answer to my problem.

I hope this fourth explanation makes sense.

Luis.



Re: Single Stepping Process in Kernel

2011-11-27 Thread Philip Guenther
On Sun, Nov 27, 2011 at 9:19 AM, Luis Useche  wrote:
...
> The idea is to create this temporary mapping after we make sure the
> access was valid but the page was not in memory.
...
> I am not proposing to trace the fault handler. My idea is to single
> step the last user-space instruction of the process in the fault
> handler to obtain the data that it was trying to write and return so
> the process can continue.
>
> Example:
>
> map_pte(cr2, tmp_page)
> single_step(cur)
> unmap_pte(cr2)

I've read what you've read three times and I still don't understand
what problem you're trying to solve.


Philip Guenther



Re: Trouble with large files in current snapshot

2011-11-27 Thread Philip Guenther
On Sun, Nov 27, 2011 at 9:48 AM, Pieter Verberne
 wrote:
> On Sun, 27 Nov 2011 12:21:49 +0100, pet...@schwertfisch.de wrote:
>> After upgrading to current (snapshot from Nov. 25) OpenBSD seems to be
>> choking on large (>2GB) files (tested with GENERIC.MP and GENERIC):
>
> The latest kernel that does work on my Soerkis is this one:
> bsd.2009  03-Nov-2011 17:18   8.6M  #85
>
> And the first that is not working:
> bsd.2010  09-Nov-2011 20:09   8.6M  #86

Thank you for doing the search for when the problem was introduced.
That helped isolate which diff (of mine) introduced the regression.
It was the wrap around check in vfs_vnops.c rev 1.69.  Fix committed;
again, thanks for the report and search results.


Philip Guenther



Re: Trouble with large files in current snapshot

2011-11-27 Thread Nigel Taylor
On 11/27/11 20:35, Ted Unangst wrote:
> On Sun, Nov 27, 2011, Pieter Verberne wrote:
>> On Sun, 27 Nov 2011 12:21:49 +0100, pet...@schwertfisch.de wrote:
>>> After upgrading to current (snapshot from Nov. 25) OpenBSD seems to
>>> be
>>> choking on large (>2GB) files (tested with GENERIC.MP and GENERIC):
> 
> Was it this change?
> 
> http://www.openbsd.org/cgi-bin/cvsweb/src/sys/kern/vfs_syscalls.c.diff?r1=1.179;r2=1.180
> 
> 
Hi,

Problem is in sys/kern/vfs_vnops.c. Fix is now in CVS.

Nigel



Re: Trouble with large files in current snapshot

2011-11-27 Thread Ted Unangst
On Sun, Nov 27, 2011, Pieter Verberne wrote:
> On Sun, 27 Nov 2011 12:21:49 +0100, pet...@schwertfisch.de wrote:
>> After upgrading to current (snapshot from Nov. 25) OpenBSD seems to
>> be
>> choking on large (>2GB) files (tested with GENERIC.MP and GENERIC):

Was it this change?

http://www.openbsd.org/cgi-bin/cvsweb/src/sys/kern/vfs_syscalls.c.diff?r1=1.179;r2=1.180



Re: Packet drop because of invalid IP checksum on Soerkis / vr / ral

2011-11-27 Thread Christiano F. Haesbaert
On Sun, Nov 27, 2011 at 12:35:23PM +0100, Pieter Verberne wrote:
> On Sun, 27 Nov 2011 00:50:21 -0200, Christiano F. Haesbaert wrote:
> >On Sat, Nov 26, 2011 at 10:37:10PM +0100, Pieter Verberne wrote:
> >>Hello,
> >>
> >>I configured my Soekris net5501 as a switch and access point. I
> >>briged all four vr(4) devices and ral0. vr0 (10.0.0.1) is connected
> >>to the router. ral0 is configured as an access point.
> >>
> >>This is the configuration I want. An access point with no IP
> >>address.
> >>
> >>$ cat /etc/hostname.ral0
> >>mediaopt hostap nwid [ssid] wpa wpaprotos wpa2 wpaakms psk
> >>wpakey [key]
> >>up
> >>
> >>However, I cannot ping to 10.0.0.1 from another computer (10.0.0.37)
> >>attached to ral0 . Wireshark on 10.0.0.37 shows both a echo request
> >>and reply, but the reply packet has an IP header checksum of 0x
> >>and the packet is dropped. This is probably because of checksum
> >>offloading done by vr(4) .
> >>
> >>How to handle this?
> >>
> >> Pieter Verberne
> >>
> >>The following configuration does work. For some reason, nfs (sunrpc)
> >>is only listening on 10.0.0.80 and not on 10.0.0.1 .
> >>
> >
> >Hi,
> >
> >Can you try this ?
> >
> >also, the output of ifconfig vr0 hwfeatures (if you're in current)
> >is useful.
> >
> >Index: if_vr.c
> >===
> >RCS file: /cvs/src/sys/dev/pci/if_vr.c,v
> >retrieving revision 1.111
> >diff -d -u -p -b -r1.111 if_vr.c
> >--- if_vr.c  22 Jun 2011 16:44:27 -  1.111
> >+++ if_vr.c  27 Nov 2011 02:45:35 -
> >@@ -643,9 +643,11 @@ vr_attach(struct device *parent, struct
> > bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
> >
> > ifp->if_capabilities |= IFCAP_VLAN_MTU;
> >+#if 0
> > if (sc->vr_quirks & VR_Q_CSUM)
> > ifp->if_capabilities |= IFCAP_CSUM_IPv4|IFCAP_CSUM_TCPv4|
> > IFCAP_CSUM_UDPv4;
> >+#endif
> > #ifndef SMALL_KERNEL
> > if (sc->vr_revid >= REV_ID_VT3065_A) {
> > ifp->if_capabilities |= IFCAP_WOL;
> 
> Awesome. I just applied my first patch, and compiled my first kernel.
> (I don't code) And it is working now :-D (with the following
> configuration:)
> 

Cool ! be ready for more then :-).

> $ cat /etc/hostname.ral0
> mediaopt hostap nwid [ssid] wpa wpaprotos wpa2 wpaakms psk wpakey [key]
> up
> 
> I'm running 5.0 stable so `ifconfig vr0 hwfeatures' doesn't work. So
> are you
> now trying to fix this for the next release? Or should I just save
> this patch?
> 

I'll come up with the correct fix, this is just to confirm our initial
assumption. 

I'll send it to you as I don't have a vr(4) to test.



Re: Trouble with large files in current snapshot

2011-11-27 Thread Pieter Verberne

On Sun, 27 Nov 2011 12:21:49 +0100, pet...@schwertfisch.de wrote:
After upgrading to current (snapshot from Nov. 25) OpenBSD seems to 
be

choking on large (>2GB) files (tested with GENERIC.MP and GENERIC):


The latest kernel that does work on my Soerkis is this one:
bsd.2009  03-Nov-2011 17:18   8.6M  #85

And the first that is not working:
bsd.2010  09-Nov-2011 20:09   8.6M  #86

$ uname -a
OpenBSD lilium.garden 5.0 GENERIC#86 i386

$ dd if=winxp1.8.ova of=dd_test
dd: winxp1.8.ova: Invalid argument
4194303+0 records in
4194303+0 records out
2147483136 bytes transferred in 216.387 secs (9924239 bytes/sec)

(sorry for testing with that particular file :-p )

Pieter


$ pwd
/home/user

$ mount
...
/dev/wd0k on /home type ffs (local, nodev, nosuid, softdep)
...

$ dd if=/dev/zero of=large1 bs=1024 count=250
250+0 records in
250+0 records out
256000 bytes transferred in 80.225 secs (31910238 bytes/sec)

$ cat large1 >large2

cat: large1: Invalid argument

$ ls -lh large*
-rw-r--r--  1 user  user   2.4G Nov 27 11:38 large1
-rw-r--r--  1 user  user   2.0G Nov 27 11:42 large2

$ rm large2
$ cp large1 large2

cp: large1: Invalid argument
$ ls -lh large*
-rw-r--r--  1 user  user   2.4G Nov 27 11:38 large1
-rw-r--r--  1 user  user 0B Nov 27 11:42 large2

OpenBSD 5.0-current (GENERIC.MP) #130: Fri Nov 25 00:28:08 MST 2011

dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP

cpu0: Intel(R) Atom(TM) CPU N270 @ 1.60GHz ("GenuineIntel" 686-class)
1.60 GHz
cpu0:

FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,NXE,SSE3,MWAIT,DS-CPL,EST,TM2,SSSE3,xTPR,PDCM,MOVBE,LAHF
real mem  = 1061416960 (1012MB)
avail mem = 1033936896 (986MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 03/06/09, SMBIOS rev. 2.6 @
0xe91f0 (42 entries)
bios0: vendor Intel Corp. version "JT94510H.86A.0025.2009.0306.1639"
date 03/06/2009
bios0: Intel Corporation D945GSEJT
acpi0 at bios0: rev 2
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP APIC MCFG SSDT SSDT SSDT
acpi0: wakeup devices P0P2(S4) PEGP(S4) USB0(S3) USB1(S3) USB2(S3)
USB3(S3) EHCI(S3) MC97(S4) P0P1(S4) PS2K(S3) PS2M(S3) UAR1(S3)
UAR2(S3) P0P4(S4) P0P5(S4) P0P6(S4) PWRB(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 133MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Atom(TM) CPU N270 @ 1.60GHz ("GenuineIntel" 686-class)
1.60 GHz
cpu1:

FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,NXE,SSE3,MWAIT,DS-CPL,EST,TM2,SSSE3,xTPR,PDCM,MOVBE,LAHF
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xe000, bus 0-255
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (P0P2)
acpiprt2 at acpi0: bus 5 (P0P1)
acpiprt3 at acpi0: bus 1 (P0P4)
acpiprt4 at acpi0: bus 2 (P0P5)
acpicpu0 at acpi0: C3, C2, C1, PSS
acpicpu1 at acpi0: C3, C2, C1, PSS
acpibtn0 at acpi0: PWRB
acpivideo0 at acpi0: IGD_
bios0: ROM list: 0xc/0xec00! 0xcf000/0x1000
cpu0: Enhanced SpeedStep 1597 MHz: speeds: 1600, 1333, 1067, 800 MHz
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82945GME Host" rev 0x03
vga1 at pci0 dev 2 function 0 "Intel 82945GME Video" rev 0x03
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
intagp0 at vga1
agp0 at intagp0: aperture at 0xd000, size 0x1000
inteldrm0 at vga1: apic 2 int 16
drm0 at inteldrm0
"Intel 82945GM Video" rev 0x03 at pci0 dev 2 function 1 not 
configured
azalia0 at pci0 dev 27 function 0 "Intel 82801GB HD Audio" rev 0x02: 
msi

azalia0: codecs: Realtek ALC662
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 82801GB PCIE" rev 0x02
pci1 at ppb0 bus 1
re0 at pci1 dev 0 function 0 "Realtek 8168" rev 0x03: RTL8168D/8111D
(0x2800), apic 2 int 16, address 00:27:0e:01:8f:99
rgephy0 at re0 phy 7: RTL8169S/8110S PHY, rev. 2
ppb1 at pci0 dev 28 function 1 "Intel 82801GB PCIE" rev 0x02
pci2 at ppb1 bus 2
ppb2 at pci0 dev 28 function 2 "Intel 82801GB PCIE" rev 0x02
pci3 at ppb2 bus 3
ppb3 at pci0 dev 28 function 3 "Intel 82801GB PCIE" rev 0x02
pci4 at ppb3 bus 4
uhci0 at pci0 dev 29 function 0 "Intel 82801GB USB" rev 0x02: apic 2 
int 23
uhci1 at pci0 dev 29 function 1 "Intel 82801GB USB" rev 0x02: apic 2 
int 19
uhci2 at pci0 dev 29 function 2 "Intel 82801GB USB" rev 0x02: apic 2 
int 18
uhci3 at pci0 dev 29 function 3 "Intel 82801GB USB" rev 0x02: apic 2 
int 16
ehci0 at pci0 dev 29 function 7 "Intel 82801GB USB" rev 0x02: apic 2 
int 23

ehci0: timed out waiting for BIOS
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
ppb4 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0xe2
pci5 at ppb4 bus 5
ichpcib0 at pci0 dev 31 function 0 "Intel 82801GBM LPC" rev 0x02

Re: Single Stepping Process in Kernel

2011-11-27 Thread Luis Useche
On Sun, Nov 27, 2011 at 4:14 AM, Philip Guenther  wrote:
> On Sat, Nov 26, 2011 at 10:25 PM, Luis Useche  wrote:
>> On Sat, Nov 26, 2011 at 7:31 PM, Ted Unangst  wrote:
>>> On Sat, Nov 26, 2011, Luis Useche wrote:
 For a project I need to single step a user space process while
 executing the fault handler. I was thinking that probably ddb single
 stepping can be reused but this is probably for kernel single stepping
 only. How about ptrace?
>>>
>>> I am officially confused because the fault handler runs in the kernel.
>>> If you want to step through a process then ptrace is what you want, or
>>> it's slightly easier to use interface, gdb.
>>
>> The interfaces you are talking about are to single step a user level
>> process from another user level process. However, I need to single
>> step in the fault handler the (user level) instruction that just
>> faulted.
>>
>> My final goal is to extract the data that the application was trying
>> to store at the unmapped page by mapping a temporary page.
>
> That won't always work if you're on a platform like i386 where the
> kernel memory appears in the address space of processes, as you
> *can't* just map in a temporary page if the process tries to access an
> address in the kernel's range.

The idea is to create this temporary mapping after we make sure the
access was valid but the page was not in memory.

> Anyway, you don't need to trace the fault handler to do what you want.
>  You trace the process with ptrace(),  then use ptrace() to examine
> the state of the process when it gets a signal when it tries to access
> the page in a non-permitted way.  For example, gdb reports the signal
> that was sent after examining the registers with ptrace(PT_GETREGS)
> and then uses ptrace(PT_IO) to get the instruction that faulted.
> Disassemble that to figure out what instruction it was and work out
> the exact address and data involved.

I am not proposing to trace the fault handler. My idea is to single
step the last user-space instruction of the process in the fault
handler to obtain the data that it was trying to write and return so
the process can continue.

Example:

map_pte(cr2, tmp_page)
single_step(cur)
unmap_pte(cr2)

Luis



Re: simple wpa2 enterprise

2011-11-27 Thread Stuart Henderson
On 2011-11-26, quartz  wrote:
> I'm looking to set up a small-sized wifi network with wpa2 enterprise.
> does anyone know of a lightweight authentication software package for
> this? all I can find in the ports tree is freeradius, but I'm looking for
> something easier to administer... something along the lines of dnsmasq
> with a simple config file that other people don't have to be an expert to
> understand.

freeradius probably is your best option, it's a bit of a slog to do the
initial setup but once that's done it's pretty simple for a non-expert
to do routine admin (adding/removing users etc)..either via a text-based
users file or, if necessary, you could use a database with some web-based
frontend.



Re: Host AP mode: power saving

2011-11-27 Thread Stuart Henderson
On 2011-11-27, Ralph Becker-Szendy  wrote:
> Traditionally, the OpenBSD 802.11 wireless device drivers do not support power
> saving mode in host AP mode.  This makes an OpenBSD-based wireless AP nearly
> unusable for those wireless clients that can not disable power saving mode on
> their end.  Unfortunately, with a large fraction of the clients for my AP now
> being iPhones, MacBooks and similar smart appliances, this is becomes a
> serious problem (Windows and Linux laptops can disable power saving mode on
> the client end).,
>
> My AP is pretty back level - it is still running OpenBSD 4.6.  Does this issue
> still exist in 5.0?

Yes.

> If yes, is there a forecast of it getting fixed?

Not afaik.

> Are there some wireless device drivers for which it is already fixed, or
> is this universal to all 802.11 devices?

Universal.



Re: X11: xrandr rotate makes picture unreadable

2011-11-27 Thread Oleksii Zhmyrov

On 11/27/11 13:23, Matthieu Herrb wrote:

On Sat, Nov 26, 2011 at 01:49:49PM +0200, Oleksii Zhmyrov wrote:

On 11/26/11 13:20, Ville Valkonen wrote:

Hello,

I am running OpenBSD current on a Lenovo SL-510 laptop (dmesg below) and
xrandr rotate doesn't work as expected. When executing
   $ xrandr --output LVDS --rotate right
picture goes completely gibberish, as seen in here:
   http://imageshack.us/photo/my-images/69/xrandr.jpg/

Currently I am using i3 window manager but it happens in Fluxbox too.
Xorg.0.log diff (below) reveals sync problem (and apparently so does the
picture).

Please let me know how should I proceed.

Sincerely,
Ville Valkonen



Lenovo SL-510, OpenBSD current, xfce4. No xorg.conf file.
  $ xrandr --output LVDS --rotate right
works as expected, nothing unusual.



I guess one of you is using a snapshot, while the other as built
xenocara from CVS sources.
Which is which ?

Please post the full Xorg.0.log and compare the intel video driver
versions.



I use almost fresh build from CVS.
Xorg.0.log is under the signature.


--
Oleksii Zhmyrov
National Technical University of Ukraine "Kyiv Polytechnic Institute"
Institute of Physics and Technology
Tel.: +380-63-496-2695


[3782970.115] (--) checkDevMem: using aperture driver /dev/xf86
[3782970.128] (--) Using wscons driver on /dev/ttyC4 in pcvt 
compatibility mode (version 3.32)

[3782970.176]
X.Org X Server 1.11.2
Release Date: 2011-11-04
[3782970.176] X Protocol Version 11, Revision 0
[3782970.176] Build Operating System: OpenBSD 5.0 amd64
[3782970.176] Current Operating System: OpenBSD monochrome.local 5.0 
GENERIC.MP#18 amd64

[3782970.176] Build Date: 22 November 2011  05:31:44PM
[3782970.176]
[3782970.176] Current version of pixman: 0.22.2
[3782970.176]   Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
[3782970.176] Markers: (--) probed, (**) from config file, (==) default 
setting,

(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[3782970.176] (==) Log file: "/var/log/Xorg.0.log", Time: Sat Nov 26 
22:05:30 2011
[3782970.207] (==) Using system config directory 
"/usr/X11R6/share/X11/xorg.conf.d"

[3782970.243] (==) No Layout section.  Using the first Screen section.
[3782970.243] (==) No screen section available. Using defaults.
[3782970.243] (**) |-->Screen "Default Screen Section" (0)
[3782970.243] (**) |   |-->Monitor ""
[3782970.262] (==) No monitor specified for screen "Default Screen Section".
Using a default monitor configuration.
[3782970.262] (==) Disabling SIGIO handlers for input devices
[3782970.262] (==) Automatically adding devices
[3782970.262] (==) Automatically enabling devices
[3782970.414] (==) FontPath set to:
/usr/X11R6/lib/X11/fonts/misc/,
/usr/X11R6/lib/X11/fonts/TTF/,
/usr/X11R6/lib/X11/fonts/OTF/,
/usr/X11R6/lib/X11/fonts/Type1/,
/usr/X11R6/lib/X11/fonts/100dpi/,
/usr/X11R6/lib/X11/fonts/75dpi/
[3782970.414] (==) ModulePath set to "/usr/X11R6/lib/modules"
[3782970.414] (II) The server relies on wscons to provide the list of 
input devices.
	If no devices become available, reconfigure wscons or disable 
AutoAddDevices.

[3782970.417] (II) Loader magic: 0x79e020
[3782970.417] (II) Module ABI versions:
[3782970.417]   X.Org ANSI C Emulation: 0.4
[3782970.417]   X.Org Video Driver: 11.0
[3782970.417]   X.Org XInput driver : 13.0
[3782970.417]   X.Org Server Extension : 6.0
[3782970.428] (--) PCI:*(0:0:2:0) 8086:2a42:17aa:213a rev 9, Mem @ 
0xf000/4194304, 0xd000/268435456, I/O @ 0x1800/8
[3782970.428] (--) PCI: (0:0:2:1) 8086:2a43:17aa:213a rev 9, Mem @ 
0xf040/1048576

[3782970.428] (II) LoadModule: "extmod"
[3782970.470] (II) Loading /usr/X11R6/lib/modules/extensions/libextmod.so
[3782970.482] (II) Module extmod: vendor="X.Org Foundation"
[3782970.482]   compiled for 1.11.2, module version = 1.0.0
[3782970.482]   Module class: X.Org Server Extension
[3782970.482]   ABI class: X.Org Server Extension, version 6.0
[3782970.482] (II) Loading extension MIT-SCREEN-SAVER
[3782970.482] (II) Loading extension XFree86-VidModeExtension
[3782970.482] (II) Loading extension XFree86-DGA
[3782970.482] (II) Loading extension DPMS
[3782970.482] (II) Loading extension XVideo
[3782970.482] (II) Loading extension XVideo-MotionCompensation
[3782970.482] (II) Loading extension X-Resource
[3782970.482] (II) LoadModule: "dbe"
[3782970.483] (II) Loading /usr/X11R6/lib/modules/extensions/libdbe.so
[3782970.490] (II) Module dbe: vendor="X.Org Foundation"
[3782970.490]   compiled for 1.11.2, module version = 1.0.0
[3782970.490]   Module class: X.Org Server Extension
[3782970.490]   ABI class: X.Org Server Extension, version 6.0
[3782970.490] (II) Loading extension DOUBLE-BUFFER
[3782970.490] (II) LoadModule: "glx"
[3782970.490] (II) Loading /usr/X11R6/lib/modules/extensions/libglx.so
[3782970.505] (II) Module glx: vendor="

Re: Packet drop because of invalid IP checksum on Soerkis / vr / ral

2011-11-27 Thread Pieter Verberne

On Sun, 27 Nov 2011 00:50:21 -0200, Christiano F. Haesbaert wrote:

On Sat, Nov 26, 2011 at 10:37:10PM +0100, Pieter Verberne wrote:

Hello,

I configured my Soekris net5501 as a switch and access point. I
briged all four vr(4) devices and ral0. vr0 (10.0.0.1) is connected
to the router. ral0 is configured as an access point.

This is the configuration I want. An access point with no IP 
address.


$ cat /etc/hostname.ral0
mediaopt hostap nwid [ssid] wpa wpaprotos wpa2 wpaakms psk wpakey 
[key]

up

However, I cannot ping to 10.0.0.1 from another computer (10.0.0.37)
attached to ral0 . Wireshark on 10.0.0.37 shows both a echo request
and reply, but the reply packet has an IP header checksum of 0x
and the packet is dropped. This is probably because of checksum
offloading done by vr(4) .

How to handle this?

 Pieter Verberne

The following configuration does work. For some reason, nfs (sunrpc)
is only listening on 10.0.0.80 and not on 10.0.0.1 .



Hi,

Can you try this ?

also, the output of ifconfig vr0 hwfeatures (if you're in current) is 
useful.


Index: if_vr.c
===
RCS file: /cvs/src/sys/dev/pci/if_vr.c,v
retrieving revision 1.111
diff -d -u -p -b -r1.111 if_vr.c
--- if_vr.c 22 Jun 2011 16:44:27 -  1.111
+++ if_vr.c 27 Nov 2011 02:45:35 -
@@ -643,9 +643,11 @@ vr_attach(struct device *parent, struct
bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);

ifp->if_capabilities |= IFCAP_VLAN_MTU;
+#if 0
if (sc->vr_quirks & VR_Q_CSUM)
ifp->if_capabilities |= IFCAP_CSUM_IPv4|IFCAP_CSUM_TCPv4|
IFCAP_CSUM_UDPv4;
+#endif
 #ifndef SMALL_KERNEL
if (sc->vr_revid >= REV_ID_VT3065_A) {
ifp->if_capabilities |= IFCAP_WOL;


Awesome. I just applied my first patch, and compiled my first kernel.
(I don't code) And it is working now :-D (with the following 
configuration:)


$ cat /etc/hostname.ral0
mediaopt hostap nwid [ssid] wpa wpaprotos wpa2 wpaakms psk wpakey [key]
up

I'm running 5.0 stable so `ifconfig vr0 hwfeatures' doesn't work. So 
are you
now trying to fix this for the next release? Or should I just save this 
patch?


Thanks
 Pieter



Re: Trouble with large files in current snapshot

2011-11-27 Thread Pieter Verberne

On Sun, 27 Nov 2011 12:21:49 +0100, pet...@schwertfisch.de wrote:
After upgrading to current (snapshot from Nov. 25) OpenBSD seems to 
be

choking on large (>2GB) files (tested with GENERIC.MP and GENERIC):


Please have a look at
http://article.gmane.org/gmane.os.openbsd.bugs/17898

Again. I downgraded to 5.0 stable.

Pieter


$ pwd
/home/user

$ mount
...
/dev/wd0k on /home type ffs (local, nodev, nosuid, softdep)
...

$ dd if=/dev/zero of=large1 bs=1024 count=250
250+0 records in
250+0 records out
256000 bytes transferred in 80.225 secs (31910238 bytes/sec)

$ cat large1 >large2

cat: large1: Invalid argument

$ ls -lh large*
-rw-r--r--  1 user  user   2.4G Nov 27 11:38 large1
-rw-r--r--  1 user  user   2.0G Nov 27 11:42 large2

$ rm large2
$ cp large1 large2

cp: large1: Invalid argument
$ ls -lh large*
-rw-r--r--  1 user  user   2.4G Nov 27 11:38 large1
-rw-r--r--  1 user  user 0B Nov 27 11:42 large2




Re: X11: xrandr rotate makes picture unreadable

2011-11-27 Thread Matthieu Herrb
On Sat, Nov 26, 2011 at 01:49:49PM +0200, Oleksii Zhmyrov wrote:
> On 11/26/11 13:20, Ville Valkonen wrote:
> >Hello,
> >
> >I am running OpenBSD current on a Lenovo SL-510 laptop (dmesg below) and
> >xrandr rotate doesn't work as expected. When executing
> >   $ xrandr --output LVDS --rotate right
> >picture goes completely gibberish, as seen in here:
> >   http://imageshack.us/photo/my-images/69/xrandr.jpg/
> >
> >Currently I am using i3 window manager but it happens in Fluxbox too.
> >Xorg.0.log diff (below) reveals sync problem (and apparently so does the
> >picture).
> >
> >Please let me know how should I proceed.
> >
> >Sincerely,
> >Ville Valkonen
> >
> 
> Lenovo SL-510, OpenBSD current, xfce4. No xorg.conf file.
>  $ xrandr --output LVDS --rotate right
> works as expected, nothing unusual.
> 

I guess one of you is using a snapshot, while the other as built
xenocara from CVS sources. 
Which is which ? 

Please post the full Xorg.0.log and compare the intel video driver
versions. 

> >
> >### Xrandr:
> >Screen 0: minimum 320 x 200, current 1366 x 768, maximum 4096 x 4096
> >VGA disconnected (normal left inverted right x axis y axis)
> >LVDS connected 1366x768+0+0 (normal left inverted right x axis y axis)
> >344mm x 193mm
> >1366x768   50.0*
> >HDMI-1 disconnected (normal left inverted right x axis y axis)
> >
> >### Xorg.0.log diff before and after the following commands
> >###   xrandr --output LVDS --rotate right
> >###   xrandr --output LVDS --rotate normal
> >### commands:
> >--- xorg.oldThu Nov 24 12:31:32 2011
> >+++ xorg.newThu Nov 24 12:31:47 2011
> >@@ -443,3 +443,26 @@ Release Date: 2011-11-04
> >  [3575506.563] is lvds
> >  [3575506.564] (II) intel(0): using SSC reference clock of 96 MHz
> >  [3575506.583] (II) intel(0): Selecting standard 18 bit TMDS pixel format.
> >+[3575738.681] (II) intel(0): EDID vendor "LEN", prod id 16560
> >+[3575738.681] (II) intel(0): Using hsync ranges from config file
> >+[3575738.681] (II) intel(0): Using vrefresh ranges from config file
> >+[3575738.681] (II) intel(0): Printing DDC gathered Modelines:
> >+[3575738.681] (II) intel(0): Modeline "1366x768"x0.0   69.30  1366
> >1414 1446 1718  768 771 775 806 -hsync -vsync (40.3 kHz)
> >+[3575738.681] (II) intel(0): EDID vendor "LEN", prod id 16560
> >+[3575739.052] (II) intel(0): Allocated new frame buffer 768x1366
> >stride 3072, tiled
> >+[3575739.082] (II) intel(0): New front buffer at 0xb344000
> >+[3575739.123] (II) intel(0): Allocated new frame buffer 1408x768
> >stride 5632, tiled
> >+[3575739.172] is lvds
> >+[3575739.172] (II) intel(0): using SSC reference clock of 96 MHz
> >+[3575739.192] (II) intel(0): Selecting standard 18 bit TMDS pixel format.
> >+[3575742.527] (II) intel(0): EDID vendor "LEN", prod id 16560
> >+[3575742.527] (II) intel(0): Using hsync ranges from config file
> >+[3575742.527] (II) intel(0): Using vrefresh ranges from config file
> >+[3575742.527] (II) intel(0): Printing DDC gathered Modelines:
> >+[3575742.527] (II) intel(0): Modeline "1366x768"x0.0   69.30  1366
> >1414 1446 1718  768 771 775 806 -hsync -vsync (40.3 kHz)
> >+[3575742.527] (II) intel(0): EDID vendor "LEN", prod id 16560
> >+[3575742.902] (II) intel(0): Allocated new frame buffer 1408x768
> >stride 5632, tiled
> >+[3575742.931] (II) intel(0): New front buffer at 0xbd44000
> >+[3575743.021] is lvds
> >+[3575743.021] (II) intel(0): using SSC reference clock of 96 MHz
> >+[3575743.041] (II) intel(0): Selecting standard 18 bit TMDS pixel format.
> >
> >### Dmesg:
> >###
> >OpenBSD 5.0-current (GENERIC) #114: Sun Nov 20 16:30:30 MST 2011
> > dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC
> >real mem = 2003517440 (1910MB)
> >avail mem = 1936134144 (1846MB)
> >mainbus0 at root
> >bios0 at mainbus0: SMBIOS rev. 2.5 @ 0xe0010 (44 entries)
> >bios0: vendor LENOVO version "6JET83WW (1.41 )" date 09/21/2010
> >bios0: LENOVO 284756G
> >acpi0 at bios0: rev 4
> >acpi0: sleep states S0 S3 S4 S5
> >acpi0: tables DSDT FACP HPET MCFG APIC BOOT SLIC SSDT SSDT SSDT
> >acpi0: wakeup devices P0P2(S4) P0P1(S4) USB0(S3) USB1(S3) USB2(S3)
> >USBR(S3) EHC1(S3) USB3(S3) USB4(S3) USB5(S3) EHC2(S3) HDEF(S4)
> >PXSX(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4)
> >RP04(S4) PXSX(S4) RP05(S4) RP06(S4) BLAN(S4) LID_(S3) SLPB(S3)
> >acpitimer0 at acpi0: 3579545 Hz, 24 bits
> >acpihpet0 at acpi0: 14318179 Hz
> >acpimcfg0 at acpi0 addr 0xe000, bus 0-255
> >acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
> >cpu0 at mainbus0: apid 0 (boot processor)
> >cpu0: Intel(R) Core(TM)2 Duo CPU T5870 @ 2.00GHz, 1995.30 MHz
> >cpu0: 
> >FPU,VME,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,SBF,SSE3,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG
> >cpu0: 2MB 64b/line 8-way L2 cache
> >cpu0: apic clock running at 199MHz
> >cpu at mainbus0: not configured
> >ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
> >acpiprt0 at acpi0: bus

Trouble with large files in current snapshot

2011-11-27 Thread peters
After upgrading to current (snapshot from Nov. 25) OpenBSD seems to be
choking on large (>2GB) files (tested with GENERIC.MP and GENERIC):

$ pwd
/home/user

$ mount 
...
/dev/wd0k on /home type ffs (local, nodev, nosuid, softdep)
...

$ dd if=/dev/zero of=large1 bs=1024 count=250
250+0 records in
250+0 records out
256000 bytes transferred in 80.225 secs (31910238 bytes/sec)

$ cat large1 >large2   
cat: large1: Invalid argument

$ ls -lh large*
-rw-r--r--  1 user  user   2.4G Nov 27 11:38 large1
-rw-r--r--  1 user  user   2.0G Nov 27 11:42 large2

$ rm large2
$ cp large1 large2 
cp: large1: Invalid argument
$ ls -lh large*
-rw-r--r--  1 user  user   2.4G Nov 27 11:38 large1
-rw-r--r--  1 user  user 0B Nov 27 11:42 large2

OpenBSD 5.0-current (GENERIC.MP) #130: Fri Nov 25 00:28:08 MST 2011
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP
cpu0: Intel(R) Atom(TM) CPU N270 @ 1.60GHz ("GenuineIntel" 686-class) 1.60 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,NXE,SSE3,MWAIT,DS-CPL,EST,TM2,SSSE3,xTPR,PDCM,MOVBE,LAHF
real mem  = 1061416960 (1012MB)
avail mem = 1033936896 (986MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 03/06/09, SMBIOS rev. 2.6 @ 0xe91f0 (42 
entries)
bios0: vendor Intel Corp. version "JT94510H.86A.0025.2009.0306.1639" date 
03/06/2009
bios0: Intel Corporation D945GSEJT
acpi0 at bios0: rev 2
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP APIC MCFG SSDT SSDT SSDT
acpi0: wakeup devices P0P2(S4) PEGP(S4) USB0(S3) USB1(S3) USB2(S3) USB3(S3) 
EHCI(S3) MC97(S4) P0P1(S4) PS2K(S3) PS2M(S3) UAR1(S3) UAR2(S3) P0P4(S4) 
P0P5(S4) P0P6(S4) PWRB(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 133MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Atom(TM) CPU N270 @ 1.60GHz ("GenuineIntel" 686-class) 1.60 GHz
cpu1: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,NXE,SSE3,MWAIT,DS-CPL,EST,TM2,SSSE3,xTPR,PDCM,MOVBE,LAHF
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xe000, bus 0-255
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (P0P2)
acpiprt2 at acpi0: bus 5 (P0P1)
acpiprt3 at acpi0: bus 1 (P0P4)
acpiprt4 at acpi0: bus 2 (P0P5)
acpicpu0 at acpi0: C3, C2, C1, PSS
acpicpu1 at acpi0: C3, C2, C1, PSS
acpibtn0 at acpi0: PWRB
acpivideo0 at acpi0: IGD_
bios0: ROM list: 0xc/0xec00! 0xcf000/0x1000
cpu0: Enhanced SpeedStep 1597 MHz: speeds: 1600, 1333, 1067, 800 MHz
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82945GME Host" rev 0x03
vga1 at pci0 dev 2 function 0 "Intel 82945GME Video" rev 0x03
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
intagp0 at vga1
agp0 at intagp0: aperture at 0xd000, size 0x1000
inteldrm0 at vga1: apic 2 int 16
drm0 at inteldrm0
"Intel 82945GM Video" rev 0x03 at pci0 dev 2 function 1 not configured
azalia0 at pci0 dev 27 function 0 "Intel 82801GB HD Audio" rev 0x02: msi
azalia0: codecs: Realtek ALC662
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 82801GB PCIE" rev 0x02
pci1 at ppb0 bus 1
re0 at pci1 dev 0 function 0 "Realtek 8168" rev 0x03: RTL8168D/8111D (0x2800), 
apic 2 int 16, address 00:27:0e:01:8f:99
rgephy0 at re0 phy 7: RTL8169S/8110S PHY, rev. 2
ppb1 at pci0 dev 28 function 1 "Intel 82801GB PCIE" rev 0x02
pci2 at ppb1 bus 2
ppb2 at pci0 dev 28 function 2 "Intel 82801GB PCIE" rev 0x02
pci3 at ppb2 bus 3
ppb3 at pci0 dev 28 function 3 "Intel 82801GB PCIE" rev 0x02
pci4 at ppb3 bus 4
uhci0 at pci0 dev 29 function 0 "Intel 82801GB USB" rev 0x02: apic 2 int 23
uhci1 at pci0 dev 29 function 1 "Intel 82801GB USB" rev 0x02: apic 2 int 19
uhci2 at pci0 dev 29 function 2 "Intel 82801GB USB" rev 0x02: apic 2 int 18
uhci3 at pci0 dev 29 function 3 "Intel 82801GB USB" rev 0x02: apic 2 int 16
ehci0 at pci0 dev 29 function 7 "Intel 82801GB USB" rev 0x02: apic 2 int 23
ehci0: timed out waiting for BIOS
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
ppb4 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0xe2
pci5 at ppb4 bus 5
ichpcib0 at pci0 dev 31 function 0 "Intel 82801GBM LPC" rev 0x02: PM disabled
pciide0 at pci0 dev 31 function 1 "Intel 82801GB IDE" rev 0x02: DMA, channel 0 
configured to compatibility, channel 1 configured to compatibility
pciide0: channel 0 disabled (no drives)
pciide0: channel 1 disabled (no drives)
pciide1 at pci0 dev 31 function 2 "Intel 82801GBM SATA" rev 0x02: DMA, channel 
0 configured to native-PCI, channel 1 configured to native-PCI
pciide1: using apic 2 int 19 for native-PCI inter

Re: Single Stepping Process in Kernel

2011-11-27 Thread Philip Guenther
On Sat, Nov 26, 2011 at 10:25 PM, Luis Useche  wrote:
> On Sat, Nov 26, 2011 at 7:31 PM, Ted Unangst  wrote:
>> On Sat, Nov 26, 2011, Luis Useche wrote:
>>> For a project I need to single step a user space process while
>>> executing the fault handler. I was thinking that probably ddb single
>>> stepping can be reused but this is probably for kernel single stepping
>>> only. How about ptrace?
>>
>> I am officially confused because the fault handler runs in the kernel.
>> If you want to step through a process then ptrace is what you want, or
>> it's slightly easier to use interface, gdb.
>
> The interfaces you are talking about are to single step a user level
> process from another user level process. However, I need to single
> step in the fault handler the (user level) instruction that just
> faulted.
>
> My final goal is to extract the data that the application was trying
> to store at the unmapped page by mapping a temporary page.

That won't always work if you're on a platform like i386 where the
kernel memory appears in the address space of processes, as you
*can't* just map in a temporary page if the process tries to access an
address in the kernel's range.

Anyway, you don't need to trace the fault handler to do what you want.
 You trace the process with ptrace(),  then use ptrace() to examine
the state of the process when it gets a signal when it tries to access
the page in a non-permitted way.  For example, gdb reports the signal
that was sent after examining the registers with ptrace(PT_GETREGS)
and then uses ptrace(PT_IO) to get the instruction that faulted.
Disassemble that to figure out what instruction it was and work out
the exact address and data involved.


Philip Guenther