Commit Graph

106210 Commits

Author SHA1 Message Date
Konstantin Belousov
4b48959f9f Enforce the maxproc limitation before allocating struct proc, initial
struct thread and kernel stack for the thread.  Otherwise, a load
similar to a fork bomb would exhaust KVA and possibly kmem, mostly due
to the struct proc being type-stable.

The nprocs counter is changed from being protected by allproc_lock sx
to be an atomic variable.  Note that ddb/db_ps.c:db_ps() use of nprocs
was unsafe before, and is still unsafe, but it seems that the only
possible undesired consequence is the harmless warning printed when
allproc linked list length does not match nprocs.

Diagnosed by:	Svatopluk Kraus <onwahe@gmail.com>
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-10-08 11:07:09 +00:00
Fabien Thomas
4f621ff9dc Fix r283120 which use class size larger than 8bits.
The new mapping will restore binary compatibility with stable_10
but file generated since r283120 are broken.

Reviewed by:	jhb
Sponsored by:	Stormshield
2015-10-08 10:00:41 +00:00
Fabien Thomas
78e79434d2 Fix r283998 that broke mapin events for hwpmc.
Reviewed by:	jhb
Sponsored by:	Stormshield
2015-10-08 09:54:33 +00:00
Alexander Motin
3d5cb709bd Add missing vnode lock in case of file modify request.
Submitted by:	Richard Kojedzinszky
MFC after:	1 week
2015-10-08 07:34:30 +00:00
Adrian Chadd
fbcf1662de wpi(4): check size before transmitting frames
In addition to https://bz-attachments.freebsd.org/attachment.cgi?id=156112;
fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=144987.

Tested:

* Tested with Intel 3945BG, STA mode

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3762
2015-10-08 07:22:40 +00:00
Adrian Chadd
4c09e592e6 wpi(4): fix some byteorder conversions
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3761
2015-10-08 07:21:36 +00:00
Adrian Chadd
19ea23a08d wpi(4): fix 'maybe uninitialized' warnings
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3760
2015-10-08 07:20:22 +00:00
Adrian Chadd
859f6ddcdc wpi(4): add some branch predictions.
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3759
2015-10-08 07:18:28 +00:00
Adrian Chadd
c34db4207c wpi(4): drop unnecessary locking in wpi_set_pslevel().
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3758
2015-10-08 07:17:11 +00:00
Ed Schouten
808d980506 Properly format pointer size independent CloudABI system calls.
CloudABI has approximately 50 system calls that do not depend on the
pointer size of the system. As the ABI is pretty compact, it takes
little effort to each truss(8) the formatting rules for these system
calls. Start off by formatting pointer size independent system calls.

Changes:

- Make it possible to include the CloudABI system call definitions in
  FreeBSD userspace builds. Add ${root}/sys to the truss(8) Makefile so
  we can pull in <compat/cloudabi/cloudabi_syscalldefs.h>.
- Refactoring: patch up amd64-cloudabi64.c to use the CLOUDABI_*
  constants instead of rolling our own table.
- Add table entries for all of the system calls.
- Add new generic formatting types (UInt, IntArray) that we'll be using
  to format unsigned integers and arrays of integers.
- Add CloudABI specific formatting types.

Approved by:	jhb
Differential Revision:	https://reviews.freebsd.org/D3836
2015-10-08 05:27:45 +00:00
Adrian Chadd
753ca9ef4f wpi(4): remove software queues
Use direct dispatch into the destination hardware ring instead of using
a staging queue.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3757
2015-10-08 00:52:41 +00:00
Bryan Drewery
a730673058 Remove redundant RFFPWAIT/vfork(2) handling in Linux fork(2) and clone(2) wrappers.
r161611 added some of the code from sys_vfork() directly into the Linux
module wrappers since they use RFSTOPPED.  In r232240, the RFFPWAIT handling
was moved to syscallret(), thus this code in the Linux module is no longer
needed as it will be called later.

This also allows the Linux wrappers to benefit from the fix in r275616 for
threads not getting suspended if their vforked child is stopped while they
wait on them.

Reviewed by:	jhb, kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D3828
2015-10-07 19:10:38 +00:00
Andrew Turner
b1bddf4039 Move pmu.c to files.arm and rename the option to pmu. This is not hwpmc
specific as we may use the pmu registers for other uses. No configs seem
to currently build this.

This will allow for more use of this device.

