Commit Graph

236037 Commits

Author SHA1 Message Date
Xin LI
a29173be53 Remove arc4random_stir and arc4random_addrandom from stdlib.h.
Users of arc4random(3) should never call them directly.

All ports tree usage was fixed as part of bug 230756.

Relnotes:       yes
Approved by:    re (marius), exp-run (bug 230756 by portmgr antoine)
2018-08-26 18:04:54 +00:00
Sean Bruno
01a9c32322 r338270 had the side effect of no longer installing libmd.so into /lib.
For users who have a seperate zfs mount of /usr or /usr/lib, this will
cause dynamic loading failures when attempting to execute zfs mount on
bootup. E.g. the system won't boot.

Including <src.opts.mk> sets SHLIBDIR, so SHLIBDIR?= has no
effect.  The other lib/ Makefiles solve this problem by moving the
SHLIBDIR  assignment to before .include <src.opts.mk>.

Submitted by:	jilles
Reviewed by:	allanjude
Approved by:	re (rgrimes)
Differential Revision:	https://reviews.freebsd.org/D16910
2018-08-26 17:05:43 +00:00
Mark Murray
19fa89e938 Remove the Yarrow PRNG algorithm option in accordance with due notice
given in random(4).

This includes updating of the relevant man pages, and no-longer-used
harvesting parameters.

Ensure that the pseudo-unit-test still does something useful, now also
with the "other" algorithm instead of Yarrow.

PR:		230870
Reviewed by:	cem
Approved by:	so(delphij,gtetlow)
Approved by:	re(marius)
Differential Revision:	https://reviews.freebsd.org/D16898
2018-08-26 12:51:46 +00:00
Colin Percival
a1b042f79d Disable atkbd0 and atkdbc0 in EC2 AMIs. This has the effect of skipping
the probing and attaching of the PS/2 mouse (not present on EC2) and
keyboard (emulated, but not accessible via EC2).

Note that we disable atkbd0 separately even though during device probing
it shows up as a child of atkbdc0; this is necessary because the device
is also initialized during the early console setup from hammer_time.

This change cuts the kernel boot time on an EC2 c5.4xlarge instance from
7259ms down to 4727 ms.

Approved by:	re (marius)
2018-08-26 03:56:54 +00:00
Brad Davis
00d5b07760 Fix the install location of hcsecd.conf
Submitted by:	vangyzen
Approved by:	re (marius)
2018-08-26 02:09:20 +00:00
Brad Davis
f1722afc8d Remove trailing slash in pathname so that valid METALOG is created in the
NO_ROOT case of make packages.

Submitted by:	Dan McGregor <dan.mcgregor@usask.ca>
Approved by:	re (rgrimes)
2018-08-25 20:19:16 +00:00
Alan Cox
49bfa624ac Eliminate the arena parameter to kmem_free(). Implicitly this corrects an
error in the function hypercall_memfree(), where the wrong arena was being
passed to kmem_free().

Introduce a per-page flag, VPO_KMEM_EXEC, to mark physical pages that are
mapped in kmem with execute permissions.  Use this flag to determine which
arena the kmem virtual addresses are returned to.

Eliminate UMA_SLAB_KRWX.  The introduction of VPO_KMEM_EXEC makes it
redundant.

Update the nearby comment for UMA_SLAB_KERNEL.

Reviewed by:	kib, markj
Discussed with:	jeff
Approved by:	re (marius)
Differential Revision:	https://reviews.freebsd.org/D16845
2018-08-25 19:38:08 +00:00
Michal Meloun
ee6281c3d3 Fix wrong offset calculation for R_ARM_TLS_TPOFF32 relocations.
TLS_TCB_SIZE is already accounted in defobj-> tlsoffset so all these symbols
were incorrectly relocated by +8.

Note:
The only consumer (for all binaries on my ARM board) of R_ARM_TLS_TPOFF32
relocation is _ThreadRuneLocale variable. And the incorrectly relocated
ThreadRuneLocale accidentally pointed to zeroed memory before memory layout
change from D16510 had changed status quo.

