Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Oct 1995 19:39:02 +0100 (MET)
From:      Juergen Lock <nox@jelal.hb.north.de>
To:        hackers@freebsd.org
Subject:   2.1.0-950928-SNAP kernel experiences
Message-ID:  <199510031839.TAA03102@saturn>

next in thread | raw e-mail | index | archive | help
First, my userland is still 2.0.5 (mostly) so i don't know if some of this
is worked around there.

1. stepping over syscalls (gdb ni) sends you to DDB, and returned
to the wrong address afterwards, with or without DDB.  patch in
i386/i386/trap.c below.

2. the linux emulator (modload'ed) still causes panics with DIAGNOSTIC,
re-applied a patch posted to one of the lists...

3. and i added back struct vmtotal total, to keep xperfmon++ happy. :)

 Other than that it seems to honor its name, -stable...

 Oh, i haven't tried one thing yet:  mount -t msdos a floppy with
a bad block, i think in one of the FATs, caused a complete hang
of all local filesystems on my previous kernel...

 greetings from germany,
	Juergen

diff -ur sys/i386/i386/symbols.raw sys.2109p/i386/i386/symbols.raw
--- sys/i386/i386/symbols.raw	Wed Aug 23 09:24:58 1995
+++ sys.2109p/i386/i386/symbols.raw	Mon Oct  2 17:09:37 1995
@@ -40,7 +40,7 @@
 #vmstat
 	_cp_time
 #	_rate
-#	_total
+	_total
 #	_sum
 #	_rectime
 #	_pgintime
diff -ur sys/i386/i386/trap.c sys.2109p/i386/i386/trap.c
--- sys/i386/i386/trap.c	Wed Aug 23 09:31:17 1995
+++ sys.2109p/i386/i386/trap.c	Mon Oct  2 15:32:40 1995
@@ -78,6 +78,11 @@
 int	trap_pfault	__P((struct trapframe *, int));
 void	trap_fatal	__P((struct trapframe *));
 
+extern inthand_t IDTVEC(syscall);
+#ifdef COMPAT_LINUX
+extern inthand_t IDTVEC(linux_syscall);
+#endif
+
 #define MAX_TRAP_MSG		27
 char *trap_msg[] = {
 	"",					/*  0 unused */
@@ -351,14 +356,23 @@
 
 #ifdef DDB
 		case T_BPTFLT:
+#ifndef DDB_NO_LCALLS
 		case T_TRCTRAP:
+#endif
 			if (kdb_trap (type, 0, &frame))
 				return;
 			break;
-#else
+#endif
+#if !defined (DDB) || defined (DDB_NO_LCALLS)
 		case T_TRCTRAP:	 /* trace trap -- someone single stepping lcall's */
 			/* Q: how do we turn it on again? */
-			frame.tf_eflags &= ~PSL_T;
+#ifdef COMPAT_LINUX
+			if (frame.tf_eip != (int) IDTVEC(syscall) &&
+			    frame.tf_eip != (int) IDTVEC(linux_syscall))
+#else
+			if (frame.tf_eip != IDTVEC(syscall))
+#endif
+				frame.tf_eflags &= ~PSL_T;
 			return;
 #endif
 
@@ -887,6 +901,15 @@
 		break;
 	}
 
+#if 1
+	if (frame.tf_eflags & PSL_T) {
+		/* traced syscall, raise sig */
+		frame.tf_eflags &= ~PSL_T;
+		if (ISPL(frame.tf_cs) == SEL_UPL) {
+			trapsignal(p, SIGTRAP, 0);
+		}
+	}
+#endif
 	userret(p, &frame, sticks);
 
 #ifdef KTRACE
@@ -980,6 +1003,15 @@
 		break;
 	}
 
+#if 1
+	if (frame.tf_eflags & PSL_T) {
+		/* traced syscall, raise sig */
+		frame.tf_eflags &= ~PSL_T;
+		if (ISPL(frame.tf_cs) == SEL_UPL) {
+			trapsignal(p, SIGTRAP, 0);
+		}
+	}
+#endif
 	userret(p, &frame, sticks);
 
 #ifdef KTRACE
diff -ur sys/i386/linux/linux_misc.c sys.2109p/i386/linux/linux_misc.c
--- sys/i386/linux/linux_misc.c	Sun Jun 25 19:32:37 1995
+++ sys.2109p/i386/linux/linux_misc.c	Mon Aug  7 21:01:13 1995
@@ -188,7 +188,7 @@
     printf("Linux-emul(%d): uselib(%s)\n", p->p_pid, path);
 #endif
 
-    NDINIT(&ni, LOOKUP, FOLLOW, UIO_SYSSPACE, path, p);
+    NDINIT(&ni, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, path, p);
     if (error = namei(&ni))
 	return error;
 
