]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFV r339226 (peter): Record merge of serf-1.3.9.
gjb [Mon, 8 Oct 2018 15:16:04 +0000 (15:16 +0000)]
MFV r339226 (peter): Record merge of serf-1.3.9.

Sponsored by: The FreeBSD Foundation

5 years agoVendor import serf-1.3.9 (now Apache serf)
peter [Mon, 8 Oct 2018 08:12:28 +0000 (08:12 +0000)]
Vendor import serf-1.3.9 (now Apache serf)

5 years agolibcrypto: have buildinf.h depend on Makefile
emaste [Fri, 5 Oct 2018 20:49:54 +0000 (20:49 +0000)]
libcrypto: have buildinf.h depend on Makefile

So that it will be regenerated after Makefile changes affecting the
file's content - specifically, the OpenSSL 1.1.1 update adds a DATE
macro which did not exist previously.

Sponsored by: The FreeBSD Foundation

5 years agoMFH r338661 through r339200.
gjb [Fri, 5 Oct 2018 17:53:47 +0000 (17:53 +0000)]
MFH r338661 through r339200.

Sponsored by: The FreeBSD Foundation

5 years agolualoader: Don't draw loader menu with autoboot_delay=-1
kevans [Fri, 5 Oct 2018 17:07:10 +0000 (17:07 +0000)]
lualoader: Don't draw loader menu with autoboot_delay=-1

This was mostly a cosmetic issue. autoboot_delay=-1 is documented to bypass
the loader menu and immediately execute the boot command, but lualoader
would draw the menu and immediately execute the boot command. No interaction
was possible with the menu.

The fix lifts autoboot_delay processing out of menu.autoboot, which now
takes a delay and does nothing if no delay is specified. This lines up with
my expectations of menu.autoboot's usage from a third party, which may
want more control over the process than the default behavior.

PR: 231610
Approved by: re (gjb)

5 years agoDocument signal handling in blacklistd(8).
lidl [Fri, 5 Oct 2018 16:52:21 +0000 (16:52 +0000)]
Document signal handling in blacklistd(8).

Reviewed by: bcr@, 0mp@
Approved by: re (gjb@)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D17423

5 years agoUpdate the existing heimdal implementation for OpenSSL 1.1.
jhb [Fri, 5 Oct 2018 16:35:24 +0000 (16:35 +0000)]
Update the existing heimdal implementation for OpenSSL 1.1.

Existing work is underway to import a newer version of heimdal, but
this patchset gets us to a fully working tree to enable more wide
spread testing of OpenSSL 1.1 for now.

I've also enabled WARNS=1 for kerberos (which is the reason for the
change in libroken).  Having -Werror enabled was useful during the
1.1 updates and we probably should have warnings enabled by default
for kerberos anyway.

This passes make tinderbox, and I have also done some very light
runtime testing on amd64.

Reviewed by: bjk, jkim, emaste
Differential Revision: https://reviews.freebsd.org/D17276

5 years agoAdd sysctls for dbuf metadata cache variables added in r336959.
mav [Fri, 5 Oct 2018 16:05:59 +0000 (16:05 +0000)]
Add sysctls for dbuf metadata cache variables added in r336959.

Approved by: re (gjb)
MFC after: 1 week

5 years agoConvert UDP length to host byte order
thj [Fri, 5 Oct 2018 12:51:30 +0000 (12:51 +0000)]
Convert UDP length to host byte order

When getting the number of bytes to checksum make sure to convert the UDP
length to host byte order when the entire header is not in the first mbuf.

Reviewed by: jtl, tuexen, ae
Approved by: re (gjb), jtl (mentor)
Differential Revision:  https://reviews.freebsd.org/D17357

5 years agoRemove the BUGS section of nscd(8) man page. According to bushman@'s
trasz [Fri, 5 Oct 2018 12:08:32 +0000 (12:08 +0000)]
Remove the BUGS section of nscd(8) man page.  According to bushman@'s
reponse quoted in PR, he no longer maintains it.

PR: 210590
Approved by: re (kib)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agobsdinstall(8): Fix a typo.
0mp [Fri, 5 Oct 2018 08:17:29 +0000 (08:17 +0000)]
bsdinstall(8): Fix a typo.