MFC after:	3 weeks
Reviewed by:	imp, jhb
Approved by:	re (marius)
2018-08-25 16:54:37 +00:00
Colin Percival
ee97b2336a Speed up vt(4) by keeping a record of the most recently drawn character and
the foreground and background colours.  In bitblt_text functions, compare
values to this cache and don't re-draw the characters if they haven't changed.
When invalidating the display, clear this cache in order to force characters
to be redrawn; also force full redraws between suspend/resume pairs since odd
artifacts can otherwise result.

When scrolling the display (which is where most time is spent within the vt
driver) this yields a significant performance improvement if most lines are
less than the width of the terminal, since this avoids re-drawing blanks on
top of blanks.

(Note that "re-drawing" here includes writing to the VGA text mode buffer; on
virtualized systems this can be extremely slow since it triggers a glyph
being rendered onto a 640x480 screen).

On a c5.4xlarge EC2 instance (with emulated text mode VGA) this cuts the time
spent in vt(4) during the kernel boot from 1200 ms to 700ms; on my laptop
(with a 3200x1800 display) the corresponding time is reduced from 970 ms down
to 155 ms.

Reviewed by:	imp, cem
Approved by:	re (gjb)
Relnotes:	Significant speedup in vt(4) and the system boot generally.
Differential Revision:	https://reviews.freebsd.org/D16723
2018-08-25 16:14:56 +00:00
Mark Johnston
fedded8d04 Fix column alignment in per-thread mode.
PR:		230872
Approved by:	re (marius)
MFC after:	1 week
2018-08-25 15:59:51 +00:00
Warner Losh
4a82f36851 Add in a missing newline
In the conversion, the newline got stripped. It worked fine when there
was only one module, but not when there are many. Add back the missing
newline.

Approved by: re@ (kib)
PR: 230868
Differential Revision: https://reviews.freebsd.org/D16895
2018-08-25 15:47:52 +00:00
Konstantin Belousov
23c97bcba1 Remove dead code in i386 cpu_throw().
Curpmap must be already valid when cpu_throw() is called, even for early
AP startup.

Suggested by:	alc
Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
Approved by:	re (marius)
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D16893
2018-08-25 15:31:23 +00:00
Konstantin Belousov
60b7423434 Unify amd64 and i386 vmspace0 pmap activation.
Add pmap_activate_boot() for i386, move the invocation on APs from MD
init_secondary() to x86 init_secondary_tail().

Suggested by:	alc
Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
Approved by:	re (marius)
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D16893
2018-08-25 15:21:28 +00:00
Kyle Evans
5dd1b8342c lualoader: Fix override of module_path on loader prompt
Earlier changes setup a config.module_path variable that was populated upon
reading of loader.conf(5) and used for restoring module_path to pristine
condition if multiple kernels are attempted. This broke the ability to
override module_path at the loader prompt in case of emergency.

Approved by:	re (rgrimes)
2018-08-25 04:28:02 +00:00
Bjoern A. Zeeb
e67e4c6392 Unbreak RSS builds after r338257. Folding both RSS blocks together
I missed the closing } of the new combined block.

Pointyhat to:	bz
Reported by:	np
Approved by:	re (kib)
2018-08-24 21:49:21 +00:00
Navdeep Parhar
47c39432b1 Unbreak VLANs after r337943.
ether_set_pcp should not be called from ether_output_frame for VLAN
interfaces -- the vid + pcp will be inserted during vlan_transmit in
that case. r337943 sets the VLAN's ifnet's if_pcp to a proper PCP value
and this led to double encapsulation (once with vid 0 and second time
with vid+pcp).

PR: 230794
Reviewed by:	kib@
Approved by:	re@ (gjb@)
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D16887
2018-08-24 21:48:13 +00:00
Marius Strobl
7f6921ae18 The read accessors generated by __BUS_ACCESSOR() have the problem that
they don't check the result of BUS_READ_IVAR(9) and silently return stack
garbage on failure in case a bus doesn't implement a particular instance
variable for example. With MMC bridges not providing MMCBR_IVAR_RETUNE_REQ,
yet, this in turn can cause mmc(4) to get into a state in which re-tuning
seems to be necessary but is inappropriate, causing mmc_wait_for_request()
to fail. Thus, don't use __BUS_ACCESSOR() for mmcbr_get_retune_req() and
instead provide a version of the latter which returns retune_req_none if
reading MMCBR_IVAR_RETUNE_REQ fails.
One more straight-forward solution would have been to change mmc(4) to not
call mmcbr_get_retune_req() if the current transfer mode doesn't require
re-tuning to begin with. However, for modes such as SDR50, it depends on
the controller whether periodic re-tuning is need. Therefore, knowledge of
whether a particular transfer mode does require re-tuning should be kept
to the bridge drivers.
This change is the generic version of r338271, as intended not requiring
bridge drivers to be touched (unless transfer modes beyond high speed are
to be supported that is).

