Commit Graph

9818 Commits

Author SHA1 Message Date
riastradh
56272c962e Don't walk off the end of the dirent buffer.
From Ilja Van Sprundel.
2017-07-28 15:37:23 +00:00
riastradh
cf5a000fe5 Clamp the length we use, not the length we don't.
Avoids uninitialized memory disclosure to userland.

From Ilja Van Sprundel.
2017-07-28 15:16:39 +00:00
martin
f08cc415b0 Avoid integer overflow in kern_malloc(). Reported by Ilja Van Sprundel.
XXX Time to kill malloc() completely!
2017-07-28 12:28:48 +00:00
skrll
111cbb5944 Add a condition variable (ex_flwanted) to struct extent so that ex_flags
becomes an invariant.

Remove strange locking for ex_flags as a result.
2017-07-24 19:56:07 +00:00
maxv
d245e6f22a Should be loadfactor(). 2017-07-14 13:23:48 +00:00
maxv
bcdfaccefa Revert rev1.26. l_estcpu is increased by only one cpu, not all of them. 2017-07-14 13:02:20 +00:00
hannken
31624a0218 Regen. 2017-07-12 09:31:59 +00:00
hannken
d29c150b3b As VOP_ADVLOCK() may block indefinitely we cannot take fstrans here.
Fixes PR kern/52364: System hangs not much before showing the login prompt
2017-07-12 09:31:07 +00:00
dholland
9a94872476 Fix vnode leak on error, introduced by the openat family changes in -r1.200.
From mjg@freebsd.
2017-07-09 22:48:44 +00:00
maxv
5dc461da23 explain a bit 2017-07-08 15:15:43 +00:00
christos
c85be1e9c7 move the timestamp stuff to uipc_socket.c because it already has the compat
includes.
2017-07-06 17:42:39 +00:00
christos
2b50acc97b Merge the two copies SO_TIMESTAMP/SO_OTIMESTAMP processing to a single
function, and add a SOOPT_TIMESTAMP define reducing compat pollution from
5 places to 1.
2017-07-06 17:08:57 +00:00
christos
c3a5f17a00 don't print diagnostic for AF_LINK 2017-07-05 17:54:46 +00:00
riastradh
0a89dacf06 Add cv_timedwaitbt, cv_timedwaitbt_sig.
Takes struct bintime maximum delay, and decrements it in place so
that you can use it in a loop in case of spurious wakeup.

Discussed on tech-kern a couple years ago:

https://mail-index.netbsd.org/tech-kern/2015/03/23/msg018557.html

Added a parameter for expressing desired precision -- not currently
interpreted, but intended for a future tickless kernel with a choice
of high-resolution timers.
2017-07-03 02:12:47 +00:00
riastradh
a18efaac6b Nix trailing whitespace. No functional change. 2017-07-03 00:53:33 +00:00
joerg
5f391f4ae2 Export the guard size of the main thread via vm.guard_size. Add a
complementary writable sysctl for the initial guard size of threads
created via pthread_create. Let the existing attribut accessors do the
right thing. Raise the default guard size for threads to 64KB.
2017-07-02 16:41:32 +00:00
christos
6d52cc85b8 don't warn about AF_LINK sockets with sa_len less than the size of the sockaddr 2017-07-02 02:39:18 +00:00
christos
c4aed00fad fix file descriptor locking (from joerg).
fixes kernel crashes by running go
XXX: pullup-7
2017-07-01 20:08:56 +00:00
christos
7700e78cab put the code that returns the sizeof the socket by family in one place. 2017-07-01 16:59:12 +00:00
snj
4e609ee710 fix typo 2017-06-25 04:10:47 +00:00
joerg
b77121f193 Recommit exec_subr.c revision 1.79:
Always include a 1MB guard area beyond the end of stack. While ASLR will
  normally create a guard area as well, this provides a deterministic area
  for all binaries.

  Mitigates the rest of CVE-2017-1000374 and CVE-2017-1000375 from
  Qualys.

Additionally, change VM_DEFAULT_ADDRESS_TOPDOWN to include
user_stack_guard_size in the size reservation.
2017-06-23 21:28:38 +00:00
skrll
34397172e3 Unwrap two lines. NFC. 2017-06-22 09:05:09 +00:00
martin
8ee7e18703 Change a KASSERT to KASSERTMSG and print the xcall function to be
invoked as a debugging help.
2017-06-21 07:39:04 +00:00
christos
f4961bd8ed Change len type to be unsigned int for consistency with the input type.
Don't check for negative; it does not matter we clamp anyway. This
broke the compat32 getsockname() where an unitialized socklen_t ended
up randomly negative causing it to fail.
2017-06-20 20:34:49 +00:00
joerg
2e851f5508 Revert for the moment, creates problems on i386. 2017-06-19 19:02:16 +00:00
joerg
5bcc4a51d6 Always include a 1MB guard area beyond the end of stack. While ASLR will
normally create a guard area as well, this provides a deterministic area
for all binaries.

Mitigates the rest of CVE-2017-1000374 and CVE-2017-1000375 from
Qualys.
2017-06-19 15:53:16 +00:00
hannken
a94bf97d25 Make the fast path of fstrans_get_lwp_info() "static inline". 2017-06-18 14:00:17 +00:00
hannken
90e2dee24a Clear fstrans entries whose mount is gone from the last fstrans_done() only. 2017-06-18 13:59:45 +00:00
chs
2b3f157429 create an nmap table for module symtabs too.
needed by dtrace.
2017-06-14 00:52:37 +00:00
riastradh
26bd73f202 Add heading comment for private localcount_adjust subroutine. 2017-06-12 21:08:34 +00:00
riastradh
44df486bb8 Move forward declaration to top of file.
Keep header comment above localcount_init adjoined to it.

