]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoAdd a WITH_BIND_NOW build knob
emaste [Tue, 6 Nov 2018 15:52:49 +0000 (15:52 +0000)]
Add a WITH_BIND_NOW build knob

The linker's -z now flag sets the DF_BIND_NOW flag, which signals to the
runtime loader that all relocation processing should be performed at
process startup rather than on demand.  In combination with lld's
default of enabling relro this causes the GOT to be made read-only when
the process starts, preventing straightforward GOT overwrite attacks.

Shawn Webb discovered a failure on HardenedBSD with BIND_NOW and ifunc
use, which resulted in my rtld fix in r340137.  Add a BIND_NOW knob as
it is trivial to do so and is a useful ELF hardening feature.  This
change is equivalent to HardenedBSD's but not identical as there are
other diffs/conflicts nearby.

Note that our ELF Tool Chain readelf does not currently decode the
DF_BIND_NOW flag - see PR232983.

Reviewed by: brooks
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17846

5 years agoFix builds with COMPAT_LINUX32 in the kernel config.
tijl [Tue, 6 Nov 2018 15:29:44 +0000 (15:29 +0000)]
Fix builds with COMPAT_LINUX32 in the kernel config.

MFC after: 3 days

5 years agoOn amd64 both Linux compat modules, linux.ko and linux64.ko, provide
tijl [Tue, 6 Nov 2018 13:51:08 +0000 (13:51 +0000)]
On amd64 both Linux compat modules, linux.ko and linux64.ko, provide
linux_ioctl_(un)register_handler that allows other driver modules to
register ioctl handlers.  The ioctl syscall implementation in each Linux
compat module iterates over the list of handlers and forwards the call to
the appropriate driver.  Because the registration functions have the same
name in each module it is not possible for a driver to support both 32 and
64 bit linux compatibility.

Move the list of ioctl handlers to linux_common.ko so it is shared by
both Linux modules and all drivers receive both 32 and 64 bit ioctl calls
with one registration.  These ioctl handlers normally forward the call
to the FreeBSD ioctl handler which can handle both 32 and 64 bit.

Keep the special COMPAT_LINUX32 ioctl handlers in linux.ko in a separate
list for now and let the ioctl syscall iterate over that list first.
Later, COMPAT_LINUX32 support can be added to the 64 bit ioctl handlers
via a runtime check for ILP32 like is done for COMPAT_FREEBSD32 and then
this separate list would disappear again.  That is a much bigger effort
however and this commit is meant to be MFCable.

This enables linux64 support in x11/nvidia-driver*.

PR: 206711
Reviewed by: kib
MFC after: 3 days

5 years agoDon't use a function when neither INET nor INET6 are defined.
tuexen [Tue, 6 Nov 2018 12:55:03 +0000 (12:55 +0000)]
Don't use a function when neither INET nor INET6 are defined.
This is a valid case for the userland stack, where this fixes
two set-but-not-used warnings in this case.

Thanks to Christian Wright for reporting the issue.

5 years agoPick 50b473c8839f5408df179bdf6f2b3fd2cf5c3b2f from upstream:
trasz [Tue, 6 Nov 2018 12:05:46 +0000 (12:05 +0000)]
Pick 50b473c8839f5408df179bdf6f2b3fd2cf5c3b2f from upstream:

    Set commit properly for FreeBSD w/ overcommit.

    When overcommit is enabled, commit needs to be set when doing mmap().  The
    regression was introduced in f80c97e.

This fixes 'retain:true'.

Discussed with: jasone
Obtained from: Qi Wang <interwq at gwu dot edu>
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRemove btxld from symlinked host tools
arichardson [Tue, 6 Nov 2018 09:36:59 +0000 (09:36 +0000)]
Remove btxld from symlinked host tools

It is only present on amd64/i386 systems which breaks buildworld on
other hosts. In fact there is no need to add it to the bootstrap tools
list since it is already included in the cross-tools phase.
However, for cross-tools it was only built if the host and target
architecture didn't match. After this change it is also built when we
are builtin with a strict $PATH.

Reported By: mmel

5 years agoDo not print "ip6" keyword in print_icmp6types() for O_ICMP6TYPE opcode.
ae [Tue, 6 Nov 2018 07:41:32 +0000 (07:41 +0000)]
Do not print "ip6" keyword in print_icmp6types() for O_ICMP6TYPE opcode.

It produces incompatibility when rules listing is used again to
restore saved ruleset, because "ip6" keyword produces separate opcode.
The kernel already has the check and only IPv6 packets will be checked
for matching.

PR: 232939
MFC after: 3 days

5 years agoInitialize last_target in the laundry thread control loop.
markj [Tue, 6 Nov 2018 02:52:54 +0000 (02:52 +0000)]
Initialize last_target in the laundry thread control loop.

In practice it is always initialized because nfreed must be positive
in order to trigger background laundering, but this isn't obvious.

CID: 1387997
MFC after: 1 week

5 years agoAdd a facility for transmitting "raw" work requests on regular NIC queues.
jhb [Tue, 6 Nov 2018 00:11:36 +0000 (00:11 +0000)]
Add a facility for transmitting "raw" work requests on regular NIC queues.

- Use PH_loc.eight[1] as a general 'cflags' (Chelsio flags) field to
  describe properties of a queued packet.  The MC_RAW_WR flag
  indicates an mbuf holding a raw work request.  mbuf_cflags() returns
  the current flags.
