John Baldwin [Wed, 21 Feb 2001 22:51:00 +0000 (22:51 +0000)]
Remove attempt to add in PREEMPTION #ifdef test in MI code that didn't
work because opt_preemption.h wasn't #include'd. Instead, make use of the
do_switch parameter to ithread_schedule() and do the check in the alpha
interrupt code.
Bruce A. Mah [Wed, 21 Feb 2001 21:57:49 +0000 (21:57 +0000)]
New release notes: Note format string paranoia and tempfile fixes,
OpenSSL ASM optimizations, sysinstall preserving /etc/mail,
savecore -k, pkg_delete(1) now deletes in dependency order.
Bill Paul [Wed, 21 Feb 2001 20:54:22 +0000 (20:54 +0000)]
Big round of minor updates:
- Use pci_get_powerstate()/pci_set_powerstate() in all the other drivers
that need them so we don't have to fiddle with the PCI power management
registers directly.
- Use pci_enable_busmaster()/pci_enable_io() to turn on busmastering and
PIO/memory mapped accesses.
- Add support to the RealTek driver for the D-Link DFE-530TX+ which has
a RealTek 8139 with its own PCI ID. (Submitted by Jason Wright)
- Have the SiS 900/National DP83815 driver be sure to disable PME
mode in sis_reset(). This apparently fixes a problem on some
motherboards where the DP83815 chip fails to receive packets.
(Submitted by Chuck McCrobie <mccrobie@cablespeed.com>)
Justin T. Gibbs [Wed, 21 Feb 2001 20:50:36 +0000 (20:50 +0000)]
aic7xxx.c:
Use the target offset rather than the target Id to reference
the untagged SCB array. The offset and id are identical save
in the twin channel case. This should correct several issues
with the 2742T.
Set the user and goal settings prior to setting the current
settings. This allows the async update routine to filter out
intermediate transfer negotiation updates that may be less
than interesting. The Linux OSM uses this to reduce the amount
of stuff printed to the console.
aic7xxx.seq:
Correct an issue with the aic7770 in twin channel mode.
We could continually attempt to start a selection even
though a selection was already occurring on one channel.
This might have the side effect of hanging our selection
or causing us to select the wrong device.
While here, create a separate polling loop for when we
have already started a selection. This should reduce
the latency of our response to a (re)selection. The diffs
look larger than they really are due to some code rearrangement
to optimize out a jmp.
aic7xxx_freebsd.c:
Use the target offset rather than the target Id to reference
the untagged SCB array. The offset and id are identical save
in the twin channel case. This should correct several issues
with the 2742T.
aic7xxx_inline.h:
Get back in sync with perforce revision ID.
aic7xxx_pci.c:
Identify adapters in ARO mode as such.
Ensure that not only the subvendor ID is correct (9005)
but also that the controller type field is valid before
looking at other information in the subdevice id. Intel
seems to have decided that their subdevice id of 8086
is more appropriate for some of their MBs with aic7xxx
parts than Adaptec's sanctioned scheme.
Add an exclusion entry for SISL (AAC on MB based adapters).
Adapters in SISL mode are owned by the RAID controller, so
even if a driver for the RAID controller is not present,
it isn't safe for us to touch them.
Andrew Gallatin [Wed, 21 Feb 2001 18:48:06 +0000 (18:48 +0000)]
Fix the osfulator in the face of Doug's optimized system call return path.
We now need to set [FRAME_FLAGS] to zero to force a full restore of state
after a signal.
Robert Watson [Wed, 21 Feb 2001 06:39:57 +0000 (06:39 +0000)]
o Move per-process jail pointer (p->pr_prison) to inside of the subject
credential structure, ucred (cr->cr_prison).
o Allow jail inheritence to be a function of credential inheritence.
o Abstract prison structure reference counting behind pr_hold() and
pr_free(), invoked by the similarly named credential reference
management functions, removing this code from per-ABI fork/exit code.
o Modify various jail() functions to use struct ucred arguments instead
of struct proc arguments.
o Introduce jailed() function to determine if a credential is jailed,
rather than directly checking pointers all over the place.
o Convert PRISON_CHECK() macro to prison_check() function.
o Move jail() function prototypes to jail.h.
o Emulate the P_JAILED flag in fill_kinfo_proc() and no longer set the
flag in the process flags field itself.
o Eliminate that "const" qualifier from suser/p_can/etc to reflect
mutex use.
Notes:
o Some further cleanup of the linux/jail code is still required.
o It's now possible to consider resolving some of the process vs
credential based permission checking confusion in the socket code.
o Mutex protection of struct prison is still not present, and is
required to protect the reference count plus some fields in the
structure.
Bruce Evans [Wed, 21 Feb 2001 06:12:38 +0000 (06:12 +0000)]
Don't include "${.CURDIR}/../../Makefile.inc" explicitly. Doing so was
a bogus no-op in the usual case where fortune/ is a subdir of games/
(since <bsd.prog.mk> does an equivalent include automatically if
possible), but breaks building fortune when fortune/ is outside of the
games/ tree (since the include was unconditional here). This fix
depends on a previous fix for non-recursiveness of ../Makefile.inc
(it didn't exist).
Robert Watson [Wed, 21 Feb 2001 05:34:34 +0000 (05:34 +0000)]
o Remove unnecessary jail() check in bpfopen() -- we limit device access
in jail using /dev namespace limits and mknod() limits, not by explicit
checks in the device open code.
Jesper Skriver [Tue, 20 Feb 2001 23:25:04 +0000 (23:25 +0000)]
Only call in_pcbnotify if the src port number != 0, as we
treat 0 as a wildcard in src/sys/in_pbc.c:in_pcbnotify()
It's sufficient to check for src|local port, as we'll have no
sessions with src|local port == 0
Without this a attacker sending ICMP messages, where the attached
IP header (+ 8 bytes) has the address and port numbers == 0, would
have the ICMP message applied to all sessions.
PR: kern/25195
Submitted by: originally by jesper, reimplimented by jlemon's advice
Reviewed by: jlemon
Approved by: jlemon
Alfred Perlstein [Tue, 20 Feb 2001 22:07:36 +0000 (22:07 +0000)]
Fix vinum for both devfs and non-devfs systems.
userland tool:
Use the vfs.devfs.generation sysctl to test for devfs presense
(thanks phk!) when devfs is active it will not try to create the
device nodes in /dev and therefore will not complain about the
failure to do so.
Revert the change in the #define for VINUM_DIR in the kernel
header so that vinum can find its device nodes.
Replace perror() with vinum_perror() to print file/line when
DEVBUG is defined (not defined by default).
kernel:
Don't use the #define names for the "superdev" creation since
they will be prepended by "/dev/" (based on VINUM_DIR), instead
use string constants.
Create both debug and non-debug "superdev" nodes in the devfs.
Problem noticed and fix tested by: Martin Blapp <mblapp@fuchur.lan.attic.ch>
Nick Sayer [Tue, 20 Feb 2001 19:54:31 +0000 (19:54 +0000)]
Fix some glaring insecurities in the prototype firewall configurations.
pass udp from any 53 to ${oip}
allows an attacker to access ANY local port by simply binding his local
side to 53. The state keeping mechanism is the correct way to allow DNS
replies to go back to their source.
Alfred Perlstein [Tue, 20 Feb 2001 12:14:01 +0000 (12:14 +0000)]
forced commit to note that the last delta also reordered some code in
remove_sd_entry() to:
Simplify (hopefully) it by moving all error returns closer to
the beginning of the function.
Return an error when "Error removing subdisk %s: not found in
plex %s\n" would have been reported, as I doubt that we are "OK"
after printing that error message.
Alfred Perlstein [Tue, 20 Feb 2001 11:37:04 +0000 (11:37 +0000)]
Take a shot at making vinum devfs aware.
Adding make_dev() and destroy_dev() calls in (hopefully) the right
places.
This is done by calling make_dev() in each object constructor and
caching the dev_t's returned from make_dev() in each struct
'subdisk'(sd), 'plex' and 'volume' such that the 'object'_free()
functioncs can call destroy dev.
This change makes a subset of the old /dev/vinum appear under devfs.
Enough nodes appear such that I'm able to mount my striped volume.
There may be more work needed to get vinum configuration working
properly.
Kirk McKusick [Tue, 20 Feb 2001 11:14:38 +0000 (11:14 +0000)]
This patch corrects two problems with the rate limiting code
that was introduced in revision 1.80. The problem manifested
itself with a `locking against myself' panic and could also
result in soft updates inconsistences associated with inodedeps.
The two problems are:
1) One of the background operations could manipulate the bitmap
while holding it locked with intent to create. This held lock
results in a `locking against myself' panic, when the background
processing that we have been coopted to do tries to lock the bitmap
which we are already holding locked. To understand how to fix this
problem, first, observe that we can do the background cleanups in
inodedep_lookup only when allocating inodedeps (DEPALLOC is set in
the call to inodedep_lookup). Second observe that calls to
inodedep_lookup with DEPALLOC set can only happen from the following
calls into the softdep code:
Only the first two of these can come from ffs_alloc.c while holding
a bitmap locked. Thus, inodedep_lookup must not go off to do
request_cleanups when being called from these functions. This change
adds a flag, NODELAY, that can be passed to inodedep_lookup to let
it know that it should not do background processing in those cases.
2) The return value from request_cleanup when helping out with the
cleanup was 0 instead of 1. This meant that despite the fact that
we may have slept while doing the cleanups, the code did not recheck
for the appearance of an inodedep (e.g., goto top in inodedep_lookup).
This lead to the softdep inconsistency in which we ended up with
two inodedep's for the same inode.
Reviewed by: Peter Wemm <peter@yahoo-inc.com>,
Matt Dillon <dillon@earth.backplane.com>
John Baldwin [Tue, 20 Feb 2001 10:39:55 +0000 (10:39 +0000)]
- In the KTR_EXTEND case, use a const char * to point to the passed in
filename insteada of copying the first 32 characters of it.
- Add in const modifiers for the passed in format strings and filenames
and their respective members in the ktr_entry struct.
John Baldwin [Tue, 20 Feb 2001 10:25:29 +0000 (10:25 +0000)]
- Add a new ithread_schedule() function to do the bulk of the work of
scheduling an interrupt thread to run when needed. This has the side
effect of enabling support for entropy gathering from interrupts on
all architectures.
- Change the software interrupt and x86 and alpha hardware interrupt code
to use ithread_schedule() for most of their processing when scheduling
an interrupt to run.
- Remove the pesky Warning message about interrupt threads having entropy
enabled. I'm not sure why I put that in there in the first place.
- Add more error checking for parameters and change some cases that
returned EINVAL to panic on failure instead via KASSERT().
- Instead of doing a documented evil hack of setting the P_NOLOAD flag
on every interrupt thread whose pri was SWI_CLOCK, set the flag
explicity for clk_ithd's proc during start_softintr().
John Baldwin [Tue, 20 Feb 2001 09:54:44 +0000 (09:54 +0000)]
- Axe unused macros used by BSD/OS in assembly for KTR tracing.
- Add a __printflike() tag to ktr_tracepoint() in the KTR_EXTEND case to
verify the arguments passed to KTR tracepoints.
John Baldwin [Tue, 20 Feb 2001 09:53:27 +0000 (09:53 +0000)]
- Abolish the 'show ktr_first' and 'show ktr_next' commands.
- Add pager capability to the 'show ktr' command. It functions much like
'ps': Enter at the prompt displays one more entry, Space displays
another page, and any other key quits.
Kris Kennaway [Tue, 20 Feb 2001 08:37:51 +0000 (08:37 +0000)]
Turns out we do need to do bootstrapping of MACHINE_CPU here: make(1) won't
set the variable until you rebuild it, and the alternative is to be stuck
playing games with ``.if defined(MACHINE_CPU) && ... '' for all eternity.
We now set up the reasonable default for i386 and alpha here -- given this
it probably makes sense to remove the corresponding code from make(1).
Luigi Rizzo [Tue, 20 Feb 2001 08:23:41 +0000 (08:23 +0000)]
Preserve alignment of first mbuf in m_copypacket.
This is useful when doing copies of packet where some leading
space has been preallocated to insert protocol headers.
Note that there are in fact almost no users of m_copypacket.
John Baldwin [Tue, 20 Feb 2001 05:26:15 +0000 (05:26 +0000)]
- Don't call clear_resched() in userret(), instead, clear the resched flag
in mi_switch() just before calling cpu_switch() so that the first switch
after a resched request will satisfy the request.
- While I'm at it, move a few things into mi_switch() and out of
cpu_switch(), specifically set the p_oncpu and p_lastcpu members of
proc in mi_switch(), and handle the sched_lock state change across a
context switch in mi_switch().
- Since cpu_switch() no longer handles the sched_lock state change, we
have to setup an initial state for sched_lock in fork_exit() before we
release it.
Andrew Gallatin [Tue, 20 Feb 2001 03:47:59 +0000 (03:47 +0000)]
Sort out the umount breakage introduced in the last 2 revisions.
Please note:
When committing changes to this file, it is important to note that
linux is not freebsd -- their system call numbers (and sometimes names)
are different on different platforms. When in doubt (and you always need
to be) check the arch-specific unistd.h and entry.S files in the linux
kernel sources to see what the syscall numbers really are.
Peter Wemm [Tue, 20 Feb 2001 01:56:52 +0000 (01:56 +0000)]
Place some hooks (__stdin, __stdout, __stderr) into libc for a future
ABI change. There is some serious evilness here to work around some
gcc weaknesses. We need to know the sizeof(FILE) manually until __sF
goes away in the next major bump. We have the size for Alpha and i386,
missing is ia64, ppc and sparc* (and i386 with 64 bit longs).
At some point down the track we can change the stdin etc #defines to
stop hard coding the size of FILE into application binaries.
Lots of head scratching and ideas and testing by: green, imp
Kris Kennaway [Mon, 19 Feb 2001 23:31:53 +0000 (23:31 +0000)]
Remove a remnant of my attempt to get alpha asm code working. OpenSSL
does include code for the alpha, but as far as I can tell, it is
non-functional (e.g. it's not even compiled by the native openssl build on
the alpha).
Ruslan Ermilov [Mon, 19 Feb 2001 14:19:57 +0000 (14:19 +0000)]
Implement one nice feature of original BSD man(1):
: As some manual pages are intended only for specific architectures,
: man searches any subdirectories, with the same name as the current
: architecture, in every directory which it searches. Machine specific
: areas are checked before general areas. The current machine type may
: be overridden by setting the environment variable MACHINE to the name
: of a specific architecture.
Maxim Sobolev [Mon, 19 Feb 2001 13:26:13 +0000 (13:26 +0000)]
Improve pkg_delete(1) behaviour when deleting several packages at once.
Instead of trying to delete packages in the same order as they were specified
in the command line, reorder deletion in such a way that if package A depends
on package B then package A will be deleted before B no matter in which order
they were specified in the command line.
Hajimu UMEMOTO [Mon, 19 Feb 2001 13:13:51 +0000 (13:13 +0000)]
Enable AI_ADDRCONFIG as a valid flag of getaddrinfo(3). Some
applications specify AI_ADDRCONFIG and fail to run under FreeBSD.
Latest mews is known. Now, getaddrinfo(3) behaves according to
AI_ADDRCONFIG.
Ruslan Ermilov [Mon, 19 Feb 2001 13:08:14 +0000 (13:08 +0000)]
Create directory infrastructure required to format, display
and store preformatted /usr/share/man manual pages in 8-bit
iso-8859-1 charset for all *_*.ISO_8859-1 locales.
Stephen McKay [Mon, 19 Feb 2001 12:04:46 +0000 (12:04 +0000)]
There is an arbitrary file size limit in ctm of 20MB. By my reckoning,
ports/INDEX,v is currently 19.97MB and will blow this limit on the next
update. Let's try doubling the limit again, to give us time to get
around to removing the limit altogether.
Bruce Evans [Mon, 19 Feb 2001 09:40:58 +0000 (09:40 +0000)]
Fixed a longstanding latency bug in signal delivery. When a signal
is sent to a process, psignal() needs to schedule an AST for the
process if the process is runnable, not just if it is current, so that
pending signals get checked for on the next return of the process to
user mode. This wasn't practical until recently because the AST flag
was per-cpu so setting it for a non-current process would usually just
cause a bogus AST for the current process.
For non-current processes looping in user mode, it took accidental
(?) magic to deliver signals at all. Signals were usually delivered
late as a side effect of rescheduling (need_resched() sets astpending,
etc.). In pre-SMPng, delivery was delayed by at most 1 quantum (the
need_resched() call in roundrobin() is certain to occur within 1
quantum for looping processes). In -current, things are complicated
by normal interrupt handlers being threads. Missing handling of the
complications makes roundrobin() a bogus no-op, but preemptive
scheduling sort of works anyway due to even larger bogons elsewhere.
Peter Wemm [Mon, 19 Feb 2001 04:43:21 +0000 (04:43 +0000)]
${BDECFLAGS} work. And fix a real error in the process. A "MAXUSERS"
string could have been passed to free(); There are some warnings here
I am not sure how to fix as they are in the lex scanner code, etc.
Bruce Evans [Mon, 19 Feb 2001 04:15:59 +0000 (04:15 +0000)]
Changed the aston() family to operate on a specified process instead of
always on curproc. This is needed to implement signal delivery properly
(see a future log message for kern_sig.c).
Debogotified the definition of aston(). aston() was defined in terms
of signotify() (perhaps because only the latter already operated on
a specified process), but aston() is the primitive.
Similar changes are needed in the ia64 versions of cpu.h and trap.c.
I didn't make them because the ia64 is missing the prerequisite changes
to make astpending and need_resched per-process and those changes are
too large to make without testing.
Kris Kennaway [Mon, 19 Feb 2001 03:59:05 +0000 (03:59 +0000)]
Introduce support for using OpenSSL ASM optimizations. This is done
through the use of a new build directive, MACHINE_CPU, which contains a
list of the CPU generations/features for which optimizations are desired.
This feature will be extended to cover the ports tree in the future.
Currently OpenSSL provides optimizations for i386, i586 and i686-class
CPUs. Currently it has not been tested on an i386 or i486.
Teach make(1) to provide sensible defaults for MACHINE_CPU if it is not
defined (namely, the lowest common denominator CPU we support for each
architecture). Currently this is i386 for the i386 architecture and ev4
for the alpha. sys.mk also sets the variable as a last resort for
consistency with MACHINE_ARCH and bootstrapping from very old versions of
make.
Benchmarks show a significant speed increase even in the i386 case, with
additional improvements for i586 and i686 systems. For maximum performance
define MACHINE_CPU=i686 i586 i386 in /etc/make.conf.
Based on a patch submitted by: Mike Silbersack <silby@silby.com>
Reviewed by: current
Bruce Evans [Mon, 19 Feb 2001 03:00:34 +0000 (03:00 +0000)]
Fixed style bugs in clock.c rev.1.164 and cpu.h rev.1.52-1.53 -- declare
tsc_present in the right places (together with other variables of the
same linkage), and don't use messy ifdefs just to avoid exporting it in
some cases.
Peter Wemm [Mon, 19 Feb 2001 02:47:42 +0000 (02:47 +0000)]
Move the sendmail -q from cron to periodic, as suggested by a few people.
This has the benefit of adding a random start time element as daily
processing takes a different amount of time on different machines.