Commit Graph

213835 Commits

Author SHA1 Message Date
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
Pedro F. Giffuni
d6f7a4fb17 mail(1): Invert calloc(3) argument order.
calloc(3) is documented to have first a number and then a size.

Obtained from:	OpenBSD (through NetBSD)
2016-07-10 02:46:20 +00:00
Alexander Motin
a8916479cc Simplify MSIX MW BAR xlat setup, and don't forget to unlock its limit.
The last fixes SB01BASE_LOCKUP workaround after driver reload.
2016-07-10 01:09:16 +00:00
Landon J. Fuller
71edabf7bd Fix heap overflow in bhnd(4) SPROM parsing.
The bus_region_* APIs accept the number of data items to be read, while
the code was passing the total number of bytes, resulting in an overflow
of the SPROM parser's buffer.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D7168
2016-07-10 00:08:40 +00:00
Alexander Motin
eeed92a759 Disable SB01BASE_LOCKUP workaround when split BARs disabled.
For some reason hack with sending MSI-X interrupts by writing to remote
LAPIC memory works only for 32-bit BARs, that are available only if split
BARs mode is enabled in BIOS.  If it is not, complain loudly and fall back
to less efficient workaround.
2016-07-09 23:22:44 +00:00
Mark Johnston
ca1ef36cf4 Avoid truncating the return value of DTrace predicates.
Predicates are DIF objects whose return value is compared with zero to
determine whether the corresponding probe body is to be executed. The return
value itself is the contents of a 64-bit DIF register, but it was being
truncated to an int before the comparison. This meant that a predicate such
as /0x100000000/ would evaluate to false.

Reported by:	rwatson
MFC after:	3 days
2016-07-09 22:41:21 +00:00
Ian Lepore
3a86bcdd17 Remove HZ=<various> from all armv6 configs, put HZ=1000 in std.armv6.
All armv6 processors are plenty fast enough for HZ=1000.

No changes are made for older arm systems, because some chips are a bit
wimpy for 1000 while others do fine, so it has to be set on a per-config
basis.
2016-07-09 21:14:59 +00:00
Ian Lepore
7651aa600b Consolidate debugging options from all arm kernel configs to std.arm[v6]. 2016-07-09 20:42:57 +00:00
Alexander Motin
9e749f25da Add emulation for Intel e1000 (e82545) network adapter.
The code was successfully tested with FreeBSD, Linux, Solaris and Windows
guests.  This interface is predictably slower (about 2x) then virtio-net,
but it is very helpful for guests not supporting virtio-net by default.

Thanks to Jeremiah Lott and Peter Grehan for doing original heavy lifting.
2016-07-09 20:41:59 +00:00
Edward Tomasz Napierala
f9a2051818 Fix ctld(8) to not exit when reloading configuration with invalid
initiator-portal clause.

MFC after:	3 days
2016-07-09 20:01:07 +00:00
Ian Lepore
392a8e4408 Correct syntax errors that only show up when compiled with INVARIANTS. 2016-07-09 18:43:15 +00:00
Conrad Meyer
b156d221c9 dd(1): Enable access to SIZE_T_MAX character devices
On machines where SIZE_T_MAX exceeds OFF_MAX (signed 64-bit), permit seeking
character devices to negative off_t values.  This enables dd(1) to interact
with kernel KVA in /dev/kmem on amd64, for example.

Sponsored by:	EMC / Isilon Storage Division
2016-07-09 17:11:54 +00:00
Alexander Motin
c266ab3830 Improve checksum "offload" support.
For compatibility reasons make driver not report any checksum offload by
default, since there is indeed none.  But if administrator knows that
interface is used only for local traffic, he can enable fake checksum
offload manually on both sides to save some CPU cycles, since the data
are already protected by CRC32 of PCIe link.

