]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r319219: add a sanity check before installworld on the running system
emaste [Sun, 16 Jul 2017 19:20:15 +0000 (19:20 +0000)]
MFC r319219: add a sanity check before installworld on the running system

FreeBSD does not guarantee kernel forward compatibility (that is,
running a newer userland on an older kernel).  The documented upgrade
procedure specifies that installkernel should be performed, followed by
a reboot and then installworld.  As a sanity check when installing onto
the running system (DESTDIR is / or unset), attempt to run "sh echo OK"
using rescue from the objdir.  If rescue fails (e.g., because the system
has not been rebooted and the "old" kernel lacks a system call required
by the to-be-installed world), abort the installation.

This was added to avoid ino64 foot-shooting in HEAD, but is generally
useful for any upgrade case adding new syscalls.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r320065: arm: add .arch_extension sec for smc instruction
emaste [Sun, 16 Jul 2017 19:16:02 +0000 (19:16 +0000)]
MFC r320065: arm: add .arch_extension sec for smc instruction

Clang 4.0 accepts the smc instruction with or without specifying
.arch_extension sec, but Clang 5.0 produces an error without it.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r320969:
gjb [Sun, 16 Jul 2017 17:36:23 +0000 (17:36 +0000)]
MFC r320969:
 Fix a missing comment marker.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r320056: arm: set appropriate section flags for .init_pagetable
emaste [Sun, 16 Jul 2017 17:04:56 +0000 (17:04 +0000)]
MFC r320056: arm: set appropriate section flags for .init_pagetable

The arm kernel linker scripts place the .init_pagetable section in .bss,
but .init_pagetable had no section flags set, and so did not match the
expected flags for .bss.

GNU ld silently ignores this case, but lld reports an error:

ld: error: incompatible section flags for .bss
>>> locore.o:(.init_pagetable): 0x0
>>> output section .bss: 0x3

PR: 220055
Sponsored by: The FreeBSD Foundation

6 years agoMFC r320988:
bapt [Sun, 16 Jul 2017 16:51:38 +0000 (16:51 +0000)]
MFC r320988:

Update pci_vendors to 2017.07.13

6 years agoMFC r311204:
markj [Sun, 16 Jul 2017 00:25:00 +0000 (00:25 +0000)]
MFC r311204:
Add some missing atomic_*_ptr #defines for arm.

6 years agoMFC: r320458
rmacklem [Sat, 15 Jul 2017 19:43:02 +0000 (19:43 +0000)]
MFC: r320458
Fix an NFSv3 client case that probably never happens.

If an NFSv3 server were to reply with weak cache consistency attributes,
but not post operation attributes, the client would use garbage attributes
from memory. This was spotted during work on the code for the NFSv4.1 client.
I have never seen evidence that this happens and it wouldn't make sense
for an NFSv3 server to do this, so this patch is basically "theoretical",
but does fix the problem if a server were to do the above.

6 years agoMFC: r320345
rmacklem [Sat, 15 Jul 2017 19:18:37 +0000 (19:18 +0000)]
MFC: r320345
Add support to the NFSv4.1/pNFS client for commits through the DS.

A NFSv4.1/pNFS server using File Layout can specify that Commit operations
are to be done against the DS instead of MDS. Since no extant pNFS
server did this, the code was untested and "#ifdef notyet".
The FreeBSD pNFS server I am developing does specify that Commits be done
through the DS, so the code has been enabled/tested.
This patch should only affect the case of a pNFS server that specfies
Commits through the DS.

Relnotes: yes

6 years agoMFC r320595:
dchagin [Sat, 15 Jul 2017 08:27:23 +0000 (08:27 +0000)]
MFC r320595:

Add support for musl consumers to the Linuxulator.

PR: 213809
Submitted by: Yonas Yanfa (for amd64)
Reported by: Yonas Yanfa
Relnotes: yes

6 years agoMFC r319057:
dchagin [Sat, 15 Jul 2017 08:24:29 +0000 (08:24 +0000)]
MFC r319057:

In r246085 some bits that are MI movied out into headers in compat/linux,
but I missed that when I commited x86_64 Linuxulator. So remove the duplicates.

6 years agoMFC r320804:
kib [Sat, 15 Jul 2017 06:33:39 +0000 (06:33 +0000)]
MFC r320804:
Fix handling of one more possible exception on return to usermode.

6 years agoMFC: r320323
rmacklem [Fri, 14 Jul 2017 21:43:57 +0000 (21:43 +0000)]
MFC: r320323
Add RPC count reporting for the two new RPCs added by r320322.

6 years agoMFC: r320322
rmacklem [Fri, 14 Jul 2017 20:47:41 +0000 (20:47 +0000)]
MFC: r320322
Add two new compound RPCs to the NFSv4.1/pNFS client.

When the NFSv4.1 client is doing pNFS, it needs to get an Open and
a Layout for every file it will be doing I/O on. The current code
does two separate RPCs to get these. This patch adds two new compounds
that do the both the Open and LayoutGet in the same RPC, reducing the
RPC count.
It also factors out the code that sets up and parses the LayoutGet operation
into separate functions, so that the code doesn't get duplicated for
these new RPCs.
This patch is fairly large, but should only affect the NFSv4.1 client
when the "pnfs" option is specified.

6 years agoMFC r320501:
kib [Fri, 14 Jul 2017 07:42:57 +0000 (07:42 +0000)]
MFC r320501:
Correct fences for sys/refcount.h.

6 years agoMFC r320489:
jhibbits [Fri, 14 Jul 2017 01:45:43 +0000 (01:45 +0000)]
MFC r320489:

  Use the more common Book-E idiom for disabling interrupts.

