]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoEliminate spurious periodic.daily error message for rotating accounting log.
ian [Sun, 7 Jul 2019 17:15:45 +0000 (17:15 +0000)]
Eliminate spurious periodic.daily error message for rotating accounting log.

In 2011, r218961 removed local code for rotating logs in favor of using the
rotate_log command in etc/rc.d/accounting.  If the accounting service is
activated then subsequently de-activated in rc.conf but still remains active
in periodic.conf, then you get an error message every day in the periodic
jobs about being unable to rotate the logs.

With this change to use "onerotate_log", the log rotation will happen the
first time periodic daily runs after accounting was disabled but periodic
accounting was left enabled.  After that happens once, the /var/account/acct
will no longer exist, which results in a different path through the periodic
code and no more error messages will appear (unless daily_show_badconfig is
set, in which case the admin will be told that periodic security processing
is enabled but the accounting file is not present).

This is only a partial fix for the problems reported in PR 202203.

PR: 202203

4 years agobhyve: abstraction for network backends
vmaffione [Sun, 7 Jul 2019 12:15:24 +0000 (12:15 +0000)]
bhyve: abstraction for network backends

Bhyve can currently emulate two virtual NICs, namely virtio-net and e1000,
and connect to the host network through two backends, namely tap and netmap.
However, there is no interface between virtual NIC functionalities and
backend functionalities. As a result, the backend code is duplicated between
the two virtual NIC implementations and also within the same virtual NIC.
Also, e1000 cannot currently use netmap as a backend.
This patch introduces a network backend API between virtio-net/e1000 and
tap/netmap, to improve code reuse and add missing functionalities.
Virtual NICs and backends can negotiate virtio-net features, such as checksum
offload and TSO. If the backend supports the features, it will propagate this
information to the guest, so that the latter can make use of them. Currently,
only netmap VALE ports support the features, but support should be added to
tap in the future.

Reviewed by: jhb, bryanv
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20659

4 years agoAdd additional check for 'blocks per group' and 'fragments per group' superblock...
fsu [Sun, 7 Jul 2019 08:58:02 +0000 (08:58 +0000)]
Add additional check for 'blocks per group' and 'fragments per group' superblock fields.

These fields will not be equal only in case if bigalloc filesystem feature is turned on.
This feature is not supported for now.

Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:    FS-27-EXT2-12: Denial of Service in openat-0 (vm_fault_hold/ext2_clusteracct)

MFC after: 2 weeks

4 years agoRemove ufs fragments logic.
fsu [Sun, 7 Jul 2019 08:56:13 +0000 (08:56 +0000)]
Remove ufs fragments logic.

The ext2fs fragments are different from ufs fragments.
In case of ext2fs the fragment should be equal or more then block size.
The values more than block size are used only in case of bigalloc feature, which is does not supported for now.

Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:    FS-22-EXT2-9: Denial of service in ftruncate-0 (ext2_balloc)

MFC after: 2 weeks

4 years agoRemove unneeded mount point unlock call.
fsu [Sun, 7 Jul 2019 08:53:52 +0000 (08:53 +0000)]
Remove unneeded mount point unlock call.

Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:    FS-11-EXT2-6: Denial Of Service in write-1 (ext2_balloc)

MFC after: 2 weeks

4 years agoA style-related change, r349791, made unclear the meaning of a
dougm [Sun, 7 Jul 2019 06:57:04 +0000 (06:57 +0000)]
A style-related change, r349791, made unclear the meaning of a
comment. Rewrite that comment to improve its clarity.

Reported by: cem
Reviewed by: alc, cem
Approved by: kib, markj (mentors, implicit)
Differential Revision: https://reviews.freebsd.org/D20871

4 years agoThree changes to pmap_enter():
alc [Sun, 7 Jul 2019 06:06:48 +0000 (06:06 +0000)]
Three changes to pmap_enter():

1. Use _pmap_alloc_l3() instead of pmap_alloc_l3() in order to handle the
possibility that a superpage mapping for "va" was created while we slept.
(This is derived from the amd64 version.)

2. Eliminate code for allocating kernel page table pages.  Kernel page
table pages are preallocated by pmap_growkernel().

3. Eliminate duplicated unlock operations when KERN_RESOURCE_SHORTAGE is
returned.

MFC after: 2 weeks

4 years agoDocument atomicity for read(2) and write(2).
kib [Sat, 6 Jul 2019 20:31:37 +0000 (20:31 +0000)]
Document atomicity for read(2) and write(2).

Take part of the text from POSIX 2018 edition and describe the
atomicity requirements for read and write syscalls.  See p1003.1-2018,
Vol.2, 2.9.7 Threads interaction with Regular File Operations.

Reviewed by: asomers
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D20867

4 years agoUpgrade our copies of clang, llvm, lld, lldb, compiler-rt, libc++,
dim [Sat, 6 Jul 2019 18:02:29 +0000 (18:02 +0000)]
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt, libc++,
libunwind and openmp to the upstream release_80 branch r364487
(effectively, 8.0.1 rc3).  The 8.0.1 release will most likely
have no further changes.

MFC after: 1 week
X-MFC-With: r349004

4 years agoFix style(9) violations involving division by PAGE_SIZE.
dougm [Sat, 6 Jul 2019 15:55:16 +0000 (15:55 +0000)]
Fix style(9) violations involving division by PAGE_SIZE.

Reviewed by: alc
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20847

4 years agoChange blist_next_leaf_alloc so that it can examine more than one leaf
dougm [Sat, 6 Jul 2019 06:15:03 +0000 (06:15 +0000)]
Change blist_next_leaf_alloc so that it can examine more than one leaf
after the one where the possible block allocation begins, and allocate
a larger number of blocks than the current limit. This does not affect
the limit on minimum allocation size, which still cannot exceed
BLIST_MAX_ALLOC.

Use this change to modify swp_pager_getswapspace and its callers, so
that they can allocate more than BLIST_MAX_ALLOC blocks if they are
available.

Tested by: pho
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20579

4 years agoRestructure cache_handle_range to avoid repeated barriers. Specifically,
alc [Fri, 5 Jul 2019 20:01:06 +0000 (20:01 +0000)]
Restructure cache_handle_range to avoid repeated barriers.  Specifically,
restructure cache_handle_range so that all of the data cache operations are
performed before any instruction cache operations.  Then, we only need one
barrier between the data and instruction cache operations and one barrier
after the instruction cache operations.