Discussed with:	bz
Sponsored by:	ABT Systems Ltd
2015-10-07 13:19:44 +00:00
Gleb Smirnoff
89bc042679 Fix regression from r287779, that bite me. If we call m_pullup()
unconditionally, we end up with an mbuf chain of two mbufs, which
later in in_arpreply() is rewritten from ARP request to ARP reply
and is sent out. Looks like igb(4) (at least mine, and at least
at my network) fails on such mbuf chain, so ARP reply doesn't go
out wire. Thus, make the m_pullup() call conditional, as it is
everywhere. Of course, the bug in igb(?) should be investigated,
but better first fix the head. And unconditional m_pullup() was
suboptimal, anyway.
2015-10-07 13:10:26 +00:00
Gleb Smirnoff
e40e8705db Fix regression from r248371. We need to copy packet header to new
mbuf. Unlike in the pre-r248371 code, assert that M_PKTHDR is set
only on a first mbuf.

Reported & tested by:	Andriy Voskoboinyk <s3erios gmail.com>
Sponsored by:		Nginx, Inc.
2015-10-07 12:40:00 +00:00
Gleb Smirnoff
20e8b32db4 In softdep_setup_freeblocks():
- Move the bread() to the beginning of function.
- Return if it fails, otherwise we will panic.

Submitted by:	mckusick
Sponsored by:	Netflix
2015-10-07 12:36:28 +00:00
Konstantin Belousov
c890751da6 A follow-up to r288492. In fact, revert the mentioned commit for
pre-VFPv3 processors, since they do require software support code to
handle denormals.  For VFPv3 and later, enable flush-to-zero if
hardware does not claim full denormals arithmetic support by VMVFR1_FZ
field in mvfr1 register.

The end result is that we do use correct fpu environment on Cortexes
with VFPv3, while ARM11 (e.g. rpi) is in non-compliant flush-to-zero
mode.  At least CPUs without complete hardware implementation of
IEEE 754 do not cause unhandled floating point exception on underflow,
as it was before r288492.

Noted by:	ian
Tested by:	gjb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-10-07 09:12:49 +00:00
Hiroki Sato
023d10cbc7 Fix a bug that caused reinitialization failure of MAC addresses on
the lagg interface when removing the primary port.

PR:			201916
Differential Revision:	https://reviews.freebsd.org/D3301
2015-10-07 06:32:34 +00:00
Kevin Lo
c99a4e8a47 Declare odata as a pointer type instead of a pointer to pointer.
Reviewed by:	adrian
2015-10-07 03:33:25 +00:00
John Baldwin
a6fe4c02d6 Move td_oncpu and td_lastcpu out of the "zero'd on fork" section of
struct thread since they are always explicitly initialized during fork
and thread creation after r286256.

Suggested by:	kib
2015-10-06 21:36:45 +00:00
Adrian Chadd
3d9902ab4a Remove gen3 check introduced in r286653.
kib spotted this and noticed it's not correct.

Submitted by:	kib
Reviewed by:	dumbbell
2015-10-06 20:58:45 +00:00
John Baldwin
189ac973de Fix various edge cases related to system call tracing.
- Always set td_dbg_sc_* when P_TRACED is set on system call entry
  even if the debugger is not tracing system call entries.  This
  ensures the fields are valid when reporting other stops that
  occur at system call boundaries such as for PT_FOLLOW_FORKS or
  when only tracing system call exits.
- Set TDB_SCX when reporting the stop for a new child process in
  fork_return().  This causes the event to be reported as a system
  call exit.
- Report a system call exit event in fork_return() for new threads in
  a traced process.
- Copy td_dbg_sc_* to new threads instead of zeroing.  This ensures
  that td_dbg_sc_code in particular will report the system call that
  created the new thread or process when it reports a system call
  exit event in fork_return().
- Add new ptrace tests to verify that new child processes and threads
  report system call exit events with a valid pl_syscall_code via
  PT_LWPINFO.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D3822
2015-10-06 19:29:05 +00:00
Conrad Meyer
e6b95927f3 Fix core corruption caused by race in note_procstat_vmmap
This fix is spiritually similar to r287442 and was discovered thanks to
the KASSERT added in that revision.

NT_PROCSTAT_VMMAP output length, when packing kinfo structs, is tied to
the length of filenames corresponding to vnodes in the process' vm map
via vn_fullpath.  As vnodes may move during coredump, this is racy.

We do not remove the race, only prevent it from causing coredump
corruption.

- Add a sysctl, kern.coredump_pack_vmmapinfo, to allow users to disable
  kinfo packing for PROCSTAT_VMMAP notes.  This avoids VMMAP corruption
  and truncation, even if names change, at the cost of up to PATH_MAX
  bytes per mapped object.  The new sysctl is documented in core.5.