6 years agoMFC r320392:
jhibbits [Fri, 14 Jul 2017 01:22:27 +0000 (01:22 +0000)]
MFC r320392:

  Disable interrupts when updating the TLB

6 years agoDocument SA-17:05.heimdal, EN-17:06.hyperv
gjb [Thu, 13 Jul 2017 16:18:46 +0000 (16:18 +0000)]
Document SA-17:05.heimdal, EN-17:06.hyperv

Sponsored by: The FreeBSD Foundation

6 years agoMFC r320876:
hselasky [Thu, 13 Jul 2017 15:16:45 +0000 (15:16 +0000)]
MFC r320876:
Make sure the mlx4en RX DMA ring gets stamped with software ownership
in order to prevent the flow of QP to error in the firmware once
UPDATE_QP is called.

Sponsored by: Mellanox Technologies

6 years agoMFC r320472,r320508,r320509:
kib [Thu, 13 Jul 2017 09:27:11 +0000 (09:27 +0000)]
MFC r320472,r320508,r320509:
Make stdio deferred cancel-safe.

6 years agoMFC r320755,r320762,r320893:
kib [Thu, 13 Jul 2017 08:29:01 +0000 (08:29 +0000)]
MFC r320755,r320762,r320893:
BIT_FLS(9).

6 years agoAdd deprecation notices for various device drivers removed in 12.0.
jhb [Wed, 12 Jul 2017 20:10:53 +0000 (20:10 +0000)]
Add deprecation notices for various device drivers removed in 12.0.

This is a direct commit to stable/11 since these files have already
been removed in head.

Reviewed by: sbruno, gjb
Differential Revision: https://reviews.freebsd.org/D11542

6 years agoMFC r320916
sbruno [Wed, 12 Jul 2017 17:51:00 +0000 (17:51 +0000)]
MFC r320916

Reset unsupported SFP tuneable back to original entry name.

Reported by: olivier@

6 years agoMFC r320906: MFV r320905: Import upstream fix for CVE-2017-11103.
delphij [Wed, 12 Jul 2017 07:26:07 +0000 (07:26 +0000)]
MFC r320906: MFV r320905: Import upstream fix for CVE-2017-11103.

In _krb5_extract_ticket() the KDC-REP service name must be obtained from
encrypted version stored in 'enc_part' instead of the unencrypted version
stored in 'ticket'.  Use of the unecrypted version provides an
opportunity for successful server impersonation and other attacks.

Submitted by: hrs
Obtained from: Heimdal
Security: FreeBSD-SA-17:05.heimdal
Security: CVE-2017-11103

6 years agoMFC r320843:
kib [Wed, 12 Jul 2017 06:49:32 +0000 (06:49 +0000)]
MFC r320843:
Fix loop termination in vm_map_find_min().

6 years agoMFC: r320577, r320620
marius [Tue, 11 Jul 2017 21:51:43 +0000 (21:51 +0000)]
MFC: r320577, r320620

Retry up to 2 ms to enable bus power as at least with some Intel
SDHCI/eMMC controllers the first attempt after a D3 to D0 transition,
i. e. when the firmware has put the devices into D3 state before,
can fail.

6 years agoMFC r316541, r316544, and r320688 from HEAD to stable/11.
erj [Tue, 11 Jul 2017 21:25:07 +0000 (21:25 +0000)]
MFC r316541, r316544, and r320688 from HEAD to stable/11.

r316541:
Fix a double free in ixgbe_rxeof()

r316544:
Don't overwrite vf->flags variable at the end of ixgbe(4) ixgbe_add_vf()

r320688:
ixgbe(4): Update HEAD (p3) to 3.2.12-k

Includes:

- Support for X550EM devices.
- Support for Bypass adapters.
- Flow Director code moved to separate files
- SR-IOV code moved to separate files
- Netmap code moved to separate files

Sponsored by: Intel Corporation

6 years agoMFC r317542, r317543, r317543
grehan [Tue, 11 Jul 2017 06:39:12 +0000 (06:39 +0000)]
MFC r317542, r317543, r317543

  317542   comment fix
  317543   set rfb default port
  317543   listen on localhost by default for rfb

6 years agoRestore layout of struct vm_map_entry, to restore layout of struct
kib [Tue, 11 Jul 2017 05:46:55 +0000 (05:46 +0000)]
Restore layout of struct vm_map_entry, to restore layout of struct
vm_map which embeds vm_map_entries.

This is a direct commit to stable/11.

Diagnosed by: markj
Sponsored by: The FreeBSD Foundation

6 years agoMFC r320801:
kib [Tue, 11 Jul 2017 05:33:07 +0000 (05:33 +0000)]
MFC r320801:
Simplify language.

6 years agoMFC r320658:
kib [Tue, 11 Jul 2017 05:31:37 +0000 (05:31 +0000)]
MFC r320658:
When reporting undefined symbol, note the version, if specified.

6 years agoMFC r320785:
gjb [Mon, 10 Jul 2017 12:24:56 +0000 (12:24 +0000)]
MFC r320785:
 Connect ena(4) to the build.

Sponsored by: The FreeBSD Foundation

6 years agoMFC 313727, 317483
grehan [Mon, 10 Jul 2017 06:28:50 +0000 (06:28 +0000)]
MFC 313727, 317483
  In addition, replace the missing caph routines with
small helper functions (bhyverun.c) or an open-coded
replacement (uart_emul.c)

  313727   Capsicumize bhyve
  317483   Allow CAP_MMAP_RW on memfd for PCI passthru