Approved by:	re (gjb)
2018-08-24 21:08:05 +00:00
Kyle Evans
8369ba427a libbe(3)/bectl(8): Make consistent with beadm
vermaden (maintainer of beadm) points out the following inconsistencies:
- "missing command" is not printed prior to usage if the error is simply a
   missing command; this should be obvious from the context
- "bectl rename" isn't using the "don't unmount" flag (zfs rename -u), so
   the active BE can't be renamed. It doesn't make sense in our context to
   *not* use -u, so use it.

Documentation updates reflect the above and note an inconsistency with the
'destroy' command that is consistent with other parts of the base system.

A fix for libbe(3) not properly being installed to /lib is included.
SHLIBDIR should have been added when it was moved in r337995.

Approved by:	re (kib)
2018-08-24 20:44:58 +00:00
Gleb Smirnoff
306abf0f35 Either "free" or "allocated" is misleading here, since an item
in a bucket is free from perspective of UMA consumer, and it is
allocated from perspective of keg.

Discussed with:	markj
Approved by:	re (kib)
2018-08-24 18:47:50 +00:00
Emmanuel Vadot
eeab916dad release: arm64: Enable overlays for PINE64 and PINE64-LTS
Approved by:	re (gjb)
2018-08-24 15:01:58 +00:00
Emmanuel Vadot
66e380123e release: arm: Setup overlays if board config defines some
Approved by:	re (gjb)
2018-08-24 15:01:22 +00:00
Emmanuel Vadot
a9e5047fa6 arm64: Add DTS overlays for A64
- sun50i-a64-sid.dtso registers the Security ID node, needed for thermal
 - sun50i-a64-ths.dtso registers the thermal node, for which we already have a
driver
 - sun50i-a64-timer.dtso registers the timer node, needed as the generic timer
 glitch on A64 SoC.

Approved by:    re (gjb)
2018-08-24 15:00:36 +00:00
Mark Murray
29f9b2a93e Limit the amount of "fast" entropy. We don't need nearly as much
for security, and the excess just slows things down badly.

PR:             230808
Submitted by:   rwmaillists@googlemail.com, but tweeked by me
Reported by:    Danilo Egea Gondolfo <danilo@FreeBSD.org>
Reviewed by:	cem,delphij
Approved by:	re(rgrimes)
Approved by:	so(delphij)
MFC after:      1 Month
Differential Revision:	https://reviews.freebsd.org/D16873
2018-08-24 14:53:46 +00:00
Mark Murray
27064b30f2 Fix braino of mine where the reseeds would happen far too often,
making the kernel process way too busy.

PR:             230808
Submitted by:   Conrad Meyer <cem@FreeBSD.org>
Reported by:    Danilo Egea Gondolfo <danilo@FreeBSD.org>
Reviewed by:	cem,delphij
Approved by:	re(rgrimes)
Approved by:	so(delphij)
MFC after:      1 Month
Security:	Yes
Differential Revision:	https://reviews.freebsd.org/D16872
2018-08-24 14:53:42 +00:00
Michael Tuexen
c6c0be2765 Fix a shadowed variable warning.
Thanks to Peter Lei for reporting the issue.

Approved by:		re(kib@)
MFH:			1 month
Sponsored by:		Netflix, Inc.
2018-08-24 10:50:19 +00:00
Alexander Motin
cb892a4117 Unblock speculative prefetcher also on pool creation.
Fix at r331950 appeared to be incomplete, fixing only case of pool
import, but not pool creation, leaving prefetcher still blocked for
newly created pools.

Approved by:	re (gjb)
MFC after:	1 week
2018-08-24 01:59:25 +00:00
Glen Barber
cd371ac1a2 Update head from ALPHA2 to ALPHA3 as part of the 12.0-RELEASE
cycle.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-08-24 00:25:25 +00:00
Warner Losh
592ffb2175 Revert drm2 removal.
Revert r338177, r338176, r338175, r338174, r338172

