]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r342880,r343981,r344902: sh: Fix $((-9223372036854775808))
Jilles Tjoelker [Wed, 13 Mar 2019 21:53:10 +0000 (21:53 +0000)]
MFC r342880,r343981,r344902: sh: Fix $((-9223372036854775808))

Since $((9223372036854775808)) overflows, $((-9223372036854775808)) was not
parsed correctly (with x=-9223372036854775808, $((x)) already worked, since
that parses the value with the minus sign in one step). Values further from
zero are still clamped to 9223372036854775807.

Also, allow the full 64 bits in octal and hexadecimal.

5 years agoMFC r344844: Flush stdout after each iteration.
Alexander Motin [Wed, 13 Mar 2019 20:28:48 +0000 (20:28 +0000)]
MFC r344844: Flush stdout after each iteration.

Without this, if output is redirected from the console, it is buffered for
too long, making tool quite unusable.

5 years agoMFC r344636: Refactor command ordering/blocking mechanism in CTL.
Alexander Motin [Wed, 13 Mar 2019 20:27:48 +0000 (20:27 +0000)]
MFC r344636: Refactor command ordering/blocking mechanism in CTL.

Replace long per-LUN queue of blocked commands, scanned on each command
completion and sometimes even twice, causing up to O(n^^2) processing cost,
by much shorter per-command blocked queues, scanned only when respective
command completes, and check only commands before the previous blocker,
reducing cost to O(n).

While there, unblock aborted commands to make them "complete" ASAP to be
removed from the OOA queue and so not waste time ordering other commands
against them.  Aborted commands that were not sent to execution yet should
have no visible side effects, so this is safe and easy optimization now,
comparing to commands already in processing, which are a still pain.

Together those two optimizations should fix quite pathological case, when
due to backend slowness CTL accumulated many thousands of blocked requests,
partially aborted by initiator and so supposedly not even existing, but
still wasting CTL CPU time.

5 years agoMFC r344586: Scrap some debug printf's, unused for years.
Alexander Motin [Wed, 13 Mar 2019 20:26:27 +0000 (20:26 +0000)]
MFC r344586: Scrap some debug printf's, unused for years.

5 years agopf tests: Disable noalias test
Kristof Provost [Tue, 12 Mar 2019 19:03:47 +0000 (19:03 +0000)]
pf tests: Disable noalias test

Direct commit to stable/12 to disable the noalias test. The noalias feature has
not been merged to stable/12 as it is a (small) behaviour change. This means
this test will fail. Disable it.

5 years agoMFC r344818: freebsd-update.8: update example to contemporary versions
Ed Maste [Tue, 12 Mar 2019 17:03:58 +0000 (17:03 +0000)]
MFC r344818: freebsd-update.8: update example to contemporary versions

PR: 235761
Reported by: linimon

5 years agoMFC r343964, r344121, r344128, r344593, r344594:
Konstantin Belousov [Tue, 12 Mar 2019 16:33:44 +0000 (16:33 +0000)]
MFC r343964, r344121, r344128, r344593, r344594:
ASLR.

5 years agoMFC r342952:
Enji Cooper [Mon, 11 Mar 2019 18:17:26 +0000 (18:17 +0000)]
MFC r342952:

Add Linux compatibility support for `SC_NPROCESSORS_{CONF,ONLN}` as `_SC_NPROCESSORS_{CONF,ONLN}`

The goal of this change is to make it easier to use getconf to query
the number of available processors.

Sadly it's unclear per POSIX, which form (with a preceding _ or
lacking it) is correct. I will bring this up on the Austin Group list so
this point is clarified for implementors that might rely on this getconf
variable in future POSIX spec versions.

This is something I noticed when trying to import GoogleTest to FreeBSD
as one of the CI scripts uses this variable on Linux.