On an Amazon EC2 a1.2xlarge instance, this simple change reduces the time
for a "make -j8 buildworld" by 9%.

Reviewed by: andrew
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20848

4 years agoBased on work posted at https://reviews.freebsd.org/D13484, change
dougm [Fri, 5 Jul 2019 16:49:34 +0000 (16:49 +0000)]
Based on work posted at https://reviews.freebsd.org/D13484, change
swap_pager_swapoff_object and swp_pager_force_pagein so that they can
page in multiple pages at a time to a swap device, rather than doing
one I/O operation for each page.

Tested by: pho
Submitted by: ota_j.email.ne.jp (Yoshihiro Ota)
Reviewed by: alc, markj, kib
Approved by: kib, markj (mentors)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20635

4 years agoMerge r349526 from amd64. When we protect an L3 entry, we only call
alc [Fri, 5 Jul 2019 05:23:23 +0000 (05:23 +0000)]
Merge r349526 from amd64.  When we protect an L3 entry, we only call
vm_page_dirty() when, in fact, we are write protecting the page and the L3
entry has PTE_D set.  However, pmap_protect() was always calling
vm_page_dirty() when an L2 entry has PTE_D set.  Handle L2 entries the
same as L3 entries so that we won't perform unnecessary calls to
vm_page_dirty().

Simplify the loop calling vm_page_dirty() on L2 entries.

4 years agonetmap: Remove pointer leakage in netmap_mem2.c
vmaffione [Thu, 4 Jul 2019 21:31:49 +0000 (21:31 +0000)]
netmap: Remove pointer leakage in netmap_mem2.c

PR: 238641
Submitted by: Fuqian Huang <huangfq.daxian@gmail.com>
Reviewed by: vmaffione
MFC after: 1 week

4 years agonetmap: fix kernel pointer printing in netmap_generic.c
vmaffione [Thu, 4 Jul 2019 21:11:45 +0000 (21:11 +0000)]
netmap: fix kernel pointer printing in netmap_generic.c

Print the adapter name rather than the address of the adapter
to avoid kernel address leakage.

PR: Bug 238642
Submitted by: Fuqian Huang <huangfq.daxian@gmail.com>
Reviewed by: vmaffione
MFC after: 1 week

4 years agoUpdate Linux compat version to 2.6.36
emaste [Thu, 4 Jul 2019 20:42:08 +0000 (20:42 +0000)]
Update Linux compat version to 2.6.36

New system calls between 2.6.32 and 2.6.26 are already implemented.

This should be mostly NFC as far as contemporary Linux applications are
concerned though, as Linux kernel 3.2 is the oldest supported by a
number of popular distros today; work is in progress by others to enable
support for those applications.

Discussed with: trasz
MFC after: 1 month

4 years agoReturn ENOTSUP for Linux FS_IOC_FIEMAP ioctl.
trasz [Thu, 4 Jul 2019 20:16:04 +0000 (20:16 +0000)]
Return ENOTSUP for Linux FS_IOC_FIEMAP ioctl.

Linux man(1) calls it for no good reason; this avoids the console spam
(eg '(man): ioctl fd=4, cmd=0x660b ('f',11) is not implemented').

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20690

4 years agoAdd support for PTRACE_O_TRACEEXIT to linuxulator ptrace(2).
trasz [Thu, 4 Jul 2019 19:46:58 +0000 (19:46 +0000)]
Add support for PTRACE_O_TRACEEXIT to linuxulator ptrace(2).
This fixes strace 4.25 from Ubuntu 19.04.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20689

4 years agoImplement PTRACE_GETSIGINFO. This makes Linux strace(1) quieter
trasz [Thu, 4 Jul 2019 19:44:13 +0000 (19:44 +0000)]
Implement PTRACE_GETSIGINFO.  This makes Linux strace(1) quieter
in some cases (strace -f man id > /dev/null).

Reviewed by: dchagin
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20691

4 years agoFix linuxulator prlimit64(2) with pid == 0. This makes 'ulimit -a'
trasz [Thu, 4 Jul 2019 19:40:01 +0000 (19:40 +0000)]
Fix linuxulator prlimit64(2) with pid == 0.  This makes 'ulimit -a'
return something reasonable, and helps linux binaries which attempt
to close all the files, eg apt(8).

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20692

4 years agoMove an assignment, drop a label, and change gotos to break statements
dougm [Thu, 4 Jul 2019 19:25:30 +0000 (19:25 +0000)]
Move an assignment, drop a label, and change gotos to break statements
in vm_map_unwire. The code generated on amd86 is unchanged.

Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20850

4 years agoReplace a 'goto' with an 'else' in vm_map_wire_locked.
dougm [Thu, 4 Jul 2019 19:17:55 +0000 (19:17 +0000)]
Replace a 'goto' with an 'else' in vm_map_wire_locked.

Reviewed by: alc
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20855

4 years agoChange boolean_t variables in vm_map_unwire and vm_map_wire_locked to
dougm [Thu, 4 Jul 2019 19:12:13 +0000 (19:12 +0000)]
Change boolean_t variables in vm_map_unwire and vm_map_wire_locked to
bool. Drop result variable. Add holes_ok bool to replace repeated
masking of flags parameter.

Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20846

4 years agoDrop a temp variable from vm_map_insert, with no effect on the
dougm [Thu, 4 Jul 2019 18:28:49 +0000 (18:28 +0000)]
Drop a temp variable from vm_map_insert, with no effect on the
resulting amd64 machine code.

Reviewed by: alc
Approved by: kib, markj (mentors, implicit)
Differential Revision: https://reviews.freebsd.org/D20849

4 years agoDefer funsetown() calls for a TTY to tty_rel_free().
markj [Thu, 4 Jul 2019 15:42:02 +0000 (15:42 +0000)]
Defer funsetown() calls for a TTY to tty_rel_free().

We were otherwise failing to call funsetown() for some descriptors
associated with a tty, such as pts descriptors.  Then, if the
descriptor is closed before the owner exits, we may get memory
corruption.

Reported by: syzbot+c9b6206303bf47bac87e@syzkaller.appspotmail.com
Reviewed by: ed
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoFix transfers that don't use busdma or bounce buffer (e.g. software dmas).
br [Thu, 4 Jul 2019 15:26:02 +0000 (15:26 +0000)]
Fix transfers that don't use busdma or bounce buffer (e.g. software dmas).
Busdma data loaded by different function (the bug introduced in r349727).