6 years agoMFC r320619:
kib [Mon, 10 Jul 2017 05:59:06 +0000 (05:59 +0000)]
MFC r320619:
Resolve confusion between different error code spaces.

6 years agoMFC r319455,r319456:
ngie [Mon, 10 Jul 2017 05:34:37 +0000 (05:34 +0000)]
MFC r319455,r319456:

r319455:

Fix up `TEST_METADATA`

- `TEST_METADATA.foo` should be `TEST_METADATA.run_tests`: this will unbreak
  trying to run the tests on a system without python installed in $PATH.
- The tests require root because they load aesni(4) and/or cryptodev(4) if
  not already loaded.

r319456:

tests/sys/opencrypto/runtests: apply minor polish to test script

- Refactor kld loading/unloading logic:
-- Use a loop instead of an unrolled one.
-- Check for the module being loaded before trying to load it, to reduce
   noise when loading modules that are already loaded.
-- Don't mute stderr from kldload -- it could be potentially useful to
   the tester.
-- In the event that the test script was terminated early, it would leave
   the modules still attached to the system (which is undesirable).
   Always unload the modules at test end with EXIT/SIGINT/SIGTERM so the
   system is returned to its former operating state as best possible.
   Unload the modules in reverse order, in part for consistency and/or
   dependency reasons.

6 years agoMFC r311699
grehan [Mon, 10 Jul 2017 03:11:48 +0000 (03:11 +0000)]
MFC r311699

ps2 mouse fixes, found by plan9/9front.

Reminded by: sevan

6 years agoMFC r320408:
pfg [Sun, 9 Jul 2017 15:13:40 +0000 (15:13 +0000)]
MFC r320408:
ext2fs: Support e2di_uid_high and e2di_gid_high.

The fields exist on all versions of the filesystem and using them is a mount
option on linux. For FreeBSD, the corresponding i_uid and i_gid are always
long enough so use them by default.

Reviewed by: Fedor Uporov

6 years agoMFC r320079:
pfg [Sun, 9 Jul 2017 15:03:41 +0000 (15:03 +0000)]
MFC r320079:
ext2fs: Enable RO huge_file feature support.

We have support for reading ext4 "huge" files but we can't write
(anything) on ext4. and some filesystem. Formally enable the feature
so that we can mount such filesystems.

Submitted by: Fedor Uporov

6 years agoMFC 320675: Add deprecation notices for gdb and kgdb.
jhb [Sun, 9 Jul 2017 04:13:33 +0000 (04:13 +0000)]
MFC 320675: Add deprecation notices for gdb and kgdb.

Even though gdb and kgdb may not be removed for 12.0 on some architectures,
the notice is unconditional as these tools will likely be removed at some
point in the future when adequate replacements are available (gdb in ports
or lldb in base).

6 years agoMFC r320570:
kib [Sun, 9 Jul 2017 03:54:10 +0000 (03:54 +0000)]
MFC r320570:
Correct signatures of several pthreads stubs.

6 years agoMFC r320069: Add ZFS to Linux statfs ftype
emaste [Sun, 9 Jul 2017 00:24:52 +0000 (00:24 +0000)]
MFC r320069: Add ZFS to Linux statfs ftype

PR: 220086
Sponsored by: The FreeBSD Foundation

6 years agoMFC r320665:
delphij [Sat, 8 Jul 2017 04:30:11 +0000 (04:30 +0000)]
MFC r320665:

In open_binary_fd: when using buffer size for strl* and snprintf,
always use >= instead of > to avoid truncation.

releng/11.1 candidate.

6 years agoDirect commit to fix a mismerge in r320797.
markj [Sat, 8 Jul 2017 02:02:49 +0000 (02:02 +0000)]
Direct commit to fix a mismerge in r320797.

6 years agoMFC r311346, r311352, r313756:
markj [Sat, 8 Jul 2017 01:56:48 +0000 (01:56 +0000)]
MFC r311346, r311352, r313756:
Add an allocator for KVA for execve arguments.

6 years agoMFC: r320208
rmacklem [Fri, 7 Jul 2017 21:26:27 +0000 (21:26 +0000)]
MFC: r320208
Ensure that the credentials field of the NFSv4 client open structure is
initialized.

bdrewery@ has reported panics "newnfs_copycred: negative nfsc_ngroups".
The only way I can see that this occurs is that the credentials field of
the open structure gets used before being filled in.
I am not sure quite how this happens, but for the file create case, the
code is serialized via the vnode lock on the directory. If, somehow, a
link to the same file gets created just after file creation, this might
occur.

This patch ensures that the credentials field is initialized to a reasonable
set of credentials before the structure is linked into any list, so I
this should ensure it is initialized before use.
I am committing the patch now, since bdrewery@ notes that the panics
are intermittent and it may be months before he knows if the patch fixes
his problem.

6 years agoMFC r312208, r312994:
markj [Fri, 7 Jul 2017 16:59:14 +0000 (16:59 +0000)]
MFC r312208, r312994:
Optimize vm_object_madvise().

6 years agoMFC r310888:
eugen [Fri, 7 Jul 2017 13:44:18 +0000 (13:44 +0000)]
MFC r310888:

  Retry to open an F_PIPE process when it dies unexpectedly.

PR:           215335
Reviewed by:  ae
Approved by:  az (mentor)

6 years agoMFC 320490
sephe [Fri, 7 Jul 2017 08:49:37 +0000 (08:49 +0000)]
MFC 320490

    hyperv/input: Remove unnecessary inclusion.

    The unbreaks gcc compilation.

    Submitted by:   Ryan Libby
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11415