After long consultations with re@, core members and mmacy, revert
these changes. Followup changes will be made to mark them as
deprecated and prent a message about where to find the up-to-date
driver.  Followup commits will be made to make this clear in the
installer. Followup commits to reduce POLA in ways we're still
exploring.

It's anticipated that after the freeze, this will be removed in
13-current (with the residual of the drm2 code copied to
sys/arm/dev/drm2 for the TEGRA port's use w/o the intel or
radeon drivers).

Due to the impending freeze, there was no formal core vote for
this. I've been talking to different core members all day, as well as
Matt Macey and Glen Barber. Nobody is completely happy, all are
grudgingly going along with this. Work is in progress to mitigate
the negative effects as much as possible.

Requested by: re@ (gjb, rgrimes)
2018-08-24 00:02:00 +00:00
Gleb Smirnoff
a307fb5b0c Fix comment. The actual meaning of ub_cnt is the opposite. 2018-08-23 23:24:28 +00:00
Marius Strobl
e94a7c27df Following r335259, don't copy boot1 from the running system for sparc64
either.
2018-08-23 22:57:42 +00:00
Allan Jude
aa2a0e0fc3 bsdinstall/zfsboot: Enable new UEFI+GELI support
After r336252 it is no longer necessary to have a separate bootpool when
booting from an encrypted disk with UEFI.

This change also switches the EFI System Partition contents from
the 800 KB boot1.efifat to a new 200 MB filesystem created with newfs_msdos
and uses loader.efi directly, instead of boot1.efi.

PR:		228916
Reviewed by:	dteske
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Klara Systems
Differential Revision:	https://reviews.freebsd.org/D12315
2018-08-23 22:50:11 +00:00
Kirk McKusick
a9c2220f5c Proper spelling of consolidation.
Submitted by: Dimitry Andric
2018-08-23 22:35:14 +00:00
Marius Strobl
602a05b0da - Use le32dec(9) for decoding EXT_CSD values where it makes sense. [1]
- Locally cache some instance variable values in mmc_discover_cards()
  in order to improve the code readability a bit.

Obtained from:	NetBSD [1]
2018-08-23 21:26:58 +00:00
Mark Johnston
899fe184c7 Add a per-pagequeue pdpages counter.
Expose these counters under the vm.domain sysctl node.  The existing
vm.stats.vm.v_pdpages sysctl is preserved.

Reviewed by:	alc (previous version)
Differential Revision:	https://reviews.freebsd.org/D14666
2018-08-23 21:03:45 +00:00
Bjoern A. Zeeb
0568fefeea Reduce the log level of tcpd_warn calls from ERR to WARNING.
This matches the name and avoids logging of warnings to console with
default syslog.conf, esp. getting rid of:
  warning: /etc/hosts.allow, line ..: can't verify hostname: \
     getaddrinfo(.., AF_INET) failed
2018-08-23 20:44:26 +00:00
Mark Johnston
99d92d732f Ensure that queue state is cleared when vm_page_dequeue() returns.
Per-page queue state is updated non-atomically, with either the page
lock or the page queue lock held.  When vm_page_dequeue() is called
without the page lock, in rare cases a different thread may be
concurrently dequeuing the page with the pagequeue lock held.  Because
of the non-atomic update, vm_page_dequeue() might return before queue
state is completely updated, which can lead to race conditions.

Restrict the vm_page_dequeue() interface so that it must be called
either with the page lock held or on a free page, and busy wait when
a different thread is concurrently updating queue state, which must
happen in a critical section.

While here, do some related cleanup: inline vm_page_dequeue_locked()
into its only caller and delete a prototype for the unimplemented
vm_page_requeue_locked().  Replace the volatile qualifier for "queue"
added in r333703 with explicit uses of atomic_load_8() where required.

Reported and tested by:	pho
Reviewed by:	alc
Differential Revision:	https://reviews.freebsd.org/D15980
2018-08-23 20:34:22 +00:00
Marius Strobl
608226d559 Obtain the bus mode (MMC or SD) from the directly superordinated
bus rather than reaching up to the bridge and use the cached mode
in mmcsd_delete(), too.
2018-08-23 20:25:27 +00:00
Mark Johnston
84c68e5820 Configure -zifunc-noplt for amd64 kernels.
Per r338251, this ensures that ifunc calls have the same ordinary
function calls.

