Commit Graph

59 Commits

Author SHA1 Message Date
tron 71b58bd028 Don't allocate block buffers on the stack. This can cause stack overflows
in the kernel and breaks SSP builds.
2009-09-11 09:28:34 +00:00
haad 7147ed320b Add work in support for compiling ccd and cgd drivers as a modules. I forgot
to committ when I have written device module autoloading stuff.
2009-06-05 19:21:02 +00:00
apb caccc8126b Pass DIOCCACHESYNC ioctl down to the underlying disk.
Addresses PR 41016.
2009-03-14 17:56:47 +00:00
cegger 08ebead94e make this compile 2009-01-11 09:51:38 +00:00
christos 461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
christos f63c93ecac PR/38735: Jonathan A. Kollasch: add the ability for cgd to be used on top of wedges 2008-11-21 20:14:20 +00:00
christos 66f8c2438f PR/39525: Joachim Schueth, Frederik Sausmikat:
cgd inadvertently encrypts blkno eight times to generate IV
Add "encblkno1" IV type to encrypt only once, rename old "encblkno" to
"encblkno8" for clarity, and make "encblkno" an alias for "encblkno8"
for backward compatibility.
2008-09-12 16:51:54 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
ad 0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
ad 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
pooka 61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +00:00
ad 2af68666da Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
2007-10-08 16:41:05 +00:00
ad eb171eaaa7 It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
2007-07-29 12:50:17 +00:00
cube 954bc13440 Change dk_lookup() to accept an additional argument of the type enum uio_seg
that tells whether the given path is in user space or kernel space, so it
can tell NDINIT().

While the raidframe calls were ok, both ccd(4) and cgd(4) were passing
pointers to user space data, which leads to strange error on i386, as
reported by Jukka Salmi on current-users.

The issue has been there since last august, I'm actually a bit surprised
that no one in the meantime has used ccd(4) or cgd(4) on an arch where it
would have simply faulted.
2007-06-26 15:22:23 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
cbiere 810b552f37 cgd_ioctl_set():
* Corrected type of keybytes to size_t to prevent a potential buffer
    overflow on 64-bit archs.
  * Fixed incorrect but harmless use of sizeof.
hexprint():
  * Corrected cast to prevent sign extension if char is signed.