6 years agoMFC r318894: Enable Amazon's "Elastic Network Adapter" in EC2 AMIs.
cperciva [Thu, 6 Jul 2017 22:34:54 +0000 (22:34 +0000)]
MFC r318894: Enable Amazon's "Elastic Network Adapter" in EC2 AMIs.

6 years agoMFC r320748:
gjb [Thu, 6 Jul 2017 18:46:33 +0000 (18:46 +0000)]
MFC r320748:
 Allow passing NOPKG= to make(1) to enable the pkg-stage target
 from getting executed when NOPKG is defined but empty.

Approved by: re (kib, insta-MFC)
Sponsored by: The FreeBSD Foundation

6 years agoMFC 319803
gnn [Thu, 6 Jul 2017 18:33:33 +0000 (18:33 +0000)]
MFC 319803

Manual page for the DTrace lockstat provider

Reviewed by: markj

6 years agoFix up r320731:
cperciva [Thu, 6 Jul 2017 18:08:38 +0000 (18:08 +0000)]
Fix up r320731:
* Record mergeinfo for merges of r317518, r318647, r319197, r319198,
r319199, r319201, r320625, r320626, r320628, r320629, r320630, r320631,
r320632.
* Merge r319200, which (commit message notwithstanding) seems to have
gotten lost from the r320731 merge.

6 years agoMFC r320165-r320167
asomers [Thu, 6 Jul 2017 17:34:53 +0000 (17:34 +0000)]
MFC r320165-r320167

r320165:
devd(8): Remove pidfile on shutdown

Sponsored by: Spectra Logic Corp

r320166:
Require devd to be running for its ATF tests to run

The ATF tests communicate with the system's running devd

PR: 220169
Reported by: gjb
Sponsored by: Spectra Logic Corp

r320167:
zfsd(8): Remove pidfile on shutdown

Sponsored by: Spectra Logic Corp

6 years agoMFC r320690:
markj [Thu, 6 Jul 2017 17:20:35 +0000 (17:20 +0000)]
MFC r320690:
Defer ACPI taskqueue creation to SI_SUB_KICK_SCHEDULER.

PR: 220277

6 years agoMFC r317518, r318647, r319197, r319198, r319199, r319200, r320625, r320626,
zbb [Thu, 6 Jul 2017 11:45:13 +0000 (11:45 +0000)]
MFC r317518, r318647, r319197, r319198, r319199, r319200, r320625, r320626,
r320628, r319201, r320629, r320630, r320631, r320632.

r317518:
Import Amazon Elastic Network Adapter (ENA) HAL to sys/contrib/

Import from vendor-sys/ena-com/1.1.4.1
SVN rev.: 317516
Version: 1.1.4.1

r318647:
Add support for Amazon Elastic Network Adapter (ENA) NIC

ENA is a networking interface designed to make good use of modern CPU
features and system architectures.

The ENA device exposes a lightweight management interface with a
minimal set of memory mapped registers and extendable command set
through an Admin Queue.

The driver supports a range of ENA devices, is link-speed independent
(i.e., the same driver is used for 10GbE, 25GbE, 40GbE, etc.), and has
a negotiated and extendable feature set.

Some ENA devices support SR-IOV. This driver is used for both the
SR-IOV Physical Function (PF) and Virtual Function (VF) devices.

ENA devices enable high speed and low overhead network traffic
processing by providing multiple Tx/Rx queue pairs (the maximum number
is advertised by the device via the Admin Queue), a dedicated MSI-X
interrupt vector per Tx/Rx queue pair, and CPU cacheline optimized
data placement.

The ENA driver supports industry standard TCP/IP offload features such
as checksum offload and TCP transmit segmentation offload (TSO).
Receive-side scaling (RSS) is supported for multi-core scaling.

The ENA driver and its corresponding devices implement health
monitoring mechanisms such as watchdog, enabling the device and driver
to recover in a manner transparent to the application, as well as
debug logs.

Some of the ENA devices support a working mode called Low-latency
Queue (LLQ), which saves several more microseconds. This feature will
be implemented for driver in future releases.

r319197:
Add mbuf defragmentation to the ENA driver

When mbuf chain is too long and device cannot handle that number
of segments in DMA transaction, mbuf chain will be defragmented.
Initially, driver was dropping all mbuf chains that were exceeding
supported number of segments.

r319198:
Add locks before each ena_up and ena_down

Lock only ena_up and ena_down calls in ioctl handler, instead of whole
ioctl. Locking ioctl with sx lock that is sleepable, is not allowed in
some cases, e.g. when multicast options are being changed.
Additional locking was added in deatch function to prevent race condition
with ioctl function.

r319199:
Add error handling to the ENA driver if init of the reset task fails

Also, to simplify cleaning routine, reset task is initialized before
allocating statistics and other resources.

r319200:
Move ENA's hw stats updating routine to separate task

Initially, stats were being updated each time OS was requesting for
the first statistic.
To read statistics from hw, condvar was used. cv_timedwait cannot be
called when unsleepable lock is held, and this happens when FreeBSD
is requesting statistic.
Seperate task is reading statistics from NIC each 1 second.

r319201:
Introduce additional locks when releasing TX resources and buffers in ENA

There could be race condition with TX cleaning routine when cleaning mbufs,
when it was called directly from main sending thread (ena_mq_start).

r320625:
Add missing lock upon initialization of the interface

Lack of this lock was causing crash if down was called in
parallel with the initialization routine.

r320626:
Acquire locks before calling drbr_flush()

It is required to hold lock that is associated with buffer ring before
flushing drbr.

r320628:
Unmask all IO irqs after driver state is set as running