Sponsored by: DARPA, AFRL

4 years agoFix cut-and-pasto that slipped through my testing.
imp [Thu, 4 Jul 2019 15:09:58 +0000 (15:09 +0000)]
Fix cut-and-pasto that slipped through my testing.

4 years agoelfcopy: Clear errors after fetching the shstrtab index.
markj [Thu, 4 Jul 2019 15:07:19 +0000 (15:07 +0000)]
elfcopy: Clear errors after fetching the shstrtab index.

Otherwise a future call to elf_errno() will return a non-zero value.
update_shdr(), for example, treats any errors associated with the ELF
descriptor as fatal.  Clear the error per the first example in
elf_errmsg.3.

Convert to elf_getshdrstrndx() while here since elf_getshstrndx() is
apparently deprecated.

Reported by: royger
Reviewed by: emaste
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20852

4 years agoConsider *clean targets as non-build targets as well.
bdrewery [Thu, 4 Jul 2019 14:51:44 +0000 (14:51 +0000)]
Consider *clean targets as non-build targets as well.

MFC after: 2 weeks
Sponsored by: DellEMC

4 years agoImplement missing MMCBR ivars
imp [Thu, 4 Jul 2019 14:15:04 +0000 (14:15 +0000)]
Implement missing MMCBR ivars

All MMCBR bridges have to implement all the MMCBR variables. This
implements them for everybody that currently doesn't.

A common routine for this should be written.

4 years agoNegate the logic of XCHAN_CAP_NOBUFS macro and rename it to
br [Thu, 4 Jul 2019 14:04:08 +0000 (14:04 +0000)]
Negate the logic of XCHAN_CAP_NOBUFS macro and rename it to
XCHAN_CAP_BOUNCE.

The only application that uses bounce buffering for now is the Government
Furnished Equipment (GFE) P2's dma core (AXIDMA) with its own dedicated
cacheless bounce buffer.

Sponsored by: DARPA, AFRL

4 years ago[PPC64] pseries llan: fix MAC address
luporl [Thu, 4 Jul 2019 12:31:24 +0000 (12:31 +0000)]
[PPC64] pseries llan: fix MAC address

There was an issue in pseries llan driver, that resulted in the first 2 bytes
of the MAC address getting stripped, and the last 2 being always 0.

In most cases the network interface still worked, despite the MAC being
different of what was specified to QEMU, but when some other host or DHCP
server expected a specific MAC, this would fail.

This change fixes this by shifting right by 2 the local-mac-address read from
device tree, if its length is 6 instead of 8, as observed in QEMU DT, that
always presents a 6 bytes value for this property.

PR: 237471
Reported by: Alfredo Dal'Ava Junior
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D20843

4 years agoUpgrade Unbound to 1.9.2.
des [Thu, 4 Jul 2019 08:40:10 +0000 (08:40 +0000)]
Upgrade Unbound to 1.9.2.

4 years agoLock busdma operations and serialize detach against open/close
marcel [Thu, 4 Jul 2019 02:51:34 +0000 (02:51 +0000)]
Lock busdma operations and serialize detach against open/close

Use sx to allow M_WAITOK allocations (suggested by markj).

admbugs: 782
Reviewed by: markj

4 years agoEliminate a goto and a label in vm_map_wire_locked by inserting an 'else'.
dougm [Wed, 3 Jul 2019 22:41:54 +0000 (22:41 +0000)]
Eliminate a goto and a label in vm_map_wire_locked by inserting an 'else'.

Reviewed by: alc
Approved by: kib, markj (mentors, implicit)
Differential Revision: https://reviews.freebsd.org/D20845

4 years agoiwm: Drain callouts after stopping the device during detach.
markj [Wed, 3 Jul 2019 21:05:40 +0000 (21:05 +0000)]
iwm: Drain callouts after stopping the device during detach.

Otherwise there is a window where they may be rescheduled.  This
typically manifested as a page fault shortly after unloading if_iwm.ko.
Close the race by draining callouts after calling iwm_stop_device(),
which is also what Dragonfly does.

Change whitespace to reduce gratuitous diffs with Dragonfly.

Reported and tested by: seanc
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoFix path of lib32 libcasper.
tijl [Wed, 3 Jul 2019 20:52:10 +0000 (20:52 +0000)]
Fix path of lib32 libcasper.

Reported by: jhb
MFC after: 1 week

4 years agocorrect pmap_ts_referenced return type
emaste [Wed, 3 Jul 2019 19:59:56 +0000 (19:59 +0000)]
correct pmap_ts_referenced return type

pmap_ts_referenced returns a count, not a boolean, and is supposed to
have int as the return type not boolean_t.

This worked previously because boolean_t is an int typedef.

Discussed with: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoSave the last callout function executed on each CPU
vangyzen [Wed, 3 Jul 2019 19:22:44 +0000 (19:22 +0000)]
Save the last callout function executed on each CPU

Save the last callout function pointer (and its argument) executed
on each CPU for inspection by a debugger.  Add a ddb `show callout_last`
command to show these pointers.  Add a kernel module that I used
for testing that command.

Relocate `ce_migration_cpu` to reduce padding and therefore preserve
the size of `struct callout_cpu` (320 bytes on amd64) despite the
added members.

This should help diagnose reference-after-free bugs where the
callout's mutex has already been freed when `softclock_call_cc`
tries to unlock it.

You might hope that the pointer would still be available, but it
isn't.  The argument to that function is on the stack (because
`softclock_call_cc` uses it later), and that might be enough in
some cases, but even then, it's very laborious.  A pointer to the
callout is saved right before these newly added fields, but that
callout might have been freed.  We still have the pointer to its
associated mutex, and the name within might be enough, but it might
also have been freed.

Reviewed by: markj jhb
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20794

4 years agoCache the next queue element when traversing a page queue.
markj [Wed, 3 Jul 2019 18:46:39 +0000 (18:46 +0000)]
Cache the next queue element when traversing a page queue.

When QUEUE_MACRO_DEBUG_TRASH is configured, removing a queue element
invalidates its queue linkage pointers.  vm_pageout_collect_batch()
was relying on these pointers remaining valid after a removal, so
modify it to fetch the next queued page before dequeuing the current
page.