- Raw work request mbufs are allocated via alloc_wr_mbuf() which will
  allocate a single contiguous range to hold the mbuf data.  The
  consumer can use mtod() to obtain the start of the work request and
  write the required work request in the buffer.  The mbuf can then be
  enqueued directly to the txq via mp_ring_enqueue().
- Since raw work requests might potentially send arbitrary work
  requests, only set the EQUIQ and EQUEQ bits on work requests that
  support them such as the normal tunneled Ethernet packet work
  requests.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D17811

5 years agoFix a couple indentation errors in r339958.
brooks [Tue, 6 Nov 2018 00:09:43 +0000 (00:09 +0000)]
Fix a couple indentation errors in r339958.

5 years agocapability.h: add comment about planned removal timeline
emaste [Tue, 6 Nov 2018 00:05:17 +0000 (00:05 +0000)]
capability.h: add comment about planned removal timeline

PR: 233007
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoAdd a custom implementation of cpu_lock_delay() for x86.
jhb [Mon, 5 Nov 2018 22:54:03 +0000 (22:54 +0000)]
Add a custom implementation of cpu_lock_delay() for x86.

Avoid using DELAY() since it can try to use spin locks on CPUs without
a P-state invariant TSC.  For cpu_lock_delay(), always use the TSC if
it exists (even if it is not P-state invariant) to delay for a
microsecond.  If the TSC does not exist, read from I/O port 0x84 to
delay instead.

PR: 228768
Reported by: Roger Hammerstein <cheeky.m@live.com>
Reviewed by: kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D17851

5 years agoelfdump: Add -E to test if a file is an ELF binary.
brooks [Mon, 5 Nov 2018 22:53:50 +0000 (22:53 +0000)]
elfdump: Add -E to test if a file is an ELF binary.

This is intended to replace potentially unreliable checks like:

file -b $1 | grep -q '^ELF ..-bit .SB executable'

Reviewed by: emaste
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15971

5 years agoAdd a delay_tsc() static function for when DELAY() uses the TSC.
jhb [Mon, 5 Nov 2018 22:51:45 +0000 (22:51 +0000)]
Add a delay_tsc() static function for when DELAY() uses the TSC.

This uses slightly simpler logic than the existing code by using the
full 64-bit counter and thus not having to worry about counter
overflow.

Reviewed by: kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D17850

5 years agoKeep inheriting $PATH when using system linker/compiler
arichardson [Mon, 5 Nov 2018 22:51:44 +0000 (22:51 +0000)]
Keep inheriting $PATH when using system linker/compiler

I missed this case when testing r340157. For now just keep
$PATH when we aren't bootstrapping a compiler so that the build
can find cc/c++/ld without an absolute path.

Reported by: yuripv

5 years agorevert r340156, restoring sys/sys/capability.h
emaste [Mon, 5 Nov 2018 22:36:45 +0000 (22:36 +0000)]
revert r340156, restoring sys/sys/capability.h

More time is still needed for ports to accommodate the migration to
capsicum.h.

The header was renamed in 2014 due to concerns about conflicts with with
a draft POSIX.1e capability.h header on other systems and there is (now)
no need for complex autoconf tests for both capability.h and capsicum.h.
Any supported Capsicum-capable system has capsicum.h.

Reported by: antoine
Sponsored by: The FreeBSD Foundation

5 years agoAdd a KPI for the delay while spinning on a spin lock.
jhb [Mon, 5 Nov 2018 21:34:17 +0000 (21:34 +0000)]
Add a KPI for the delay while spinning on a spin lock.

Replace a call to DELAY(1) with a new cpu_lock_delay() KPI.  Currently
cpu_lock_delay() is defined to DELAY(1) on all platforms.  However,
platforms with a DELAY() implementation that uses spin locks should
implement a custom cpu_lock_delay() doesn't use locks.

Reviewed by: kib
MFC after: 3 days

5 years agoFix -DNO_CLEAN build after r340157
arichardson [Mon, 5 Nov 2018 21:30:00 +0000 (21:30 +0000)]
Fix -DNO_CLEAN build after r340157

Approved By: jhb (mentor)

5 years agoDocument the fact that cap_limit_set() always frees the input nvlist.
markj [Mon, 5 Nov 2018 21:01:45 +0000 (21:01 +0000)]
Document the fact that cap_limit_set() always frees the input nvlist.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoRework setting PTE_D for kernel mappings.
jhb [Mon, 5 Nov 2018 20:00:36 +0000 (20:00 +0000)]
Rework setting PTE_D for kernel mappings.

