Commit Graph

214069 Commits

Author SHA1 Message Date
Konstantin Belousov
b42dfd6dff Fill tf_trapno for trap frames created for syscall.
If tf_trapno contains garbage which appears to be equal to T_NMI,
e.g. due to thread previously entered kernel due to NMI, doreti
sequence skips ast, and does so until a trap or hardware interrupt
occur.

The visible effects of the issue are quite confusing.  First, signals
delivery is postponed in observable ways.  In particular, the
guarantee that unblocked async signals queue is flushed before a
return from syscall, is broken.  Second, if there are pending signals,
all interruptible sleeps of the stuck thread are aborted immediately.

Since modern CPUs are relatively fast and tickless kernel generates
low interrupt rate, the faulty condition might exist for long time (in
an application time scale).

In collaboration with:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-11 15:52:52 +00:00
Enji Cooper
75f09ab639 Remove redundant declarations for intel_fbc_enabled(..) and
i915_gem_dump_object(..) to fix -Wredundant-decls warning

MFC after:	1 week
PR:		209924
Reported by:	Mark Millard <markmi@dsl-only.net>
Tested with:	devel/amd64-gcc (5.3.0)
Sponsored by:	EMC / Isilon Storage Division
2016-07-11 15:50:06 +00:00
Enji Cooper
966d9ae5b6 Remove redundant declaration for radeon_pm_acpi_event_handler(..) to fix
-Wredundant-decls warning

MFC after:	1 week
PR:		209924
Reported by:	Mark Millard <markmi@dsl-only.net>
Tested with:	devel/amd64-gcc (5.3.0)
Sponsored by:	EMC / Isilon Storage Division
2016-07-11 15:47:43 +00:00
Konstantin Belousov
19efd8a5a8 In vgonel(), postpone setting BO_DEAD until VOP_RECLAIM() is called,
if vnode is VMIO.  For VMIO vnodes, set BO_DEAD in vm_object_terminate().

The vnode_destroy_object(), when calling into vm_object_terminate(),
must be able to flush buffers.  BO_DEAD purpose is to quickly destroy
buffers on write when the underlying vnode is not operable any more
(one example is the devfs node after geom is gone).  Setting BO_DEAD
for reclaiming vnode before object is terminated is premature, and
results in unability to flush buffers with live SU dependencies from
vinvalbuf() in vm_object_terminate().

Reported by:	David Cross <dcrosstech@gmail.com>
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-07-11 14:19:09 +00:00
Glen Barber
f6a1d618ad Fix the naming of -CURRENT
Sponsored by:	The FreeBSD Foundation
2016-07-11 14:07:24 +00:00
Cy Schubert
b04471d88a r302561 broke buildworld. This patch fixes that.
MFC after:	3 days
X-MFC with:	r302561
2016-07-11 13:41:40 +00:00
Robert Watson
98daa3e5db Add AUE_WAIT6 handling to the BSM conversion switch statement, reusing
the BSM encoding used for AUE_WAIT4.

MFC after:	3 days
Sponsored by:	DARPA, AFRL
2016-07-11 13:06:17 +00:00
Andrey V. Elsukov
fcbdb770aa Flush buffer after output. This fixes adding new data to already
printed flows.

PR:		210882
MFC after:	3 days
2016-07-11 12:44:58 +00:00
Michal Meloun
fc3466adda OFWPCI: Fix style(9).
No functional change.