Approved by:    emaste (mentor; implicit: https://reviews.freebsd.org/D19527)
Differential Revision: https://reviews.freebsd.org/D19528

5 years agoMFC r344743: Reduce CTL threads priority to about PUSER.
Alexander Motin [Mon, 11 Mar 2019 13:55:47 +0000 (13:55 +0000)]
MFC r344743: Reduce CTL threads priority to about PUSER.

Since in most configurations CTL serves as network service, we found
that this change improves local system interactivity under heavy load.
Priority of main threads is set slightly higher then worker taskqueues
to make them quickly sort incoming requests not creating bottlenecks,
while plenty of worker taskqueues should be less sensitive to latency.

5 years agoMFC r344709:
Guangyuan Yang [Mon, 11 Mar 2019 07:18:40 +0000 (07:18 +0000)]
MFC r344709:

Fix typos and caps for ipfw(8) man page.

PR: 236030
Submitted by: olgeni

5 years agoMFC r343882
Sean Eric Fagan [Mon, 11 Mar 2019 03:01:58 +0000 (03:01 +0000)]
MFC r343882

r343881 had an uninitialized error.  This fixes that.

PR:             233849

5 years agoMFC r343881
Sean Eric Fagan [Mon, 11 Mar 2019 03:00:33 +0000 (03:00 +0000)]
MFC r343881

r339008 broke repquota for UFS.  This rectifies that.

Refactor the function calls and tests so that, on UFS, the proper fields
are filled out.

PR:           233849

5 years agoMFC r344402
Sean Eric Fagan [Mon, 11 Mar 2019 02:42:49 +0000 (02:42 +0000)]
MFC r344402

* Handle SIGPIPE in gssd
We've got some cases where the other end of gssd's AF_LOCAL socket gets
closed, resulting in an error (and SIGPIPE) when it tries to do I/O to it.
Closing without cleaning up means the next time nfsd starts up, it hangs,
unkillably; this allows gssd to handle that particular error.

* Limit the retry cound in gssd_syscall to 5.
The default is INT_MAX, which effectively means forever.  And it's an
uninterruptable RPC call, so it will never stop.

The two changes mitigate the problem.

5 years agoMFC r344782: bridge: Fix spurious warnings about capabilities
Alexander Motin [Mon, 11 Mar 2019 01:45:26 +0000 (01:45 +0000)]
MFC r344782: bridge: Fix spurious warnings about capabilities

Mask off the bits we don't care about when checking that capabilities
of the member interfaces have been disabled as intended.

5 years agoMFC r344489: Free some space in struct ctl_io_hdr for better use.
Alexander Motin [Mon, 11 Mar 2019 01:44:18 +0000 (01:44 +0000)]
MFC r344489: Free some space in struct ctl_io_hdr for better use.

 - Collapse original_sc and serializing_sc fields into one, since they
are never used simultanously, we have only one local I/O and one remote.

 - Move remote_sglist and local_sglist fields into CTL_PRIV_BACKEND,
since they are used only on Originating SC in XFER mode, where requests
don't ever reach backends, so we can reuse backend's private storage.

5 years agoMFC r344550:
Mark Johnston [Mon, 11 Mar 2019 00:52:55 +0000 (00:52 +0000)]
MFC r344550:
Improve vmem tuning for platforms without a direct map.

5 years agoMFC r344494,r344495:
Vladimir Kondratyev [Sun, 10 Mar 2019 20:43:08 +0000 (20:43 +0000)]
MFC r344494,r344495:

evdev: export event device properties through sysctl interface

A big security advantage of Wayland is not allowing applications to read
input devices all the time. Having /dev/input/* accessible to the user
account subverts this advantage.

libudev-devd was opening the evdev devices to detect their types (mouse,
keyboard, touchpad, etc). This don't work if /dev/input/* is inaccessible.
With the kernel exposing this information as sysctls (kern.evdev.input.*),
we can work w/o /dev/input/* access, preserving the Wayland security model.

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: wulf, imp
Differential Revision: https://reviews.freebsd.org/D18694

5 years agoMFC r343362,r343365,r343367,r343368,r343461,r343751,r344310:
Enji Cooper [Sun, 10 Mar 2019 16:14:42 +0000 (16:14 +0000)]
MFC r343362,r343365,r343367,r343368,r343461,r343751,r344310:

r343362:

Add [initial] functional tests for sendfile(2) as lib/libc/sys/sendfile

These testcases exercise a number of functional requirements for sendfile(2).

The testcases use IPv4 and IPv6 domain sockets with TCP, and were confirmed
functional on UFS and ZFS. UDP address family sockets cannot be used per the
sendfile(2) contract, thus using UDP sockets is outside the scope of
testing the syscall in positive cases. As seen in
`:s_negative_udp_socket_test`, UDP is used to test the sendfile(2) contract
to ensure that EINVAL is returned by sendfile(2).

The testcases added explicitly avoid testing out `SF_SYNC` due to the
complexity of verifying that support. However, this is a good next logical
item to verify.

The `hdtr_positive*` testcases work to a certain degree (the header
testcases pass), but the trailer testcases do not work (it is an expected
failure). In particular, the value received by the mock server doesn't match
the expected value, and instead looks something like the following (using
python array notation):

`trailer[:]message[1:]`

instead of:

`message[:]trailer[:]`

This makes me think there's a buffer overrun issue or problem with the
offset somewhere in the sendfile(2) system call, but I need to do some
other testing first to verify that the code is indeed sane, and my
assumptions/code isn't buggy.

The `sbytes_negative` testcases that check `sbytes` being set to an
invalid value resulting in `EFAULT` fails today as the other change
(which checks `copyout(9)`) has not been committed [1]. Thus, it
should remain an expected failure (see bug 232210 for more details
on this item).

Next steps for testing sendfile(2):
1. Fix the header/trailer testcases so that they pass.
2. Setup if_tap interface and test with it, instead of using "localhost", per
   @asomers's suggestion.
3. Handle short recv(2)'s in `server_cat(..)`.
4. Add `SF_SYNC` support.
5. Add some more negative tests outside the scope of the functional contract.

PR:  232210

r343365:

Unbreak the gcc build with sendfile_test after r343362

gcc 8.x is more pedantic than clang 7.x with format strings and the tests
passed `void*` variables while supplying `%s` (which is technically
incorrect).

Make the affected `void*` variables use `char*` storage instead to address
this issue, as the compiler will upcast the values to `char*`.

MFC with: r343362

r343367:

Unbreak the build on architectures where size_t isn't synonymous with uintmax_t

I should have used `%zu` instead of `%ju` with `size_t` types.

MFC with: r343362, r343365
Pointyhat to: ngie

r343368:

Fix up r343367

I should have only changed the format qualifier with the `size_t` value,
`length`, not the other [`off_t`] value, `dest_file_size`.

MFC with: r343362, r343365, r343367

r343461:

Fix reporting errors with `gai_strerror(..)`

The return value (`err`) should be checked; not the `errno` value.

PR: 235200
MFC with: r343362, r343365, r343367-r343368

r343751:

Avoid the DNS lookup for "localhost"

ci.FreeBSD.org does not have access to a DNS resolver/network (unlike my test
VM), so in order for the test to pass on the host, it needs to avoid the DNS
lookup by using the numeric host address representation.

PR: 235200
MFC with: r343362, r343365, r343367-r343368, r343461

r344310:

Make `server_cat(..)` handle short receives

In short, the prior code was far too simplistic when it came to calling recv(2)
and failed intermittently (or in the case of Jenkins, deterministically).

Handle short recv(2)s by checking the return code and incrementing the window
into the buffer by the number of received bytes. If the number of received
bytes <= 0, then bail out of the loop, and test the total number of received
bytes vs the expected number of bytes sent for equality, and base whether or
not the test passes/fails on that fact.

Remove the expected failure, now that the hdtr testcases deterministically pass
on my host after this change [1].

PR: 234809 [1], 235200

Approved by: emaste (mentor, implicit: MFC to ^/stable/11 in r344977)
Differential Revision: https://reviews.freebsd.org/D19523

5 years agoMFC r344870:
Andrey V. Elsukov [Sun, 10 Mar 2019 04:41:30 +0000 (04:41 +0000)]
MFC r344870:
  Fix the problem with O_LIMIT states introduced in r344018.

  dyn_install_state() uses `rule` pointer when it creates state.
  For O_LIMIT states this pointer actually is not struct ip_fw,
  it is pointer to O_LIMIT_PARENT state, that keeps actual pointer
  to ip_fw parent rule. Thus we need to cache rule id and number
  before calling dyn_get_parent_state(), so we can use them later
  when the `rule` pointer is overrided.

  PR: 236292

5 years agopf: Small performance tweak
Kristof Provost [Sun, 10 Mar 2019 00:56:38 +0000 (00:56 +0000)]
pf: Small performance tweak

Because fetching a counter is a rather expansive function we should use
counter_u64_fetch() in pf_state_expires() only when necessary. A "rdr
pass" rule should not cause more effort than separate "rdr" and "pass"
rules. For rules with adaptive timeout values the call of
counter_u64_fetch() should be accepted, but otherwise not.

From the man page:
    The adaptive timeout values can be defined both globally and for
    each rule.  When used on a per-rule basis, the values relate to the
    number of states created by the rule, otherwise to the total number
    of states.

This handling of adaptive timeouts is done in pf_state_expires().  The
calculation needs three values: start, end and states.

1. Normal rules "pass .." without adaptive setting meaning "start = 0"
   runs in the else-section and therefore takes "start" and "end" from
   the global default settings and sets "states" to pf_status.states
   (= total number of states).

2. Special rules like
   "pass .. keep state (adaptive.start 500 adaptive.end 1000)"
   have start != 0, run in the if-section and take "start" and "end"
   from the rule and set "states" to the number of states created by
   their rule using counter_u64_fetch().

Thats all ok, but there is a third case without special handling in the
above code snippet:

3. All "rdr/nat pass .." statements use together the pf_default_rule.
   Therefore we have "start != 0" in this case and we run the
   if-section but we better should run the else-section in this case and
   do not fetch the counter of the pf_default_rule but take the total
   number of states.

Submitted by: Andreas Longwitz <longwitz@incore.de>

5 years agoMFC r343354:
Mark Johnston [Sat, 9 Mar 2019 21:09:44 +0000 (21:09 +0000)]
MFC r343354:
Remove extraneous setutxent() calls in write(1).

PR: 235096

5 years agoMFC r343990:
Andriy Voskoboinyk [Sat, 9 Mar 2019 12:54:10 +0000 (12:54 +0000)]
MFC r343990:
net80211: hide casts for 'i_seq' field offset calculation inside
ieee80211_getqos() and reuse it in various places.

5 years agoMFC r344744:
Andriy Voskoboinyk [Sat, 9 Mar 2019 12:44:05 +0000 (12:44 +0000)]
MFC r344744:
rtwn_usb(4): fix LED blinking for RTL8192CU during scanning

5 years agoMFC r344720:
Kristof Provost [Sat, 9 Mar 2019 10:35:37 +0000 (10:35 +0000)]
MFC r344720:

pf tests: Test for nested inline anchor issue

PR: 196314

5 years agoMFC r344764
Kristof Provost [Sat, 9 Mar 2019 10:34:42 +0000 (10:34 +0000)]
MFC r344764

tests: Move common (vnet) test functions into a common file

The netipsec and pf tests have a number of common test functions. These
used to be duplicated, but it makes more sense for them to re-use the
common functions.

PR: 236223

5 years agoMFC r339836, r340286, r341358:
Kristof Provost [Sat, 9 Mar 2019 10:33:47 +0000 (10:33 +0000)]
MFC r339836, r340286, r341358:

pf tests: Test ':0' ignoring link-local addresses

Fix test: sys.netpfil.pf.pass_block.noalias

Replace hard-coded epair0b with the variable holds the real epair interface
used for testing.

pf tests: Make pass_block:noalias more robust

Send several ICMPv6 echo requests. We've seen occasional failures with a
single request.

PR: 201695

5 years agoMFC r340073, r341359:
Kristof Provost [Sat, 9 Mar 2019 10:28:36 +0000 (10:28 +0000)]
MFC r340073, r341359:

pf: Keep a reference to struct ifnets we're using

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

pf: Fix panic on overlapping interface names

In rare situations[*] it's possible for two different interfaces to have
the same name. This confuses pf, because kifs are indexed by name (which
is assumed to be unique). As a result we can end up trying to
if_rele(NULL), which panics.

Explicitly checking the ifp pointer before if_rele() prevents the panic.
Note pf will likely behave in unexpected ways on the the overlapping
interfaces.

[*] Insert an interface in a vnet jail. Rename it to an interface which
exists on the host. Remove the jail. There are now two interfaces with
the same name in the host.

5 years agoMFC r341360:
Kristof Provost [Sat, 9 Mar 2019 10:24:39 +0000 (10:24 +0000)]
MFC r341360:

pf tests: Test name handling

Provoke a situation where two interfaces have the same name, and verify
pf's reaction to this.

5 years agoMFC r344838:
Cy Schubert [Sat, 9 Mar 2019 00:32:00 +0000 (00:32 +0000)]
MFC r344838:

Remove an empty directory emptied by r343702.

5 years agoMFC 344671: Don't assume all children of a nexus are ports.
John Baldwin [Fri, 8 Mar 2019 19:20:46 +0000 (19:20 +0000)]
MFC 344671: Don't assume all children of a nexus are ports.

Specifically, ccr(4) devices are also children of cxgbe nexus devices.
Rather than making assumptions about the child device's softc, walk
the list of ports from the nexus' softc to determine if a child is a
port in t4_child_location_str().  This fixes a panic when detaching a
ccr device.

5 years agoMFC 343620: Don't set IFCAP_TXRTLMT during lagg_clone_create().
John Baldwin [Fri, 8 Mar 2019 19:07:41 +0000 (19:07 +0000)]
MFC 343620: Don't set IFCAP_TXRTLMT during lagg_clone_create().

lagg_capabilities() will set the capability once interfaces supporting
the feature are added to the lagg.  Setting it on a lagg without any
interfaces is pointless as the if_snd_tag_alloc call will always fail
in that case.

5 years agoMFC 343456: Fix a few more places to handle ofld tx queues for RATELIMIT.
John Baldwin [Fri, 8 Mar 2019 19:03:28 +0000 (19:03 +0000)]
MFC 343456: Fix a few more places to handle ofld tx queues for RATELIMIT.

- Drain offload transmit queues when RATELIMIT is enabled but
  TCP_OFFLOAD is not.
- Expose the per-VI nofldtxq and first_ofld_txq sysctls when
  RATELIMIT is enabled but TCP_OFFLOAD is not.
- Clear offload transmit queue stats as part of a 'cxgbetool clearstats'
  request when RATELIMIT is enabled but TCP_OFFLOAD is not.

5 years agoMFC 343056: Reject new sessions if the necessary queues aren't initialized.
John Baldwin [Fri, 8 Mar 2019 18:59:37 +0000 (18:59 +0000)]
MFC 343056: Reject new sessions if the necessary queues aren't initialized.

ccr reuses the control queue and first rx queue from the first port on
each adapter.  The driver cannot send requests until those queues are
initialized.  Refuse to create sessions for now if the queues aren't
ready.  This is a workaround until cxgbe allocates one or more
dedicated queues for ccr.

5 years agoMFC 343048:
John Baldwin [Fri, 8 Mar 2019 18:53:54 +0000 (18:53 +0000)]
MFC 343048:
Update the note about the need for COMPAT_FREEBSD<n> kernel options.

Rather than mentioning the requirement for 4.x binaries but not
explaining why (it was assuming an upgrade from 4.x to 5.0-current),
explain when compat options are needed (for running existing host
binaries) in a more general way while using a more modern example
(COMPAT_FREEBSD11 for 11.x binaries).  While here, explicitly mention
that a GENERIC kernel should always work.

5 years agoMFC r343845:
Enji Cooper [Fri, 8 Mar 2019 15:48:19 +0000 (15:48 +0000)]
MFC r343845:

Clean up all directories created by `make hier`

The logic I introduced in r322511 unfortunately left chflags schg'ed
directories behind created by `make hier` (in the stock /etc/mtree
files, this is limited to /var/empty).

The proposed change calls `chflags -R 0` and `rm -Rf ...` to clean all
of the directories that could not be removed by `${MAKE} clean`.
`${MAKE} clean` in bsd.obj.mk calls `cleandir`/`cleanobj`, which handles
the first directory tree walk/removal.

Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D19174

5 years agoMFC r344696:
Vincenzo Maffione [Fri, 8 Mar 2019 08:26:06 +0000 (08:26 +0000)]
MFC r344696:

netmap: pkt-gen: fix bug in send_packets()

The send_packets() function was using ring->cur as index to scan
the transmit ring. This function may also set ring->cur ahead of
ring->head, in case no more slots are available. However, the function
also uses nm_ring_space() which looks at ring->head to check how many
slots are available. If ring->head and ring->cur are different, this
results in pkt-gen advancing ring->cur beyond ring->tail.

This patch fixes send_packets() (and similar source locations) to
use ring->head as a index, rather than using ring->cur.

5 years agoMFC 342658:
John Baldwin [Fri, 8 Mar 2019 01:04:19 +0000 (01:04 +0000)]
MFC 342658:
Correct variable name in two panic messages: num_msi_irq -> num_msi_irqs.

5 years agoMFC r344661, r344669: Limit 24xx adapters to only MSI interrupts by default.
Alexander Motin [Fri, 8 Mar 2019 00:56:07 +0000 (00:56 +0000)]
MFC r344661, r344669: Limit 24xx adapters to only MSI interrupts by default.

This was actually the known good configuration we used before.
Single MSI-X configuration doesn't even work there on my tests, just due
to lack of documentation not sure whether by design or I am doing something
wrong.

5 years agoMFC r344660: Add to isp(4) tunables to limit MSI/MSI-X usage.
Alexander Motin [Fri, 8 Mar 2019 00:54:34 +0000 (00:54 +0000)]
MFC r344660: Add to isp(4) tunables to limit MSI/MSI-X usage.

There are some problem reports possibly related to the new driver use of
multiple interrupts on older cards.  Hopefully this allow to workaround
them.

5 years agoMFC r344702: There is no `device atacard` but there is `device atapccard`.
Alexander Motin [Fri, 8 Mar 2019 00:53:11 +0000 (00:53 +0000)]
MFC r344702: There is no `device atacard` but there is `device atapccard`.

5 years agoMFC 340020: Don't enter DDB for fatal traps before panic by default.
John Baldwin [Fri, 8 Mar 2019 00:20:37 +0000 (00:20 +0000)]
MFC 340020: Don't enter DDB for fatal traps before panic by default.

Add a new 'debugger_on_trap' knob separate from 'debugger_on_panic'
and make the calls to kdb_trap() in MD fatal trap handlers prior to
calling panic() conditional on this new knob instead of
'debugger_on_panic'.  Disable the new knob by default.  Developers who
wish to recover from a fatal fault by adjusting saved register state
and retrying the faulting instruction can still do so by enabling the
new knob.  However, for the more common case this makes the user
experience for panics due to a fatal fault match the user experience
for other panics, e.g. 'c' in DDB will generate a crash dump and
reboot the system rather than being stuck in an infinite loop of fatal
fault messages and DDB prompts.

5 years agoAdd UPDATING entry for r344898 - RETPOLINE BROKEN_OPTIONS
Ed Maste [Thu, 7 Mar 2019 21:30:26 +0000 (21:30 +0000)]
Add UPDATING entry for r344898 - RETPOLINE BROKEN_OPTIONS

Sponsored by: The FreeBSD Foundation

5 years agoDisable WITH_RETPOLINE on stable/12.
Konstantin Belousov [Thu, 7 Mar 2019 20:40:39 +0000 (20:40 +0000)]
Disable WITH_RETPOLINE on stable/12.

It is known that clang 7 generates broken ifunc calls when retpoline is
enabled. Since libc uses ifuncs, mark WITH_RETPOLINE as always broken
and disabled. To be removed after clang 8 MFC.

This is a direct commit to the branch.

Reported by: many
Tested by: Nikola Mihaylov <c.source.code@gmail.com>
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation

5 years agoMFC r344449: scp: validate filenames provided by server against wildcard
Ed Maste [Thu, 7 Mar 2019 20:12:50 +0000 (20:12 +0000)]
MFC r344449: scp: validate filenames provided by server against wildcard

... in client

OpenSSH-portable commits:

check in scp client that filenames sent during remote->local directory
copies satisfy the wildcard specified by the user.

This checking provides some protection against a malicious server
sending unexpected filenames, but it comes at a risk of rejecting wanted
files due to differences between client and server wildcard expansion rules.

For this reason, this also adds a new -T flag to disable the check.

reported by Harry Sintonen
fix approach suggested by markus@;
has been in snaps for ~1wk courtesy deraadt@

OpenBSD-Commit-ID: 00f44b50d2be8e321973f3c6d014260f8f7a8eda

Minor patch conflict (getopt) resolved.

Obtained from: OpenSSH-portable 391ffc4b9d31fa1f4ad566499fef9176ff8a07dc

scp: add -T to usage();

OpenBSD-Commit-ID: a7ae14d9436c64e1bd05022329187ea3a0ce1899

Obtained from: OpenSSH-portable 2c21b75a7be6ebdcbceaebb43157c48dbb36f3d8

PR: 234965
Sponsored by: The FreeBSD Foundation

5 years agoMFC r344553:
David Bright [Thu, 7 Mar 2019 15:30:48 +0000 (15:30 +0000)]
MFC r344553:

asmc: Add support for Mac mini 2,1

PR: 235798
Submitted by: Trev <fbsdbugs4@sentry.org>
Reported by: Trev <fbsdbugs4@sentry.org>

5 years agoMFC r339941 (by mckusick):
Konstantin Belousov [Thu, 7 Mar 2019 13:51:18 +0000 (13:51 +0000)]
MFC r339941 (by mckusick):
In preparation for adding inode check-hashes, change the fsck_ffs
inodirty() function to have a pointer to the inode being dirtied.
No functional change (as for now the parameter is ununsed).

5 years agoMFC r344883:
Cy Schubert [Thu, 7 Mar 2019 13:45:36 +0000 (13:45 +0000)]
MFC r344883:

(MFV r344878:)

4.2.8p12 --> 4.2.8p13

Security:       CVE-2019-8936
                VuXML: c2576e14-36e2-11e9-9eda-206a8a720317
Obtained from:  nwtime.org

5 years agoMFC r344470:
David Bright [Thu, 7 Mar 2019 13:10:34 +0000 (13:10 +0000)]
MFC r344470:

Fix several Coverity-detected issues in newsyslog.

- CID 1394815, CID 1305673: Dereference before null check - memory was
  allocated and the allocation checked for NULL with a call to errx()
  if it failed. Code below that was guaranteed that the pointer was
  non-NULL, but there was another check for NULL at the exit of the
  function (after the memory had already been referenced). Eliminate
  the useless NULL check.

- CID 1007452: Resource leak - Storage intended to be allocated and
  returned to the caller was never freed. This was the result of a
  regression in the function signature introduced in r208648 (2010)
  (thanks for that find, @cem!). Fixed by altering the function
  signature and passing the allocated memory to the caller as
  intended. This also fixes PR158794.

- CID 1008620: Logically dead code in newsyslog.c - This was a direct
  result of CID 1007452. Since the memory allocated as described there
  was not returned to the caller, a subsequent check for the memory
  having been allocated was dead code. Returning the memory
  re-animates the code that is the subject of this CID.

- CID 1006131: Unused value - in parsing a configuration file, a
  pointer to the end of the last field was saved, but not used after
  that. Rewrite to use the pointer value. This could have been fixed
  by avoiding the assignment altogether, but this solutions more
  closely follows the pattern used in the preceding code.

PR:             158794
Reported by:    Coverity, Ken-ichi EZURA <k.ezura@gmail.com> (PR158794)

Sponsored by: Dell EMC Isilon

5 years agoMFC of 344731
Kirk McKusick [Thu, 7 Mar 2019 00:02:25 +0000 (00:02 +0000)]
MFC of 344731

Roundup tunefs -S logsize to filesystem block size

Sponsored by: Netflix

5 years agoMFC of 344552 and 344732
Kirk McKusick [Wed, 6 Mar 2019 23:54:55 +0000 (23:54 +0000)]
MFC of 344552 and 344732

Have fsck_ffs adjust size for files with hole at end

Tighten last lbn calculation

Sponsored by: Netflix

5 years agoMFC 341098: Add read-only sysctls for all tunables in the cxgbe(4) driver.
John Baldwin [Wed, 6 Mar 2019 23:09:27 +0000 (23:09 +0000)]
MFC 341098: Add read-only sysctls for all tunables in the cxgbe(4) driver.

5 years agoMFC r344355:
Konstantin Belousov [Wed, 6 Mar 2019 17:41:12 +0000 (17:41 +0000)]
MFC r344355:
pkru(3) man page.

5 years agoMFC r344354:
Konstantin Belousov [Wed, 6 Mar 2019 17:40:30 +0000 (17:40 +0000)]
MFC r344354:
Add usermode helpers for the Intel userspace protection keys feature.

5 years agoMFC r344353:
Konstantin Belousov [Wed, 6 Mar 2019 17:33:05 +0000 (17:33 +0000)]
MFC r344353:
Add kernel support for Intel userspace protection keys feature on
Skylake Xeons.

5 years agoMFC r344352:
Konstantin Belousov [Wed, 6 Mar 2019 17:26:30 +0000 (17:26 +0000)]
MFC r344352:
amd64: add defines and decode protection keys and SGX page faults reasons.

5 years agoMFC r344351:
Konstantin Belousov [Wed, 6 Mar 2019 17:25:11 +0000 (17:25 +0000)]
MFC r344351:
Implement rangesets.

5 years agoMFC r343705:
Cy Schubert [Wed, 6 Mar 2019 02:51:33 +0000 (02:51 +0000)]
MFC r343705:

new_kmem_alloc(9) is a Solaris/illumos malloc(9). FreeBSD and NetBSD
never get here, however a test for SOLARIS, as redundant as this test is,
serves to document that this is the illumos definition. This should help
those who come after me to follow the code more easily.

5 years agoMFC r343704:
Cy Schubert [Wed, 6 Mar 2019 02:46:18 +0000 (02:46 +0000)]
MFC r343704:

Kernel module shim sources have no business being in the userland
build directory, especially those for other operating systems.
The kernel module shims for other operating systems are hereby removed.
The kernel module shim for FreeBSD, mlfk_ipl.c, is already in
sys/contrib/ipfilter/netinet. The one here is never used and should
not be in the userland build directory either.

mlfk_rule.c isn't used either however we will keep it in case someone
wishes to use this shim to load rules via a kernel module, handy for
embedded. In that case it should be copied to
sys/contrib/ipfilter/netinet and a Makefile created to employ it.
(Probably a useful documentation project when time permits.)

5 years agoMFC r343703
Cy Schubert [Wed, 6 Mar 2019 02:43:31 +0000 (02:43 +0000)]
MFC r343703

Remove a reference to HP-UX in a comment.

5 years agoMFC r343702:
Cy Schubert [Wed, 6 Mar 2019 02:40:01 +0000 (02:40 +0000)]
MFC r343702:

Remove a redundant ip_compat.h, originally merged from upstream.

5 years agoMFC r343701 & r343732:
Cy Schubert [Wed, 6 Mar 2019 02:37:25 +0000 (02:37 +0000)]
MFC r343701 & r343732:

ipfilter #ifdef cleanup.

Remove #ifdefs for ancient and irrelevant operating systems from
ipfilter.

When ipfilter was written the UNIX and UNIX-like systems in use
were diverse and plentiful. IRIX, Tru64 (OSF/1) don't exist any
more. OpenBSD removed ipfilter shortly after the first time the
ipfilter license terms changed in the early 2000's. ipfilter on AIX,
HP/UX, and Linux never really caught on. Removal of code for operating
systems that ipfilter will never run on again will simplify the code
making it easier to fix bugs, complete partially implemented features,
and extend ipfilter.

Unsupported previous version FreeBSD code and some older NetBSD code
has also been removed.

What remains is supported FreeBSD, NetBSD, and illumos. FreeBSD and
NetBSD have collaborated exchanging patches, while illumos has expressed
willingness to have their ipfilter updated to 5.1.2, provided their
zone-specific updates to their ipfilter are merged (which are of interest
to FreeBSD to allow control of ipfilters in jails from the global zone).

Reviewed by: glebius@
Differential Revision: https://reviews.freebsd.org/D19006

5 years agoMFC r344628: poll.2: POLLNVAL is returned also for insufficient rights
Ed Maste [Wed, 6 Mar 2019 00:45:42 +0000 (00:45 +0000)]
MFC r344628: poll.2: POLLNVAL is returned also for insufficient rights

Reported by: Bora Ã–zarslan <borako.ozarslan@gmail.com>
Sponsored by: The FreeBSD Foundation

5 years agoMFC r344600:
Mark Johnston [Tue, 5 Mar 2019 19:41:08 +0000 (19:41 +0000)]
MFC r344600:
Add a missing return statement to g_concat_kernel_dump().

5 years agoMFC r344278:
Mark Johnston [Tue, 5 Mar 2019 19:37:06 +0000 (19:37 +0000)]
MFC r344278:
Move a racy assertion in filt_pipewrite().

PR: 235640

5 years agoMFC r343410:
Ed Maste [Tue, 5 Mar 2019 19:08:37 +0000 (19:08 +0000)]
MFC r343410:

freebsd-update: fix style from r343271 change

PR: 234771
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Sponsored by: The FreeBSD Foundation

5 years agoMFC freebsd-update: Clarify unsupported release upgrade error message
Ed Maste [Tue, 5 Mar 2019 19:01:57 +0000 (19:01 +0000)]
MFC freebsd-update: Clarify unsupported release upgrade error message

MFC r343122:

freebsd-update: Clarify unsupported release upgrade error message

Notify users that upgrading from -CURRENT or -STABLE is unsupported by
freebsd-update.

Also ensure --currently-running provides a correctly formatted release
(as done by -r).

Reported by: yuri
Reviewed by: bcran

MFC r343268:

frebsd-update: fix --currently-running after r343122

Reported by: Brandon Schneider

MFC rr343271:

freebsd-update: Allow upgrade from pre-release builds

Update r343122 to include -ALPHA, -BETA and -RC releases as
upgrade-able via freebsd-update.

Reported by: delphij, des
Reviewed by: delphij

PR: 234771
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343152: freebsd-update: Use BASEDIR when checking for src component
Ed Maste [Tue, 5 Mar 2019 18:52:13 +0000 (18:52 +0000)]
MFC r343152: freebsd-update: Use BASEDIR when checking for src component

src could potentially be installed under the based dir
and not under the root or vice versa.

PR: 224048
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: delphij
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343270: freebsd-update: Update /etc/passwd after password db changes
Ed Maste [Tue, 5 Mar 2019 18:29:25 +0000 (18:29 +0000)]
MFC r343270: freebsd-update: Update /etc/passwd after password db changes

Add -p to pwd_mkdb in order to ensure password db changes are also
included in /etc/passwd.

PR: 165954, 232921, 229487
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: jilles
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343411: freebsd-update: Clarify unsupported upgrade message
Ed Maste [Tue, 5 Mar 2019 18:26:34 +0000 (18:26 +0000)]
MFC r343411: freebsd-update: Clarify unsupported upgrade message

PR: 204115
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: delphij
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343412: Fix a typo/wordsmith a description modified in [MFC of r343407]
Ed Maste [Tue, 5 Mar 2019 18:23:31 +0000 (18:23 +0000)]
MFC r343412: Fix a typo/wordsmith a description modified in [MFC of r343407]

5 years agoMFC r343407: freebsd-update: open $PAGER only if necessary
Ed Maste [Tue, 5 Mar 2019 18:19:26 +0000 (18:19 +0000)]
MFC r343407: freebsd-update: open $PAGER only if necessary

PR: 194547, 208497
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: delphij
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343409: freebsd-update: Stop installing empty component sets
Ed Maste [Tue, 5 Mar 2019 18:15:35 +0000 (18:15 +0000)]
MFC r343409: freebsd-update: Stop installing empty component sets

Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by: rgrimes
Reviewed by: delphij
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343589: freebsd-update: regenerate man page database after update
Ed Maste [Tue, 5 Mar 2019 18:10:06 +0000 (18:10 +0000)]
MFC r343589: freebsd-update: regenerate man page database after update

These are currently not reproducible because they're built by the
makewhatis on the freebsd-update build host, not the one in the tree.
Regenerate after update, and later we can avoid including it in
freebsd-update data.

PR: 214545, 217389
Reviewed by: delphij
Sponsored by: The FreeBSD Foundation

5 years agoMFC r344692:
Kristof Provost [Tue, 5 Mar 2019 08:45:07 +0000 (08:45 +0000)]
MFC r344692:

pf tests: Test CVE-2019-5597

Generate a fragmented packet with different header chains, to provoke
the incorrect behaviour of pf.
Without the fix this will trigger a panic.

Obtained from: Corentin Bayet, Nicolas Collignon, Luca Moro at Synacktiv

5 years agoMFC r344561:
Jason A. Harmening [Tue, 5 Mar 2019 08:33:14 +0000 (08:33 +0000)]
MFC r344561:

Fix incorrect assertion in vnode_pager_generic_getpages()

5 years agoMFC r344666:
Bryan Drewery [Mon, 4 Mar 2019 21:10:40 +0000 (21:10 +0000)]
MFC r344666:

  bsd.nls.mk isn't optional.

PR: 232527

5 years agoMFC r344245:
Andriy Voskoboinyk [Mon, 4 Mar 2019 03:38:43 +0000 (03:38 +0000)]
MFC r344245:
snmp_hostres(3): fix a typo in sanity checks in handle_chunk()

PR: 204253
Submitted by: David Binderman <dcb314@hotmail.com>

5 years agoMFC r344244:
Andriy Voskoboinyk [Mon, 4 Mar 2019 03:30:39 +0000 (03:30 +0000)]
MFC r344244:
Fix memory / resource leaks in usr.sbin/rpc.ypupdated/update.c

Re-apply r343909 to this file to get the issue fixed.

PR: 204956
Reported by: David Binderman <dcb314@hotmail.com>

5 years agoMFC r344491: An IPv6 address matching should be fixed.
Hajimu UMEMOTO [Sun, 3 Mar 2019 03:40:11 +0000 (03:40 +0000)]
MFC r344491: An IPv6 address matching should be fixed.
Specifying an IPv6 address by the -a option was broken
since r309933.

5 years agoMFC r344480: Remove disabled CTL_LEGACY_STATS support.
Alexander Motin [Sat, 2 Mar 2019 03:17:23 +0000 (03:17 +0000)]
MFC r344480: Remove disabled CTL_LEGACY_STATS support.

It was not only disabled for quite a while, but also appeared to be broken
at r325517, when maximum number of ports was made configurable.

5 years agoMFC r343978:
Kristof Provost [Fri, 1 Mar 2019 22:33:24 +0000 (22:33 +0000)]
MFC r343978:

pfctl: Fix ifa_grouplookup()

Setting the length of the request got lost in r343287, which means SIOCGIFGMEMB
gives us the required length, but does not copy the names of the group members.
As a result we don't get a correct list of group members, and 'set skip on
<ifgroup>' broke.

This produced all sorts of very unexpected results, because we would end up
applying 'set skip' to unexpected interfaces.

5 years agoMFC r344691:
Kristof Provost [Fri, 1 Mar 2019 18:12:05 +0000 (18:12 +0000)]
MFC r344691:

pf: IPv6 fragments with malformed extension headers could be erroneously passed by pf or cause a panic

We mistakenly used the extoff value from the last packet to patch the
next_header field. If a malicious host sends a chain of fragmented packets
where the first packet and the final packet have different lengths or number of
extension headers we'd patch the next_header at the wrong offset.
This can potentially lead to panics or rule bypasses.

Reported by: Corentin Bayet, Nicolas Collignon, Luca Moro at Synacktiv
Approved by: so
Obtained from: OpenBSD
Security: CVE-2019-5597

5 years agoMFC r344592:
Konstantin Belousov [Fri, 1 Mar 2019 11:29:18 +0000 (11:29 +0000)]
MFC r344592:
procctl(2): fix -width parameter to .Bl.

5 years agoMFC r344477:
Hans Petter Selasky [Fri, 1 Mar 2019 08:04:17 +0000 (08:04 +0000)]
MFC r344477:
Add new USB quirk.

PR: 235897
Sponsored by: Mellanox Technologies

5 years agoMFC r343118: new small tool trim(1) to delete contents for blocks
Eugene Grosbein [Fri, 1 Mar 2019 05:02:09 +0000 (05:02 +0000)]
MFC r343118: new small tool trim(1) to delete contents for blocks
on flash based storage devices that use wear-leveling algorithms.

5 years agoMFC r344474-r344476
Ben Widawsky [Fri, 1 Mar 2019 02:16:37 +0000 (02:16 +0000)]
MFC r344474-r344476

r344474:
nvdimm: split spa dev into a separate entity

Separate code for exposing a device backed by a system physical
address range away from the NVDIMM spa code. This will allow a
future patch to add support for NVDIMM namespaces while using the
same device code.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Reviewed by: bwidawsk
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18736

r344475:
nvdimm: Read NVDIMM namespace labels

When attaching to NVDIMM devices, read and verify the namespace
labels from the special namespace label storage area. A later
change will expose NVDIMM namespaces derived from this label data.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Discussed with: kib
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18735

r344476:
nvdimm: Simple namespace support

Add support for simple NVDIMM v1.2 namespaces from the UEFI
version 2.7 specification. The combination of NVDIMM regions and
labels can lead to a wide variety of namespace layouts. Here we
support a simple subset of namespaces where each NVDIMM SPA range
is composed of a single region per member dimm.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Discussed with: kib
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18736

5 years agoMFC r344063,r344088:
Martin Matuska [Thu, 28 Feb 2019 22:55:44 +0000 (22:55 +0000)]
MFC r344063,r344088:

MFC r344063:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1085: Fix a null pointer dereference bug in zip writer
  PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2
            decopmpression
  PR #1116: Add support for 64-bit ar format
  PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2]
  PR #1125: RAR5 reader - fix an invalid read and a memory leak
  PR #1131: POSIX reader - do not fail when tree_current_lstat() fails
            due to ENOENT [3]
  PR #1134: Delete unnecessary null pointer checks before calls of free()
  OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy.
  OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader

MFC r344088:
  archive_read_disk_posix.c: initialize delayed_errno

PR: 233006 [3]
Security: CVE-2019-1000019 [1], CVE-2019-1000020 [2]

5 years agoMFC r343877,r343880:
Bryan Drewery [Thu, 28 Feb 2019 20:57:36 +0000 (20:57 +0000)]
MFC r343877,r343880:

  r343877:
    ipfw table list: Fix showing header outside of 'all'.
  r343880:
    Fix build of r343877

Relnotes: yes

5 years agoMFC r344510
Vincenzo Maffione [Thu, 28 Feb 2019 09:40:26 +0000 (09:40 +0000)]
MFC r344510

netmap: remove redundant call to nm_set_native_flags()

This redundant call was introduced by mistake in r343772.

Sponsored by:   Sunny Valley Networks

5 years agoMFC r344444:
Dimitry Andric [Thu, 28 Feb 2019 06:53:18 +0000 (06:53 +0000)]
MFC r344444:

Pull in r353299 from upstream lld trunk (by George Rimar):

  Recommit r353293 "[LLD][ELF] - Set DF_STATIC_TLS flag for i386 target."

  With the following changes:
  1) Compilation fix:
  std::atomic<bool> HasStaticTlsModel = false; ->
  std::atomic<bool> HasStaticTlsModel{false};

  2) Adjusted the comment in code.

  Initial commit message:

  DF_STATIC_TLS flag indicates that the shared object or executable
  contains code using a static thread-local storage scheme.

  Patch checks if IE/LE relocations were used to check if the code uses
  a static model. If so it sets the DF_STATIC_TLS flag.

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

Pull in r353378 from upstream lld trunk (by George Rimar):

  [LLD][ELF] - Set DF_STATIC_TLS flag for X64 target

  This is the same as D57749, but for x64 target.

  "ELF Handling For Thread-Local Storage" p41 says
  (https://www.akkadia.org/drepper/tls.pdf):
  R_X86_64_GOTTPOFF relocation is used for IE TLS models.
  Hence if linker sees this relocation we should add DF_STATIC_TLS flag.

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

This adds support to lld for the DF_STATIC_TLS flag in shared objects,
which signals to the dynamic linker that the shared object requires
static thread local storage.

See also: https://reviews.freebsd.org/D19072

5 years agoMFC r344437: Allow I/OAT of present Xeon E5/E7 to work thorugh PLX NTB.
Alexander Motin [Thu, 28 Feb 2019 00:30:13 +0000 (00:30 +0000)]
MFC r344437: Allow I/OAT of present Xeon E5/E7 to work thorugh PLX NTB.

Its a hack, we can't know/list all DMA engines, but this covers all
I/OAT of Xeon E5/E7 at least from Sandy Bridge till Skylake I saw.

5 years agoMFC r344441: Fix few issues in ioat(4) driver.
Alexander Motin [Thu, 28 Feb 2019 00:28:44 +0000 (00:28 +0000)]
MFC r344441: Fix few issues in ioat(4) driver.

 - Do not explicitly count active descriptors.  It allows hardware reset
to happen while device is still referenced, plus simplifies locking.
 - Do not stop/start callout each time the queue becomes empty.  Let it
run to completion and rearm if needed, that is much cheaper then to touch
it every time, plus also simplifies locking.
 - Decouple submit and cleanup locks, making driver reentrant.
 - Avoid memory mapped status register read on every interrupt.
 - Improve locking during device attach/detach.
 - Remove some no longer used variables.

Sponsored by: iXsystems, Inc.

5 years agoMFC r344473:
David Bright [Wed, 27 Feb 2019 22:29:12 +0000 (22:29 +0000)]
MFC r344473:

CID 1332000: Logically dead code in sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c

A pointer is first tested for NULL. If non-NULL, another pointer is
set equal to the first. The second pointer is then checked for NULL
and an error path taken if so. This second test and the associated
path is dead code as the pointer value, having just been checked for
NULL, cannot be NULL at this point. Remove the dead code.

Sponsored by: Dell EMC Isilon

5 years agoMFC r344381:
Dimitry Andric [Wed, 27 Feb 2019 22:12:04 +0000 (22:12 +0000)]
MFC r344381:

Fix more AddressSanitizer violations in usr.bin/top

In line_update(), set lastcol correctly after moving to any non-zero
column, so the "overwrite old stuff" part does not attempt to address
negative offsets in the current line.

Rewrite setup_buffer() to always allocate at least 80 characters,
otherwise various calls to summary_format() will overwrite the end of
the buffers, if the screen width gets small enough.

5 years agoMFC r344503:
Dimitry Andric [Wed, 27 Feb 2019 22:02:46 +0000 (22:02 +0000)]
MFC r344503:

Pull in r354756 from upstream llvm trunk (by Craig Topper):

  [X86] Fix tls variable lowering issue with large code model

  Summary:
  The problem here is the lowering for tls variable. Below is the DAG
  for the code. SelectionDAG has 11 nodes:

  t0: ch = EntryToken
t8: i64,ch = load<(load 8 from `i8 addrspace(257)* null`,
addrspace 257)> t0, Constant:i64<0>, undef:i64
  t10: i64 = X86ISD::WrapperRIP TargetGlobalTLSAddress:i64<i32*
  @x> 0 [TF=10]
t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64
      t12: i64 = add t8, t11
    t4: i32,ch = load<(dereferenceable load 4 from @x)> t0, t12,
    undef:i64
  t6: ch = CopyToReg t0, Register:i32 %0, t4

  And when mcmodel is large, below instruction can NOT be folded.

    t10: i64 = X86ISD::WrapperRIP TargetGlobalTLSAddress:i64<i32* @x> 0
    [TF=10]
  t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64

  So "t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64" is
  lowered to " Morphed node: t11: i64,ch = MOV64rm<Mem:(load 8 from
  got)> t10, TargetConstant:i8<1>, Register:i64 $noreg,
  TargetConstant:i32<0>, Register:i32 $noreg, t0"

  When llvm start to lower "t10: i64 = X86ISD::WrapperRIP
  TargetGlobalTLSAddress:i64<i32* @x> 0 [TF=10]", it fails.

  The patch is to fold the load and X86ISD::WrapperRIP.

  Fixes PR26906

  Patch by LuoYuanke

  Reviewers: craig.topper, rnk, annita.zhang, wxiao3

  Reviewed By: rnk

  Subscribers: llvm-commits

  Tags: #llvm

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

This should fix "fatal error: error in backend: Cannot select" messages
when compiling <ctype.h> functions using -mcmodel=large.

Reported by: phk
PR: 233143

5 years agoMFC r344218: mdmfs(8): use -o reserve with malloc-backed md(4)
Kyle Evans [Wed, 27 Feb 2019 17:00:14 +0000 (17:00 +0000)]
MFC r344218: mdmfs(8): use -o reserve with malloc-backed md(4)

Mentioned in mdconfig(8), malloc-backed md(4) can be unstable unless
required memory is allocated up front with -o reserve. Furthermore, panics
have been observed with md used in fstab on 12.0-RELEASE. Choose the stable
route and pass -o reserve.

5 years agoMFC: r344602
Jung-uk Kim [Tue, 26 Feb 2019 19:34:42 +0000 (19:34 +0000)]
MFC: r344602

Merge OpenSSL 1.1.1b.

5 years agoMFC r344305, r344365:
Mark Johnston [Tue, 26 Feb 2019 15:03:59 +0000 (15:03 +0000)]
MFC r344305, r344365:
Impose a limit on the number of GEOM_CTL arguments.

admbug: 854

5 years agoMFC r344307:
Mark Johnston [Tue, 26 Feb 2019 14:56:01 +0000 (14:56 +0000)]
MFC r344307:
Limit the number of entries allocated for a REPORT_ZONES command.

5 years agoMerge ENA OOO RX fixes
Marcin Wojtas [Tue, 26 Feb 2019 12:22:53 +0000 (12:22 +0000)]
Merge ENA OOO RX fixes

MFC r344150-r344151

Obtained from: Semihalf
Sponsored by: Amazon, Inc.