- Fix note_procstat_vmmap to self-limit in the second pass.  This
  addresses corruption, at the cost of sometimes producing a truncated
  result.

- Fix PROCSTAT_VMMAP consumers libutil (and libprocstat, via copy-paste)
  to grok the new zero padding.

Reported by:	pho (https://people.freebsd.org/~pho/stress/log/datamove4-2.txt)
Relnotes:	yes
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3824
2015-10-06 18:07:00 +00:00
Dimitry Andric
88750be440 Merge ^/head r288836 through r288925. 2015-10-06 16:25:13 +00:00
Roger Pau Monné
1a52c10530 Update Xen headers from 4.2 to 4.6
Pull the latest headers for Xen which allow us to add support for ARM and
use new features in FreeBSD.

This is a verbatim copy of the xen/include/public so every headers which
don't exits anymore in the Xen repositories have been dropped.

Note the interface version hasn't been bumped, it will be done in a
follow-up. Although, it requires fix in the code to get it compiled:

 - sys/xen/xen_intr.h: evtchn_port_t is already defined in the headers so
   drop it.

 - {amd64,i386}/include/intr_machdep.h: NR_EVENT_CHANNELS now depends on
   xen/interface/event_channel.h, so include it.

 - {amd64,i386}/{amd64,i386}/support.S: It's not neccessary to include
   machine/intr_machdep.h. This is also fixing build compilation with the
   new headers.

 - dev/xen/blkfront/blkfront.c: The typedef for blkif_request_segmenthas
   been dropped. So directly use struct blkif_request_segment

Finally, modify xen/interface/xen-compat.h to throw a preprocessing error if
__XEN_INTERFACE_VERSION__ is not set. This is allow us to catch any file
where xen/xen-os.h is not correctly included.

Submitted by:		Julien Grall <julien.grall@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3805
Sponsored by:		Citrix Systems R&D
2015-10-06 11:29:44 +00:00
Gleb Smirnoff
640082d498 Remove debugging variable from r143761. 2015-10-06 09:43:49 +00:00
Hiren Panchasara
62d4443f00 Add a comment specifying how we implement rfc3042.
Differential Revision:	D3746
MFC after:	    1 week
Sponsored by:	    Limelight Networks
2015-10-06 07:46:19 +00:00
Alan Cox
27e9ed8a5a Exploit r288122 to address a cosmetic issue. Pages belonging to either
the kernel or kmem object can't be paged out.  Since they can't be paged
out, they are never enqueued in a paging queue.  Nonetheless, passing
PQ_INACTIVE to vm_page_unwire() in kmem_unback() creates the appearance
that these pages are being enqueued in the inactive queue.  As of r288122,
we can avoid giving this false impression by passing PQ_NONE.

Submitted by:	kmacy
Differential Revision:	https://reviews.freebsd.org/D1674
2015-10-06 05:49:00 +00:00
Cy Schubert
d029a42ab4 On some interfaces, ipfilter drops UDP packets with zero checkum.
This commit fixes that.

PR:		166372
Submitted by:	mk@neon1.net
Reviewed by:	Darren Reed <darrenr@reed.wattle.id.au>
MFC after:	1 week
2015-10-06 03:41:11 +00:00
Justin Hibbits
db0d64f24a Save the link register in savectx().
Pointed out by:	jhb
2015-10-06 01:24:46 +00:00
John Baldwin
3edd0ffffe Include additional info in ptrace(2) KTR traces:
- The new PC value and signal passed to PT_CONTINUE, PT_DETACH, PT_SYSCALL,
  and PT_TO_SC[EX].
- The system call code returned via PT_LWPINFO.

MFC after:	1 week
2015-10-05 21:36:53 +00:00
Warner Losh
d635a37ffa Mark swap_pager_putpages static at its definition. It was already
static at its declaration. Remove needless swapdev_strategy forward
declaration.

MFC After: 3 days
2015-10-05 21:29:17 +00:00
Dimitry Andric
4f01407b5b Prepare for merging back to head. 2015-10-05 19:48:12 +00:00
Dimitry Andric
c710e87b3b Merge ^/head r288457 through r288830. 2015-10-05 17:54:54 +00:00
Ruslan Bukin
31239b7219 Attach interrupt controller device before other devices.
Sponsored by:	University of Cambridge
2015-10-05 13:15:21 +00:00
Mark Murray
dcabe03158 Fix printf-like formats for KASSERT.
Submitted by:	jenkins
Approved by:	so (/dev/random blanket)
2015-10-05 10:45:52 +00:00
Mark Murray
0a9565c86e It appears that under some circumstances, like virtualisiation, the
'rdrand' instruction may occasionally not return random numbers, in
spite of looping attempts to do so. The reusult is a KASSERT/panic.

Reluctantly accept this state-of-affairs, but make a noise about it.
if this 'noise' spams the console, it may be time to discontinue
using that source.

This is written in a general way to account for /any/ source that
might not supply random numbers when required.

Submitted by:	jkh (report and slightly different fix)
Approved by:	so (/dev/random blanket)
2015-10-05 07:41:12 +00:00
Kevin Lo
8aabf601d1 Remove the unnecessary cast. 2015-10-05 05:24:16 +00:00
Sean Bruno
2bfaedae36 Set correct argemdio addr, comment out arge1 as its not physically
connected to anything.  Move a couple of devices out of the kernel
and into modules.
2015-10-04 22:50:37 +00:00
Andrew Turner
8bdcc09641 When trying to execute from a misaligned address raise a SIGBUS with the
invalid address alignment code.

Obtained from:	EuroBSDCon
Sponsored by:	ABT Systems Ltd
2015-10-04 21:16:45 +00:00
Alexander V. Chernikov
ab415c8307 Invoke lle_event for new entry iff it has lladdr set. 2015-10-04 19:10:27 +00:00
Kevin Lo
78f32e980c Replace M_NOWAIT with M_WAITOK for consistency with other wireless drivers. 2015-10-04 13:40:22 +00:00
Kevin Lo
24c838f059 Fix max TX power settings for RT5390/RT5392.
While here remove wrong definition of RT2860_USB_PHY_MAN_RST.
2015-10-04 13:39:00 +00:00
Konstantin Belousov
b86860001b When asserting IL bit in exception syndrome register, print the raw
register value.

Reviewed by:	andrew
Sponsored by:	The FreeBSD Foundation
2015-10-04 12:52:30 +00:00
Alexander V. Chernikov
7503e0c783 Simplify if (lladdr) condition in nd6_cache_lladdr():
For case (7) (new entry) nothing has to be done except lle_event.
  Invoke this event directly from "create new lle" code block.
  For case (4) (existing entry, same mac) useless mac update was performed,
  along with LLENTRY_RESOLVED lle_event. There was no sense in doing that,
  since nothing really had changed. Simply avoid this condition instead.
  Given that, condition was simplified to (3),(5) states which can be merged
  with previous block.
2015-10-04 12:42:07 +00:00
Robert Watson
ba2f5f5ed3 Add missing stack unwind information to several assembly functions on
ARMv6/7:

- Define _SAVE() macro to allow unwind data to be conditionally defined for
  ARM assembly code in the kernel.

- Use _SAVE() to provide unwind information for bcopy_page(), and two (of
  many) instances of copyin() and copyout().

Reviewed by:	andrew, imp
MFC after:	3 days
Sponsored by:	University of Cambridge
2015-10-04 09:39:40 +00:00
Alexander V. Chernikov
9b420b3da4 Eliminate nd6_llinfo_settimer(). All consumers were converted to
use nd6_llinfo_settimer_locked() in r216022.
Make nd6_llinfo_settimer_locked() static: last external consumer was
converted in r288124.
2015-10-04 08:33:16 +00:00
Alexander V. Chernikov
c0b8aeae2d Add __noinline attribute to several functions to ease dtrace instrumentation 2015-10-04 08:21:15 +00:00
Marcelo Araujo
973532fc7d Remove per complete the fec aggregation protocol.
The remove began with revision r271733.

NOTE: This patch must never be merge to 10-Stable

Reviewed by:	glebius
Approved by:	bapt (mentor)
Relnotes:	Yes
Sponsored by:	EuroBSDCon Sweden.
Differential Revision:	D3786
2015-10-04 08:00:29 +00:00
Adrian Chadd
280bcab3d0 drm2: a few minor fixes after r280183
* Remove obsolete drm_agp_*_memory() prototypes.
* Fix comment in drm_fops.c (outisde -> outside).
* Fix some formatting issues in drm_stub.c (spaces -> tabs).
* Add missing case statement (gen == 3) in intel_gpu_reset().
* Restore pci_enable_busmaster() call in the init path (fixes gpu hang on i945GM).
* Replace M_WAITOK with M_NOWAIT when the return value of malloc is checked (may be incorrect).

Submitted by:	<s3erios@gmail.com>
Reviewed by:	dumbbell
Approved by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D3413
2015-10-04 07:45:36 +00:00