If driver left MSI-x handlling routine because interface was put down,
it is not unmasking IRQs, so any requesting interrupt will be awaiting
for unmasking.

On ena_up() routine all interrupts are being unmasked and any awaiting
interrupt will be handled right away.

If handler was executed before driver state was set as running, handling
routine is being ended immediately, leaving IO irqs for given queue
masked.

r320629:
Call drbr_advance() before leaving TX routine

If drbr_advance() is not called before doing cleanup and packet is
already enqueued for sending (tx_info is holding pointer to mbuf), then
mbuf is cleaned both in drbr_flush() and in cleanup routine, when all
mbufs hold by tx_buffer_info are being released.

This causes panic, because mbuf is released twice.

r320630:
Remove RX mtx from ENA driver

RX lock is no longer required. There can only be one RX cleanup task
running at a time, RX cleanup cannot be executed if interface is not
yet initialized and ena_down() will not free any RX resources if any io
interrupt is being handled - RX cleanup task is only called from an
interrupt handler.

r320631:
Fix creation of dma tags and TSO settings

TSO settings were not reflecting real HW capabilities.

DMA tags were created with wrong window - high address was the same as
low, so excluding window was not working.

Capabilities of TX dma transaction were not set properly - TSO max size
had been increased and size of one segment had been adjusted.

r320632:
Replace mbuf defragmentation with collapse

Collapse should be more effective than defragmentation.
Added missing declaration of ena_check_and_collapse_mbuf().

Submitted by: Michal Krawczyk <mk@semihalf.com>
Jakub Palider <jpa@semihalf.com>
Jan Medala <jan@semihalf.com>
Obtained from: Semihalf, Amazon.com Inc.
Sponsored by: Amazon.com Inc.

6 years agoMFC r317161:
ngie [Thu, 6 Jul 2017 05:59:22 +0000 (05:59 +0000)]
MFC r317161:

which(1): sort #includes

No functional change [intended].

6 years agoRegenerate src.conf(5)
ngie [Thu, 6 Jul 2017 05:53:38 +0000 (05:53 +0000)]
Regenerate src.conf(5)

6 years agoMFC r317179:
ngie [Thu, 6 Jul 2017 05:51:23 +0000 (05:51 +0000)]
MFC r317179:

Clean up WITH*_PROFILE

- Clarify that profiled libraries are usable with gprof(8).
- Add WITH_PROFILE to complement WITHOUT_PROFILE and placate makeman.

6 years agoMFC r318651:
ngie [Thu, 6 Jul 2017 05:30:11 +0000 (05:30 +0000)]
MFC r318651:

Remove glimpse make target added in r181432

The textproc/glimpse port expired over 3 years ago because there weren't any
more publicly available distfiles, and because it lacked a maintainer. Remove
the target as it's no longer executable on FreeBSD.

6 years agoMFC r319626:
ngie [Thu, 6 Jul 2017 05:28:32 +0000 (05:28 +0000)]
MFC r319626:

Add basic tests for echo(1)

Verify that echo(1) does not...
- ... print the trailing newline character with option '-n'.
- ... print the trailing newline character when '\c' is appended to
      the end of the string.

6 years agoMFC r319637:
ngie [Thu, 6 Jul 2017 05:26:24 +0000 (05:26 +0000)]
MFC r319637:

Add testcases for `cat -b`

6 years agoMFC r319634:
ngie [Thu, 6 Jul 2017 05:22:02 +0000 (05:22 +0000)]
MFC r319634:

Add additional testcases for cat(1)

Verify the following additional cases:
- -s (in isolation, in addition to the -se testcase obtained via the
      NetBSD test).
- -vt

6 years agoMFC r320599:
gjb [Thu, 6 Jul 2017 00:43:43 +0000 (00:43 +0000)]
MFC r320599:
 Fix Vagrant image upload after recent API changes.

 - Update ATLAS_UPLOAD_URL to avoid various regular expressions
   from failing to match due to redirections.
 - Use ATLAS_UPLOAD_URL throughout the script.
 - Adjust several regular expression patterns.

Sponsored by: The FreeBSD Foundation

6 years agoThis update is primarily bug fixes in C++ symbol demangling, including:
emaste [Wed, 5 Jul 2017 16:39:29 +0000 (16:39 +0000)]
This update is primarily bug fixes in C++ symbol demangling, including:

- rvalue reference
- builtin type auto and decltype(auto)
- revamped support for function return types
- formatting fixes
- omit void when its the only param
- ref-qualifiers and others in function types
- type qualifiers in pointer-to-member function types
- incorrect handling regarding CV-qualifiers in function types
- ref-qualifier found in nested-name
- properly handle <name> ::= <substitute><template-args>
- make sure that nested function name is not a substitute candidate
- correctly handle expression in template args
- skip unknown substitution abbreviations

Also r320663 libelftc: bump version, tracking import in r320343

6 years agoMFC r320451:
markj [Wed, 5 Jul 2017 16:21:26 +0000 (16:21 +0000)]
MFC r320451:
Complete support for the IO_APPEND flag in fuse.

6 years agoMFC r320163:
asomers [Wed, 5 Jul 2017 15:59:52 +0000 (15:59 +0000)]
MFC r320163:

Fix usr.sbin/makefs/makefs_ffs_tests when /etc/fstab does not exist

dumpfs prints a harmless warning message (via ufs_disk_fillout(3) and
getfsfile(3)), when /etc/fstab does not exist.  We can ignore it.

PR: 220165
Reported by: gjb
Sponsored by: Spectra Logic Corp

6 years agoMFC r319714, r319854
asomers [Wed, 5 Jul 2017 15:58:23 +0000 (15:58 +0000)]
MFC r319714, r319854