Sponsored by:	iXsystems, Inc.
2016-07-09 14:59:16 +00:00
Andrew Turner
04d18df9af Remove an unneeded call to fdt_get_unit, the return value is unused.
MFC after:	1 month
Sponsored by:	ABT Systems Ltd
2016-07-09 13:27:14 +00:00
Kristof Provost
aa7cac58c6 pf: Map hook returns onto the correct error values
pf returns PF_PASS, PF_DROP, ... in the netpfil hooks, but the hook callers
expect to get E<foo> error codes.
Map the returns values. A pass is 0 (everything is OK), anything else means
pf ate the packet, so return EACCES, which tells the stack not to emit an ICMP
error message.

PR:	207598
2016-07-09 12:17:01 +00:00
Alexander Motin
8795de77ce Rewrite if_ntb to use modern interface KPIs and features.
It includes: link state, if_transmit, buf_ring, multiple queues, bpf, etc.

Sponsored by:	iXsystems, Inc.
2016-07-09 12:10:08 +00:00
Alexander Motin
b42e3ec60b Improve memory allocation errors handling on receive. 2016-07-09 12:00:04 +00:00
Alexander Motin
a7e0f01a3d Synchronize MTU code with Linux.
It is mandatory for transport compatibility.
2016-07-09 11:58:59 +00:00
Alexander Motin
59850913b2 Reimplement doorbell register emulation for NTB_SB01BASE_LOCKUP.
This allows at least first three doorbells to work very close to normal
hardware, properly signaling events to upper layers without spurious or
lost events.  Doorbells above the first three may still report spurious
events due to lack of reliable information, but they are rarely used.
2016-07-09 11:57:21 +00:00
Alexander Motin
f31eea5c49 Bring some more order into link and qp state handling.
Do not touch scratchpad registers until link is reported up.
Mask and do not handle doorbell events until respective qp is up.
2016-07-09 11:48:57 +00:00
Alexander Motin
ef48f66349 Switch ctx_lock from mutex to rmlock.
It is odd idea to serialize different MSI-X vectors.  Use of rmlocks
here allows them to execute in parallel, but still protects ctx.
If upper layers require any additional serialization -- they can
do it by themselves.
2016-07-09 11:47:52 +00:00
Alexander Motin
1be8a2635c Create separate RX taskqueue for each qp. 2016-07-09 11:46:32 +00:00
Alexander Motin
784ec7043b Remove rx_completion_task taskqueue.
It is not needed after RX lock removed in previous commit.
2016-07-09 11:45:18 +00:00
Alexander Motin
0a42578f0d Remove unneeded RX lock, and make TX lock per-qp. 2016-07-09 11:43:51 +00:00
Alexander Motin
0c84bc33cf Reduce code divergence from Linux, preparing for DMA support. 2016-07-09 11:40:59 +00:00
Alexander Motin
f7be35856a Fix operation with multiple qps. 2016-07-09 11:36:09 +00:00
Tobias C. Berner
b86969a5a6 Add myself (tcberner) as ports committer, and update mentor/mentee relationships.
Approved by:	rakuco (mentor)
2016-07-09 11:22:11 +00:00
Alexander Motin
9a5325c205 NewBus'ify NTB subsystem.
This follows NTB subsystem modularization in Linux, tuning it to FreeBSD
native NewBus interfaces.  This change allows to support different types
of hardware with different drivers, support multiple NTB instances in a
system, ntb_transport module use for needs other then if_ntb, etc.

Sponsored by:	iXsystems, Inc.
2016-07-09 11:20:42 +00:00
Alexander Motin
12738808e7 Remove some dead code found by Clang static analyzer. 2016-07-09 09:47:11 +00:00
Alexander Motin
b56203ac03 Fix NTB_SDOORBELL_LOCKUP workaround.
Since SBARxSZ register can be write-once, it can be unusable for disabling
the SBAR.  For such case also set SBARxBASE to zero to not intersect with
config BAR.
2016-07-09 09:34:24 +00:00
Baptiste Daroussin
0833e924c6 Revert the change from errx/strerror to errc to appease gcc 4.2 2016-07-09 06:52:55 +00:00