MFC after: 3 weeks
2016-07-11 08:24:04 +00:00
Sepherosa Ziehau
60169cb210 hyperv/vmbus: Embed channel detach task in channel itself.
GC work queue stuffs.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6864
2016-07-11 08:12:04 +00:00
Pietro Cerutti
5a4d1cc66f Do not truncate lines longer than 512 chars.
PR:		210344
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D6881
2016-07-11 08:05:46 +00:00
Sepherosa Ziehau
3e1c325e63 hyperv/vmbus: Save vmbus softc to channels.
So that we don't need to access the global vmbus softc.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6863
2016-07-11 07:54:58 +00:00
Sepherosa Ziehau
fd5831c624 hyperv/vmbus: Create channel synchronously.
The device probe/attach has been move to a different thread, so the
reasons to create the channel asynchronously are no longer valid.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6862
2016-07-11 07:45:31 +00:00
Sepherosa Ziehau
1ecb24660f hyperv/vmbus: Use post message Hypercall APIs for unload
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6861
2016-07-11 07:28:15 +00:00
Enji Cooper
789872f2e9 Don't test for xpt not being NULL before calling svc_xprt_free(..)
svc_xprt_alloc(..) will always return initialized memory as it uses
mem_alloc(..) under the covers, which uses malloc(.., M_WAITOK, ..).

MFC after: 1 week
Reported by: Coverity
CID: 1007341
Sponsored by: EMC / Isilon Storage Division
2016-07-11 07:24:56 +00:00
Enji Cooper
462984cb6f Convert svc_xprt_alloc(..) and svc_xprt_free(..)'s prototypes to
ANSI C style prototypes

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2016-07-11 07:17:52 +00:00
Enji Cooper
7d3db23544 Deobfuscate cleanup path in clnt_vc_create(..)
Similar to r300836, r301800, and r302550, cl and ct will always
be non-NULL as they're allocated using the mem_alloc routines,
which always use `malloc(..., M_WAITOK)`.

MFC after: 1 week
Reported by: Coverity
CID: 1007342
Sponsored by: EMC / Isilon Storage Division
2016-07-11 07:07:15 +00:00
Enji Cooper
f99529597c Deobfuscate cleanup path in clnt_dg_create(..)
Similar to r300836 and r301800, cl and cu will always be non-NULL as they're
allocated using the mem_alloc routines, which always use
`malloc(..., M_WAITOK)`.

Deobfuscating the cleanup path fixes a leak where if cl was NULL and
cu was not, cu would not be free'd, and also removes a duplicate test for
cl not being NULL.

MFC after: 1 week
Reported by: Coverity
CID: 1007033, 1007344
Sponsored by: EMC / Isilon Storage Division
2016-07-11 06:58:24 +00:00
Sepherosa Ziehau
47a3ee5c60 hyperv/vmbus: Add sysctl to expose vmbus version.
Requested by:	Hongxiong Xian <v-hoxian microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6860
2016-07-11 06:55:02 +00:00
Pyun YongHyeon
f2e1e9bd53 Belatedly remove CSUM_IP_FRAGS and CSUM_FRAGMENT offloading
capabilities.  It was removed in r243624 and r254804/r271006
respectively.
This file and mbuf(9) needs updates for other offloading
capabilities(i.e. CSUM_SCTP and CSUM_TSO).
2016-07-11 06:49:56 +00:00
Sepherosa Ziehau
833cfa5fcb hyperv/vmbus: Explicitly assign channel message process array.
While I'm here, remove the useless message type from message process
array, which is not used and serves no purposes at all.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6858
2016-07-11 06:37:04 +00:00
Peter Grehan
5dab2ac7af Implement right shift/ctl, and convert the VNC/xorg scancode
of 0xff03 into right-alt.

Reported by:	lme@
MFC after:	1 week
2016-07-11 06:31:15 +00:00
Sepherosa Ziehau
dd012a57a7 hyperv/vmbus: Function renaming.
And pass vmbus_softc to vmbus_doattach()

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6842
2016-07-11 06:29:56 +00:00
Sepherosa Ziehau
57bb267df3 hyperv/hn: Add tunable to allow tcp_lro_queue_mbuf()
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6841
2016-07-11 06:23:01 +00:00
Sepherosa Ziehau
c1cc5bdfe8 hyperv/vmbus: Use post message Hypercall APIs for channel request
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6831
2016-07-11 06:11:24 +00:00
Xin LI
56858424bb Use _PATH_DEVNULL instead of hardcoding.
MFC after:	2 weeks
2016-07-11 05:44:58 +00:00
Sepherosa Ziehau
2d774f207c hyperv/stor: Fix the INQUIRY checks
Don't check the area that the host has not filled.