Submitted by: Don Morris <dgmorris@earthlink.net>
Reviewed by: cem, vangyzen
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20842

4 years agobhyve/audio: don't leak resources on failed initialization.
seanc [Wed, 3 Jul 2019 17:24:24 +0000 (17:24 +0000)]
bhyve/audio: don't leak resources on failed initialization.

Coverity CID: 1402793
Approved by: markj, jhb, bhyve
Differential Revision: https://reviews.freebsd.org/D20841

4 years agoUse unmapped (M_NOMAP) mbufs for zero-copy AIO writes via TOE.
jhb [Wed, 3 Jul 2019 16:06:11 +0000 (16:06 +0000)]
Use unmapped (M_NOMAP) mbufs for zero-copy AIO writes via TOE.

Previously the TOE code used its own custom unmapped mbufs via
EXT_FLAG_VENDOR1.  The old version always wired the entire AIO request
buffer first for the duration of the AIO operation and constructed
multiple mbufs which used the wired buffer as an external buffer.

The new version determines how much room is available in the socket
buffer and only wires the pages needed for the available room building
chains of M_NOMAP mbufs.  This means that a large AIO write will now
limit the amount of wired memory it uses to the size of the socket
buffer.

Reviewed by: gallatin, np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D20839

4 years agoRemove dead code added after r348743 in the LinuxKPI. The
hselasky [Wed, 3 Jul 2019 09:48:20 +0000 (09:48 +0000)]
Remove dead code added after r348743 in the LinuxKPI. The
LINUXKPI_VERSION macro is not defined for any compiled LinuxKPI code
which basically means __GFP_NOTWIRED is never checked when allocating
pages. This should work fine with the existing external DRM code as
long as the page wiring and unwiring is balanced.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAlso remove lib32 versions of libradius.
tijl [Wed, 3 Jul 2019 09:14:39 +0000 (09:14 +0000)]
Also remove lib32 versions of libradius.

MFC after: 1 week

4 years agoAlso remove lib32 version of libcasper.so.0.
tijl [Wed, 3 Jul 2019 09:08:17 +0000 (09:08 +0000)]
Also remove lib32 version of libcasper.so.0.

4 years agoAlso remove lib32 version of libprivateifconfig after r344530.
tijl [Wed, 3 Jul 2019 09:06:39 +0000 (09:06 +0000)]
Also remove lib32 version of libprivateifconfig after r344530.

4 years agoSubclass Rockchip's General Register Files driver from Simple MFD driver.
ganbold [Wed, 3 Jul 2019 03:42:51 +0000 (03:42 +0000)]
Subclass Rockchip's General Register Files driver from Simple MFD driver.

4 years agoFix build error introduced by r349596.
ganbold [Wed, 3 Jul 2019 01:40:29 +0000 (01:40 +0000)]
Fix build error introduced by r349596.

4 years agoRemove the CDIOCREADSUBCHANNEL_SYSSPACE ioctl.
markj [Wed, 3 Jul 2019 00:10:01 +0000 (00:10 +0000)]
Remove the CDIOCREADSUBCHANNEL_SYSSPACE ioctl.

This was added for emulation of Linux's CDROMSUBCHNL, but allows
users with read access to a cd(4) device to overwrite kernel memory
provided that the driver detects some media present.

Reimplement CDROMSUBCHNL by bouncing the data from CDIOCREADSUBCHANNEL
through the linux_cdrom_subchnl structure passed from userspace.

admbugs: 768
Reported by: Alex Fortune
Security: CVE-2019-5602
Security: FreeBSD-SA-19:11.cd_ioctl

4 years agolibc: correct iconv buffer overflow
emaste [Tue, 2 Jul 2019 23:56:37 +0000 (23:56 +0000)]
libc: correct iconv buffer overflow

admbugs: 920
Submitted by: Andrea Venturoli, gabor
Reported by: Andrea Venturoli <security@netfence.it>, NetFence
Security: CVE-2019-5600
Security: FreeBSD-SA-19:09.iconv

