Commit Graph

4251 Commits

Author SHA1 Message Date
jdc
a406dfbd14 Rename 'ncpus' to '_ncpus', otherwise we shadow sparc/sparc64's 'ncpus'
when MULTIPROCESSOR is defined.
2005-06-05 21:22:20 +00:00
thorpej
daf3614dbb Remove this version of genassym; nothing uses it. 2005-06-05 18:26:19 +00:00
jdc
f13fcfe512 Rename 'ncpus' to '_ncpus', otherwise we shadow sparc/sparc64's 'ncpus'
when MULTIPROCESSOR is defined.
2005-06-05 09:04:49 +00:00
uwe
fb2315c16b Constify argument to ttyldisc_lookup and ttyldisc_remove. 2005-06-04 22:45:11 +00:00
he
1d07c48176 An Elf32_Addr can't be cast to caddr_t without first being cast to intptr_t
without causing a warning (turned into error).  Fixes build problem for amd64.
2005-06-03 13:30:10 +00:00
matt
25a0e29a75 When writing coredumps, don't write zero uninstantiated demand-zero pages.
Also, with ELF core dumps, trim trailing zeroes from sections.  These two
changes can shrink coredumps by over 50% in size.
2005-06-02 17:01:43 +00:00
explorer
48c9742722 restore NetBSD RCS tag in __KERNEL_RCSID() macro 2005-06-02 15:48:11 +00:00
tron
a40b37b948 Change first argument of m_copydata() back to "struct mbuf *" because
m_copydata() might eventually modify the "mbuf" structure to support
lazy mbuf mapping as pointed out by YAMAMOTO Takashi on "tech-net".
2005-06-02 15:19:28 +00:00
tron
c4f68c0d95 Add missing RCS id. Problem pointed out by Jukka Salmi. 2005-06-02 12:58:16 +00:00
tron
f0abca45e5 Fix bad botch invented in last change. 2005-06-02 12:42:10 +00:00
tron
c54394a240 Change the first argument of m_copydata() to "const struct mbuf *" (which
doesn't require any implementation changes). This will allow us to get
rid off a lot of nasty type casts.
2005-06-02 10:34:59 +00:00
blymn
92bd9a35e9 Fix function variable names shadowing global declarations. 2005-06-01 13:12:49 +00:00
drochner
49d230fa91 need a "const" 2005-06-01 12:27:15 +00:00
chs
3f15e64c3c rename "kbucket" to "kmembuckets", for greater clarity.
don't forget to update vmstat this time.
2005-05-30 23:04:53 +00:00
christos
05e9e5eae6 rename delay. 2005-05-30 22:15:38 +00:00
thorpej
749453ad62 This copy of genassym.sh is now obsolete. PR toolchain/30350 2005-05-30 15:56:47 +00:00
martin
0621296675 Close additional file descriptors if we set MSG_CTRUNC in a SCM_RIGHTS
message. From der Mouse in PR kern/30370.
2005-05-30 11:21:11 +00:00
christos
f63d439f2a finish bucket -> kbucket change 2005-05-30 04:15:17 +00:00
christos
efb6943313 - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
2005-05-29 22:24:14 +00:00
christos
6639138da1 Now we can fix the volatile cast-aways.
Rename some shadowed variables while here.
2005-05-29 21:16:14 +00:00
christos
b636cdfe8a Regen 2005-05-29 21:11:30 +00:00
christos
44285e060d Argument for swapctl cannot be const, since it gets loaded with swap
statistics.
2005-05-29 21:07:49 +00:00
elad
686a5b23f6 Make veriexec_fp_cmp() a bit more useful by allowing it to compare two
fingerprints based on a common algorithm without requiring an actual
entry in the tables.
2005-05-29 16:07:10 +00:00
elad
65b04a0bf1 Use PAGE_SIZE chunks, not VERIEXEC_BUFSIZE - it's very important that the
size is not arbitrary and is exactly the size of a page.
2005-05-28 16:37:20 +00:00
elad
dbc8605f39 - Add VERIEXEC_OPINIT() and veriexec_add_fp_ops(), simplifying the addition
of fingerprinting algorithms to the ops vector.

- Cleanup in veriexec_add_fp_name().

- Remove veriexec_default_ops and use the above API for adding the default
  methods in veriexec_init_fp_ops().
2005-05-28 15:49:36 +00:00
elad
a2c658e922 Add indication for number of fingerprinted files on each device.
When a table is created for a new device, a new variable is created
under the kern.veriexec.count node named "dev_<id>". For example,
dev_0, dev_3, etc.
2005-05-22 22:34:01 +00:00
christos
7cdea212c0 No 0x in front of %p... 2005-05-22 15:54:45 +00:00
wrstuden
6336cd3696 The file being closed is (fdp->fd_lastfile - i), not i. So compare
(fdp->fd_lastfile - i) against fd_knlistsize. Otherwise we can
call knote_fdclose() on a file descriptor that doesn't have a knote.

This issue explains random panics I have had on process exit over the
past few years.
2005-05-20 16:13:00 +00:00
elad
5888b16eef Some changes in veriexec.
New features:

  - Add a veriexec_report() routine to make most reporting consistent and
    remove some common code.
  - Add 'strict' mode that controls how veriexec behaves.
  - Add sysctl knobs:
     o kern.veriexec.verbose controls verbosity levels. Value: 0, 1.
     o kern.veriexec.strict controls strict level. Values: 0, 1, 2. See
       documentation in sysctl(3) for details.
     o kern.veriexec.algorithms returns a string with a space separated
       list of supported hashing algorithms in veriexec.
  - Updated documentation in man pages for sysctl(3) and sysctl(8).

Bug fixes:

  - veriexec_removechk(): Code cleanup + handle FINGERPRINT_NOTEVAL
    correctly.
  - exec_script(): Don't pass 0 as flag when executing a script; use the
    defined VERIEXEC_INDIRECT - which is 1. Makes indirect execution
    enforcement work.
  - Fix some printing formats and types..
2005-05-19 20:16:19 +00:00
cube
9a1ab71f5f Add P_CLDSIGIGN, P_NOCLDSTOP and P_NOCLDWAIT to the list of flags we want
to inherit from the parent process.
2005-05-17 19:22:19 +00:00
christos
362a4a0bd5 Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
2005-05-17 04:14:57 +00:00
christos
6919a4b65c don't unlock twice. 2005-05-09 23:40:20 +00:00
christos
3b37af53b0 lock all uses of uidhash. provide macros to lock and unlock. based on more
discussions with yamt.
2005-05-09 11:10:07 +00:00
christos
0c55badfae Protect chgsbsize() with splsoftnet(). As discussed with yamt. 2005-05-09 03:27:21 +00:00
christos
8dc75b1c08 Panic strings should not end with \n. 2005-05-08 18:44:39 +00:00
christos
761bd09636 PR/30154: YAMAMOTO Takashi: tcp_close locking botch
chgsbsize() as mentioned in the PR can be called from an interrupt context
via tcp_close(). Avoid calling uid_find() in chgsbsize().
- Instead of storing so_uid in struct socketvar, store *so_uidinfo
- Add a simple lock to struct uidinfo.
2005-05-07 17:42:09 +00:00
martin
e8c879147d In m_pulldown avoid a prepend to the next mbuf in the chain if the result
would still not have all data we want continous.
Fixes PR kern/30098.
2005-05-06 09:40:40 +00:00
manu
89647c7ca6 First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
2005-05-03 16:26:27 +00:00
blymn
9c99b5674f Don't adjust the size of the hash table on file removes, it breaks things. 2005-04-26 10:45:41 +00:00
lukem
3fd1802e62 Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.
2005-04-25 15:02:02 +00:00
blymn
d725d86471 Fix possible bad memory reference, add panic on inconsistent state. 2005-04-24 12:58:26 +00:00
blymn
877d9e76c3 Remove bogus DIAGNOSTIC check and panic. 2005-04-23 09:10:47 +00:00
blymn
8387760ed1 Rototill of the verified exec functionality.
* We now use hash tables instead of a list to store the in kernel
    fingerprints.
  * Fingerprint methods handling has been made more flexible, it is now
    even simpler to add new methods.
  * the loader no longer passes in magic numbers representing the
    fingerprint method so veriexecctl is not longer kernel specific.
  * fingerprint methods can be tailored out using options in the kernel
    config file.
  * more fingerprint methods added - rmd160, sha256/384/512
  * veriexecctl can now report the fingerprint methods supported by the
    running kernel.
  * regularised the naming of some portions of veriexec.
2005-04-20 13:44:45 +00:00
mrg
1ec9145306 be explicit in the description for POSIX saved set-id that this is for
POSIX-style, not sane-style.  (ie, add "POSIX " to the description.)
2005-04-18 10:46:39 +00:00
hannken
23bc271d48 `lkmlookup()' is called with its name argument either from kernel or from
user space. Add an argument `need_copyin' to only use `copyinstr()' if
the name is from user space.

modstat -n NAME works again.

Reviewed by: Peter Postma <peter@netbsd.org>
2005-04-12 14:13:16 +00:00
itohy
34088139ab The definition of IRFRAMEDISC (10) is incorrect since the value is dynamic.
The *DISC definition is only for backward compatibility with deprecated
TIOC[GS]ETD ioctls, and not needed for new TIOC[GS]LINED ioctls.
The value of IRFRAMEDISC has never been correct, so we don't have any
compatibility to be kept.
Just remove the IRFRAMEDISC defintion.
2005-04-10 14:28:11 +00:00
christos
92987fed44 Reset SIGCHLD handler if it is ignored, and clear the P_CLDSIGIGN bit. It
does not make sense to inherit this across execs. From FreeBSD.
2005-04-09 16:07:52 +00:00
yamt
9eabef72e3 don't #include unnecessary headers. 2005-04-07 12:12:51 +00:00
yamt
2fc4b4f5e7 sys_mount:
- reject attempts of MNT_GETARGS + other MNT_xxx.
- don't modify mnt_flags needlessly for MNT_GETARGS.
  a stopgap fix for PR/29898.
2005-04-06 13:49:31 +00:00
yamt
dad03fda36 introduce new types, blist_bitmap_t and blist_blkno_t,
and use them instead of uint64_t.
make them 32-bit for now because it's what swap slot allocation code uses.
2005-04-06 13:09:10 +00:00
yamt
a1bde39425 move implementation details from blist.h into subr_blist.c. 2005-04-06 11:36:37 +00:00
yamt
a1e1c4e82e - add a missing cast in the 1-bit optimization case of blst_leaf_alloc.
- use uint64_t rather than daddr_t/u_daddr_t and rename SWAP -> BLIST.

XXX 32 bit is enough?  will revisit later.
2005-04-06 11:35:54 +00:00
yamt
2c8d11ba2b make blist compilable on netbsd. 2005-04-06 11:33:54 +00:00
yamt
186b3b1026 bring in blist from freebsd as-is. 2005-04-06 11:32:06 +00:00
yamt
6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
yamt
99229e5d39 introduce a function to drain bufq and use it where appropriate. 2005-03-31 11:28:53 +00:00
chs
c92634930b fix validation of new values when setting vm.{hi,low}water. fixes PR 29651. 2005-03-31 02:34:10 +00:00
christos
f9a341d1f6 PR/19837: Stephen Ma: signal(SIGCHLD, SIG_IGN) should not create zombies. 2005-03-30 17:07:50 +00:00
christos
518587967d Re-enable chgsbsize. It should work now. 2005-03-29 18:18:06 +00:00
he
8c10d661b0 Properly disable the bulk of chgsbsize(), completing revision 1.84.
This does an #if 0 / #endif, so that no code (or declarations!) are
left after the first "return 1", making this compilable for vax and
playsation2 again, both of which use gcc 2.95.3 or similar.
2005-03-29 15:57:17 +00:00
thorpej
e633e8b61b - Define a VFS_ATTACH() macro that places a reference to a vfsops structure
into the "vfsops" link set.
- Use VFS_ATTACH() where vfsops are declared for individual file systems.
- In vfsinit(), traverse the "vfsops" link set, rather than vfs_list_initial[].
2005-03-29 02:41:05 +00:00
matt
9034eca609 Add code to preen proc0 cache fter loading a LKM.
(conditional on PMAP_NEED_PROCWR)
2005-03-27 08:34:41 +00:00
fvdl
c487efe4a7 Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
  that will return the default VM map address. The default function
  is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
  macro. This gives emulations control over the default map address,
  and allows things to be mapped at the right address (in 32bit range)
  for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
  or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
  instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
2005-03-26 05:12:34 +00:00
christos
b279845eed Don't free the wrong lock. Pointed out by Konrad Schroder 2005-03-25 22:48:23 +00:00
christos
ae9d3eacae Avoid a possible race during the time we give up our lock in order to
allocate memory. (From yamt)
2005-03-23 04:01:04 +00:00
christos
e0ba8227a7 Don't call malloc with a simple_lock held. Thanks to Greg Oster for pointing
my stupid mistake.
2005-03-23 01:16:44 +00:00
christos
cb282cd325 Keep track and limit the number of locks per uid. From OpenBSD 2005-03-20 19:16:33 +00:00
christos
f7c5085de0 It does not make sense to free the uidinfo struct since it is used now
for multiple things (proccnt,lockcnt,sbsize) and it adds too much code
complexity. Instead add a uid_find() routine that returns the existing
struct or allocates a new one.

Re-enable the sbsize limit code.
2005-03-20 19:15:48 +00:00
bouyer
e97ceab999 Fix off-by-one bug which would cause a region at the end of the extent
to be alloctated multiple times:
- we're allocating region of size 1
- there are holes in the extent, but all of size larger than 1
- there are 2 contigous allocations at the end of the extent, the last one
  being of size 1.
While there fix a DIAGNOSTIC check: to check that a region is inside the extent
we need to check start and end, not only start.
2005-03-15 18:22:24 +00:00
christos
d232675d86 PR/29679: Gunnar.Ritter: fstat() blksize on the write side of the pipe returns
0. Fix it by returning the peer's block size.
XXX: This is the minimal fix. Probably the buffer size should be initialized
somewhere else, but probably this would need some more code changes.
2005-03-12 18:43:42 +00:00
atatat
5b8a6c916d Revert the change that made kern.file2 and net.*.*.pcblist into nodes
instead of structs.  It had other deleterious side-effects that are
rather nasty.  Another solution must be found.
2005-03-11 06:16:15 +00:00
atatat
ca63da437a Change types of kern.file2 and net.*.*.pcblist to NODE 2005-03-10 05:43:25 +00:00
atatat
7c62c74d09 Add the following nodes to the sysctl tree:
net.local.stream.pcblist
	net.local.dgram.pcblist
	net.inet.tcp.pcblist
	net.inet.udp.pcblist
	net.inet.raw.pcblist
	net.inet6.tcp6.pcblist
	net.inet6.udp6.pcblist
	net.inet6.raw6.pcblist

which allow retrieval of the pcbs in use for those protocols.  The
struct involved is 32/64 bit clean and incorporates parts of struct
inpcb, struct unpcb, a bit of struct tcpcb, and two socket addresses.
2005-03-09 05:07:19 +00:00
atatat
529b14ddf5 Add kern.file2. As kern.proc2 is to kern.proc, so is kern.file2 to
kern.file, namely a 32/64 bit clean sysctl interface to the same data.
It also borrows a few things from struct vnode (if applicable) and
from struct proc, just to tie things together a bit more.

You can walk this list "by file" or "by pid".  The former method is
similar to kern.file but omits the filehead, and the latter can give
you duplicates if multiple processes have the same struct file open,
but tells you which process it is.
2005-03-09 05:02:17 +00:00
wrstuden
a758abc39e Adjust error case handling. If the VOP_LOOKUP() call unlocked the
parent directory node, remember that.

Addresses locking/lookup issues seen in:

http://mail-index.NetBSD.org/tech-kern/2004/06/20/0019.html
http://mail-index.netbsd.org/tech-kern/2005/01/08/0000.html
2005-03-08 17:29:29 +00:00
yamt
f81c9770f3 bufq_priocscan_get: don't update state in the case of !remove. fix BUFQ_PEEK. 2005-03-03 05:00:22 +00:00
christos
8eb274055a Some ibcs2 binaries need executable stacks. Thanks to J Chapman Flack
for determining this and coming up with a fix.
2005-03-03 04:39:37 +00:00
mycroft
b9c71ccc7a Copyright maintenance. 2005-03-02 11:05:34 +00:00
perry
77f2a006d0 regen 2005-02-26 23:58:19 +00:00
perry
aaec764348 get rid of trailing spaces in the "created from" line (constructed by
stripping the $s from $NetBSD$ in the source file.)
2005-02-26 23:32:31 +00:00
perry
b244cb9316 regen 2005-02-26 22:15:10 +00:00
perry
573311af21 revert trailing whitespace change -- it had unintended consequences 2005-02-26 22:14:39 +00:00
perry
ba7c4ed2a6 regen 2005-02-26 22:10:31 +00:00
perry
f05ce97c60 remove some trailing spaces in generated output when removing $s from $NetBSD$ 2005-02-26 22:06:38 +00:00
perry
deef459f67 Change the DO NOT EDIT warning slightly, including the text "DO NOT EDIT".
(It is nice if all files that should not be edited have DO NOT EDIT in them.)
2005-02-26 21:40:45 +00:00
perry
da8abec863 nuke trailing whitespace 2005-02-26 21:34:55 +00:00
matt
7eddba88c0 Add the code for pselect and pollts. Add selcommon and pollcommon to
<sys/select.h> and <sys/poll.h>.
2005-02-25 19:56:07 +00:00
matt
47a6f2d4b0 Regen. (for pselect and pollts) 2005-02-25 19:55:18 +00:00
matt
124745835a Add pselect and pollts 2005-02-25 19:53:56 +00:00
heas
57cef74601 Expose sysctl_root node to kernel sources. It will be used by FreeBSD sysctl
emulation.
2005-02-20 19:43:46 +00:00
matt
832084d8ae Regen. (no actual differences) 2005-02-19 22:19:02 +00:00
matt
16cf76fdc3 Add placeholders for sys_pselect and sys_pollts 2005-02-19 22:15:51 +00:00
peter
e5d29518c6 Remove one repeated word. From Martin Végiard. 2005-02-18 00:21:37 +00:00
peter
dc3b7c44eb Fix a typo, recieve -> receive. From Martin Végiard. 2005-02-18 00:17:13 +00:00
elric
e6e79dacef The API for ksyms_getval_from_kernel changed. 2005-02-16 00:30:28 +00:00
cube
9367bbf87b The way I handled /dev/ksyms requests vs. kernel requests was completely
broken.  Inside the kernel, we always have to use the real values of the
st_name fields, and only do the math when the request comes from userland.

No need for ksyms_getval_from{kernel,userland} hack anymore.  However, a
different version will be asked for pull-up in -2{,-0}, one that doesn't
break the API, that is.

Fixes PR#29133 from Jens Kessmeier.
2005-02-15 21:09:57 +00:00
christos
be3704c73f pass the flag to fdclone. 2005-02-12 23:14:03 +00:00
fvdl
7b10f1cabc Don't panic when lwp_suspend finds an LWP on another CPU, just return
EINVAL for now.
2005-02-12 21:39:00 +00:00
jmc
02a4880993 vm_map_max needs a struct pointer, so add a missing deref here 2005-02-12 09:38:25 +00:00
chs
467487d274 use vm_map_{min,max}() instead of dereferencing the vm_map pointer directly.
define and use vm_map_set{min,max}() for modifying these values.
remove the {min,max}_offset aliases for these vm_map fields to be more
namespace-friendly.  PR 26475.
2005-02-11 02:12:03 +00:00