PR:		https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209443
PR:		https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210425
Submitted by:	Hongjiang Zhang <honzhan microsoft com>
Reviewed by:	sephe, Dexuan Cui <decui microsoft com>
MFC after:	3 days
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6955
2016-07-11 05:17:48 +00:00
Sepherosa Ziehau
236764b1c2 hyperv/vmbus: Implement a new set of APIs for post message Hypercall
And use this new APIs for Initial Contact post message Hypercall.
More post message Hypercalls will be converted.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6830
2016-07-11 04:52:11 +00:00
Marcelo Araujo
391adcc526 Do not allow whitespace in macro names.
Obtained from:	OpenBSD (r1.19).
2016-07-11 03:34:32 +00:00
Xin LI
823c0d5f5e Allow - in distribution names. This is needed for freebsd-update to work
with 11.0+, where the debugging symbols use a new naming scheme for release
distribution files.

Errata candidate.

Approved by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D7170
2016-07-11 03:31:12 +00:00
Pedro F. Giffuni
24b797cc1a mail(1): Fix a comment.
Obtained from:	NetBSD (CVS Rev 1.29)
2016-07-11 00:03:39 +00:00
Enji Cooper
53d08a21d4 Correct OLD_LIBS change done in r298840
libkvm.so lives in /lib, not /usr/lib

MFC after: 3 days
X-MFC note: ^/stable/11 only
X-MFC with: r298840
Submitted by: Herbert J. Skuhra <herbert@mailbox.org>
Sponsored by: EMC / Isilon Storage Division
2016-07-10 20:42:18 +00:00
Alexander Motin
ce35eeb771 Revert odd change, setting limit registers before base.
I don't know what errata is mentioned there, I was unable to find it, but
setting limit before the base simply does not work at all.  According to
specification attempt to set limit out of the present window range resets
it to zero, effectively disabling it.  And that is what I see in practice.

Fixing this properly disables access for remote side to our memory until
respective xlat is negotiated and set.  As I see, Linux does the same.
2016-07-10 20:22:04 +00:00
Alexander Motin
9c85a81906 Fix wrong copy/paste in r302510. 2016-07-10 19:52:26 +00:00
Alexander Motin
d2de6786c1 Remove callout_reset(link_work) from ntb_transport_attach().
At that point link is quite likely not established yet, so messing with
scratch registers is premature there.  Original commit message mentioned
code diff reduction from Linux, but this line is not present in Linux now.
2016-07-10 19:15:29 +00:00
Michal Meloun
dac935533b EXTRES: Add OF node as argument to all <foo>_get_by_ofw_<bar>() functions.
In some cases, the driver must handle given properties located in
specific OF subnode. Instead of creating duplicate set of function, add
'node' as argument to existing functions, defaulting it to device OF node.

MFC after: 3 weeks
2016-07-10 18:28:15 +00:00
Robert Watson
5fa69ff015 In process-descriptor close(2) and fstat(2), audit target process
information.  pgkill(2) already audits target process ID.

MFC after:	3 days
Sponsored by:	DARPA, AFRL
2016-07-10 14:17:36 +00:00
Robert Watson
e5ec733909 Do allow auditing of read(2) and write(2) system calls, by assigning
those system calls audit event identifiers AUE_READ and AUE_WRITE.
While auditing file-descriptor I/O is not required by the Common
Criteria, in practice this proves useful for both live and forensic
analysis.

NB: freebsd32 already assigns AUE_READ and AUE_WRITE to read(2) and
write(2).

MFC after:	3 days
Sponsored by:	DARPA, AFRL
2016-07-10 13:42:33 +00:00
Robert Watson
0df4264748 When mmap(2) is used with a vnode, capture vnode attributes in the
audit trail.  This was not required for Common Criteria auditing
(which requires only that the intent to read or write be audited
at the time of open(2)), but is useful for contemporary live
analysis and forensics.