No functional change.
2017-06-12 21:07:14 +00:00
chs
20bf3061d4 define a copy of getnanotime() named dtrace_getnanotime() so that
dtrace can know from the name that it should not allow setting
fbt probes on it.  needed by dtrace.
2017-06-09 01:16:33 +00:00
chs
3756187172 add some pool_allocators for pool item sizes larger than PAGE_SIZE.
needed by dtrace.
2017-06-08 04:00:01 +00:00
chs
ec5ea71a90 move some buffer cache internals declarations from buf.h to vfs_bio.c.
this is needed to avoid name conflicts with ZFS and also
makes it clearer that other code shouldn't be messing with these.
remove the LFS debug code that poked around in bufqueues and
remove the BQ_EMPTY bufqueue since nothing uses it anymore.
provide a function to let LFS and wapbl read the value of nbuf for now.
2017-06-08 01:23:01 +00:00
chs
67c81802f1 allow cv_signal() immediately followed by cv_destroy().
this sequence is used by ZFS in a couple places and by supporting it
natively we can undo our local ZFS changes that avoided it.
note that this is only legal when all of the waiters use cv_wait()
and not any of the other variations, and lockdebug will catch
any violations of this rule.
2017-06-08 01:09:52 +00:00
hannken
287643b0da Operations fstrans_start() and fstrans_start_nowait() now always
use FSTRANS_SHARED as lock type so remove the lock type argument.

File system state FSTRANS_SUSPENDING is now unused so remove it.

Regen vnode_if files.

Ride 8.99.1 less than a hour ago.
2017-06-04 08:05:41 +00:00
hannken
775d23a76b Operations fstrans_start() and fstrans_start_nowait() now always
use FSTRANS_SHARED as lock type so remove the lock type argument.
2017-06-04 08:03:26 +00:00
hannken
f5647f853e Locking a layer vnode using the regular bypass routine is no longer
racy.  Undo the change from 2017-03-30 11:16:52, commitid eurqbzuGxGRlryLz
and make vi_lock a krwlock_t again.
2017-06-04 08:02:26 +00:00
hannken
48c67e7912 Regen. 2017-06-04 08:00:27 +00:00
hannken
dfcc54aa9c Add "FSTRANS=LOCK" and "FSTRANS=UNLOCK" to vop_lock and vop_unlock.
Add two "static inline" functions to vnode_if.c to handle MPSAFE
and FSTRANS before and after the "VCALL()".

Take FSTRANS and handle error before "VCALL(...vop_lock...)" and
release it after "VCALL(...vop_unlock...)".
2017-06-04 07:59:17 +00:00
hannken
8e1cefd98c A vnode is usually called "active", if it has an associated file system
node and a usecount greater zero.  Therefore rename state "VS_ACTIVE"
to "VS_LOADED" and add a new synthetic state "VS_ACTIVE" for VSTATE_ASSERT()
to assert an active vnode.

Add VSTATE_ASSERT_UNLOCKED() to be used with v_interlock unheld and
move the state assertion macros to sys/vnode_impl.h.
2017-06-04 07:58:29 +00:00
chs
ffb3d80455 localcount_init() can't fail because percpu_alloc() can't fail.
remove the check and change the return type to void.
2017-06-02 00:32:12 +00:00
chs
fd34ea77eb remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
2017-06-01 02:45:05 +00:00
chs
1f0e167178 vmem_alloc() with VM_SLEEP cannot fail, so percpu_alloc() cannot fail either. 2017-05-31 23:54:17 +00:00
chs
c85613c074 assert that vmem_alloc() with VM_SLEEP does not fail. 2017-05-31 23:53:30 +00:00
hannken
e4e82d96c7 Restrict vgone() to suspended file systems only.
Welcome to 7.99.75, old file system modules would cause a diagnostic
assertion with new kernel.
2017-05-28 16:39:41 +00:00
hannken
a8045334ce Add a helper to propagate file system suspension for vrevoke().
Take care to retry suspension on interrupt as vrevoke must succeed.
2017-05-28 16:35:47 +00:00
bouyer
6e4cb2b9ab merge the bouyer-socketcan branch to HEAD.
CAN stands for Controller Area Network, a broadcast network used
in automation and automotive fields. For example, the NMEA2000 standard
developped for marine devices uses a CAN network as the link layer.

This is an implementation of the linux socketcan API:
https://www.kernel.org/doc/Documentation/networking/can.txt
you can also see can(4).

This adds a new socket family (AF_CAN) and protocol (PF_CAN),
as well as the canconfig(8) utility, used to set timing parameter of
CAN hardware. Also inclued is a driver for the CAN controller
found in the allwinner A20 SoC (I tested it with an Olimex lime2 board,
connected with PIC18-based CAN devices).

There is also the canloop(4) pseudo-device, which allows to use
the socketcan API without CAN hardware.

At this time the CANFD part of the linux socketcan API is not implemented.
Error frames are not implemented either. But I could get the cansend and
canreceive utilities from the canutils package to build and run with minimal
changes. tcpudmp(8) can also be used to record frames, which can be
decoded with etherreal.
2017-05-27 21:02:54 +00:00
riastradh
c921bd9b79 Check VOP_INACTIVE contract with a judicious assert. 2017-05-26 14:40:09 +00:00
riastradh
51e152b5ce Clarify comment. 2017-05-26 14:39:20 +00:00