2007-01-19 18:59:59 +00:00
christos 491c94e1fc - remove size check; the init functions do it.
- fix size_t/int confusion
- caddr_t -> void *
2006-12-01 15:52:55 +00:00
christos 853fed0ed7 prevent blocksizes > 4K. 2006-11-25 21:13:23 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
xtraeme 4a09170d84 Use __unused in function arguments where appropiate. (hi christos) 2006-10-12 06:56:47 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
ad 3029ac48c7 - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
2006-07-21 16:48:45 +00:00
christos 709b2e6f55 don't allocate too much stuff on the stack. 2006-06-20 03:20:44 +00:00
elad 2867b68bc3 integrate kauth. 2006-05-14 21:42:26 +00:00
xtraeme b2bb747d7c Make this build again (remove unused variable). 2006-01-04 17:16:35 +00:00
yamt 690d424f28 - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
2006-01-04 10:13:05 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt 464cf44f6c dksubr: do b_blkno -> b_rawblkno translation earlier so that bufq can uses it. 2005-10-18 00:14:43 +00:00
yamt aec75b1cc6 - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
  have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
  from sys/bufq.h to sys/bufq_impl.h.
  (is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c.  (not tested)
2005-10-15 17:29:10 +00:00
yamt 5cb036f6e3 add wedge support to xbd and cgd. 2005-08-20 12:03:52 +00:00
yamt bc505ef8dd use pseudo_disk_{init,attach,detach} where appropriate. 2005-08-20 12:01:04 +00:00
drochner 9b0c17575e constification fallout 2005-06-28 20:23:02 +00:00
drochner 31924c84cd cast-qual fallout 2005-05-31 19:20:37 +00:00
xtraeme 9db2752f7e Make this build with "-Wcast-qual -Wshadow". 2005-05-31 02:50:59 +00:00
explorer 4efbb8a57b Looks like a 'struct buf *bp' was left over from a previosu commit. Since kernel builds stop on this, removing it. 2005-03-31 16:46:13 +00:00
yamt 99229e5d39 introduce a function to drain bufq and use it where appropriate. 2005-03-31 11:28:53 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
yamt 05f25dcc2a move buffer queue related stuffs from buf.h to their own header, bufq.h. 2004-10-28 07:07:35 +00:00
yamt 4a85dda9fc fix debug printf formats to match with the recent sys/buf.h.
a patch provided by Ryo HAYASAKA.  PR/27138.
2004-10-04 11:12:09 +00:00
thorpej 4152bad13d Remove a comment that doesn't really make sense. 2004-08-23 05:38:15 +00:00
thorpej a1bb10ef89 Use static in a few more places. 2004-08-23 05:37:42 +00:00
dbj 092bb86443 . eliminate cgd specific buffer pool, use bufpool instead
and store previous buffer in bp->b_private.
. don't bother to raise splbio in cgdiodone
. use V_INCR_NUMOUTPUT
2004-07-19 13:46:23 +00:00
elric befeae8929 Modified the dksubr routines to:
o  expect the disk's start routine to return an int.  If the
	   int is non-zero, we enqueue the request and try again
	   later.
	o  have a dk_start() routine which runs the request queue.
	o  have a dk_iodone() function which should be called by the
	   driver using the framwork from its iodone.  dk_iodone will
	   retry the queue since presumably further progress may be
	   possible once a request is complete.  It is required that
	   the underlying driver have the resources to keep at least
	   one transaction in flight at any time.

Modified cgd to:

	o  be able to keep one transaction in flight at any time
	   (almost) by keeping a buffer of size MAXPHYS in its softc
	   and use it.

We still need to make the cgd_cbufpool per device rather than global
and provide a low water mark for it.

Addresses PR: kern/24715
(at least according to the submitter.)
2004-03-27 23:23:06 +00:00
dan b912bfcc09 Fix a longstanding bug in key-handling for the blowfish cipher.
This is an incompatible change, and will break all existing cgd images
encrypted with blowfish. Users will need to dump their data before
booting a kernel with this change, and recreate cgd's and restore data
afterwards.

I believe this affects a very small number of users other than myself;
indeed after several alert mails in an attempt to find them, only 2
such users have come forward. They have both agreed the requirement
for backwards compatibility does not warrant the effort nor the mess
in the code.  This code does exist, if it should later prove to be
needed, but will not be in the tree.

Further, by the nature of the issue, I have strong reasons to believe
that, even if they missed these mails, there would be few other users
of blowfish who update their systems with any regularity; any such
users would have tripped over the problem in the same way I did when
it was first found over a year ago.

The problem stems from two issues with the underlying blowfish
encryption routines used by cgd:
 - they take key length arguments counted in bytes, rather than bits
   like all the opther ciphers.
 - they silently truncate any keys longer than an internal limit,
   rather than returning an error (which would have exposed the
   previous discrepancy immediately).

As a result, the kernel reads too much data as the key from cgdconfig,
and then truncates most of it. This can easily be demonstrated/tested.
Currently, Blowfish users will find that if they mis-enter the cgd
passphrase on the first attempt, when validation fails and cgdconfig
prompts for the passphrase again, the cgd will not correctly configure
even when given a correct passphrase.
2004-03-18 10:42:08 +00:00
hannken 3db4e2acd8 Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.
VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp)  Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp)      Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
2004-01-25 18:06:48 +00:00
yamt 7266a95907 store a i/o priority hint in struct buf for buffer queue discipline. 2004-01-10 14:39:50 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
agc 23a6c4c9b7 Test the right variable after allocating space, and then get rid of an
unused local variable.
2003-05-17 14:26:30 +00:00