MFC after:	3 days
Sponsored by:	DARPA, AFRL
2016-07-10 11:49:10 +00:00
Jared McNeill
0e1cdf8ba6 Add clk_get_by_ofw_node_index, which is like clk_get_by_ofw_index but
operates on a specific OF node instead of the pass in device's OF node.

Reviewed by:		andrew, mmel
Differential Revision:	https://reviews.freebsd.org/D6957
2016-07-10 10:53:50 +00:00
Jared McNeill
22a81821b0 Align descriptors and data buffers to 32 bits. This restriction is
described in the A20 (and later) user manuals.
2016-07-10 10:38:28 +00:00
Jared McNeill
6964917c0e In the absence of a bus-width property, default to 4-bit bus width instead
of 1-bit.
2016-07-10 10:21:22 +00:00
Alexander Motin
58e5fbcbaf Replace NTB man page with more detailed and up to date.
Sponsored by:	iXsystems, Inc.
2016-07-10 10:17:38 +00:00
Robert Watson
8ec75c0fc3 Audit the file-descriptor number argument for openat(2). Remove a comment
about the desirability of auditing the number, as it was in fact in the
wrong place (in the common path for open(2) and openat(2), and only the
latter accepts a file-descriptor argument).  Where other ABIs support
openat(2), it may be necessary to do additional argument auditing as it is
not performed in kern_openat(9).

MFC after:	3 days
Sponsored by:	DARPA, AFRL
2016-07-10 09:50:21 +00:00
Dmitry Chagin
d09bf88425 Add linux_mmap.c to the appropriate conf/files.
Reported by:	kib@
MFC after:	1 week
2016-07-10 08:38:10 +00:00
Dmitry Chagin
97d06da692 Fix a copy/paste bug introduced during X86_64 Linuxulator work.
FreeBSD support NX bit on X86_64 processors out of the box, for i386 emulation
use READ_IMPLIES_EXEC flag, introduced in r302515.

While here move common part of mmap() and mprotect() code to the files in compat/linux
to reduce code dupcliation between Linuxulator's.

Reported by:    Johannes Jost Meixner, Shawn Webb

MFC after:	1 week
XMFC with:	r302515, r302516
2016-07-10 08:22:04 +00:00
Dmitry Chagin
ab231b83ea Regen for r302215 (Linux personality). 2016-07-10 08:17:16 +00:00
Dmitry Chagin
23e8912c60 Implement Linux personality() system call mainly due to READ_IMPLIES_EXEC flag.
In Linux if this flag is set, PROT_READ implies PROT_EXEC for mmap().
Linux/i386 set this flag automatically if the binary requires executable stack.

READ_IMPLIES_EXEC flag will be used in the next Linux mmap() commit.
2016-07-10 08:15:50 +00:00
Robert Watson
51d1f69069 Audit file-descriptor arguments to I/O system calls such as
read(2), write(2), dup(2), and mmap(2).  This auditing is not
required by the Common Criteria (and hence was not being
performed), but is valuable in both contemporary live analysis
and forensic use cases.

MFC after:	3 days
Sponsored by:	DARPA, AFRL
2016-07-10 08:04:02 +00:00
Andrey A. Chernov
5a5807dd4c Remove broken support for collation in [a-z] type ranges.
Only first 256 wide chars are considered currently, all other are just
dropped from the range. Proper implementation require reverse tables
database lookup, since objects are really big as max UTF-8 (1114112
code points), so just the same scanning as it was for 256 chars will
slow things down.

POSIX does not require collation for [a-z] type ranges and does not
prohibit it for non-POSIX locales. POSIX require collation for ranges
only for POSIX (or C) locale which is equal to ASCII and binary for
other chars, so we already have it.

No other *BSD implements collation for [a-z] type ranges.

Restore ABI compatibility with unused now __collate_range_cmp() which
is visible from outside (will be removed later).
2016-07-10 03:49:38 +00:00