4 years agoImplement pmap_copy(). (This includes the changes applied to the amd64
alc [Tue, 2 Jul 2019 23:02:52 +0000 (23:02 +0000)]
Implement pmap_copy().  (This includes the changes applied to the amd64
pmap_copy() in r349585.)

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D20790

4 years agoInvoke ext_free function when freeing an unmapped mbuf.
jhb [Tue, 2 Jul 2019 22:58:21 +0000 (22:58 +0000)]
Invoke ext_free function when freeing an unmapped mbuf.

Fix a mis-merge when extracting the unmapped mbuf changes from
Netflix's in-kernel TLS changes where the call to the function that
freed the backing pages from an unmapped mbuf was missed.

Sponsored by: Chelsio Communications

4 years agoFix description of debug.obsolete_panic.
jhb [Tue, 2 Jul 2019 22:57:24 +0000 (22:57 +0000)]
Fix description of debug.obsolete_panic.

MFC after: 1 week

4 years agoFix build race when building rtld
arichardson [Tue, 2 Jul 2019 22:11:07 +0000 (22:11 +0000)]
Fix build race when building rtld

I found this on one of the CheriBSD Jenkins builders. Using
beforelinking instead of ${PROG} should fix the dependency for the
DEBUG_FILES case.

Reviewed by: brooks

4 years agoMore style.
kib [Tue, 2 Jul 2019 21:03:06 +0000 (21:03 +0000)]
More style.

Re-wrap long lines, reformat comments, remove excessive blank line.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 years agoefihttp: mac and err can be used uninitialized
tsoome [Tue, 2 Jul 2019 20:32:35 +0000 (20:32 +0000)]
efihttp: mac and err can be used uninitialized

While there, also check if mac != NULL, and use pointer compare for ipv4
and dns.

4 years agoMark pages allocated from the per-CPU cache.
markj [Tue, 2 Jul 2019 19:51:40 +0000 (19:51 +0000)]
Mark pages allocated from the per-CPU cache.

Only free pages to the cache when they were allocated from that cache.
This mitigates rapid fragmentation of physical memory seen during
poudriere's dependency calculation phase.  In particular, pages
belonging to broken reservations are no longer freed to the per-CPU
cache, so they get a chance to coalesce with freed pages during the
break.  Otherwise, the optimized CoW handler may create object
chains in which multiple objects contain pages from the same
reservation, and the order in which we do object termination means
that the reservation is broken before all of those pages are freed,
so some of them end up in the per-CPU cache and thus permanently
fragment physical memory.

The flag may also be useful for eliding calls to vm_reserv_free_page(),
thus avoiding memory accesses for data that is likely not present
in the CPU caches.

Reviewed by: alc
Discussed with: jeff
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20763

4 years agoStyle.
kib [Tue, 2 Jul 2019 19:32:48 +0000 (19:32 +0000)]
Style.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 years agoAdd implicit PROT_MAX() knob to proccontrol(1).
kib [Tue, 2 Jul 2019 19:12:02 +0000 (19:12 +0000)]
Add implicit PROT_MAX() knob to proccontrol(1).

Reviewed by: emaste, markj (previous version)
Discussed with: brooks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D20795

4 years agoControl implicit PROT_MAX() using procctl(2) and the FreeBSD note
kib [Tue, 2 Jul 2019 19:07:17 +0000 (19:07 +0000)]
Control implicit PROT_MAX() using procctl(2) and the FreeBSD note
feature bit.

In particular, allocate the bit to opt-out the image from implicit
PROTMAX enablement.  Provide procctl(2) verbs to set and query
implicit PROTMAX handling.  The knobs mimic the same per-image flag
and per-process controls for ASLR.

Reviewed by: emaste, markj (previous version)
Discussed with: brooks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D20795

4 years agoUse traditional 'p' local to designate td->td_proc in kern_mmap.
kib [Tue, 2 Jul 2019 19:01:14 +0000 (19:01 +0000)]
Use traditional 'p' local to designate td->td_proc in kern_mmap.

Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D20795

4 years agopci(4): Use plural configuration registers
zeising [Tue, 2 Jul 2019 17:48:27 +0000 (17:48 +0000)]
pci(4): Use plural configuration registers

Change to use registers instead of register, as it is customary to use
plural when talking about PCI registers.

This was missed in r349150.

MFC after: 3 days

4 years agoif_muge: set IFCAP_VLAN_MTU to maintain 1500 MTU with vlan use
emaste [Tue, 2 Jul 2019 16:44:04 +0000 (16:44 +0000)]
if_muge: set IFCAP_VLAN_MTU to maintain 1500 MTU with vlan use

PR: 238665
Submitted by: Ralf <iz-rpi03@hs-karlsruhe.de>
MFC after: 1 week

4 years agoInclude sys/lock.h, as told by man page.
mav [Tue, 2 Jul 2019 15:01:54 +0000 (15:01 +0000)]
Include sys/lock.h, as told by man page.

MFC after: 1 week

4 years agoCorrect name of vmm(4) pptdevs variable.
wblock [Tue, 2 Jul 2019 14:53:51 +0000 (14:53 +0000)]
Correct name of vmm(4) pptdevs variable.

Reported by: nwolff@ixsystems.com

4 years agoFix handling of errors from sblock() in soreceive_stream().
markj [Tue, 2 Jul 2019 14:24:42 +0000 (14:24 +0000)]
Fix handling of errors from sblock() in soreceive_stream().

Previously we would attempt to unlock the socket buffer despite having
failed to lock it.  Simply return an error instead: no resources need
to be released at this point, and doing so is consistent with
soreceive_generic().

PR: 238789
Submitted by: Greg Becker <greg@codeconcepts.com>
MFC after: 1 week

4 years agoExtend simple_mfd driver to expose a syscon interface if
ganbold [Tue, 2 Jul 2019 08:47:18 +0000 (08:47 +0000)]
Extend simple_mfd driver to expose a syscon interface if
that node is also compatible with syscon. For instance,
Rockchip RK3399's GRF (General Register Files) is compatible
with simple-mfd as well as syscon and has devices like
usb2-phy, emmc-phy and pcie-phy etc. under it.

Reviewed by: manu

4 years agoFix i386 LINT after r349594.
mav [Tue, 2 Jul 2019 07:47:11 +0000 (07:47 +0000)]
Fix i386 LINT after r349594.

MFC after: 1 month

4 years agoAdd driver for NTB in AMD SoC.
mav [Tue, 2 Jul 2019 05:25:18 +0000 (05:25 +0000)]
Add driver for NTB in AMD SoC.

This patch is the driver for NTB hardware in AMD SoCs (ported from Linux)
and enables the NTB infrastructure like Doorbells, Scratchpads and Memory
window in AMD SoC. This driver has been validated using ntb_transport and
if_ntb driver already available in FreeBSD.

Submitted by: Rajesh Kumar <rajesh1.kumar@amd.com>
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D18774

4 years agobwn(4): Include SROM revision when printing device identification.
landonf [Tue, 2 Jul 2019 02:52:05 +0000 (02:52 +0000)]
bwn(4): Include SROM revision when printing device identification.

4 years agoImport tzdata 2019b
philip [Tue, 2 Jul 2019 01:12:23 +0000 (01:12 +0000)]
Import tzdata 2019b

Changes: https://github.com/eggert/tz/blob/2019b/NEWS

MFC after: 1 day

4 years agoAdd a new "untrusted" option to the mount command. Its purpose
mckusick [Mon, 1 Jul 2019 23:22:26 +0000 (23:22 +0000)]
Add a new "untrusted" option to the mount command. Its purpose
is to notify the kernel that the file system is untrusted and it
should use more extensive checks on the file-system's metadata
before using it. This option is intended to be used when mounting
file systems from untrusted media such as USB memory sticks or other
externally-provided media.

It will initially be used by the UFS/FFS file system, but should
likely be expanded to be used by other file systems that may appear
on external media like msdosfs, exfat, and ext2fs.

Reviewed by:  kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20786

4 years agoarm64: efi: Map memory IO region as device
manu [Mon, 1 Jul 2019 22:11:56 +0000 (22:11 +0000)]
arm64: efi: Map memory IO region as device

Reviewed by: andrew
Sponsored by: Ampere Computing, LLC

4 years agog_mirror_taste: avoid deadlock, always clear tasting flag
rlibby [Mon, 1 Jul 2019 22:06:36 +0000 (22:06 +0000)]
g_mirror_taste: avoid deadlock, always clear tasting flag

If g_mirror_taste encountered an error at g_mirror_add_disk, it might
try to g_mirror_destroy the device with the G_MIRROR_DEVICE_FLAG_TASTING
flag still set.  This would wait on a worker to complete the destruction
with g_mirror_try_destroy, but that function bails out if the tasting
flag is set, resulting in a deadlock.  Clear the tasting flag before
trying to destroy the device.

Test Plan:
sysctl debug.fail_point.mnowait="1%return"
kyua test -k /usr/tests/sys/geom/class/mirror/Kyuafile

Reviewed by: markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20744

4 years agog_eli_create: only dec g_access acw if we inc'd it
rlibby [Mon, 1 Jul 2019 22:06:16 +0000 (22:06 +0000)]
g_eli_create: only dec g_access acw if we inc'd it

Reviewed by: cem, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20743

4 years agoTidy up pmap_copy(). Notably, deindent the innermost loop by making a
alc [Mon, 1 Jul 2019 22:00:42 +0000 (22:00 +0000)]
Tidy up pmap_copy().  Notably, deindent the innermost loop by making a
simple change to the control flow.  Replace an unnecessary test by a
KASSERT.  Add a comment explaining an obscure test.

Reviewed by: kib, markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D20812

4 years agoSince r349571 we need all the accessor to be present for set or get
manu [Mon, 1 Jul 2019 21:50:53 +0000 (21:50 +0000)]
Since r349571 we need all the accessor to be present for set or get
otherwise we panic.
dwmmc don't handle VCCQ (voltage for the IO line of the SD/eMMC) or
TIMING.
Add the needed accessor in the {read,write}_ivar functions.

Reviewed by: imp (previous version)

4 years agoPull in r360968 from upstream llvm trunk (by Philip Reames):
dim [Mon, 1 Jul 2019 21:06:10 +0000 (21:06 +0000)]
Pull in r360968 from upstream llvm trunk (by Philip Reames):

  Clarify comments on helpers used by LFTR [NFC]

  I'm slowly wrapping my head around this code, and am making comment
  improvements where I can.

Pull in r360972 from upstream llvm trunk (by Philip Reames):

  [LFTR] Factor out a helper function for readability purpose [NFC]

Pull in r360976 from upstream llvm trunk (by Philip Reames):

  [IndVars] Don't reimplement Loop::isLoopInvariant [NFC]

  Using dominance vs a set membership check is indistinguishable from a
  compile time perspective, and the two queries return equivelent
  results.  Simplify code by using the existing function.

Pull in r360978 from upstream llvm trunk (by Philip Reames):

  [LFTR] Strengthen assertions in genLoopLimit [NFCI]

Pull in r362292 from upstream llvm trunk (by Nikita Popov):

  [IndVarSimplify] Fixup nowrap flags during LFTR (PR31181)

  Fix for https://bugs.llvm.org/show_bug.cgi?id=31181 and partial fix
  for LFTR poison handling issues in general.

  When LFTR moves a condition from pre-inc to post-inc, it may now
  depend on value that is poison due to nowrap flags. To avoid this, we
  clear any nowrap flag that SCEV cannot prove for the post-inc addrec.

  Additionally, LFTR may switch to a different IV that is dynamically
  dead and as such may be arbitrarily poison. This patch will correct
  nowrap flags in some but not all cases where this happens. This is
  related to the adoption of IR nowrap flags for the pre-inc addrec.
  (See some of the switch_to_different_iv tests, where flags are not
  dropped or insufficiently dropped.)

  Finally, there are likely similar issues with the handling of GEP
  inbounds, but we don't have a test case for this yet.

  Differential Revision: https://reviews.llvm.org/D60935

Pull in r362971 from upstream llvm trunk (by Philip Reames):

  Prepare for multi-exit LFTR [NFC]

  This change does the plumbing to wire an ExitingBB parameter through
  the LFTR implementation, and reorganizes the code to work in terms of
  a set of individual loop exits. Most of it is fairly obvious, but
  there's one key complexity which makes it worthy of consideration.
  The actual multi-exit LFTR patch is in D62625 for context.

  Specifically, it turns out the existing code uses the backedge taken
  count from before a IV is widened. Oddly, we can end up with a
  different (more expensive, but semantically equivelent) BE count for
  the loop when requerying after widening.  For the nestedIV example
  from elim-extend, we end up with the following BE counts:
  BEFORE: (-2 + (-1 * %innercount) + %limit)
  AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))<nsw>)

  This is the only test in tree which seems sensitive to this
  difference. The actual result of using the wider BETC on this example
  is that we actually produce slightly better code. :)

  In review, we decided to accept that test change.  This patch is
  structured to preserve the old behavior, but a separate change will
  immediate follow with the behavior change.  (I wanted it separate for
  problem attribution purposes.)

  Differential Revision: https://reviews.llvm.org/D62880