@@ -196,25 +196,39 @@
     if (vnodep == NULL)
 	    return ENOEXEC;
 
-    if (vnodep->v_writecount)
+    if (vnodep->v_writecount) {
+	    VOP_UNLOCK(vnodep);
 	    return ETXTBSY;
+    }
 
-    if (error = VOP_GETATTR(vnodep, &attr, p->p_ucred, p))
-	return error;
+    if (error = VOP_GETATTR(vnodep, &attr, p->p_ucred, p)) {
+	    VOP_UNLOCK(vnodep);
+	    return error;
+    }
 
     if ((vnodep->v_mount->mnt_flag & MNT_NOEXEC)
 	|| ((attr.va_mode & 0111) == 0)
-	|| (attr.va_type != VREG))
+	|| (attr.va_type != VREG)) {
+	    VOP_UNLOCK(vnodep);
 	    return ENOEXEC;
+    }
 
-    if (attr.va_size == 0)
+    if (attr.va_size == 0) {
+	    VOP_UNLOCK(vnodep);
 	    return ENOEXEC;
+    }
 
-    if (error = VOP_ACCESS(vnodep, VEXEC, p->p_ucred, p))
+    if (error = VOP_ACCESS(vnodep, VEXEC, p->p_ucred, p)) {
+	VOP_UNLOCK(vnodep);
 	return error;
+    }
 
-    if (error = VOP_OPEN(vnodep, FREAD, p->p_ucred, p))
+    if (error = VOP_OPEN(vnodep, FREAD, p->p_ucred, p)) {
+	VOP_UNLOCK(vnodep);
 	return error;
+    }
+
+    VOP_UNLOCK(vnodep);	/* lock no longer needed */
 
     error = vm_mmap(kernel_map, (vm_offset_t *)&a_out, 1024,
 	    	    VM_PROT_READ, VM_PROT_READ, 0, (caddr_t)vnodep, 0);
@@ -225,7 +239,7 @@
      * Is it a Linux binary ?
      */
     if (((a_out->a_magic >> 16) & 0xff) != 0x64)
-	return -1;
+	return ENOEXEC;
 
     /*
      * Set file/virtual offset based on a.out variant.
@@ -240,7 +254,7 @@
 	file_offset = 0;
 	break;
     default:
-	return (-1);
+	return ENOEXEC;
     }
 
     vnodep->v_flag |= VTEXT;
diff -ur sys/sys/vmmeter.h sys.2109p/sys/vmmeter.h
--- sys/sys/vmmeter.h	Fri Sep 15 12:20:10 1995
+++ sys.2109p/sys/vmmeter.h	Mon Oct  2 17:13:58 1995
@@ -111,6 +111,9 @@
 	long	t_armshr;	/* active shared real memory */
 	long	t_free;		/* free memory pages */
 };