r319714:
Add tests for ln(1)

* Verify that when creating a hard link to a symbolic link, '-L' option
  creates a hard link to the target of the symbolic link
* Verify that when creating a hard link to a symbolic link, '-P' option
  creates a hard link to the symbolic link itself
* Verify that if the target file already exists, '-f' option unlinks it so
  that link may occur
* Verify that if the target file or directory is a symbolic link, '-shf'
  option prevents following the link
* Verify that if the target file or directory is a symbolic link, '-snf'
  option prevents following the link
* Verify that '-s' option creates a symbolic link
* Verify that '-w' option produces a warning if the source of a symbolic
  link does not currently exist

Submitted by: shivansh
Reviewed by: asomers, ngie
Sponsored by: Google, Inc (GSoC 2017)
Differential Revision: https://reviews.freebsd.org/D11084

r319854:
bin/ln: Set umask appropriately before creating files for testing

These changes were missed in D11084

Submitted by: shivansh
Reviewed by: asomers
X-MFC-With: 319714
Sponsored by: Google, Inc (GSoC 2017)
Differential Revision: https://reviews.freebsd.org/D11158

6 years agoMFC r319900:
asomers [Wed, 5 Jul 2017 15:50:41 +0000 (15:50 +0000)]
MFC r319900:

sbin/ipfw: strcpy, strncpy => strlcpy

Reported by: Coverity
CID: 13561621356166
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10662

6 years agoMFC r319337:
asomers [Wed, 5 Jul 2017 15:34:06 +0000 (15:34 +0000)]
MFC r319337:

Fix integer overflow in "camcontrol format"

Reported by: Coverity
CID: 1011426
Sponsored by: Spectra Logic Corp

6 years agoMFC r318790, r319336
asomers [Wed, 5 Jul 2017 15:31:42 +0000 (15:31 +0000)]
MFC r318790, r319336

r318790:
Fix a buffer overflow in bootparamd(8)

If /etc/bootparams contains a line with an excessively long pathname, and a
client asks for that path, then bootparamd will overflow a buffer and crash
while parsing that line.  This is not remotely exploitable since it requires
a malformed /etc/bootparams file.

Reported by: Coverity
CID: 1305954
Sponsored by: Spectra Logic Corp

r319336:
Fix uninitialized variable in bootparamd.c

Restore line that was accidentally deleted in change 318790

Reported by: Coverity
CID: 1375855
X-MFC-With: 318790
Sponsored by: Spectra Logic Corp

6 years agoMFC r320318:
kib [Wed, 5 Jul 2017 06:32:53 +0000 (06:32 +0000)]
MFC r320318:
Use address space guard to implement inter-segment gap.

6 years agoAdd MAP_GUARD and use it for stack grow area protection.
kib [Wed, 5 Jul 2017 06:18:00 +0000 (06:18 +0000)]
Add MAP_GUARD and use it for stack grow area protection.
Bump __FreeBSD_version.

MFC r320317:
Implement address space guards.

MFC r320338:
Remove stale part of the comment.

MFC r320339:
Correctly handle small MAP_STACK requests.

MFC r320344:
For now, allow mprotect(2) over the guards to succeed regardless of
the requested protection.

MFC r320430:
Treat the addr argument for mmap(2) request without MAP_FIXED flag as
a hint.

MFC r320560 (by alc):
Modify vm_map_growstack() to protect itself from the possibility of the
gap entry in the vm map being smaller than the sysctl-derived stack guard
size.

6 years agoMFC r320644:
allanjude [Tue, 4 Jul 2017 15:53:23 +0000 (15:53 +0000)]
MFC r320644:
Add deprecation notices for all rcmd tools

6 years agoMFC r320403, r320497
andrew [Tue, 4 Jul 2017 10:54:08 +0000 (10:54 +0000)]
MFC r320403, r320497

r320403:
Some of the atomic_clear_* functions were incorrectly defined to be an
atomic add. Correct these, fixing a NULL-pointer dereference in netgraph.

PR: 220273
Sponsored by: DARPA, AFRL

r320497:
Remove a blank line accidentally added in r320403.

6 years agoMFC r320422:
kib [Tue, 4 Jul 2017 04:53:21 +0000 (04:53 +0000)]
MFC r320422:
Do not ignore an error from vm_mmap_object().

6 years agoMFC r319699
alc [Mon, 3 Jul 2017 22:20:42 +0000 (22:20 +0000)]
MFC r319699
  When allocating swap blocks, if the available number of free blocks in a
  subtree is already zero, then setting the "largest contiguous free block"
  hint for that subtree to anything other than zero makes no sense.  (To be
  clear, assigning a value to the hint that is too large is not a correctness
  problem, only a pessimization.)

MFC r319755
  blist_fill()'s return type is too narrow.  blist_fill() accepts a 64-bit
  quantity as the size of the range to fill, but returns a 32-bit quantity
  as the number of blocks that were allocated to fill that range.  This
  revision corrects that mismatch.

MFC r319793
  Remove an unnecessary field from struct blist.  (The comment describing
  what this field represented was also inaccurate.)

  In r178792, blist_create() grew a malloc flag, allowing M_NOWAIT to be
  specified.  However, blist_create() was not modified to handle the
  possibility that a malloc() call failed.  Address this omission.

  Increase the width of the local variable "radix" to 64 bits.  This
  matches the width of the corresponding field in struct blist.

6 years agoMFC: r319882, r320062, r320070, r320126
rmacklem [Mon, 3 Jul 2017 19:46:12 +0000 (19:46 +0000)]
MFC: r319882, r320062, r320070, r320126
Make MAXBCACHEBUF a tunable called vfs.maxbcachebuf.