Pull in r362975 from upstream llvm trunk (by Philip Reames):

  [LFTR] Use recomputed BE count

  This was discussed as part of D62880.  The basic thought is that
  computing BE taken count after widening should produce (on average)
  an equally good backedge taken count as the one before widening.
  Since there's only one test in the suite which is impacted by this
  change, and it's essentially equivelent codegen, that seems to be a
  reasonable assertion.  This change was separated from r362971 so that
  if this turns out to be problematic, the triggering piece is obvious
  and easily revertable.

  For the nestedIV example from elim-extend.ll, we end up with the
  following BE counts:
  BEFORE: (-2 + (-1 * %innercount) + %limit)
  AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))<nsw>)

  Note that before is an i32 type, and the after is an i64.  Truncating
  the i64 produces the i32.

Pull in r362980 from upstream llvm trunk (by Philip Reames):

  Factor out a helper function for readability and reuse in a future
  patch [NFC]

Pull in r363613 from upstream llvm trunk (by Philip Reames):

  Fix a bug w/inbounds invalidation in LFTR (recommit)

  Recommit r363289 with a bug fix for crash identified in pr42279.
  Issue was that a loop exit test does not have to be an icmp, leading
  to a null dereference crash when new logic was exercised for that
  case.  Test case previously committed in r363601.

  Original commit comment follows:

  This contains fixes for two cases where we might invalidate inbounds
  and leave it stale in the IR (a miscompile). Case 1 is when switching
  to an IV with no dynamically live uses, and case 2 is when doing
  pre-to-post conversion on the same pointer type IV.

  The basic scheme used is to prove that using the given IV (pre or
  post increment forms) would have to already trigger UB on the path to
  the test we're modifying. As such, our potential UB triggering use
  does not change the semantics of the original program.

  As was pointed out in the review thread by Nikita, this is defending
  against a separate issue from the hasConcreteDef case. This is about
  poison, that's about undef. Unfortunately, the two are different, see
  Nikita's comment for a fuller explanation, he explains it well.

  (Note: I'm going to address Nikita's last style comment in a separate
  commit just to minimize chance of subtle bugs being introduced due to
  typos.)

  Differential Revision: https://reviews.llvm.org/D62939