Reviewed by:	emaste (previous version)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D16750
2018-08-23 19:58:24 +00:00
Michael Tuexen
90ab3571d8 Use arc4rand() instead of read_random() in the SCTP and TCP code.
This was suggested by jmg@.

Reviewed by:		delphij@, jmg@, jtl@
MFC after:		1 month
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D16860
2018-08-23 19:10:45 +00:00
Emmanuel Vadot
4ca213c07a a10_timer: Update the driver so we can use it on other SoC
a10_timer is currently use in UP allwinner SoC (A10 and A13).
Those don't have the generic arm timer.
The arm generic timecounter is broken in the A64 SoC, some attempts have
been made to fix the glitch but users still reported some minor ones.
Since the A64 (and all Allwinner SoC) still have this timer controller, rework
the driver so we can use it in any SoC.
Since it doesn't have the 64 bits counter on all SoC, use one of the
generic 32 bits counter as the timecounter source.

PR:	229644
2018-08-23 18:46:05 +00:00
Emmanuel Vadot
55f3f71ca0 aw_mmc: Handle MMCBR_IVAR_RETUNE_REQ
Without this the mmc stack sometimes think that we are in in a retune
operation and some command like switch the bus width to 4 bits failed.
We now switch correctly to 4 bits mode for sd card.

Reported by:	jmg, others in pine64 irc channel
2018-08-23 18:33:42 +00:00
Alex Richardson
c91575ceec Don't build skein_block_asm.s if we don't have an as binary
This fixes building libmd on MacOS/Linux. The real fix is probably to
build it as a .S file with $CC instead. It might also be better to just
compile the C file in userspace since the compiler can the use SSE/AVX.

Reviewed By:	emaste, brooks
Approved By:	jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D16844
2018-08-23 18:19:33 +00:00
Alex Richardson
c97e51679b Only bootstrap localedef if ${MK_LOCALES} != "no"
During the build it is only used by share/ctypedef and share/colldef
which will not be built if ${MK_LOCALE} == "no". This saves a tiny bit
of time when building without locales.

Approved By:	jhb (mentor)
2018-08-23 18:19:21 +00:00
Alex Richardson
a00cd9540d Fix non-FreeBSD host lib32 build for TARGET=amd64
When building on non-FreeBSD systems we need to pass an explicit target
triple to clang otherwise it will attempt to build with the host triple.
This also has advantages when building on a FreeBSD host: we now tell
clang that we are targeting at least FreeBSD 12.0 instead of an older
version so it can enable newer features.

Reviewed By:	brooks (mentor)
Approved By:	jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D16842
2018-08-23 18:19:10 +00:00
Alex Richardson
4635180ea7 Allow bootstrapping md5 on Linux, MacOS and FreeBSD < 12
In order to build on a Linux host we need to bootstrap md5 since the Linux
md5sum command produces output in a different format.

Reviewed By:	emaste
Approved By:	brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D16846
2018-08-23 18:19:01 +00:00
Alex Richardson
a52fd948a2 Handle -DNO_ROOT for make compat in include/
Otherwise this step will fail on a Linux host due to missing "wheel" group

Approved By:	brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D16841
2018-08-23 18:18:52 +00:00
Alex Richardson
101db63b42 Don't use absolute path to sed when building usr.bin/join
This is required to build sort on Linux hosts since sed is in /bin there.

Approved By:	jhb (mentor)
2018-08-23 18:18:43 +00:00
Marius Strobl
6daf59aa79 Remove a duplicated interface capability bit missed in r336313. 2018-08-23 18:11:55 +00:00
Kyle Evans
d7f41421d2 Remove hyper-v leftovers when WITHOUT_HYPERV is set
hv_vss_daemon was missed.

Submitted by:	Oliver Pinter
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D16811
2018-08-23 18:06:31 +00:00
Kyle Evans
13eade284e stand: fdt: Drop some write-only assignments/variables and leaked bits
Generally straightforward enough; a copy of argv[1] was being made in
command_fdt_internal, solely used for a comparison within the
handler-search, then promptly leaked.

Reported by:	ports gcc and clang's static analyzer
2018-08-23 18:01:34 +00:00