By making MAXBCACHEBUF a tunable, it can be increased to allow for
larger read/write data sizes for the NFS client.
The tunable is limited to MAXPHYS, which is currently 128K.
Making MAXPHYS a tunable or increasing its value is being discussed,
since it would be nice to support a read/write data size of 1Mbyte
for the NFS client when mounting the AmazonEFS file service.

Also, define NFS_MAXXDR as the upper bound on XDR overhead in an NFS RPC.

6 years agoMFC r303052:
markj [Mon, 3 Jul 2017 18:42:26 +0000 (18:42 +0000)]
MFC r303052:
Make vm_pageout_wakeup_thresh a u_int rather than an int.

6 years agoMFC r309017 (partially):
markj [Mon, 3 Jul 2017 16:40:05 +0000 (16:40 +0000)]
MFC r309017 (partially):
Omit v_cache_count when computing the number of free pages, since its
value is always 0.

6 years agoMFC r320421:
ken [Mon, 3 Jul 2017 15:34:21 +0000 (15:34 +0000)]
MFC r320421:

  ------------------------------------------------------------------------
  r320421 | ken | 2017-06-27 13:26:02 -0600 (Tue, 27 Jun 2017) | 37 lines

  Fix a panic in camperiphfree().

  If a peripheral driver (e.g. da, sa, cd) is added or removed from the
  peripheral driver list while an unrelated peripheral driver instance (e.g.
  da0, sa5, cd2) is going away and is inside camperiphfree(), we could
  dereference an invalid pointer.

  When peripheral drivers are added or removed (see periphdriver_register()
  and periphdriver_unregister()), the peripheral driver array is resized
  and existing entries are moved.

  Although we hold the topology lock while we traverse the peripheral driver
  list, we retain a pointer to the location of the peripheral driver pointer
  and then drop the topology lock.  So we are still vulnerable to the list
  getting moved around while the lock is dropped.

  To solve the problem, cache a copy of the peripheral driver pointer.  If
  its storage location in the list changes while we have the lock dropped, it
  won't have any effect.

  This doesn't solve the issue that peripheral drivers ("da", "cd", as opposed
  to individual instances like "da0", "cd0") are not generally part of a
  reference counting scheme to guard against deregistering them while there
  are instances active.  The caller (generally the person unloading a module)
  has to be aware of active drivers and not unload something that is in use.

  sys/cam/cam_periph.c:
   In camperiphfree(), cache a pointer to the peripheral driver
   instance to avoid holding a pointer to an invalid memory location
   in the event that the peripheral driver list changes while we have
   the topology lock dropped.

  PR: kern/219701
  Submitted by: avg
  Sponsored by: Spectra Logic

  ------------------------------------------------------------------------
PR: kern/219701
Sponsored by: Spectra Logic

6 years agoMFC r320420:
ken [Mon, 3 Jul 2017 15:10:16 +0000 (15:10 +0000)]
MFC r320420:

  ------------------------------------------------------------------------
  r320420 | ken | 2017-06-27 11:55:25 -0600 (Tue, 27 Jun 2017) | 25 lines

  In scsi_zbc_in(), fill in the length in the ZBC IN CDB.

  Without the allocation length set, the target will either reject
  the command or complete it without transferring any data.

  This fixes the REPORT ZONES command for SCSI ZBC protocol devices,
  as well as ATA ZAC protocol devices that are behind a SCSI to ATA
  translation layer.  (LSI/Broadcom's 12Gb SAS adapters translate ZBC
  commands to ZAC commands.)  Those are Host Aware and Host Managed SMR
  drives.

  This will fix REPORT ZONE commands sent to the da(4) driver via the
  GEOM bio interface and zonectl, and REPORT ZONE commands sent from
  camcontrol(8).

  Note that in the case of camcontrol(8), we currently only send
  SCSI ZBC commands to native SCSI protocol devices, not ATA devices
  behind a SAT layer.

  sys/cam/scsi/scsi_da.c:
   Fill in the length field in scsi_zbc_in().

  Sponsored by: Spectra Logic
  ------------------------------------------------------------------------

6 years agoMFC r320488:
gjb [Mon, 3 Jul 2017 13:02:21 +0000 (13:02 +0000)]
MFC r320488:
 Correct the branch naming convention in param.h.
 While here, consistently use upper-case 'X' to represent the
 version number.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r320479:
ae [Mon, 3 Jul 2017 08:53:22 +0000 (08:53 +0000)]
MFC r320479:
  Fix IPv6 extension header parsing. The length field doesn't include the
  first 8 octets.

  Obtained from: Yandex LLC

6 years agoMFC r320093: Check return value of seteuid() and bail out if we fail.
delphij [Mon, 3 Jul 2017 05:22:10 +0000 (05:22 +0000)]
MFC r320093: Check return value of seteuid() and bail out if we fail.

6 years agoMFC r320494: Fix double free by reverting r300385 and r300624 which was
delphij [Mon, 3 Jul 2017 02:11:14 +0000 (02:11 +0000)]
MFC r320494: Fix double free by reverting r300385 and r300624 which was
false positive reported by cppcheck.

releng/11.1 candidate.

6 years agoMFC r319969-r319970
araujo [Sun, 2 Jul 2017 04:22:37 +0000 (04:22 +0000)]
MFC r319969-r319970

r319969:
Use nitems() from sys/param.h.

r319970:
Use nitems() from sys/param.h.

6 years agoMFC r319678:
araujo [Sun, 2 Jul 2017 04:19:03 +0000 (04:19 +0000)]
MFC r319678:

Allow sysctl kern.vm_guest to return bhyve when running under bhyve.

Submitted by: Sean Fagan <sef@ixsystems.com>
Reviewed by: grehan
MFH: 4 weeks.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D11090

6 years agoMFC r319487-r319488, r319682, r319968, r319995
araujo [Sun, 2 Jul 2017 04:14:34 +0000 (04:14 +0000)]
MFC r319487-r319488, r319682, r319968, r319995

r319487:
Add VNC Authentication support based on RFC6143 section 7.2.2.

Submitted by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Reworked by: myself
Reviewed by: grehan, rgrimes and jilles
Relnotes: Yes.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D10818

r319488:
Bump manpage date.

r319682:
Make the VNC authentication build with LibreSSL on HardenedBSD and TrueOS.

PR: 219790
Submitted by: Shirkdog <mshirk@daemon-security.com>
Reviewed by: grehan and rgrimes
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D11071

r319968:
Initialize variables and use byteorder(9) instead of aliasing char array
buf via uint32_t pointer.

CID: 1375949
Reported by: Coverity, cem
Reviewed by: cem
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D11153

r319995:
Check if pthread_create(3) successfully created the thread prior to call
pthread_join(3). The variable tid is not yet initialized in case
the authentication fails at early stage, that would lead pthread_join be
called with an uninitialized variable.

CID: 1375950
Reported by: Coverity, cem
Reviewed by: cem
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D11150

6 years agoMFC r320390:
araujo [Sun, 2 Jul 2017 04:09:05 +0000 (04:09 +0000)]
MFC r320390:

With r318394 seems it breaks gpart(8) in some embedded systems such like PCEngines,
RPI1-B, Alix and APU2 boards as well as NanoBSD with the following message:

vnode_pager_generic_getpages_done: I/O read error 5

Seems the breakage was because it was missed to include acr in glabel update.

Reported by: Peter Blok <pblok@bsd4all.org>,
madpilot, imp and trasz.
Reviewed by: trasz
Tested by: Peter Blok and madpilot.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D11365

6 years agoMFC r320332:
kib [Sun, 2 Jul 2017 03:47:56 +0000 (03:47 +0000)]
MFC r320332:
Style.

6 years agoMFC r320049
alc [Sat, 1 Jul 2017 21:54:11 +0000 (21:54 +0000)]
MFC r320049
  Pages that are passed to swap_pager_putpages() should already be fully
  dirty.  Assert that they are fully dirty rather than redundantly calling
  vm_page_dirty() on them.

6 years agoMFC r320181
alc [Sat, 1 Jul 2017 19:47:13 +0000 (19:47 +0000)]
MFC r320181
  Eliminate an unused macro.

6 years agoMFC r319605
alc [Sat, 1 Jul 2017 19:06:14 +0000 (19:06 +0000)]
MFC r319605
  The variable "breakout" is used like a Boolean, so actually define it as
  one.

6 years agoMFC r320316:
kib [Sat, 1 Jul 2017 03:33:26 +0000 (03:33 +0000)]
MFC r320316:
Do not try to unmark MAP_ENTRY_IN_TRANSITION marked by other thread.

6 years agoMFC r320308:
kib [Sat, 1 Jul 2017 03:30:47 +0000 (03:30 +0000)]
MFC r320308:
Translate between abridged and full x87 tags for compat32 ptrace(PT_GETFPREGS).

6 years ago- Update stable/11 to 11.1-PRERELEASE for the duration of the
gjb [Thu, 29 Jun 2017 23:57:35 +0000 (23:57 +0000)]
- Update stable/11 to 11.1-PRERELEASE for the duration of the
  11.1-RELEASE cycle.
- Reset __FreeBSD_version for 11.1-STABLE.

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

6 years agoMFC r320372:
markj [Thu, 29 Jun 2017 17:34:48 +0000 (17:34 +0000)]
MFC r320372:
Fix a memory leak in ses_get_elm_devnames().

Approved by: re (gjb)

6 years agoMFC r320353: linux_getdents, linux_readdir: fix mismatch between malloc and free...
avg [Thu, 29 Jun 2017 12:49:03 +0000 (12:49 +0000)]
MFC r320353: linux_getdents, linux_readdir: fix mismatch between malloc and free tags

Approved by: re (gjb)

6 years agoMFC r320263:
tuexen [Wed, 28 Jun 2017 21:08:21 +0000 (21:08 +0000)]
MFC r320263:
Use a longer buffer for messages in ERROR chunks.

MFC r320264:
Check the length of a COOKIE chunk before accessing fields in it.

MFC r320300:
Handle sctp_get_next_param() in a consistent way.

Approved by: re (marius@)

6 years agoMFC r315518
alc [Wed, 28 Jun 2017 05:28:15 +0000 (05:28 +0000)]
MFC r315518
  Avoid unnecessary calls to vm_map_protect() in elf_load_section().

  Typically, when elf_load_section() unconditionally passed VM_PROT_ALL to
  elf_map_insert(), it was needlessly enabling execute access on the
  mapping, and it would later have to call vm_map_protect() to correct the
  mapping's access rights.  Now, instead, elf_load_section() always passes
  its parameter "prot" to elf_map_insert().  So, elf_load_section() must
  only call vm_map_protect() if it needs to remove the write access that
  was temporarily granted to perform a copyout().

Approved by: re (kib)

6 years agoMFC r320202:
kib [Wed, 28 Jun 2017 05:20:28 +0000 (05:20 +0000)]
MFC r320202:
Call pmap_copy() only for map entries which have the backing object
instantiated.

Approved by: re (delphij)