+#ifdef KERNEL
+struct vmtotal total;
+#endif
 
 /*
  * Optional instrumentation.


#
# GENERIC -- Generic machine with WD/AHx/NCR/BTx family disks
#
#	GENERIC,v 1.45.2.3 1995/06/05 21:50:41 jkh Exp
#

machine		"i386"
cpu		"I386_CPU"
cpu		"I486_CPU"
cpu		"I586_CPU"
ident		SPIIIGII
maxusers	64

options		MATH_EMULATE		#Support for x87 emulation
options		INET			#InterNETworking
options		FFS			#Berkeley Fast Filesystem
options		NFS			#Network Filesystem
options		MSDOSFS			#MSDOS Filesystem
options		"CD9660"		#ISO 9660 Filesystem
options		PROCFS			#Process filesystem
options		"COMPAT_43"		#Compatible with BSD 4.3
options		"SCSI_DELAY=5"		#Be pessimistic about Joe SCSI device
options		BOUNCE_BUFFERS		#include support for DMA bounce buffers
options		UCONSOLE		#Allow users to grab the console
options        "BROKEN_KEYBOARD_RESET"

options		DDB_NO_LCALLS		#dont enter ddb on gdb ni over lcall

config		kernel	root on wd0 

#####################################################################
# COMPATIBILITY OPTIONS                                             

#
# Implement system calls compatible with 4.3BSD and older versions of
# FreeBSD.
#
options		"COMPAT_43"

#
# Allow user-mode programs to manipulat their local descriptor tables.
# This option is required for the WINE Windows(tm) emulator, and is
# not used by anything else (that we know of).
#
options		USER_LDT		#allow user-level control of i386 ldt

#
options		"COMPAT_LINUX"
#
# These three options provide support for System V Interface
# Definition-style interprocess communication, in the form of shared
# memory, semaphores, and message queues, respectively.
#
options		SYSVSHM
options		SYSVSEM
options		SYSVMSG


#####################################################################
# DEBUGGING OPTIONS

#
# Enable the kernel debugger.
#
options		DDB

# 
# KTRACE enables the system-call tracing facility ktrace(2).
#
options		KTRACE			#kernel tracing

#
# The DIAGNOSTIC option is used in a number of source files to enable
# extra sanity checking of internal structures.  This support is not
# enabled by default because of the extra time it would take to check
# for these conditions, which can only occur as a result of
# programming errors.
#
options		DIAGNOSTIC

#
# Allow ordinary users to take the console - this is useful for X.
options		UCONSOLE


controller	isa0
controller	pci0

controller	fdc0	at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
disk		fd0	at fdc0 drive 0
disk		fd1	at fdc0 drive 1
tape		ft0	at fdc0 drive 2

controller	wdc0	at isa? port "IO_WD1" bio irq 14 vector wdintr
disk		wd0	at wdc0 drive 0
disk		wd1	at wdc0 drive 1

controller	wdc1	at isa? port "IO_WD2" bio irq 15 vector wdintr
disk		wd2	at wdc1 drive 0
disk		wd3	at wdc1 drive 1

controller	ncr0
controller	ahc0

#controller	bt0	at isa? port "IO_BT0" bio irq ? vector btintr
controller	uha0	at isa? port "IO_UHA0" bio irq ? drq 5 vector uhaintr
controller	ahc1	at isa? bio irq ? vector ahcintr
controller	ahb0	at isa? bio irq ? vector ahbintr
controller	aha0	at isa? port "IO_AHA0" bio irq ? drq 5 vector ahaintr
controller	aic0    at isa? port 0x340 bio irq 11 vector aicintr
#controller	nca0	at isa? port 0x1f88 bio irq 10 vector ncaintr
#controller	nca1	at isa? port 0x350 bio irq 5 vector ncaintr
#controller	sea0	at isa? bio irq 5 iomem 0xc8000 iosiz 0x2000 vector seaintr

controller	scbus0

device		sd0

device		st0

device		cd0	#Only need one of these, the code dynamically grows

#device		wt0	at isa? port 0x300 bio irq 5 drq 1 vector wtintr
device		wt0	at isa? port 0x280 bio irq 3 drq 1 vector wtintr
#device		mcd0	at isa? port 0x300 bio irq 10 vector mcdintr
#device		mcd1	at isa? port 0x340 bio irq 11 vector mcdintr

#controller	matcd0	at isa? port ? bio

#device		scd0	at isa? port 0x230 bio

# syscons is the default console driver, resembling an SCO console
device		sc0	at isa? port "IO_KBD" tty irq 1 vector scintr

#
# Options for `sc':
#
# HARDFONTS allows the driver to load an ISO-8859-1 font to replace
# the default font in your display adapter's memory.
#
options		HARDFONTS
#
# MAXCONS is maximum number of virtual consoles, no more than 16
# default value: 12
#
#options         "MAXCONS=16"

#options         "COM_MULTIPORT"

# Enable this and PCVT_FREEBSD for pcvt vt220 compatible console driver
#device		vt0	at isa? port "IO_KBD" tty irq 1 vector pcrint
#options		"PCVT_FREEBSD=210"	# pcvt running on FreeBSD 2.1
#options		XSERVER			# include code for XFree86

device		npx0	at isa? port "IO_NPX" irq 13 vector npxintr

device		sio0	at isa? port "IO_COM1" tty irq 4 vector siointr
#device		sio0	at isa? port "IO_COM3" tty flags 0x285
device		sio1	at isa? port "IO_COM2" tty irq 3 vector siointr
device		sio2	at isa? port "IO_COM3" tty irq 5 vector siointr
# S3 gfx card, no sio3...
#device		sio3	at isa? port "IO_COM4" tty irq 9 vector siointr
# and sio2 shares int w sio0  (needs options "COM_MULTIPORT")
#device          sio2	at isa? port "IO_COM1" tty flags 0x285 irq 4 vector siointr

device		lpt0	at isa? port? tty irq 7 vector lptintr
device		lpt1	at isa? port? tty
device		lpt2	at isa? port? tty

# Order is important here due to intrusive probes, do *not* alphabetize
# this list of network interfaces until the probes have been fixed.
# Right now it appears that the ie0 must be probed before ep0. See
# revision 1.20 of this file.
device de0
device ed0 at isa? port 0x280 net irq  5 iomem 0xd8000 vector edintr
device ed1 at isa? port 0x300 net irq  5 iomem 0xd8000 vector edintr
#device ie0 at isa? port 0x360 net irq  7 iomem 0xd0000 vector ieintr
device ep0 at isa? port 0x300 net irq 10 vector epintr
#device ix0 at isa? port 0x300 net irq 10 iomem 0xd0000 iosiz 32768 vector ixintr
#device le0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector le_intr
#device lnc0 at isa? port 0x280 net irq 10 drq 0 vector lncintr
#device lnc1 at isa? port 0x300 net irq 10 drq 0 vector lncintr
#device ze0 at isa? port 0x300 net irq 5 iomem 0xd8000 vector zeintr
#device zp0 at isa? port 0x300 net irq 10 iomem 0xd8000 vector zpintr

#
# Audio drivers: `snd', `sb', `pas', `gus', `pca'
#
# snd: Voxware sound support code
# sb: SoundBlaster PCM - SoundBlaster, SB Pro, SB16, ProAudioSpectrum
# sbxvi: SoundBlaster 16
# sbmidi: SoundBlaster 16 MIDI interface
# pas: ProAudioSpectrum PCM and MIDI
# gus: Gravis Ultrasound - Ultrasound, Ultrasound 16, Ultrasound MAX
# gusxvi: Gravis Ultrasound 16-bit PCM
# gusmax: Gravis Ultrasound MAX (currently broken)
# mss: Microsoft Sound System
# opl: Yamaha OPL-2 and OPL-3 FM - SB, SB Pro, SB 16, ProAudioSpectrum
# uart: stand-alone 6850 UART for MIDI
# mpu: Roland MPU-401 stand-alone card
# 
# Beware!  The addresses specified below are also hard-coded in
# i386/isa/sound/sound_config.h.  If you change the values here, you
# must also change the values in the include file.
#
# pca: PCM audio through your PC speaker
#
# If you don't have a lpt0 device at IRQ 7, you can remove the
# ``conflicts'' specification in the appropriate device entries below.
#
# Controls all sound devices
controller	snd0
device sb0      at isa? port 0x220 irq 7 conflicts drq 1 vector sbintr
device sbxvi0   at isa? drq 5
device sbmidi0  at isa? port 0x330
device pas0     at isa? port 0x388 irq 10 drq 6 vector pasintr
device gus0 at isa? port 0x220 irq 11 drq 1 vector gusintr
device gusxvi0 at isa? port 0x530 irq 7 conflicts drq 3 vector adintr
device gusmax0 at isa? port 0x32c
device mss0 at isa? port 0x530 irq 10 drq 1 vector adintr
device opl0     at isa? port 0x388
device mpu0     at isa? port 0x330 irq 6 drq 0
device uart0 at isa? port 0x330 irq 5 vector "m6850intr"

# Not controlled by `snd'
device pca0 at isa? port IO_TIMER1 tty


pseudo-device	loop
pseudo-device	ether
pseudo-device	log
pseudo-device	sl	1
# ijppp uses tun instead of ppp device
pseudo-device	ppp	1
pseudo-device	tun	1
#pseudo-device	pty	16
pseudo-device	pty	32
pseudo-device	gzip		# Exec gzipped a.out's
pseudo-device	vn		#Vnode driver (turns a file into a device)
pseudo-device	snp	10	#Snoop device - to look at pty/vty/etc..

#options		NSIP			#XNS over IP
#options		LLC			#X.25 link layer for Ethernets
#options		HDLC			#X.25 link layer for serial lines

# broken
#options		EON			#ISO CLNP over IP

#
# Internet family options:
#
# TCP_COMPAT_42 causes the TCP code to emulate certain bugs present in
# 4.2BSD.  This option should not be used unless you have a 4.2BSD
# machine and TCP connections fail.
#
# GATEWAY allows the machine to forward packets, and also configures
# larger static sizes of a number of system tables.
#
# MROUTING enables the kernel multicast packet forwarder, which works
# with mrouted(8).
#
# IPFIREWALL enables support for IP firewall construction, in
# conjunction with the `ipfw' program.  IPFIREWALL_VERBOSE does
# the obvious thing.
# IPACCT enables IP accounting.
#
# ARP_PROXYALL enables global proxy ARP.  Beware!  This can burn
# your house down!  See netinet/if_ether.c for the gory details.
# (Eventually there will be a better management interface.)
#
#options		"TCP_COMPAT_42"		#emulate 4.2BSD TCP bugs
options		GATEWAY			#internetwork gateway
#options		MROUTING		# Multicast routing
options         IPFIREWALL              #firewall
options         IPFIREWALL_VERBOSE      #print information about
#options		IPACCT			#ipaccounting
					# dropped packets
#options		ARP_PROXYALL		# global proxy ARP





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