Rather than unconditionally setting PTE_D for all writeable kernel
mappings, set PTE_D for writable mappings of unmanaged pages (whether
user or kernel).  This matches what amd64 does and also matches what
the RISC-V spec suggests (preset the A and D bits on mappings where
the OS doesn't care about the state).

Suggested by: alc
Reviewed by: alc, markj
Sponsored by: DARPA

5 years agoBuild the elftoolchain libraries as part of bootstrap-tools
arichardson [Mon, 5 Nov 2018 19:51:16 +0000 (19:51 +0000)]
Build the elftoolchain libraries as part of bootstrap-tools

It is not necessary to build libelf and libdwarf this early. Furthermore,
when building on Linux/MacOS, m4 will only be built during the bootstrap
tools phase and not be available in $PATH before.

Reviewed By: emaste
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17800

5 years agoAllow building world without inheriting $PATH
arichardson [Mon, 5 Nov 2018 19:51:10 +0000 (19:51 +0000)]
Allow building world without inheriting $PATH

Inheriting $PATH during the build phase can cause the build to fail when
compiling on a different system due to missing build tools or incompatible
versions somewhere in $PATH. This has cause build failures for us before
due to the jenkins slaves still running FreeBSD 10.
Listing the tools we depend on explicitly instead of just using whatever
happens to be in $PATH allows us to check that we don't accidentally add a
new build dependency.

All tools that do no need to be bootstrapped will now be symlinked to
${WORLDTMP}/legacy/bin and during the build phase $PATH will only contain
${WORLDTMP}. There is also a new variable "BOOTSTRAP_ALL_TOOLS" which can
be set to force compiling almost all bootstrap tools instead of symlinking
them. This will not bootstrap tools such as cp,mv, etc. since they may be
used during the build and for those we should really only be using POSIX
compatible options.

Furthermore, this change is required in order to be able to build on
non-FreeBSD hosts. While the same binaries may exist on Linux/MacOS they
often accept different flags or produce incompatible output.

Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D16815

5 years agoRemove backwards-compatibility sys/capability.h
emaste [Mon, 5 Nov 2018 19:25:57 +0000 (19:25 +0000)]
Remove backwards-compatibility sys/capability.h

In r263232 sys/capability.h was renamed to sys/capsicum.h, to avoid
conflicts with a capability.h header found on other operating systems.

Sufficient time has now passed, so remove the old header at the
beginning of FreeBSD 13.

Discussed with: oshogbo
Sponsored by: The FreeBSD Foundation

5 years agoOnly assert locked for many async events.
imp [Mon, 5 Nov 2018 18:47:29 +0000 (18:47 +0000)]
Only assert locked for many async events.

Many async events that we see are called for this specific path. When
calling an async callback for a targetted device, XTP will lock that
specific device's path lock (same as what cam_periph_lock does). For
those AC_ events, assert we have the lock rather than trying to
recusrively take it (which causes panics since it's not recursive).

Add annotations about this and about the fact that AC_SCSI_AEN events
are generated now only in the ata stack (which cannot have a scsi_da
attachment). Leave it in place in case I've overlooked something as
the code is harmless.

This is fallout from my attempts to "fix" locking for softc->flags in
r330796 that's not been triggered often enough to get my attention
until now.

Sponsored by: Netflix
MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D17837

5 years agolualoader: Add chainload menu entry
kevans [Mon, 5 Nov 2018 16:20:07 +0000 (16:20 +0000)]
lualoader: Add chainload menu entry

MFC after: 4 days

5 years agoRegen src.conf.5 after r340150
emaste [Mon, 5 Nov 2018 15:30:13 +0000 (15:30 +0000)]
Regen src.conf.5 after r340150

5 years agoExpand WITH_LLD_BOOTSTRAP description
emaste [Mon, 5 Nov 2018 15:22:41 +0000 (15:22 +0000)]
Expand WITH_LLD_BOOTSTRAP description

Reported by: bz

5 years agohwpmc: limit wait for user callchain collection to 1 tick
mmacy [Mon, 5 Nov 2018 08:11:16 +0000 (08:11 +0000)]
hwpmc: limit wait for user callchain collection to 1 tick

The hwpmc pcpu sample buffer is prone to head of line blocking
when waiting for user process to return to user space and
collect a pending callchain. If more than one tick has elapsed
between the time the sample entry was marked for collection and
the time that the hardclock pmc handler runs to copy the records
to a larger temporary buffer, mark the sample entry as not in
use.

This changes reduces the number of samples marked as not valid
when collecting under load from ~99.5% to 5-20%.

Reported by: mjg@
MFC after: 3 days

5 years agopowerpc/SMP: Don't spam the console with AP bringup messages
jhibbits [Mon, 5 Nov 2018 01:53:20 +0000 (01:53 +0000)]
powerpc/SMP: Don't spam the console with AP bringup messages

Especially on new POWER9 systems, the console can be filled with

  SMP: AP CPU #XX launched

messages.  This can also slow down the console printing.  Instead, do what
x86 now does, as of r333335, and print it all on one line, unless
bootverbose is set.

5 years agoMove pmc* bits behind MK_PMC to fix WITHOUT_PMC build
kevans [Mon, 5 Nov 2018 00:20:58 +0000 (00:20 +0000)]
Move pmc* bits behind MK_PMC to fix WITHOUT_PMC build

No objection from: mmacy
MFC after: 3 days

5 years agoAdd hybrid C.UTF-8 locale being identical to default C locale except
yuripv [Sun, 4 Nov 2018 22:13:22 +0000 (22:13 +0000)]
Add hybrid C.UTF-8 locale being identical to default C locale except
that it uses the same ctype maps and functions as other UTF-8 locales.

Reviewed by: bapt, cem, eadler
Approved by: kib (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17833

5 years agoping: simplify use of Casper
oshogbo [Sun, 4 Nov 2018 20:26:29 +0000 (20:26 +0000)]
ping: simplify use of Casper

There is no need to check if capdns is NULL.
If we will build the system without casper all cap_gethostaddr will be
replaced by the standard functions.

5 years agolibcasper: using explicit_bzero in cap_grp service
oshogbo [Sun, 4 Nov 2018 19:43:59 +0000 (19:43 +0000)]
libcasper: using explicit_bzero in cap_grp service

Please notice that we still don't clean information in nvlist structures.

Submitted by: David CARLIER <devnexen@gmail.com>
Differential Revision: https://reviews.freebsd.org/D16777

5 years agolibcasper: fix limitations in dns service
oshogbo [Sun, 4 Nov 2018 19:38:54 +0000 (19:38 +0000)]
libcasper: fix limitations in dns service

The getaddrinfo(3) and gethostbyname(3) are used to return the address for a
given hostname. The getnameinfo(3) and gethostbyaddr(3) are used to return
hostname for a given address. Right now in casper, we have two limitations:
- NAME which allows resolving DNS names.
- ADDR which allows to do revert DNS lookups.

Before this change the rights was mixed up:
NAME - getnameinfo(3) and gethostbyname(3)
ADDR - gethostbyaddr(3) and getaddrinfo(3)

Which no matters on limitation allowed us to resolve DNS names and do DNS
lookups basically by using a different set of functions.

Now the NAME type allows getaddrinfo(3) and gethostbyname (3)functions,
and the ADDR names allow to use gethostbyaddr(3) and getnameinfo(3) functions.

Reviewed by: pjd, bcr
MFC after: 3 weeks
Discussed with: hrs
Differential Revision: https://reviews.freebsd.org/D16930

5 years agolibcasper: Update example in man page to use cap_getnameinfo function.
oshogbo [Sun, 4 Nov 2018 19:31:44 +0000 (19:31 +0000)]
libcasper: Update example in man page to use cap_getnameinfo function.

Reviewed by: hrs
Differential Revision: https://reviews.freebsd.org/D16931

5 years agolibcasper: Document the cap_getaddrinfo and cap_getnameinfo functions
oshogbo [Sun, 4 Nov 2018 19:29:19 +0000 (19:29 +0000)]
libcasper: Document the cap_getaddrinfo and cap_getnameinfo functions

Reviewed by: hrs
Differential Revision: https://reviews.freebsd.org/D16929

5 years agocapsicum: use a new capsicum helpers in tools
oshogbo [Sun, 4 Nov 2018 19:24:49 +0000 (19:24 +0000)]
capsicum: use a new capsicum helpers in tools

Use caph_{rights,ioctls,fcntls}_limit to simplify the code.

5 years agortld: move relro enforcement after ifunc processing
emaste [Sun, 4 Nov 2018 19:21:12 +0000 (19:21 +0000)]
rtld: move relro enforcement after ifunc processing

Previously the combination of relro (implicit), -z now and ifunc use
resulted in a segfault when applying ifuncs after relro (test binary
here just calls amd64_get_fsbase()):

| % env LD_DEBUG=1 libexec/rtld-elf/obj/ld-elf.so.1 a.out
| ...
| enforcing main obj relro
| ...
| resolving ifuncs
| reloc_jmpslot: *0x203198 = 0x189368ea4570
| zsh: bus error (core dumped)  LD_DEBUG=1 obj/ld-elf.so.1 ~/a.out

Reported by: Shawn Webb
Reviewed by: kib
Sponsored by: The FreeBSD Foundation

5 years agoMove the fixed base for PIE loading on arm.
kib [Sun, 4 Nov 2018 19:11:32 +0000 (19:11 +0000)]
Move the fixed base for PIE loading on arm.

Existing base causes conflicts for direct execution of ld-elf.so.1
because default linking base for non-PIE binaries is 0x10000.

Reported and tested by: Mark Millard <marklmi26-fbsd@yahoo.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoMake ng_pptpgre(8) netgraph node be able to restore order for packets
eugen [Sun, 4 Nov 2018 19:10:44 +0000 (19:10 +0000)]
Make ng_pptpgre(8) netgraph node be able to restore order for packets
reordered in transit instead of dropping them altogether.
It uses sequence numbers of PPtPGRE packets.

A set of new sysctl(8) added to control this ability or disable it:

net.graph.pptpgre.reorder_max (1) defines maximum length of node's
private reorder queue used to keep data waiting for late packets.
Zero value disables reordering. Default value 1 allows the node to restore
the order for two packets swapped in transit. Greater values allow the node
to deliver packets being late after more packets in sequence
at cost of increased kernel memory usage.

net.graph.pptpgre.reorder_timeout (1) defines time value in miliseconds
used to wait for late packets. It may be useful to increase this
if reordering spot is distant.

MFC after: 1 month

5 years agoFix a recusive call introduce in the r340130.
oshogbo [Sun, 4 Nov 2018 18:52:59 +0000 (18:52 +0000)]
Fix a recusive call introduce in the r340130.

5 years agoUn-break build libexpact.
oshogbo [Sun, 4 Nov 2018 18:24:11 +0000 (18:24 +0000)]
Un-break build libexpact.

The writeRandomBytes_arc4random is not used if the arc4random_buf
is available. This caused compiler to throw warnings which are treated as
an error in libexpact.

Approved by: vangyzen

5 years agoDrop ed(1) "crypto"
cem [Sun, 4 Nov 2018 17:56:16 +0000 (17:56 +0000)]
Drop ed(1) "crypto"

You should not be using DES.  You should not have been using DES for the
past 30 years.

The ed DES-CBC scheme lacked several desirable properties of a sealed
document system, even ignoring DES itself.  In particular, it did not
provide the "integrity" cryptographic property (detection of tampering), and
it treated ASCII passwords as 64-bit keys (instead of using a KDF like
scrypt or PBKDF2).

Some general approaches ed(1) users might consider to replace the removed
DES mode:

1. Full disk encryption with something like AES-XTS.  This is easy to
conceptualize, design, and implement, and it provides confidentiality for
data at rest.  Like CBC, it lacks tampering protection.  Examples include
GELI, LUKS, FileVault2.

2. Encrypted overlay ("stackable") filesystems (EncFS, PEFS?, CryptoFS,
others).

3. Native encryption at the filesystem layer.  Ext4/F2FS, ZFS, APFS, and
NTFS all have some flavor of this.

4. Storing your files unencrypted.  It's not like DES was doing you much
good.

If you have DES-CBC scrambled files produced by ed(1) prior to this change,
you may decrypt them with:

  openssl des-cbc -d -iv 0 -K <key in hex> -in <inputfile> -out <plaintext>

Reviewed by: allanjude, bapt, emaste
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D17829

5 years agolibcapsicum: Introduce caph_{rights,ioctls,fcntls}_limit
oshogbo [Sun, 4 Nov 2018 17:22:58 +0000 (17:22 +0000)]
libcapsicum: Introduce caph_{rights,ioctls,fcntls}_limit

The idea behind those functions is not to force consumers to remember that there
is a need to check errno on failure. We already have a caph_enter(3) function
which does the same for cap_enter(2).

MFC after: 2 weeks

5 years agocapsicum: allow ppoll(2) in capability mode
oshogbo [Sun, 4 Nov 2018 17:12:53 +0000 (17:12 +0000)]
capsicum: allow ppoll(2) in capability mode

We already allow to use poll(2). There is no reason to disallow ppoll(2).

PR: 232495
Submitted by: Stefan Grundmann <sg2342@googlemail.com>
Reviewed by: cem, oshogbo
MFC after: 2 weeks

5 years agoTeach man(1) about C.UTF-8.
yuripv [Sun, 4 Nov 2018 16:58:55 +0000 (16:58 +0000)]
Teach man(1) about C.UTF-8.

While here, use LANG as the proper source to select man pages language/encoding,
falling back to LC_CTYPE.

Reviewed by: bapt
Approved by: kib (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17835

5 years agoUpdate expat to 2.2.6
vangyzen [Sun, 4 Nov 2018 16:08:59 +0000 (16:08 +0000)]
Update expat to 2.2.6

Update contrib/expat by merging from the vendor branch.

Update expat_config.h manually, using
    make -C /usr/ports/textproc/expat2 configure
as a baseline.

MFC after: 1 month
Relnotes: yes
Security: yes; see contrib/expat/Changes since 2.2.0
Sponsored by: Dell EMC Isilon

5 years agocsqrt(3): Fix some typos in the manual page
0mp [Sun, 4 Nov 2018 14:11:38 +0000 (14:11 +0000)]
csqrt(3): Fix some typos in the manual page

Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu>
Reviewed by: eadler
Approved by:    krion (mentor, implicit), mat (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17831

5 years agoSimplify NLS alias handling by using native make(1) multi variable for loops
bapt [Sun, 4 Nov 2018 10:14:08 +0000 (10:14 +0000)]
Simplify NLS alias handling by using native make(1) multi variable for loops

5 years agoFix bad copy/paste
bapt [Sun, 4 Nov 2018 06:59:13 +0000 (06:59 +0000)]
Fix bad copy/paste

5 years agoSimplify a bit distrib-dirs target
bapt [Sun, 4 Nov 2018 06:47:21 +0000 (06:47 +0000)]
Simplify a bit distrib-dirs target

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D3915

5 years agonfsd: Factorize code
bapt [Sun, 4 Nov 2018 06:39:01 +0000 (06:39 +0000)]
nfsd: Factorize code

Factorize code by using struct sockaddr_storage to handle both ipv6 and ipv4

Discussed with: rmacklem
Reviewed by: manu
MFC after: 1 month
Sponsored by: Gandi.net
Differential Revision: https://reviews.freebsd.org/D13223

5 years agoipfw(8): clarify layer2 processing abilities
eugen [Sun, 4 Nov 2018 06:35:48 +0000 (06:35 +0000)]
ipfw(8): clarify layer2 processing abilities

Make it clear that ipfw action set for layer2 frames it a bit limited.

PR: 59835
Reviewed by: yuripv
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D17719

5 years agoAdd aditional counter descriptions to AMD 0x17
mmacy [Sun, 4 Nov 2018 06:24:27 +0000 (06:24 +0000)]
Add aditional counter descriptions to AMD 0x17

Submitted by: Somalapuram Amaranath
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D17401

5 years agoRemove Obj_Entry textsize member.
kib [Sun, 4 Nov 2018 00:32:28 +0000 (00:32 +0000)]
Remove Obj_Entry textsize member.

It is unused after r340102, and more important, I do not see how to
define textsize in both practically useful and correct way, for binaries
with more that one executable segments.

Sponsored by: The FreeBSD Foundation

5 years agostrptime: make %k and %l specifiers match their description in
yuripv [Sat, 3 Nov 2018 23:37:13 +0000 (23:37 +0000)]
strptime: make %k and %l specifiers match their description in
strftime(3), and allow them to process space-padded input.

PR: 230720
Submitted by: rlittle@inetco.com (original version)
Approved by: kib (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17761

5 years agoUpdate to CLDR 34 and UNICODE 11.
yuripv [Sat, 3 Nov 2018 22:02:10 +0000 (22:02 +0000)]
Update to CLDR 34 and UNICODE 11.

Discussed with: bapt
Approved by: kib (mentor)
MFC after: 1 month

5 years agoFlush data cache for executable loadable segments explicitly.
kib [Sat, 3 Nov 2018 20:39:16 +0000 (20:39 +0000)]
Flush data cache for executable loadable segments explicitly.

Do not use textsize and do not flush everything between map base and
base + textsize, because unmapped areas cannot be flushed.

This makes Obj_Entry textsize only use go away, and I will remove it
later.

Reported by: tuexen
Tested by: Mark Millard <marklmi26-fbsd@yahoo.com>
Sponsored by: The FreeBSD Foundation

5 years agoDo not use bzero() for the O_ICMP6TYPE opcode.
ae [Sat, 3 Nov 2018 20:05:50 +0000 (20:05 +0000)]
Do not use bzero() for the O_ICMP6TYPE opcode.

The buffer is already zeroed in compile_rule() function, and also it
may contain configured F_NOT flag in o.len field. This fixes the filling
for "not icmp6types" opcode.

PR: 232939
MFC after: 3 days

5 years agolibcompat: disable retpoline when building build tools
emaste [Sat, 3 Nov 2018 19:31:11 +0000 (19:31 +0000)]
libcompat: disable retpoline when building build tools

These are built with the host toolchain which may not support retpoline.
While here, move the MK_ overrides to a separate line and sort them
alphabetically to support future changes.

MFC with: r339511
Sponsored by: The FreeBSD Foundation

5 years agoUpdate the "flag" for draft-ietf-6man-ipv6only-flag.
bz [Sat, 3 Nov 2018 18:03:24 +0000 (18:03 +0000)]
Update the "flag" for draft-ietf-6man-ipv6only-flag.

Having the flag named "6" can possibly be a problem for configurations
where parsing strings and numbers can produce ambivalent results.
Rename the "6" flag to the "S"ix (or Silence-IPv4) flag.

5 years agoConvert epoch to read / write records per cpu
mmacy [Sat, 3 Nov 2018 03:43:32 +0000 (03:43 +0000)]
Convert epoch to read / write records per cpu

In discussing D17503 "Run epoch calls sooner and more reliably" with
sbahra@ we came to the conclusion that epoch is currently misusing the
ck_epoch API. It isn't safe to do a "write side" operation (ck_epoch_call
or ck_epoch_poll) in the middle of a "read side" section. Since, by definition,
it's possible to be preempted during the middle of an EPOCH_PREEMPT
epoch the GC task might call ck_epoch_poll or another thread might call
ck_epoch_call on the same section. The right solution is ultimately to change
the way that ck_epoch works for this use case. However, as a stopgap for
12 we agreed to simply have separate records for each use case.

Tested by: pho@

MFC after: 3 days

5 years ago9952 Block size change during zfs receive drops spill block
mav [Sat, 3 Nov 2018 03:10:06 +0000 (03:10 +0000)]
9952 Block size change during zfs receive drops spill block

Replication code in receive_object() falsely assumes that if received
object block size is different from local, then it must be a new object
and calls dmu_object_reclaim() to wipe it out. In most cases it is not a
problem, since all dnode, bonus buffer and data block(s) are immediately
rewritten any way, but the problem is that spill block (if used) is not.
This means loss of ACLs, extended attributes, etc.

This issue can be triggered in very simple way:
1. create 4KB file with 10+ ACL entries;
2. take snapshot and send it to different dataset;
3. append another 4KB to the file;
4. take another snapshot and send incrementally;
5. witness ACL loss on receive side.

PR: 198457
Discussed with: mahrens
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

5 years agoRemove apparently unused 0-byte files that cause grief on Windows
emaste [Sat, 3 Nov 2018 01:53:26 +0000 (01:53 +0000)]
Remove apparently unused 0-byte files that cause grief on Windows

r235274 added a sort regression test (it operates by comparing output
against GNU sort).  The commit included a number of 0-byte files, one
of which ends in a trailing . which reportedly breaks svn/git checkouts
on Windows.

It appears these were added accidentally, so just remove them.

PR: 232479
MFC after: 1 month

5 years agoAdd missing .El
imp [Sat, 3 Nov 2018 01:44:37 +0000 (01:44 +0000)]
Add missing .El

5 years agoDocument disbale_phy in ahcich sysctls.
imp [Sat, 3 Nov 2018 00:47:02 +0000 (00:47 +0000)]
Document disbale_phy in ahcich sysctls.

5 years agoImplement ability to turn on/off PHYs for AHCI devices.
imp [Sat, 3 Nov 2018 00:37:51 +0000 (00:37 +0000)]
Implement ability to turn on/off PHYs for AHCI devices.

As part of Chuck's work on fixing kernel crashes caused by disk I/O
errors, it is useful to be able to trigger various kinds of
errors. This patch allows causing an AHCI-attached disk to disappear,
by having the driver keep the PHY disabled when the driver would
otherwise enable the PHY. It also allows making the disk reappear by
having the driver go back to setting the PHY enable/disable state as
it normal would and simulating the hardware event that causes a bus
rescan.

Submitted by: Chuck Silvers
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D16043

5 years agoUpdate awk(1) manual to state an exception to egrep(1)-like RE syntax
dteske [Fri, 2 Nov 2018 23:03:40 +0000 (23:03 +0000)]
Update awk(1) manual to state an exception to egrep(1)-like RE syntax

Reviewed by: imp, jmg
MFC after: 3 days
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/D17739

5 years agoMFV: r339981
jkim [Fri, 2 Nov 2018 22:50:13 +0000 (22:50 +0000)]
MFV: r339981

Merge ACPICA 20181031.

5 years agoUse correct type for IOCTL request argument.
hselasky [Fri, 2 Nov 2018 22:23:25 +0000 (22:23 +0000)]
Use correct type for IOCTL request argument.
This fixes signed IOCTL value warnings in uhsoctl().

MFC after: 1 week
Submitted by: Marcin Cieslak <saper@saper.info>
Sponsored by: Mellanox Technologies

5 years agoFurther research shows usbdump(8) is what we should point people at
imp [Fri, 2 Nov 2018 22:18:02 +0000 (22:18 +0000)]
Further research shows usbdump(8) is what we should point people at
rather than tcpdump for usb traffic capture.

5 years agoCatch up with the SCSI device removal. We should likely review why we
imp [Fri, 2 Nov 2018 22:15:47 +0000 (22:15 +0000)]
Catch up with the SCSI device removal. We should likely review why we
even have this.

5 years agoDocument r226775: tell why we omit usbus[0-9]+
imp [Fri, 2 Nov 2018 22:15:30 +0000 (22:15 +0000)]
Document r226775: tell why we omit usbus[0-9]+

tcpdump can capture packet traces from the usb bus. usbus[0-9] are
registered as ifnet devices so this can work. When these devices come
up, devd was trying to run pccard_ether on those interfaces, which
didn't exist and generated an error.

5 years agoVendor import of expat 2.2.6
vangyzen [Fri, 2 Nov 2018 22:10:07 +0000 (22:10 +0000)]
Vendor import of expat 2.2.6

Sponsored by: Dell EMC Isilon

5 years agonewvers.sh: fix git false positive -dirty tag
emaste [Fri, 2 Nov 2018 21:20:46 +0000 (21:20 +0000)]
newvers.sh: fix git false positive -dirty tag

Assuming that any output from `git diff-index --name-only` implies
changes in the working tree results in false positives: files with
metadata, but not content, changes are also listed.

Check that content differences exist before adding the -dirty tag to
the git hash.

PR: 229230
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D15968

5 years agoembed_mfs.sh: replace some compound statements with conventional ifs
emaste [Fri, 2 Nov 2018 21:07:06 +0000 (21:07 +0000)]
embed_mfs.sh: replace some compound statements with conventional ifs

Use the more readable form - there's no need to try being clever.

5 years agoRegen after r340080: Add const to input-only char * arguments.
brooks [Fri, 2 Nov 2018 20:56:19 +0000 (20:56 +0000)]
Regen after r340080: Add const to input-only char * arguments.

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17812

5 years agoAdd const to input-only char * arguments.
brooks [Fri, 2 Nov 2018 20:50:22 +0000 (20:50 +0000)]
Add const to input-only char * arguments.

These arguments are mostly paths handled by NAMEI*() macros which already
take const char * arguments.

This change improves the match between syscalls.master and the public
declerations of system calls.

Reviewed by: kib (prior version)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17812

5 years agosys/types.h: avoid using terse macro _M
emaste [Fri, 2 Nov 2018 20:48:29 +0000 (20:48 +0000)]
sys/types.h: avoid using terse macro _M

Although _M is reserved for use by the implemenation it is rather non-
descriptive and conflicted with a libc++ test.  Just rename to _Major
and _Minor to avoid conflicts.

Reviewed by: dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16734

5 years agopf: Fix build if INVARIANTS is not set
kp [Fri, 2 Nov 2018 19:23:50 +0000 (19:23 +0000)]
pf: Fix build if INVARIANTS is not set

r340061 included a number of assertions pf_frent_remove(), but these assertions
were the only use of the 'prev' variable. As a result builds without
INVARIANTS had an unused variable, and failed.

Reported by: vangyzen@

5 years agom_pulldown() may reallocate n. Update the oip pointer after the
jtl [Fri, 2 Nov 2018 19:14:15 +0000 (19:14 +0000)]
m_pulldown() may reallocate n. Update the oip pointer after the
m_pulldown() call.

MFC after: 2 weeks
Sponsored by: Netflix

5 years agoDefine NT_FREEBSD_FEATURE_CTL ELF note type
emaste [Fri, 2 Nov 2018 19:02:03 +0000 (19:02 +0000)]
Define NT_FREEBSD_FEATURE_CTL ELF note type

This ELF note will be used to allow binaries to opt out of, or in to,
upcoming vulnerability mitigation and other features.

Committing the definition and readelf change separately to allow
independent MFC.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoreadelf: decode R_MIPS_HIGHER and R_MIPS_HIGHEST relocation types
emaste [Fri, 2 Nov 2018 18:40:01 +0000 (18:40 +0000)]
readelf: decode R_MIPS_HIGHER and R_MIPS_HIGHEST relocation types

Sponsored by: The FreeBSD Foundation

5 years agoAdd sysctl_usec_to_sbintime and sysctl_msec_to_sbintime.
imp [Fri, 2 Nov 2018 17:50:57 +0000 (17:50 +0000)]
Add sysctl_usec_to_sbintime and sysctl_msec_to_sbintime.

These functions are used to present a sbintime_t as either a number of
microseconds or a number of milliseconds respectively.

Sponsored by: Netflix

5 years agopf: Keep a reference to struct ifnets we're using
kp [Fri, 2 Nov 2018 17:05:40 +0000 (17:05 +0000)]
pf: Keep a reference to struct ifnets we're using

Ensure that the struct ifnet we use can't go away until we're done with
it.

5 years agopfsync: Add missing unlock
kp [Fri, 2 Nov 2018 17:03:53 +0000 (17:03 +0000)]
pfsync: Add missing unlock

If we fail to set up the multicast entry for pfsync and return an error
we must release the pfsync lock first.

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D17506

5 years agoAdjust SiS 966/968 HDA controller naming.
mav [Fri, 2 Nov 2018 17:02:10 +0000 (17:02 +0000)]
Adjust SiS 966/968 HDA controller naming.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>

5 years agopfsync: Allow module to be unloaded
kp [Fri, 2 Nov 2018 17:01:18 +0000 (17:01 +0000)]
pfsync: Allow module to be unloaded

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D17505

5 years agopf tests: Basic pfsync test
kp [Fri, 2 Nov 2018 16:59:55 +0000 (16:59 +0000)]
pf tests: Basic pfsync test

Set up two jails, configure pfsync between them and create state in one
of them, verify that this state is copied to the other jail.

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D17504

5 years agopfsync: Handle syncdev going away
kp [Fri, 2 Nov 2018 16:57:23 +0000 (16:57 +0000)]
pfsync: Handle syncdev going away

If the syncdev is removed we no longer need to clean up the multicast
entry we've got set up for that device.

Pass the ifnet detach event through pf to pfsync, and remove our
multicast handle, and mark us as no longer having a syncdev.

Note that this callback is always installed, even if the pfsync
interface is disabled (and thus it's not a per-vnet callback pointer).

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D17502

5 years agopfsync: Ensure uninit is done before pf
kp [Fri, 2 Nov 2018 16:53:15 +0000 (16:53 +0000)]
pfsync: Ensure uninit is done before pf

pfsync touches pf memory (for pf_state and the pfsync callback
pointers), not the other way around. We need to ensure that pfsync is
torn down before pf.

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D17501

5 years agoNotify that the ifnet will go away, even on vnet shutdown
kp [Fri, 2 Nov 2018 16:50:17 +0000 (16:50 +0000)]
Notify that the ifnet will go away, even on vnet shutdown

pf subscribes to ifnet_departure_event events, so it can clean up the
ifg_pf_kif and if_pf_kif pointers in the ifnet.
During vnet shutdown interfaces could go away without sending the event,
so pf ends up cleaning these up as part of its shutdown sequence, which
happens after the ifnet has already been freed.

Send the ifnet_departure_event during vnet shutdown, allowing pf to
clean up correctly.

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D17500

5 years agopfsync: Make pfsync callbacks per-vnet
kp [Fri, 2 Nov 2018 16:47:07 +0000 (16:47 +0000)]
pfsync: Make pfsync callbacks per-vnet

The callbacks are installed and removed depending on the state of the
pfsync device, which is per-vnet. The callbacks must also be per-vnet.

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D17499

5 years agoInitialize the eflags field of vm_map headers.
markj [Fri, 2 Nov 2018 16:26:44 +0000 (16:26 +0000)]
Initialize the eflags field of vm_map headers.

Initializing the eflags field of the map->header entry to a value with a
unique new bit set makes a few comparisons to &map->header unnecessary.

Submitted by: Doug Moore <dougm@rice.edu>
Reviewed by: alc, kib
Tested by: pho
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14005

5 years agocxgbe/iw_cxgbe: Suppress spurious "Unexpected streaming data ..."
np [Fri, 2 Nov 2018 16:21:44 +0000 (16:21 +0000)]
cxgbe/iw_cxgbe: Suppress spurious "Unexpected streaming data ..."
messages.

Submitted by: Krishnamraju Eraparaju @ Chelsio
MFC after: 1 month
Sponsored by: Chelsio Communications

5 years agopf: Limit the fragment entry queue length to 64 per bucket.
kp [Fri, 2 Nov 2018 15:32:04 +0000 (15:32 +0000)]
pf: Limit the fragment entry queue length to 64 per bucket.

So we have a global limit of 1024 fragments, but it is fine grained to
the region of the packet.  Smaller packets may have less fragments.
This costs another 16 bytes of memory per reassembly and devides the
worst case for searching by 8.

Obtained from: OpenBSD
Differential Revision: https://reviews.freebsd.org/D17734

5 years agopf: Split the fragment reassembly queue into smaller parts
kp [Fri, 2 Nov 2018 15:26:51 +0000 (15:26 +0000)]
pf: Split the fragment reassembly queue into smaller parts

Remember 16 entry points based on the fragment offset.  Instead of
a worst case of 8196 list traversals we now check a maximum of 512
list entries or 16 array elements.

Obtained from: OpenBSD
Differential Revision: https://reviews.freebsd.org/D17733

5 years agopf: Count holes rather than fragments for reassembly
kp [Fri, 2 Nov 2018 15:23:57 +0000 (15:23 +0000)]
pf: Count holes rather than fragments for reassembly

Avoid traversing the list of fragment entris to check whether the
pf(4) reassembly is complete.  Instead count the holes that are
created when inserting a fragment.  If there are no holes left, the
fragments are continuous.

Obtained from: OpenBSD
Differential Revision: https://reviews.freebsd.org/D17732

5 years agoAdd new USB v2.0 PCI ID.
hselasky [Fri, 2 Nov 2018 15:03:52 +0000 (15:03 +0000)]
Add new USB v2.0 PCI ID.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
Sponsored by: Mellanox Technologies

5 years agoRevert "pf: Limit the maximum number of fragments per packet"
kp [Fri, 2 Nov 2018 15:01:59 +0000 (15:01 +0000)]
Revert "pf: Limit the maximum number of fragments per packet"

This reverts commit r337969.
We'll handle this the OpenBSD way, in upcoming commits.