Pull in r363875 from upstream llvm trunk (by Philip Reames):

  [LFTR] Rename variable to minimize confusion [NFC]

  (Recommit of r363293 which was reverted when a dependent patch was.)

  As pointed out by Nikita in D62625, BackedgeTakenCount is generally
  used to refer to the backedge taken count of the loop. A conditional
  backedge taken count - one which only applies if a particular exit is
  taken - is called a ExitCount in SCEV code, so be consistent here.

Pull in r363877 from upstream llvm trunk (by Philip Reames):

  [LFTR] Stylistic cleanup as suggested in last review comment of
  D62939 [NFC]

  (Resumbit of r363292 which was reverted along w/an earlier patch)

Pull in r364346 from upstream llvm trunk (by Philip Reames):

  [LFTR] Adjust debug output to include extensions (if any)

Pull in r364693 from upstream llvm trunk (by Philip Reames):

  [IndVars] Remove a bit of manual constant folding [NFC]

  SCEV is more than capable of folding (add x, trunc(0)) to x.

Pull in r364709 from upstream llvm trunk (by Nikita Popov):

  [LFTR] Fix post-inc pointer IV with truncated exit count (PR41998)

  Fixes https://bugs.llvm.org/show_bug.cgi?id=41998. Usually when we
  have a truncated exit count we'll truncate the IV when comparing
  against the limit, in which case exit count overflow in post-inc form
  doesn't matter. However, for pointer IVs we don't do that, so we have
  to be careful about incrementing the IV in the wide type.

  I'm fixing this by removing the IVCount variable (which was ExitCount
  or ExitCount+1) and replacing it with a UsePostInc flag, and then
  moving the actual limit adjustment to the individual cases (which
  are: pointer IV where we add to the wide type, integer IV where we
  add to the narrow type, and constant integer IV where we add to the
  wide type).

  Differential Revision: https://reviews.llvm.org/D63686

Together, these should fix a hang when building the textproc/htmldoc
port, due to an incorrect loop optimization.

PR: 237515
MFC after: 1 week

4 years agoFactor out the code that does a VOP_SETATTR(size) from vn_truncate().
rmacklem [Mon, 1 Jul 2019 20:41:43 +0000 (20:41 +0000)]
Factor out the code that does a VOP_SETATTR(size) from vn_truncate().

This patch factors the code in vn_truncate() that does the actual
VOP_SETATTR() of size into a separate function called vn_truncate_locked().
This will allow the NFS server and the patch that adds a
copy_file_range(2) syscall to call this function instead of duplicating
the code and carrying over changes, such as the recent r347151.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D20808

4 years agonetmap: fix two panics with emulated adapter
vmaffione [Mon, 1 Jul 2019 20:37:35 +0000 (20:37 +0000)]
netmap: fix two panics with emulated adapter

This patch fixes 2 panics. The first one is due to the current VNET not
being set in the emulated adapter transmission path. The second one
is caused by the M_PKTHDR flag not being set when preallocated mbufs
are recycled in the transmit path.

Submitted by: aleksandr.fedorov@itglobal.com
Reviewed by: vmaffione
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20824

4 years agoadd superio driver
avg [Mon, 1 Jul 2019 17:05:41 +0000 (17:05 +0000)]
add superio driver

The goal of this driver is consolidate information about SuperIO chips
and to provide for peaceful coexistence of drivers that need to access
SuperIO configuration registers.

While SuperIO chips can host various functions most of them are
discoverable and accessible without any knowledge of the SuperIO.
Examples are: keyboard and mouse controllers, UARTs, floppy disk
controllers.  SuperIO-s also provide non-standard functions such as
GPIO, watchdog timers and hardware monitoring.  Such functions do
require drivers with a knowledge of a specific SuperIO.

At this time the driver supports a number of ITE and Nuvoton (fka
Winbond) SuperIO chips.
There is a single driver for all devices.  So, I have not done the usual
split between the hardware driver and the bus functionality.  Although,
superio does act as a bus for devices that represent known non-standard
functions of a SuperIO chip.  The bus provides enumeration of child
devices based on the hardcoded knowledge of such functions.  The
knowledge as extracted from datasheets and other drivers.
As there is a single driver, I have not defined a kobj interface for it.
So, its interface is currently made of simple functions.
I think that we can the flexibility (and complications) when we actually
need it.

I am planning to convert nctgpio and wbwd to superio bus very soon.
Also, I am working on itwd driver (watchdog in ITE SuperIO-s).
Additionally, there is ithwm driver based on the reverted sensors
import, but I am not sure how to integrate it given that we still lack
any sensors interface.

Discussed with: imp, jhb
MFC after: 7 weeks
Differential Revision: https://reviews.freebsd.org/D8175

4 years agonctgpio: change default pin names to those used by the datasheet(s)
avg [Mon, 1 Jul 2019 15:43:48 +0000 (15:43 +0000)]
nctgpio: change default pin names to those used by the datasheet(s)

That is, instead of the current GPIO00 - GPIO15 the names will be GPIO00
- GPIO07, GPIO10 - GPIO17.  The first digit is a GPIO "bank" / group
number and the second one is a pin number within the bank.  Alternative
view is that the pin names are changed from decimal numbering scheme to
octal one (as there are 8 pins per bank).

Discussed with: cem, gonzo
MFC after: 2 weeks

4 years agoAdd support for the Marvell 88E6190 11 ports switch.
loos [Mon, 1 Jul 2019 13:41:37 +0000 (13:41 +0000)]
Add support for the Marvell 88E6190 11 ports switch.

With more ports, some of the registers are shifted a bit to accommodate.

This switch also adds two high speed Serdes/SGMII interfaces (2.5 Gb/s).