Reported by: Jose Luis Duran
Reviewed by: bcr
Approved by: re (gjb), krion (mentor, implicit), mat (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17409

5 years agoMODULE_PNP_INFO(9): Fix a grammar mistake.
0mp [Fri, 5 Oct 2018 08:00:45 +0000 (08:00 +0000)]
MODULE_PNP_INFO(9): Fix a grammar mistake.

Reported by: ak
Reviewed by: imp, Yuri Pankov <yuripv@yuripv.net>
Approved by: re (gjb), krion (mentor, implicit), mat (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17403

5 years agohwpmc: Refactor sample ring buffer handling to fix races
mmacy [Fri, 5 Oct 2018 05:55:56 +0000 (05:55 +0000)]
hwpmc: Refactor sample ring buffer handling to fix races

Refactor sample ring buffer ring handling to make it more robust to
long running callchain collection handling

r338112 introduced a (now fixed) regression that exposed a number of race
conditions within the management of the sample buffers. This
simplifies the handling and moves the decision to overwrite a
callchain sample that has taken too long out of the NMI in to the
hardlock handler. With this change the problem no longer shows up as a
ring corruption but as the code spending all of its time in callchain
collection.

- Makes the producer / consumer index incrementing monotonic, making it
  easier (for me at least) to reason about.
- Moves the decision to overwrite a sample from NMI context to interrupt
  context where we can enforce serialization.
- Puts a time limit on waiting to collect a user callchain - putting a
  bound on head-of-line blocking causing samples to be dropped
- Removes the flush routine which was previously needed to purge
  dangling references to the pmc from the sample buffers but now is only
  a source of a race condition on unload.

Previously one could lock up or crash HEAD by running:
pmcstat -S inst_retired.any_p -T and then hitting ^C

After this change it is no longer possible.

PR: 231793
Reviewed by: markj@
Approved by: re (gjb@)
Differential Revision: https://reviews.freebsd.org/D17011

5 years agoeliminate locking surrounding ui_vmsize and swap reserve by using atomics
mmacy [Fri, 5 Oct 2018 05:50:56 +0000 (05:50 +0000)]
eliminate locking surrounding ui_vmsize and swap reserve by using atomics

Change swap_reserve and swap_total to be in units of pages so that
swap reservations can be done using only atomics instead of using a single
global mutex for swap_reserve and a single mutex for all processes running
under the same uid for uid accounting.

Results in mmap speed up and a 70% increase in brk calls / second.

Reviewed by: alc@, markj@, kib@
Approved by: re (delphij@)
Differential Revision: https://reviews.freebsd.org/D16273

5 years agoRevert r339174: Move 32-bit compat support for FIODGNAME to the right place.
brooks [Thu, 4 Oct 2018 23:55:03 +0000 (23:55 +0000)]
Revert r339174: Move 32-bit compat support for FIODGNAME to the right place.

A case was missed in this commit which breaks sshing into a 32-bit sshd
on a 64-bit system.

Approved by: re (gjb)

5 years agoHold a write lock across udp_notify()
rstone [Thu, 4 Oct 2018 22:03:58 +0000 (22:03 +0000)]
Hold a write lock across udp_notify()

With the new route cache feature udp_notify() will modify the inp when it
needs to invalidate the route cache.  Ensure that we hold a write lock on
the inp before calling the function to ensure that multiple threads don't
race while trying to invalidate the cache (which previously lead to a page
fault).

Differential Revision: https://reviews.freebsd.org/D17246
Reviewed by: sbruno, bz, karels
Sponsored by: Dell EMC Isilon
Approved by: re (gjb)

5 years agoReduce NL_ARGMAX to 4096 to match Linux.
brooks [Thu, 4 Oct 2018 21:55:58 +0000 (21:55 +0000)]
Reduce NL_ARGMAX to 4096 to match Linux.

NL_ARGMAX is the maximum number of positional arguments supported by
printf(3). Prior to r308145 it was declared as 99 and not enforced.
r308145 added enforcement and increased the value to 64k.

Unfortunately, development versions of PostgreSQL used the system
definition to allocate and zero an NL_ARGMAX * 4 sized array on the
stack of its snprintf implementation with measurable performance
impacts. This has been fixed in new PostgreSQL versions, but it is
possible that other programs suffer from this problem.

A value of 4096 puts us on par with Linux and is certainly large enough
for any reasonable program.

Reviewed by: mjg
Reported by: mjg
Approved by: re (gjb)
Differential revision: https://reviews.freebsd.org/D17387
Differential revision: https://reviews.freebsd.org/D8286

5 years agoamd64: hide non-erms jump label under non-erms copyin/copyout
mjg [Thu, 4 Oct 2018 20:01:48 +0000 (20:01 +0000)]
amd64: hide non-erms jump label under non-erms copyin/copyout

This change is a no-op in terms of semantics, but has a side effect
of removing a perfectly useless nop sled for CPUs with ERMS.

Approved by: re (gjb)
Sponsored by:   The FreeBSD Foundation

5 years ago[ig4] style(9) clean-up
gonzo [Thu, 4 Oct 2018 19:54:47 +0000 (19:54 +0000)]
[ig4] style(9) clean-up

Submitted by: Rajesh Kumar <rajfbsd@gmail.com>
Approved by: re (gjb, kib)

5 years agocrt: switch to standard note type definitions from elf_common.h
emaste [Thu, 4 Oct 2018 17:35:32 +0000 (17:35 +0000)]
crt: switch to standard note type definitions from elf_common.h

This makes it easier to grep the source tree for these notes, and
ensures that they will remain in sync.

Reviewed by: kib
Approved by: re (gjb)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17408

5 years agobsdinstall(8): Document ZFS installation scripting.
0mp [Thu, 4 Oct 2018 09:28:40 +0000 (09:28 +0000)]
bsdinstall(8): Document ZFS installation scripting.

- Extend the bsdinstall(8) man page with ZFS installation scripting
  details. [1]
- Extend the bsdinstall(8) man page with the description of all the ZFS
  variables involved in a scripted installation of ZFS-based systems. [1]
- Extend the SCRIPTING section with an example for a ZFS-based scripted
  installation. [1]
- Create a new section explaining how ZFS datasets must be written into
  a variable to get them set on the final system. [1]

While here:
- Add Roberto to the copyrights for recognition as changes to the manual
  page are huge.
- Use "Dq" for default values.
- Use sysrc(8) instead of echo in examples.

Submitted by: Roberto Fernandez Cueto <roberfern@gmail.com> [1]
Reviewed by: dteske
Approved by: re (gjb), krion (mentor, implicit), mat (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D14169

5 years agoRemove invalid comments and correct some typos.
pjd [Thu, 4 Oct 2018 05:57:27 +0000 (05:57 +0000)]
Remove invalid comments and correct some typos.

Approved by: re (kib)

5 years agoWhen the adist_free list is empty and we lose connection to the receiver we
pjd [Thu, 4 Oct 2018 05:54:57 +0000 (05:54 +0000)]
When the adist_free list is empty and we lose connection to the receiver we
move all elements from the adist_send and adist_recv lists back onto the
adist_free list, but we don't wake consumers waitings for the adist_free list
to become non-empty. This can lead to the sender process stopping audit trail
files distribution and waiting forever.

Fix the problem by adding the missing wakeup.

While here slow down spinning on CPU in case of a short race in
sender_disconnect() and add an explaination when it can occur.

PR: 201953
Reported by: peter
Approved by: re (kib)

5 years agoWhen we look for a new trail file there might be a race between find trail
pjd [Thu, 4 Oct 2018 05:48:09 +0000 (05:48 +0000)]
When we look for a new trail file there might be a race between find trail
file name and opening it. This race was not properly handled, because we were
copying new name before checking for openat(2) error and when we were trying
again we were starting with the next trail file. This could result in skipping
distribution of such a trail file.

Fix this problem by checking for ENOENT first (only for .not_terminated files)
and then updating (or not) tr_filename before restarting the search.

PR: 200139
Reported by: peter
Approved by: re (kib)

5 years agoFix the hardware.{txt,html} build in the release/Makefile 'reldoc'
gjb [Thu, 4 Oct 2018 01:46:56 +0000 (01:46 +0000)]
Fix the hardware.{txt,html} build in the release/Makefile 'reldoc'
target.

The doc/share/mk/doc.commands.mk sets SVN to /usr/local/bin/svn
by default, which is not necessarily installed by the documentation
project textproc/docproj port.

Ensure SVN can be evaluated properly to include the hardware pages
by iterating through /usr/local/bin and /usr/bin and looking for
both svn and svnlite binaries, and pass the SVN variable explicitly
through env(1) in the reldoc target to avoid failures if it does not
exist.

Approved by: re (rgrimes)
Sponsored by: The FreeBSD Foundation

5 years agoMove 32-bit compat support for FIODGNAME to the right place.
brooks [Wed, 3 Oct 2018 20:39:48 +0000 (20:39 +0000)]
Move 32-bit compat support for FIODGNAME to the right place.

ioctl(2) commands only have meaning in the context of a file descriptor
so translating them in the syscall layer is incorrect.

The new handler users an accessor to retrieve/construct a pointer from
the last member of the passed structure and relies on type punning to
access the other member which requires no translation.

Reviewed by: kib
Approved by: re (rgrimes, gjb)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Review: https://reviews.freebsd.org/D17388

5 years agoSet the default loader for powerpc64 back to to forth too.
andreast [Wed, 3 Oct 2018 19:09:09 +0000 (19:09 +0000)]
Set the default loader for powerpc64 back to to forth too.
The commit from r338893 covered only the powerpc build.

Approved by: re (kib)

5 years agoIn PR 227259, a user is reporting that they have code which is using
glebius [Wed, 3 Oct 2018 17:40:04 +0000 (17:40 +0000)]
In PR 227259, a user is reporting that they have code which is using
shutdown() to wakeup another thread blocked on a stream listen socket.
This code is failing, while it used to work on FreeBSD 10 and still
works on Linux.

It seems reasonable to add another exception to support something users are
actually doing, which used to work on FreeBSD 10, and still works on Linux.
And, it seems like it should be acceptable to POSIX, as we still return
ENOTCONN.

This patch is different to what had been committed to stable/11, since
code around listening sockets is different. Patch in D15019 is written
by jtl@, slightly modified by me.

PR: 227259
Obtained from: jtl
Approved by: re (kib)
Differential Revision:  D15019

5 years agoopenssh: connect libressl-api-compat.c and regen config.h
emaste [Wed, 3 Oct 2018 16:38:36 +0000 (16:38 +0000)]
openssh: connect libressl-api-compat.c and regen config.h

Differential Revision: https://reviews.freebsd.org/D17390

5 years agoopenssh: add openbsd-compat/libressl-api-compat.c
emaste [Wed, 3 Oct 2018 16:06:17 +0000 (16:06 +0000)]
openssh: add openbsd-compat/libressl-api-compat.c

Missed in migrating changeset from git to svn for r338811

Reported by: jhb

5 years agoFix an inverted test in ucode_load_ap().
markj [Wed, 3 Oct 2018 14:20:43 +0000 (14:20 +0000)]
Fix an inverted test in ucode_load_ap().

This caused microcode to be updated only on the BSP if hyperthreading
was disabled, typically resulting in a hang or reset.

Approved by: re (kib)
Sponsored by: The FreeBSD Foundation

5 years agoUse strlcpy() instead of strncpy().
tuexen [Wed, 3 Oct 2018 07:35:16 +0000 (07:35 +0000)]
Use strlcpy() instead of strncpy().

Approved by:            re (kib@)
CID: 13959801395981
X-MFC with: r339012
MFC after:              1 week

5 years agoMove 32-bit compat support for CDIOREADTOCENTRYS to the right place.
brooks [Tue, 2 Oct 2018 23:23:56 +0000 (23:23 +0000)]
Move 32-bit compat support for CDIOREADTOCENTRYS to the right place.

ioctl(2) commands only have meaning in the context of a file descriptor
so translating them in the syscall layer is incorrect.

The new handler users an accessor to retrieve/construct a pointer from
the last member of the passed structure and relies on type punning to
access the other members which require no translation.

Reviewed by: kib (prior version), jhb
Approved by: re (rgrimes)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Review: https://reviews.freebsd.org/D17378

5 years agoUpdate obsolete files list for OpenSSL 1.1.1.
jhb [Tue, 2 Oct 2018 21:40:57 +0000 (21:40 +0000)]
Update obsolete files list for OpenSSL 1.1.1.

This will need a real date once this is merged to head.

One weird thing to note: the 32-bit engines get dumped into /usr/lib32
rather than /usr/lib32/engines, and I bet the 32-bit libcrypto.so i
looking for the .so files in the wrong place.  We should probably fix
both of those at some point.

Reviewed by: emaste, jkim
Differential Revision: https://reviews.freebsd.org/D17384

5 years agoUse nda(4) on powerpc64
kbowling [Tue, 2 Oct 2018 21:36:00 +0000 (21:36 +0000)]
Use nda(4) on powerpc64

Approved by: re@ (kib), krion (mentor), imp
Differential Revision: https://reviews.freebsd.org/D17368

5 years agoAfter r338257 is was possible to trigger a KASSERT() in ud6_output()
bz [Tue, 2 Oct 2018 17:29:56 +0000 (17:29 +0000)]
After r338257 is was possible to trigger a KASSERT() in ud6_output()
using an application trying to use a v4mapped destination address on a
kernel without INET support or on a v6only socket.
Catch this case and prevent the packet from going anywhere;
else, without the KASSERT() armed, a v4mapped destination
address might go out on the wire or other undefined behaviour
might happen, while with the KASSERT() we panic.

PR: 231728
Reported by: Jeremy Faulkner (gldisater gmail.com)
Approved by: re (kib)

5 years agoMODULE_PNP_INFO(9): Add example of T usage.
0mp [Tue, 2 Oct 2018 17:01:42 +0000 (17:01 +0000)]
MODULE_PNP_INFO(9): Add example of T usage.

Provide an example of specifying a common vendor value as the documentation
is not clear enough at the moment.

While here, add 'D:#' to the previous example to eat the remaining
description string.

Also, pet mandoc a bit.

Submitted by: Yuri Pankov <yuripv@yuripv.net>
Reviewed by: cem, imp
Approved by: re (kib), krion (mentor, implicit), mat (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17321

5 years agoRework the logic around quick checks for auditing that take place at
rwatson [Tue, 2 Oct 2018 15:58:17 +0000 (15:58 +0000)]
Rework the logic around quick checks for auditing that take place at
system-call entry and whenever audit arguments or return values are
captured:

1. Expose a single global, audit_syscalls_enabled, which controls
   whether the audit framework is entered, rather than exposing
   components of the policy -- e.g., if the trail is enabled,
   suspended, etc.

2. Introduce a new function audit_syscalls_enabled_update(), which is
   called to update audit_syscalls_enabled whenever an aspect of the
   policy changes, so that the value can be updated.

3. Remove a check of trail enablement/suspension from audit_new() --
   at the point where this function has been entered, we believe that
   system-call auditing is already in force, or we wouldn't get here,
   so simply proceed to more expensive policy checks.

4. Use an audit-provided global, audit_dtrace_enabled, rather than a
   dtaudit-provided global, to provide policy indicating whether
   dtaudit would like system calls to be audited.

5. Do some minor cosmetic renaming to clarify what various variables
   are for.

These changes collectively arrange it so that traditional audit
(trail, pipes) or the DTrace audit provider can enable system-call
probes without the other configured.  Otherwise, dtaudit cannot
capture system-call data without auditd(8) started.

Reviewed by: gnn
Sponsored by: DARPA, AFRL
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17348

5 years agolibelf: correct mips64el test to use ELF header
emaste [Tue, 2 Oct 2018 15:08:41 +0000 (15:08 +0000)]
libelf: correct mips64el test to use ELF header

libelf maintains two views of endianness: e_byteorder, and
e_ident[EI_DATA] in the ELF header itself.  e_byteorder is not always
kept in sync, so use the ELF header endianness to test for mips64el.

PR: 231790
Bisected by: sbruno
Reviewed by: jhb
Approved by: re (kib)
MFC with: r338478
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17380

5 years agoAdd missing newline in pwarn message.
mckusick [Tue, 2 Oct 2018 13:45:25 +0000 (13:45 +0000)]
Add missing newline in pwarn message.

Reported by: Mark Millard <marklmi@yahoo.com>
Approved by: re (kib)

5 years agotop(1): Rework DESCRIPTION OF MEMORY section.
0mp [Tue, 2 Oct 2018 08:13:54 +0000 (08:13 +0000)]
top(1): Rework DESCRIPTION OF MEMORY section.

Due to markup issues, the DESCRIPTION OF MEMORY section is rather
unreadable; rework it a bit, using subsections for different lines of the
top output, and move it closer to description.

While here, pet manlint ordering other sections as expected.

Submitted by: Yuri Pankov <yuripv@yuripv.net>
Reviewed by: eadler
Approved by: re (gjb), krion (mentor)
Differential Revision: https://reviews.freebsd.org/D17369

5 years agoMake sendmail work with OpenSSL 1.1 API. Taken from the ports tree.
jkim [Mon, 1 Oct 2018 20:55:01 +0000 (20:55 +0000)]
Make sendmail work with OpenSSL 1.1 API.  Taken from the ports tree.

https://svnweb.freebsd.org/ports/head/mail/sendmail/files/patch-tls.c?revision=466240

Requested by: gshapiro

5 years agoRevert r338773. A patch from the ports tree will be committed.
jkim [Mon, 1 Oct 2018 20:51:26 +0000 (20:51 +0000)]
Revert r338773.  A patch from the ports tree will be committed.

Requested by: gshapiro

5 years agoamd64: reimplement libc memset and bzero with kernel memset
mjg [Mon, 1 Oct 2018 20:39:17 +0000 (20:39 +0000)]
amd64: reimplement libc memset and bzero with kernel memset

This is a depessimization, see r334537 for an explanation. Routines
remain significantly slower than they have to be.

bzero was removed from the kernel but remains in libc. Macroify to
accommodate differences to memset (no return value, always setting to 0).

The bzero.S file is left in place due to libc build magic which pulls in
a C variant if a matching .S file is missing.

Reviewed by: kib
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17355

5 years agoFix a da(4) driver memory leak for SCSI SMR devices.
ken [Mon, 1 Oct 2018 19:00:46 +0000 (19:00 +0000)]
Fix a da(4) driver memory leak for SCSI SMR devices.

In the probe case for SCSI SMR Host Aware or Most Managed drives, be sure
to free allocated memory.

sys/cam/scsi/scsi_da.c:
In dadone_probezone(), free the data pointer before returning.

MFC after: 3 days
Sponsored by: Spectra Logic
Approved by: re (kib)

5 years agoUse an unsigned iterator for domain sets.
markj [Mon, 1 Oct 2018 18:51:39 +0000 (18:51 +0000)]
Use an unsigned iterator for domain sets.

Otherwise (iter % ds->ds_cnt) is not guaranteed to lie in the range
[0, MAXMEMDOM).

Reported by: pho
Reviewed by: kib
Approved by: re (rgrimes)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17374

5 years agoAdd kernel ifunc support on arm64.
andrew [Mon, 1 Oct 2018 18:51:08 +0000 (18:51 +0000)]
Add kernel ifunc support on arm64.

Tested with ifunc resolvers in the kernel and module with calls from
kernel to kernel, module to kernel, and module to module.

Reviewed by: kib (previous version)
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17370

5 years agoApply r339046 to i386.
markj [Mon, 1 Oct 2018 18:48:33 +0000 (18:48 +0000)]
Apply r339046 to i386.

Belatedly add a comment to the amd64 pmap explaining why we initialize
the kernel pmap's resident page count.

Reviewed by: alc, kib
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17377

5 years agoThis commit reverts 338930. The approach was wrong.
andreast [Mon, 1 Oct 2018 18:46:35 +0000 (18:46 +0000)]
This commit reverts 338930. The approach was wrong.

Fix the issue with subtracting the TLS_TCB_SIZE too when we are trying to get
the 'where' in the R_PPC_TPREL32 case. At allocation time we added an offset
and the TLS_TCB_SIZE. This has to be subtracted as well.

Now all the issues reported are fixed. Tests were done on G4 and G5 PowerMac's.
Additionally I ran the tls tests from the gcc test suite and made sure the
results are as good as pre 338486.

Thanks to tuexen for reporting the malfunction and for patient testing.
Also testing thanks goes to jhibbits.

Reported by: tuexen
Discussed with: jhibbits, nwhitehorn
Approved by: re (gjb)
Pointyhat to: andreast

5 years agoRemove references to the "new" NFS clients and servers. The "old"
trasz [Mon, 1 Oct 2018 18:26:41 +0000 (18:26 +0000)]
Remove references to the "new" NFS clients and servers.  The "old"
NFS stack is long gone.

Approved by: re (gjb)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDrop pre-AVX toolchain for amd64 and i386 to simplify the makefile.
jkim [Mon, 1 Oct 2018 18:16:36 +0000 (18:16 +0000)]
Drop pre-AVX toolchain for amd64 and i386 to simplify the makefile.

Especially, head does not support old toolchains because of ifunc support.

5 years agoFix build with GCC 8.1.
br [Mon, 1 Oct 2018 16:16:05 +0000 (16:16 +0000)]
Fix build with GCC 8.1.

GCC 8.1 failed to build LLVM's libc++ when -Wshadow is set,
so lower down WARNS flag to 3.

This is similar to dtc(1) which uses libc++ and sets WARNS to 3.

Approved by: re (gjb)
Sponsored by: DARPA, AFRL

5 years agolibbe(3): Fix BE activation promoting activated BE
kevans [Mon, 1 Oct 2018 14:57:33 +0000 (14:57 +0000)]
libbe(3): Fix BE activation promoting activated BE

This allows older BEs to be destroyed as they become replaced by a BE
created from them: e.g.

bectl create -e brokenworld fixedworld
bectl activate fixedworld
bectl destroy brokenworld

Submitted by: Shawn Webb
Approved by: re (gjb)
Obtained from: HardenedBSD (5948c0581e)

5 years agoCount bootstrap data as resident in the kernel pmap.
markj [Mon, 1 Oct 2018 14:47:49 +0000 (14:47 +0000)]
Count bootstrap data as resident in the kernel pmap.

Such data may later be unmapped.  This occurs, for example, when a
loader-provided microcode update file is discarded.

Reviewed by: alc, kib
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17340

5 years agoarm64: Raise again L3 table for early devmap
manu [Mon, 1 Oct 2018 14:27:53 +0000 (14:27 +0000)]
arm64: Raise again L3 table for early devmap

The initial raise in r336519 wasn't enough for using big resolution
(1920 x 1200 for example). Raise it again.

Reported by: bob prohaska <fbsd@www.zefox.net>
Tested by: bob prohaska <fbsd@www.zefox.net>
Approved by: re (gjb@)

5 years agoAllow empty NUMA memory domains to support Threadripper2
gallatin [Mon, 1 Oct 2018 14:14:21 +0000 (14:14 +0000)]
Allow empty NUMA memory domains to support Threadripper2

The AMD Threadripper 2990WX is basically a slightly crippled Epyc.
Rather than having 4 memory controllers, one per NUMA domain, it has
only 2  memory controllers enabled. This means that only 2 of the
4 NUMA domains can be populated with physical memory, and the
others are empty.

Add support to FreeBSD for empty NUMA domains by:

- creating empty memory domains when parsing the SRAT table,
    rather than failing to parse the table
- not running the pageout deamon threads in empty domains
- adding defensive code to UMA to avoid allocating from empty domains
- adding defensive code to cpuset to avoid binding to an empty domain
    Thanks to Jeff for suggesting this strategy.

Reviewed by: alc, markj
Approved by: re (gjb@)
Differential Revision: https://reviews.freebsd.org/D1683

5 years agoMitigate providing a timing signal if the COOKIE or AUTH
tuexen [Mon, 1 Oct 2018 14:05:31 +0000 (14:05 +0000)]
Mitigate providing a timing signal if the COOKIE or AUTH
validation fails.
Thanks to jmg@ for reporting the issue, which was discussed in
https://admbugs.freebsd.org/show_bug.cgi?id=878

Approved by:            re (TBD@)
MFC after:              1 week

5 years agoAdd STT_GNU_IFUNC and R_AARCH64_IRELATIVE support on arm64.
andrew [Mon, 1 Oct 2018 14:02:29 +0000 (14:02 +0000)]
Add STT_GNU_IFUNC and R_AARCH64_IRELATIVE support on arm64.

This is based on the amd64 implementation. Support for both PLT and
non-PLT (e.g. a global variable initilised with a pointer to an ifunc)
cases are supported.

We don't pass anything to the resolver as it is expected they will read
the ID registers directly, with the number of registers with CPU info
likely to increase in the future.

Reviewed by: kib
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17341

5 years agoAfter allocating chunks set the fields in a consistent way.
tuexen [Mon, 1 Oct 2018 13:09:18 +0000 (13:09 +0000)]
After allocating chunks set the fields in a consistent way.
This removes two assignments for the flags field being done
twice and adds one, which was missing.
Thanks to Felix Weinrank for reporting the issue he found
by using fuzz testing of the userland stack.

Approved by:            re (kib@)
MFC after:              1 week

5 years agoAdd INP_INFO_WUNLOCK_ASSERT() macro and use it instead of
ae [Mon, 1 Oct 2018 10:46:00 +0000 (10:46 +0000)]
Add INP_INFO_WUNLOCK_ASSERT() macro and use it instead of
INP_INFO_UNLOCK_ASSERT() in TCP-related code. For encapsulated traffic
it is possible, that the code is running in net_epoch_preempt section,
and INP_INFO_UNLOCK_ASSERT() is very strict assertion for such case.

PR: 231428
Reviewed by: mmacy, tuexen
Approved by: re (kib)
Differential Revision: https://reviews.freebsd.org/D17335

5 years agoFix the MODULE_PNP_INFO() for iwm(4) where I got the bus and module
bz [Mon, 1 Oct 2018 10:44:33 +0000 (10:44 +0000)]
Fix the MODULE_PNP_INFO() for iwm(4) where I got the bus and module
arguments wrong in r339020.

PR: 231625
Reported by: Yuri Pankov (yuripv yuripv.net)
Reviewed by: cem, Yuri Pankov (yuripv yuripv.net)
Approved by: re (kib)
Pointyhat to: bz (a rather big one for this one)

5 years agoPlug mbuf leak in the SCTP input path in an error case.
tuexen [Sun, 30 Sep 2018 21:54:02 +0000 (21:54 +0000)]
Plug mbuf leak in the SCTP input path in an error case.

Approved by:            re (kib@)
MFC after:              1 week
CID: 749312

5 years agoPlug mbuf leaks in the SCTP output path in error cases.
tuexen [Sun, 30 Sep 2018 21:31:33 +0000 (21:31 +0000)]
Plug mbuf leaks in the SCTP output path in error cases.

Approved by:            re (kib@)
MFC after:              1 week
CID: 1395307

5 years agoUse PNP metadata to allow devmatch to autoload ure(4)
allanjude [Sun, 30 Sep 2018 21:23:31 +0000 (21:23 +0000)]
Use PNP metadata to allow devmatch to autoload ure(4)

Reviewed by: manu imp
Approved by: re (kib)
X-MFC-with: devmatch
Sponsored by: Klara Systems

5 years agoUpdate x86/ifunc.h.
kib [Sun, 30 Sep 2018 16:57:30 +0000 (16:57 +0000)]
Update x86/ifunc.h.

Remove ifunc emulation.
Add helper for usermode ifunc resolver definition.
Update copyright years.

Sponsored by: The FreeBSD Foundation
Approved by: re (rgrimes)
MFC after: 1 week

5 years agoFix the handling of ancillary data for SCTP socket. Implement
tuexen [Sun, 30 Sep 2018 16:21:31 +0000 (16:21 +0000)]
Fix the handling of ancillary data for SCTP socket. Implement
sctp_process_cmsgs_for_init() and sctp_findassociation_cmsgs()
similar to sctp_find_cmsg() to improve consistency and avoid
the signed/unsigned issues in sctp_process_cmsgs_for_init()
and sctp_findassociation_cmsgs().

Thanks to andrew@ for reporting the problem he found using
syzcaller.

Approved by:            re (kib@)
MFC after:              1 week

5 years agoIncrement the corresponding UDP stats counter (udps_opackets) when
tuexen [Sun, 30 Sep 2018 12:16:06 +0000 (12:16 +0000)]
Increment the corresponding UDP stats counter (udps_opackets) when
sending UDP encapsulated SCTP packets.
This is consistent with the behaviour that when such packets are received,
the corresponding UDP stats counter (udps_ipackets) is incremented.
Thanks to Peter Lei for making me aware of this inconsistency.

Approved by:            re (kib@)
MFC after:              1 week

5 years agoProvide MODULE_PNP_INFO() for iwm(4) so that devmatch(8) can
bz [Sat, 29 Sep 2018 21:14:54 +0000 (21:14 +0000)]
Provide MODULE_PNP_INFO() for iwm(4) so that devmatch(8) can
do its job.

PR: 231625
Submitted by: Yuri Pankov (yuripv yuripv.net)
Approved by: re (kib)

5 years agoclang: allow ifunc resolvers to accept arguments
emaste [Sat, 29 Sep 2018 20:01:23 +0000 (20:01 +0000)]
clang: allow ifunc resolvers to accept arguments

Previously Clang required ifunc resolution functions to take no
arguments, presumably because GCC documented ifunc resolvers as taking
no arguments.  However, GCC accepts resolvers accepting arguments, and
our rtld passes CPU ID information (cpuid, hwcap, etc.) to ifunc
resolvers.  Just remove the check from the in-tree compiler for our in-
tree compiler; a different (per-OS) approach may be required upstream.

Reported by: mjg
Approved by: re (rgrimes)
MFC after: 1 week
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

5 years agoFix UP build.
kib [Sat, 29 Sep 2018 16:17:35 +0000 (16:17 +0000)]
Fix UP build.

Reported by: tijl
Sponsored by: The FreeBSD Foundation
Approved by: re (rgrimes)

5 years agoPull in r329557 from upstream lld trunk (by George Rimar):
dim [Sat, 29 Sep 2018 14:12:03 +0000 (14:12 +0000)]
Pull in r329557 from upstream lld trunk (by George Rimar):

  [ELF] - Allow LLD to produce file symbols.

  This is for PR36716 and
  this enables emitting STT_FILE symbols.

  Output size affect is minor:
  lld binary size changes from 52,883,408 to 52,949,400
  clang binary size changes from 83,136,456 to 83,219,600

  Differential revision: https://reviews.llvm.org/D45261

This fixes a regression in lld that made it stop emitting STT_FILE
symbols, which ctfmerge relies upon to uniquify function table entries
that reference STB_LOCAL symbols.  Consequently, ctfmerge stopped
emitting entries for static functions into the function table, and
dtrace no longer gets type info for them.

Approved by: re (kib)
Reported by: markj
PR: 230444
MFC after: 3 days

5 years agoFor changing the MTU on tun/tap devices, it should not matter whether it
tuexen [Sat, 29 Sep 2018 13:01:23 +0000 (13:01 +0000)]
For changing the MTU on tun/tap devices, it should not matter whether it
is done via using ifconfig, which uses a SIOCSIFMTU ioctl() command, or
doing it using a TUNSIFINFO/TAPSIFINFO ioctl() command.
Without this patch, for IPv6 the new MTU is not used when creating routes.
Especially, when initiating TCP connections after increasing the MTU,
the old MTU is still used to compute the MSS.
Thanks to ae@ and bz@ for helping to improve the patch.

Reviewed by: ae@, bz@
Approved by: re (kib@)
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D17180

5 years agoamd64: remove unnecessary cld from libc memcpy/bcopy
mjg [Sat, 29 Sep 2018 07:40:52 +0000 (07:40 +0000)]
amd64: remove unnecessary cld from libc memcpy/bcopy

The ABI specifies the direction forward on function call, making
the cld instruction redundant.

Approved by: re (kib)

5 years agoAvoid panic when adjusting priority of a read in the face of an IO error
allanjude [Sat, 29 Sep 2018 01:26:07 +0000 (01:26 +0000)]
Avoid panic when adjusting priority of a read in the face of an IO error

PR: 231516
Reported by: sbruno
Approved by: re (rgrimes)
Obtained from: ZFS-on-Linux
X-MFC-with: 334844
Sponsored by: Klara Systems

MFV/ZoL: Fix zio->io_priority failed (7 < 6) assert

commit c26cf0966d131b722c32f8ccecfe5791a789d975
Author: Tony Hutter <hutter2@llnl.gov>
Date:   Tue May 29 18:13:48 2018 -0700

  Fix zio->io_priority failed (7 < 6) assert

  This fixes an assert in vdev_queue_change_io_priority():

    VERIFY3(zio->io_priority < ZIO_PRIORITY_NUM_QUEUEABLE) failed (7 < 6)
    PANIC at vdev_queue.c:832:vdev_queue_change_io_priority()

Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
5 years ago[sdhci] Add ACPI identifier for AMD eMMC 5.0 controller
gonzo [Sat, 29 Sep 2018 00:35:36 +0000 (00:35 +0000)]
[sdhci] Add ACPI identifier for AMD eMMC 5.0 controller

Submitted by: Rajesh Kumar <rajfbsd@gmail.com>
Approved by: re (rgrimes)
Differential Revision: https://reviews.freebsd.org/D17189

5 years agoFix typo in comment.
tuexen [Fri, 28 Sep 2018 19:47:32 +0000 (19:47 +0000)]
Fix typo in comment.

Reported by: @danfe
Approved by: re (kib@)
MFC after: 1 week
X-MFC: r338941

5 years agoRegenerate after UNIMPL -> OBSOL changes in r339001.
jhb [Fri, 28 Sep 2018 17:25:28 +0000 (17:25 +0000)]
Regenerate after UNIMPL -> OBSOL changes in r339001.

Approved by: re (gjb)

5 years agoMark various removed system calls as OBSOL instead of UNIMPL.
jhb [Fri, 28 Sep 2018 17:23:54 +0000 (17:23 +0000)]
Mark various removed system calls as OBSOL instead of UNIMPL.

This is mostly a cosmetic change except that obsolete system calls are
assigned meaningful names in the names arrays which means that using
tools like kdump or truss against binaries invoking these system calls
will print out the name instead of the number.  The script I use to
generate the XML list of syscalls for GDB also ignores UNIMPL but not
OBSOL entries.  In general UNIMPL should only be used to reserve
placeholders for system calls that have never been implemented while
system calls that existed at one time in FreeBSD but were removed
should be marked OBSOL instead.

Reviewed by: brooks, kib, imp
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17344

5 years agoRun 32-bit compat ldconfig on mips64.
jhb [Fri, 28 Sep 2018 17:01:43 +0000 (17:01 +0000)]
Run 32-bit compat ldconfig on mips64.

mips64 supports COMPAT_FREEBSD32 (for o32 binaries), so run the 32-bit
compat ldconfig on it as well.

Reported by: brooks
Reviewed by: brooks, kib
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17342

5 years agoCorrect vm_fault_copy_entry() handling of backing file truncation
kib [Fri, 28 Sep 2018 14:11:38 +0000 (14:11 +0000)]
Correct vm_fault_copy_entry() handling of backing file truncation
after the file mapping was wired.

if a wired map entry is backed by vnode and the file is truncated,
corresponding pages are invalidated.  vm_fault_copy_entry() should be
aware of it and allow for invalid pages past end of file. Also, such
pages should be not mapped into userspace.  If userspace accesses the
truncated part of the mapping later, it gets a signal, there is no way
kernel can prevent the page fault.

Reported by: andrew using syzkaller
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D17323

5 years agoIn vm_fault_copy_entry(), we should not assert that entry is charged
kib [Fri, 28 Sep 2018 14:11:01 +0000 (14:11 +0000)]
In vm_fault_copy_entry(), we should not assert that entry is charged
if the dst_object is not of swap type.

It can only happen when entry does not require copy, otherwise
vm_map_protect() already adds the charge. So the assert was right for
the case where swap object was allocated in the vm_fault_copy_entry(),
but not when it was just copied from src_entry and its type is not
swap.

Reported by: andrew using syzkaller
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D17323

5 years agoIn vm_fault_copy_entry(), collect the code to initialize a newly
kib [Fri, 28 Sep 2018 14:10:12 +0000 (14:10 +0000)]
In vm_fault_copy_entry(), collect the code to initialize a newly
allocated dst_object in a single place.

Suggested and reviewed by: alc
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D17323

5 years agoRevert part of the r338891 which reordered local invalidation and IPI.
kib [Fri, 28 Sep 2018 14:08:20 +0000 (14:08 +0000)]
Revert part of the r338891 which reordered local invalidation and IPI.

For PCID case, there is a dependency between pm_gen zeroing and
reading pm_active for IPI target selection, to ensure that the
invalidation is not missed.

Reported and tested by: mjg
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)

5 years agoExport ID_AA64ISAR{0,1}_EL1 to userland.
andrew [Fri, 28 Sep 2018 11:57:40 +0000 (11:57 +0000)]
Export ID_AA64ISAR{0,1}_EL1 to userland.

As with r338962 also export the instruction set attribute register. This
will allow userland to identify optional instructions the hardware
supports, for example in a future ifunc handler to decide which
implementation of a function to return.

Approved by: re (kib)

5 years agoWhen multiple threads are involved receiving completion events in LibUSB
hselasky [Fri, 28 Sep 2018 10:28:22 +0000 (10:28 +0000)]
When multiple threads are involved receiving completion events in LibUSB
make sure there is always a master polling thread, by setting the "ctx_handler"
field in the context. Else the reception of completion events can stop.
This happens if event threads are created and destroyed during runtime.

Found by: Ludovic Rousseau <ludovic.rousseau+freebsd@gmail.com>
PR: 231742
MFC after: 1 week
Approved by: re (kib)
Sponsored by: Mellanox Technologies

5 years agoUpdate head from ALPHA7 to ALPHA8 as part of the 12.0-RELEASE
gjb [Fri, 28 Sep 2018 00:01:45 +0000 (00:01 +0000)]
Update head from ALPHA7 to ALPHA8 as part of the 12.0-RELEASE
cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

5 years agoCentralize compat support for PCIOCGETCONF.
brooks [Thu, 27 Sep 2018 21:08:32 +0000 (21:08 +0000)]
Centralize compat support for PCIOCGETCONF.

The pre-7.x compat for both native and 32-bit code was already in
pci_user.c. Use this infrastructure to add implement 32-bit support.
This is more correct as ioctl(2) commands only have meaning in the
context of a file descriptor.

Reviewed by: kib
Approved by: re (gjb)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential revision: https://reviews.freebsd.org/D17324

5 years agoamd64: fix return value of copyinstr after r338970
mjg [Thu, 27 Sep 2018 20:48:07 +0000 (20:48 +0000)]
amd64: fix return value of copyinstr after r338970

The function stopped swapping rdi and rsi, but the error handling
code was not updated with the new register name.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

5 years agoClear stack allocated data structure to prevent kernel memory leak.
gordon [Thu, 27 Sep 2018 18:39:54 +0000 (18:39 +0000)]
Clear stack allocated data structure to prevent kernel memory leak.

Reported by: Thomas Barabosch, Fraunhofer FKIE
Reviewed by: wes@
Approved by: re (implicit)
Approved by: so
Security: FreeBSD-EN-18:12.mem
Security: CVE-2018-17155

5 years agoAdd description, parameters, options, sysctl and examples of using AQMs to ipfw man...
ygy [Thu, 27 Sep 2018 18:14:01 +0000 (18:14 +0000)]
Add description, parameters, options, sysctl and examples of using AQMs to ipfw man page. CoDel, PIE, FQ-CoDel and FQ-PIE AQM for Dummynet exist in FreeBSD 11 and 10.3.

Submitted by: ralsaadi@swin.edu.au
Reviewed by: AllanJude
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12507

5 years agoDon't clear DR6 for debug exceptions from userland.
jhb [Thu, 27 Sep 2018 17:33:59 +0000 (17:33 +0000)]
Don't clear DR6 for debug exceptions from userland.

This reverts part of r333368.  The attempt to clear DR6 was occuring
too soon as trapsignal() does not pause to let the debugger notice the
SIGTRAP and query DR6.  The signal exchange does not occur until much
later during ast().  As a result, GDB was no longer recognizing
hardware breakpoints and watchpoints on x86.

In addition, any userland programs that want to inspect DR6 in a
SIGTRAP handler don't have a way to do this if we clear DR6 in the
exception handler.

Instead of relying on the kernel to clear DR6, debuggers will have to
explicitly clear it after a trace trap (which they needed to do on
older kernels anyway).

Reviewed by: kib
Approved by: re (delphij)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D17319

5 years agoamd64: reimplement libc memcmp and bcmp with kernel memcmp
mjg [Thu, 27 Sep 2018 17:08:29 +0000 (17:08 +0000)]
amd64: reimplement libc memcmp and bcmp with kernel memcmp

Both are significantly slower than hand-coded loops. See r338963 for
kernel commit.

bcmp differs from memcmp by always returning 1 when a difference is
found, as opposed to going for a value bigger or lower than 0
depending on what it is. This means it can do less work. For now the
code is duplicated and modified. This will get deduplicated after
another round of optimization when memcmp will get a longer-term form.

Both tested with the glibc suite. While the suite does not have a test
for bcmp, I created a wrapper routine which verified that values match
(0 vs 0, 1 vs non-zero).

Reviewed by: kib
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17336

5 years agoamd64: macroify and mostly depessimize copyinstr
mjg [Thu, 27 Sep 2018 15:53:36 +0000 (15:53 +0000)]
amd64: macroify and mostly depessimize copyinstr

See r338968 for details.

Reviewed by: kib
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17288

5 years agoIn in6_pcbpurgeif0() called, e.g., from if_clone_destroy(),
bz [Thu, 27 Sep 2018 15:32:37 +0000 (15:32 +0000)]
In in6_pcbpurgeif0() called, e.g., from if_clone_destroy(),
once we have a lock, make sure the inp is not marked freed.
This can happen since the list traversal and locking was
converted to epoch(9).  If the inp is marked "freed", skip it.

This prevents a NULL pointer deref panic later on.

Reported by: slavash (Mellanox)
Tested by: slavash (Mellanox)
Reviewed by: markj (no formal review but caught my unlock mistake)
Approved by: re (kib)

5 years agoamd64: mostly depessimize copystr
mjg [Thu, 27 Sep 2018 15:27:53 +0000 (15:27 +0000)]
amd64: mostly depessimize copystr

- remove a forward branch in the common case
- replace xchg + lodsb/stosb loop with simple movs

A simple test on Intel(R) Core(TM) i7-4600U CPU @ 2.10GH copying
/foo/bar/baz in a loop goes from 295715863 ops/s to 465807408.

Further changes are pending.

Reviewed by: kib
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17281

5 years agoamd64: clean up copyin/copyout
mjg [Thu, 27 Sep 2018 15:24:16 +0000 (15:24 +0000)]
amd64: clean up copyin/copyout

- move the PSL.AC comment to the fault handler
- stop testing for zero-sized ops. after several minutes of package
building there were no copyin calls with zero bytes and very few
copyout. the semantic of returning 0 in this case is preserved
- shorten exit paths by clearing %eax earlier
- replace xchg with 3 movs. this is what compilers do. a naive
benchmark on EPYC suggests about 1% increase in thoughput thanks to
this change.
- remove the useless movb %cl,%al from copyout. it looks like a
leftover from many years ago

Reviewed by: kib
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17286

5 years agolib(4): Fix mdoc issues.
0mp [Thu, 27 Sep 2018 14:52:42 +0000 (14:52 +0000)]
lib(4): Fix mdoc issues.

- Fix "mandoc -Tlint" warnings.
- Use the "Er" macro for errors.
- Add an extra newline for readability.
- Reference m_pullup(9) and m_defrag(9).
- Use the "Fx" macro when talking about FreeBSD versions.

Reviewed by: bcr
Approved by: re (gjb), krion (mentor)
Differential Revision: https://reviews.freebsd.org/D17270

5 years agoRemove -m (update) from ldconfig -32 & -soft invocation on startup.
kib [Thu, 27 Sep 2018 14:31:41 +0000 (14:31 +0000)]
Remove -m (update) from ldconfig -32 & -soft invocation on startup.

Since r154114 which introduced ldconfig_local32_dirs, ldconfig -32 was
called with -m. This means that ld-elf32.so.hints paths set is not
cleared for compat32 on boot, unlike ld,so,hints.  Same -m was used in
r294295 for ld-elf-soft.so.hints on arm.  The patch fixes the
asymmetry.

Noted by: Andreas Longwitz <longwitz@incore.de>
Reviewed by: brooks, emaste, imp
Discussed with: bdrewery
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D17331

5 years agoamd64: implement memcmp in assembly
mjg [Thu, 27 Sep 2018 14:05:44 +0000 (14:05 +0000)]
amd64: implement memcmp in assembly

Both the in-kernel C variant and libc asm variant have very poor performance.
The former compiles to a single byte comparison loop, which breaks down even
for small sizes. The latter uses rep cmpsq/b which turn out to have very poor
throughput and are slower than a hand-coded 32-byte comparison loop.

Depending on size this is about 3-4 times faster than the current routines.

Reviewed by: kib
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17328

5 years agoExport ID_AA64PFR0_EL1 to userland
andrew [Thu, 27 Sep 2018 13:54:09 +0000 (13:54 +0000)]
Export ID_AA64PFR0_EL1 to userland

Create a user view of the ID_AA64PFR0_EL1 register with values common
across all CPUs.

Approved by: re (kib)
Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D17301