Sponsored by: Rubicon Communications, LLC (Netgate)

4 years agoAllow bootstrapping elftoolchain on MacOS and Linux
arichardson [Mon, 1 Jul 2019 11:52:54 +0000 (11:52 +0000)]
Allow bootstrapping elftoolchain on MacOS and Linux

This is required in order to build on non-FreeBSD systems without setting
all the XAR/XSTRINGS/etc. variables

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D16771

4 years agoFix generation of krb5-config with LC_CTYPE=*.UTF-8
arichardson [Mon, 1 Jul 2019 11:47:45 +0000 (11:47 +0000)]
Fix generation of krb5-config with LC_CTYPE=*.UTF-8

When building on MacOS with a UTF-8 locale sed will fail when reading
krb-config.in due to invalid characters. Forcing the "C" locale fixes this.

Reviewed By: emaste, cy
Differential Revision: https://reviews.freebsd.org/D16849

4 years agoupgrade the warning printf-s in bus accessors to KASSERT-s, take 2
avg [Mon, 1 Jul 2019 06:22:41 +0000 (06:22 +0000)]
upgrade the warning printf-s in bus accessors to KASSERT-s, take 2

After this change sys/bus.h includes sys/systm.h when _KERNEL is
defined.
This brings back r349459 but with systm.h hidden from userland.

MFC after: 2 weeks

4 years agoThe RFC 3128 test should be made after the offset mask has been applied.
cy [Sun, 30 Jun 2019 22:32:33 +0000 (22:32 +0000)]
The RFC 3128 test should be made after the offset mask has been applied.

Reported by: christos@NetBSD.org
X-MFC with: r349399

4 years agoRevert r349400. It has uintended effects.
cy [Sun, 30 Jun 2019 22:27:58 +0000 (22:27 +0000)]
Revert r349400. It has uintended effects.

Reported by: christos@NetBSD.org
X-MFC with: r349400.

4 years agoefihttp: mark unused arguments with __unused
tsoome [Sun, 30 Jun 2019 20:21:27 +0000 (20:21 +0000)]
efihttp: mark unused arguments with __unused

we do have __unused, lets use it.

4 years agoefihttp: comparison of integers of different signs
tsoome [Sun, 30 Jun 2019 20:18:31 +0000 (20:18 +0000)]
efihttp: comparison of integers of different signs

message.HeaderCount is UINTN (unsigned int), so should be i.

4 years agoClean efihttp pointer-sign warnings
tsoome [Sun, 30 Jun 2019 20:15:02 +0000 (20:15 +0000)]
Clean efihttp pointer-sign warnings

The Http protocol structure is using unsigned char strings, Use type casts
where needed.

4 years agoreadelf: Add RISC-V DWARF register aliases
mhorne [Sun, 30 Jun 2019 19:47:15 +0000 (19:47 +0000)]
readelf: Add RISC-V DWARF register aliases

This allows DWARF debugging output to use the common register
mneumonics, such as ra, sp, or t0.

DWARF registers 0-31 are mapped to the 32 general purpose registers,
which are then followed by the 32 floating point registers.

Reviewed by: markj
Approved by: markj (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D20779

4 years agoelftoolchain: fix an incorrect e_flags description
mhorne [Sun, 30 Jun 2019 19:43:13 +0000 (19:43 +0000)]
elftoolchain: fix an incorrect e_flags description

r349482 introduced the definitions and descriptions of the RISC-V
specific e_flags values to elftoolchain. However, the description for
the EF_RISCV_RVE flag was incorrectly duplicated from EF_RISCV_RVC. Fix
this by providing the proper description for this flag.

Reported by: jhb
Approved by: markj (mentor)

4 years agoFix CROSS_TOOLCHAIN=amd64-gcc build after r349554
arichardson [Sun, 30 Jun 2019 17:03:14 +0000 (17:03 +0000)]
Fix CROSS_TOOLCHAIN=amd64-gcc build after r349554

Apparently clang can remove the reference to __umoddi3 but GCC keeps it.

Reported by: lwhsu

4 years agoVendor import of Unbound 1.9.2.
des [Sun, 30 Jun 2019 15:01:11 +0000 (15:01 +0000)]
Vendor import of Unbound 1.9.2.

4 years agoVendor import of Unbound 1.9.1.
des [Sun, 30 Jun 2019 14:56:56 +0000 (14:56 +0000)]
Vendor import of Unbound 1.9.1.

4 years agoChanges to the expose_password functionality:
des [Sun, 30 Jun 2019 14:46:15 +0000 (14:46 +0000)]
Changes to the expose_password functionality:

 - Implement use_first_pass, allowing expose_password to be used by other
   service functions than pam_auth() without prompting a second time.

 - Don't prompt for a password during pam_setcred().

PR: 238041
MFC after: 3 weeks

4 years agoFix my name in license header
arichardson [Sun, 30 Jun 2019 14:04:30 +0000 (14:04 +0000)]
Fix my name in license header

Reported by: trasz

4 years agoReduce size of rtld by 22% by pulling in less code from libc
arichardson [Sun, 30 Jun 2019 11:49:58 +0000 (11:49 +0000)]
Reduce size of rtld by 22% by pulling in less code from libc

Currently RTLD is linked against libc_nossp_pic which means that any libc
symbol used in rtld can pull in a lot of depedencies. This was causing
symbol such as __libc_interposing and all the pthread stubs to be included
in RTLD even though they are not required. It turns out most of these
dependencies can easily be avoided by providing overrides inside of rtld.

This change is motivated by CHERI, where we have an experimental ABI that
requires additional relocation processing to allow the use of function
pointers inside of rtld. Instead of adding this self-relocation code to
RTLD I attempted to remove most function pointers from RTLD and discovered
that most of them came from the libc dependencies instead of being actually
used inside rtld.

A nice side-effect of this change is that rtld is now 22% smaller on amd64.

   text    data     bss     dec     hex filename
0x21eb6   0xce0   0xe60  145910   239f6 /home/alr48/ld-elf-x86.before.so.1
0x1a6ed   0x728   0xdd8  113645   1bbed /home/alr48/ld-elf-x86.after.so.1

The number of R_X86_64_RELATIVE relocations that need to be processed on
startup has also gone down from 368 to 187 (almost 50% less).

Reviewed By: kib
Differential Revision: https://reviews.freebsd.org/D20663