]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoLinuxKPI: Add vm_fault_t type.
johalun [Tue, 14 May 2019 23:32:02 +0000 (23:32 +0000)]
LinuxKPI: Add vm_fault_t type.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoLinuxKPI: Add context member to ww_mutex and bump FreeBSD version.
johalun [Tue, 14 May 2019 23:21:20 +0000 (23:21 +0000)]
LinuxKPI: Add context member to ww_mutex and bump FreeBSD version.

This patch is part of https://reviews.freebsd.org/D19565.

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoLinuxKPI: Let del_timer return a value to match Linux.
johalun [Tue, 14 May 2019 23:12:14 +0000 (23:12 +0000)]
LinuxKPI: Let del_timer return a value to match Linux.

This patch is part of https://reviews.freebsd.org/D19565.

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoReplace global list for grouplist with list(s) for each exportlist element.
rmacklem [Tue, 14 May 2019 22:00:47 +0000 (22:00 +0000)]
Replace global list for grouplist with list(s) for each exportlist element.

In mountd.c, the grouplist structures are linked into a single global
linked list headed by "grphead". The only use of this linked list is
to free all list elements when the exportlist elements are also all being
free'd at the time the exports are being reloaded.
This patch replaces this one global linked list head with a list head in
each exportlist structure, where the grouplist elements for that exported
file system are linked.
The only change is that now the grouplist elements are free'd with the
associated exportlist element as they are free'd instead of all grouplist
elements being free'd after the exportlist elements are free'd. This
change should have no effect in practice.
This is being done, since a future patch that will add a "-I" option for
incrementally updating the exports in the kernel needs to know which
grouplist elements are associated with each exported file system and
having them linked into a list headed by the exportlist element does that.

MFC after: 1 month

5 years agoClose some races in multicast socket option handling.
markj [Tue, 14 May 2019 21:30:55 +0000 (21:30 +0000)]
Close some races in multicast socket option handling.

r333175 converted the global multicast lock to a sleepable sx lock,
so the lock order with respect to the (non-sleepable) inp lock changed.
To handle this, r333175 and r333505 added code to drop the inp lock,
but this opened races that could leave multicast group description
structures in an inconsistent state.  This change fixes the problem by
simply acquiring the global lock sooner.  Along the way, this fixes
some LORs and bogus error handling introduced in r333175, and commits
some related cleanup.

Reported by: syzbot+ba7c4943547e0604faca@syzkaller.appspotmail.com
Reported by: syzbot+1b803796ab94d11a46f9@syzkaller.appspotmail.com
Reviewed by: ae
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20070

5 years agoFix handling of r10 in Linux ptrace(2). This fixes decoding
trasz [Tue, 14 May 2019 20:59:44 +0000 (20:59 +0000)]
Fix handling of r10 in Linux ptrace(2).  This fixes decoding
of the 'flags' argument to mmap(2) with Linux strace(1).

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

5 years agotuntap: Defer clearing if_softc until after if_detach
kevans [Tue, 14 May 2019 20:32:29 +0000 (20:32 +0000)]
tuntap: Defer clearing if_softc until after if_detach

r346670 added an sx to close a race between the ifioctl handler and
interface destruction. Unfortunately, it clears if_softc immediately after
the interface is closed, but before if_detach has been invoked.

Any time before detachment, an interface that's part of a bridge may still
receive traffic that's pushed through tunstart/tunstart_l2 and promptly
lead to a panic because if_softc is now NULL.

Fix it by deferring the clearing of if_softc until after the interface has
detached and thus been removed from the bridge. if_softc still gets cleared
in case another thread has already entered the ioctl handler before it's
replaced with ifdead_ioctl.

Reported by: markj
MFC after: 3 days

5 years agoSpecify -z notext when building with -z ifunc-noplt.
markj [Tue, 14 May 2019 18:26:39 +0000 (18:26 +0000)]
Specify -z notext when building with -z ifunc-noplt.

The upstream implementation of -z ifunc-noplt disallows its combination
with -z text.  The option does not have much significance for kernel
builds, though.

Reviewed by: kib (previous version)
Discussed with: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20260

5 years agoRemove redundant -Wl uses from the kernel's LDFLAGS.
markj [Tue, 14 May 2019 18:10:32 +0000 (18:10 +0000)]
Remove redundant -Wl uses from the kernel's LDFLAGS.

No functional change intended.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoMitigations for Microarchitectural Data Sampling.
kib [Tue, 14 May 2019 17:02:20 +0000 (17:02 +0000)]
Mitigations for Microarchitectural Data Sampling.

Microarchitectural buffers on some Intel processors utilizing
speculative execution may allow a local process to obtain a memory
disclosure.  An attacker may be able to read secret data from the
kernel or from a process when executing untrusted code (for example,
in a web browser).

Reference: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00233.html
Security: CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091
Security: FreeBSD-SA-19:07.mds
Reviewed by: jhb
Tested by: emaste, lwhsu
Approved by: so (gtetlow)

5 years agoFix some spelling errors in ng_eiface(4).
ygy [Tue, 14 May 2019 15:41:34 +0000 (15:41 +0000)]
Fix some spelling errors in ng_eiface(4).

MFC after: 3 days
PR: 237764
Submitted by: Tom Marcoen <tom.marcoen@gmail.com>

5 years agoFix formatting.
markj [Tue, 14 May 2019 15:19:48 +0000 (15:19 +0000)]
Fix formatting.

MFC after: 3 days

5 years agoRemove bpf interface lock, it is no longer exist.
ae [Tue, 14 May 2019 10:21:28 +0000 (10:21 +0000)]
Remove bpf interface lock, it is no longer exist.

5 years agoRevert r346292 (permit_nonrandom_stackcookies)
cem [Mon, 13 May 2019 23:37:44 +0000 (23:37 +0000)]
Revert r346292 (permit_nonrandom_stackcookies)

We have a better, more comprehensive knob for this now:
kern.random.initial_seeding.bypass_before_seeding=1.

Requested by: delphij
Sponsored by: Dell EMC Isilon

5 years agoloader: fix memory handling errors in module.c
tsoome [Mon, 13 May 2019 22:17:11 +0000 (22:17 +0000)]
loader: fix memory handling errors in module.c

file_loadraw():
check for file_alloc() and strdup() results.
we leak 'name'.

mod_load() does leak 'filename'.

mod_loadkld() does not need to check fp, file_discard() does check.

5 years agoAvoid possible recursion on BPF_LOCK() in bpfwrite().
ae [Mon, 13 May 2019 20:17:55 +0000 (20:17 +0000)]
Avoid possible recursion on BPF_LOCK() in bpfwrite().

Release BPF_LOCK() before invoking if_output() and if_input().
Also enter epoch section before releasing lock, this should prevent
access to ifnet that may be freed on interface detach.

Reported by: markj

5 years agoFortuna: Fix false negatives in is_random_seeded()
cem [Mon, 13 May 2019 19:35:35 +0000 (19:35 +0000)]
Fortuna: Fix false negatives in is_random_seeded()

(1) We may have had sufficient entropy to consider Fortuna seeded, but the
random_fortuna_seeded() function would produce a false negative if
fs_counter was still zero.  This condition could arise after
random_harvestq_prime() processed the /boot/entropy file and before any
read-type operation invoked "pre_read()."  Fortuna's fs_counter variable is
only incremented (if certain conditions are met) by reseeding, which is
invoked by random_fortuna_pre_read().

is_random_seeded(9) was introduced in r346282, but the function was unused
prior to r346358, which introduced this regression.  The regression broke
initial seeding of arc4random(9) and broke periodic reseeding[A], until something
other than arc4random(9) invoked read_random(9) or read_random_uio(9) directly.
(Such as userspace getrandom(2) or read(2) of /dev/random.  By default,
/etc/rc.d/random does this during multiuser start-up.)

(2) The conditions under which Fortuna will reseed (including initial seeding)
are: (a) sufficient "entropy" (by sheer byte count; default 64) is collected
in the zeroth pool (of 32 pools), and (b) it has been at least 100ms since
the last reseed (to prevent trivial DoS; part of FS&K design).  Prior to
this revision, initial seeding might have been prevented if the reseed
function was invoked during the first 100ms of boot.

This revision addresses both of these issues.  If random_fortuna_seeded()
observes a zero fs_counter, it invokes random_fortuna_pre_read() and checks
again.  This addresses the problem where entropy actually was sufficient,
but nothing had attempted a read -> pre_read yet.

The second change is to disable the 100ms reseed guard when Fortuna has
never been seeded yet (fs_lasttime == 0).  The guard is intended to prevent
gratuitous subsequent reseeds, not initial seeding!

Machines running CURRENT between r346358 and this revision are encouraged to
refresh when possible.  Keys generated by userspace with /dev/random or
getrandom(9) during this timeframe are safe, but any long-term session keys
generated by kernel arc4random consumers are potentially suspect.

[A]: Broken in the sense that is_random_seeded(9) false negatives would cause
arc4random(9) to (re-)seed with weak entropy (SHA256(cyclecount ||
FreeBSD_version)).

PR: 237869
Reported by: delphij, dim
Reviewed by: delphij
Approved by: secteam(delphij)
X-MFC-With: r346282, r346358 (if ever)
Security: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20239

5 years agoAdd an UPDATING entry and bump __FreeBSD_version for r347532.
markj [Mon, 13 May 2019 18:48:08 +0000 (18:48 +0000)]
Add an UPDATING entry and bump __FreeBSD_version for r347532.

Reported by: rgrimes, Oliver Pinter <oliver.pinter@hardenedbsd.org>

5 years agoRestore the pre-r347532 behaviour of ignoring wiring failures in mmap().
markj [Mon, 13 May 2019 18:40:01 +0000 (18:40 +0000)]
Restore the pre-r347532 behaviour of ignoring wiring failures in mmap().

The error handling added in r347532 is not right when mapping vnodes
and will be fixed separately.

Reported by: syzbot+1d2cc393bd6c88a548be@syzkaller.appspotmail.com
MFC with: r347532

5 years agoAdd warning to the Linuxulator makefiles that building it outside of a
dchagin [Mon, 13 May 2019 18:28:40 +0000 (18:28 +0000)]
Add warning to the Linuxulator makefiles that building it outside of a
kernel does not make sence.

PR: 222861
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20179

5 years agoLinuxulator depends on a fundamental kernel settings such as SMP. Many
dchagin [Mon, 13 May 2019 18:24:29 +0000 (18:24 +0000)]
Linuxulator depends on a fundamental kernel settings such as SMP. Many
of them listed in opt_global.h which is not generated while building
modules outside of a kernel and such modules never match real cofigured
kernel.

So, we should prevent our users from building obviously defective modules.

Therefore, remove the root cause of the building of modules outside of a
kernel - the possibility of building modules with DEBUG or KTR flags.
And remove all of DEBUG printfs as it is incomplete and in threaded
programms not informative, also a half of system call does not have DEBUG
printf. For debuging Linux programms we have dtrace, ktr and ktrace ability.

PR: 222861
Reviewed by: trasz
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20178

5 years agoLinuxulator getpeername() returns EINVAL in case then namelen less then 0.
dchagin [Mon, 13 May 2019 18:14:20 +0000 (18:14 +0000)]
Linuxulator getpeername() returns EINVAL in case then namelen less then 0.

MFC after: 2 weeks

5 years agoExtend the libcap_sysctl tests.
markj [Mon, 13 May 2019 17:53:03 +0000 (17:53 +0000)]
Extend the libcap_sysctl tests.

- Add some coverage for cap_sysctl(3).
- Add a test for the case where the caller wishes to find the sysctl
  output length without specifying an output buffer.

Reviewed by: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17856

5 years agoConvert the libcap_sysctl test cases to ATF.
markj [Mon, 13 May 2019 17:51:03 +0000 (17:51 +0000)]
Convert the libcap_sysctl test cases to ATF.

Reviewed by: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17855

5 years agoAdd cap_sysctl(3) and cap_sysctlnametomib(3).
markj [Mon, 13 May 2019 17:49:54 +0000 (17:49 +0000)]
Add cap_sysctl(3) and cap_sysctlnametomib(3).

These complement cap_sysctlbyname(3) to provide a drop-in
replacement for the corresponding libc functions.

Also revise the libcap_sysctl limit interface to provide access
to sysctls by MIB, and to avoid direct manipulation of nvlists
by the caller.

Reviewed by: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17854

5 years agoOur bsd_to_linux_sockaddr() and linux_to_bsd_sockaddr() functions
dchagin [Mon, 13 May 2019 17:48:16 +0000 (17:48 +0000)]
Our bsd_to_linux_sockaddr() and linux_to_bsd_sockaddr() functions
alter the userspace sockaddr to convert the format between linux and BSD versions.
That's the minimum 3 of copyin/copyout operations for one syscall.

Also some syscall uses linux_sa_put() and linux_getsockaddr() when load
sockaddr to userspace or from userspace accordingly.

To avoid this chaos, especially converting sockaddr in the userspace,
rewrite these 4 functions to convert sockaddr only in kernel and leave
only 2 of this functions.

Also in order to reduce duplication between MD parts of the Linuxulator put
struct sockaddr conversion functions that are MI out into linux_common module.

PR: 232920
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20157

5 years agoProvide separate accounting for user-wired pages.
markj [Mon, 13 May 2019 16:38:48 +0000 (16:38 +0000)]
Provide separate accounting for user-wired pages.

Historically we have not distinguished between kernel wirings and user
wirings for accounting purposes.  User wirings (via mlock(2)) were
subject to a global limit on the number of wired pages, so if large
swaths of physical memory were wired by the kernel, as happens with
the ZFS ARC among other things, the limit could be exceeded, causing
user wirings to fail.

The change adds a new counter, v_user_wire_count, which counts the
number of virtual pages wired by user processes via mlock(2) and
mlockall(2).  Only user-wired pages are subject to the system-wide
limit which helps provide some safety against deadlocks.  In
particular, while sources of kernel wirings typically support some
backpressure mechanism, there is no way to reclaim user-wired pages
shorting of killing the wiring process.  The limit is exported as
vm.max_user_wired, renamed from vm.max_wired, and changed from u_int
to u_long.

The choice to count virtual user-wired pages rather than physical
pages was done for simplicity.  There are mechanisms that can cause
user-wired mappings to be destroyed while maintaining a wiring of
the backing physical page; these make it difficult to accurately
track user wirings at the physical page layer.

The change also closes some holes which allowed user wirings to succeed
even when they would cause the system limit to be exceeded.  For
instance, mmap() may now fail with ENOMEM in a process that has called
mlockall(MCL_FUTURE) if the new mapping would cause the user wiring
limit to be exceeded.

Note that bhyve -S is subject to the user wiring limit, which defaults
to 1/3 of physical RAM.  Users that wish to exceed the limit must tune
vm.max_user_wired.

Reviewed by: kib, ngie (mlock() test changes)
Tested by: pho (earlier version)
MFC after: 45 days
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19908

5 years agoDo not leak memory used for binary filter.
ae [Mon, 13 May 2019 14:07:02 +0000 (14:07 +0000)]
Do not leak memory used for binary filter.

5 years agoRework locking in BPF code to remove rwlock from fast path.
ae [Mon, 13 May 2019 13:45:28 +0000 (13:45 +0000)]
Rework locking in BPF code to remove rwlock from fast path.

On high packets rate the contention on rwlock in bpf_*tap*() functions
can lead to packets dropping. To avoid this, migrate this code to use
epoch(9) KPI and ConcurrencyKit's lists.

* all lists changed to use CK_LIST;
* reference counting added to bpf_if and bpf_d;
* now bpf_if references ifnet and releases this reference on destroy;
* each bpf_d descriptor references bpf_if when it is attached;
* new struct bpf_program_buffer introduced to keep BPF filter programs;
* bpf_program_buffer, bpf_d and bpf_if structures are freed by
  epoch_call();
* bpf_freelist and ifnet_departure event are no longer needed, thus
  both are removed;

Reviewed by: melifaro
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D20224

5 years agoRevert r347356 and r347371
manu [Mon, 13 May 2019 12:38:33 +0000 (12:38 +0000)]
Revert r347356 and r347371

passwd related files need to be tagged as config file so pkg update
will attempt merging them when we install a new package.
We should use CONFS for that.
Revert for now until I come up with a better version of this patch as
it breaks pkgbase for users.

5 years agoRevert r347402. After r347429 symlink is no longer needed.
ae [Mon, 13 May 2019 08:34:13 +0000 (08:34 +0000)]
Revert r347402. After r347429 symlink is no longer needed.

5 years agoCatch up with r347241.
markj [Mon, 13 May 2019 01:18:17 +0000 (01:18 +0000)]
Catch up with r347241.

MFC with: r347241

5 years agoAdd support for HiFive Unleashed -- the board with a multi-core RISC-V SoC
br [Sun, 12 May 2019 16:17:05 +0000 (16:17 +0000)]
Add support for HiFive Unleashed -- the board with a multi-core RISC-V SoC
from SiFive, Inc.

The first core on this SoC (hart 0) is a 64-bit microcontroller.

o Pick a hart to run boot process using hart lottery.
  This allows to exclude hart 0 from running the boot process.
  (BBL releases hart 0 after the main harts, so it never wins the lottery).
o Renumber CPUs early on boot.
  Exclude non-MMU cores. Store the original hart ID in struct pcpu. This
  allows to find out the correct destination for IPIs and remote sfence
  calls.

Thanks to SiFive, Inc for the board provided.

Reviewed by: markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D20225

5 years agoarm: allwinner: aw_clk_nm: Don't reparent the clock if we didn't ask
manu [Sun, 12 May 2019 15:27:01 +0000 (15:27 +0000)]
arm: allwinner: aw_clk_nm: Don't reparent the clock if we didn't ask

When looking for the best frequency don't change the clock parent if the
clock wasn't configured to do that.

5 years agocache: fix a brainfart in r347505
mjg [Sun, 12 May 2019 07:56:01 +0000 (07:56 +0000)]
cache: fix a brainfart in r347505

If bumping over the counter goes over the limit we have to decrement it back.

Previous code would only bump the counter after adding the entry (thus allowing
the cache to go over the limit).

Sponsored by: The FreeBSD Foundation

5 years agoseqc: fix sed-introduced typos (seqcuence -> sequence)
mjg [Sun, 12 May 2019 07:13:25 +0000 (07:13 +0000)]
seqc: fix sed-introduced typos (seqcuence -> sequence)

Sponsored by: The FreeBSD Foundation

5 years agoamd64: tidy up pagezero*/pagecopy (movq -> movl)
mjg [Sun, 12 May 2019 07:11:44 +0000 (07:11 +0000)]
amd64: tidy up pagezero*/pagecopy (movq -> movl)

Sponsored by: The FreeBSD Foundation

5 years agocache: bump numcache on entry, while here fix lnumcache type
mjg [Sun, 12 May 2019 06:59:22 +0000 (06:59 +0000)]
cache: bump numcache on entry, while here fix lnumcache type

Sponsored by: The FreeBSD Foundation

5 years agoamd64: fixup MEMMOVE comment (10 -> r10)
mjg [Sun, 12 May 2019 06:42:17 +0000 (06:42 +0000)]
amd64: fixup MEMMOVE comment (10 -> r10)

Sponsored by: The FreeBSD Foundation

5 years agocache: push sdt probes in cache_zap_locked to code doing the work
mjg [Sun, 12 May 2019 06:39:30 +0000 (06:39 +0000)]
cache: push sdt probes in cache_zap_locked to code doing the work

Avoids branching to check which probe to evaluate. Very same check was
being done later to do the actual work.

Sponsored by: The FreeBSD Foundation

5 years agox86: store pending bitmapped IPIs in per-cpu areas
mjg [Sun, 12 May 2019 06:36:54 +0000 (06:36 +0000)]
x86: store pending bitmapped IPIs in per-cpu areas

This gets rid of the global cpu_ipi_pending array.

While replace cmpset with fcmpset in the delivery code and opportunistically
check if given IPI is already pending.

Sponsored by: The FreeBSD Foundation

5 years agoamd64: stop re-reading curpc in suword
mjg [Sun, 12 May 2019 06:34:58 +0000 (06:34 +0000)]
amd64: stop re-reading curpc in suword

Plugs re-reads missed in r341719

Sponsored by: The FreeBSD Foundation

5 years agorandom(4): depessimize arc4random
mjg [Sun, 12 May 2019 06:32:46 +0000 (06:32 +0000)]
random(4): depessimize arc4random

- __predict_false reseeding on entry as it is almost never true.
- don't blindly atomic_cmpset as on x86 it ends up dirtying the cacheline.
it almost ever succeeds per above
- fetch the timestamp prior to getting the cpu number

Reviewed by: cem
Approved by: secteam (delphij)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20242

5 years agoFactor code into two new functions in preparation for a future commit.
rmacklem [Sat, 11 May 2019 22:41:58 +0000 (22:41 +0000)]
Factor code into two new functions in preparation for a future commit.

Factor code into two functions.
read_exportfile() a functon  which reads the exports file(s) and calls
get_exportlist_one() to process each of them.
delete_export() a function which deletes the exports in the kernel for a file
system.
The contents of these functions is just the same code as was used to do the
operations, moved into separate functions. As such, there is no semantic change.
This is being done in preparation for a future commit that will add an
option to do incremental changes of kernel exports upon receiving SIGHUP.

MFC after: 1 month

5 years agoCorrect a handful of typos.
schweikh [Sat, 11 May 2019 19:31:54 +0000 (19:31 +0000)]
Correct a handful of typos.

5 years agoSupport the use of the ipsec kld.
cy [Sat, 11 May 2019 17:59:13 +0000 (17:59 +0000)]
Support the use of the ipsec kld.

X-MFC with: r347410

5 years agoA new parameter to blist_alloc specifies an upper bound on the size of
dougm [Sat, 11 May 2019 16:15:13 +0000 (16:15 +0000)]
A new parameter to blist_alloc specifies an upper bound on the size of
the allocation request, so that the blocks allocated are from the next
set of free blocks big enough to satisfy the minimum requirements of
the request, and the number of blocks allocated are as many as
possible, up to the specified maximum. The implementation of
swp_pager_getswapspace uses this parameter to ask for a number of
blocks between the new halved request size and the previous failed
request size. Thus a request for 32 blocks may fail, but instead of
getting only 16 blocks instead, the caller asks for 16 to 31 next, and
might get 19 or 27, which is closer to what they originally wanted.

I expect this to lead to bigger block allocations and less block
fragmentation, at least in some cases.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20001

5 years agorevert r346588 for now
jhibbits [Sat, 11 May 2019 15:17:42 +0000 (15:17 +0000)]
revert r346588 for now

The rewrite of strcmp in assembly uses an instruction added in PowerISA
2.05, making it SIGILL on CPUs older than the POWER6, such as the PPC970 in
the PowerMac G5.  Revert this until we get clang+lld, or retire the in-tree
binutils in favor of newer binutils with IFUNC support, whichever comes
first.

5 years agotwsi: Calculate the clock param based on the bus frequency
manu [Sat, 11 May 2019 15:03:51 +0000 (15:03 +0000)]
twsi: Calculate the clock param based on the bus frequency

Instead of precalculating the different speed, respect the bus frequency
and calculate the clock register parameter based on it.
If the platform didn't register the core clk, fallback on the precomputed
values (This is likely do be the case on Marvell boards).

5 years agoallwinner: clk: sun8i_r: Correct resets
manu [Sat, 11 May 2019 15:02:55 +0000 (15:02 +0000)]
allwinner: clk: sun8i_r: Correct resets

The i2c reset wasn't defined and some bits where wrong, correct them.

5 years agoallwinner: clk: prediv_mux: Init the current parent
manu [Sat, 11 May 2019 15:02:20 +0000 (15:02 +0000)]
allwinner: clk: prediv_mux: Init the current parent

Do not init the first parent but read the clock register to find
it's current parent and init this one.

5 years agoUpdate leap-seconds to leap-seconds.3757622400.
delphij [Sat, 11 May 2019 14:22:21 +0000 (14:22 +0000)]
Update leap-seconds to leap-seconds.3757622400.

As per https://datacenter.iers.org/data/latestVersion/16_BULLETIN_C16.txt:

     INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)

SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE

SERVICE DE LA ROTATION TERRESTRE DE L'IERS
OBSERVATOIRE DE PARIS
61, Av. de l'Observatoire 75014 PARIS (France)
Tel.      : +33 1 40 51 23 35
e-mail    : services.iers@obspm.fr
http://hpiers.obspm.fr/eop-pc

                                              Paris, 07 January 2019

                                              Bulletin C 57

                                              To authorities responsible
                                              for the measurement and
                                              distribution of time

                          INFORMATION ON UTC - TAI

 NO leap second will be introduced at the end of June 2019.
 The difference between Coordinated Universal Time UTC and the
 International Atomic Time TAI is :

     from 2017 January 1, 0h UTC, until further notice : UTC-TAI = -37 s

 Leap seconds can be introduced in UTC at the end of the months of December
 or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
 six months, either to announce a time step in UTC, or to confirm that there
 will be no time step at the next possible date.

                                            Christian BIZOUARD
                                            Director
                                            Earth Orientation Center of IERS
    Observatoire de Paris, France

Requested by: rgrimes
Obtained from: ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.3757622400
MFC after: 3 days

5 years agoCallers of swp_pager_getswapspace get either as many blocks as they
dougm [Sat, 11 May 2019 10:16:43 +0000 (10:16 +0000)]
Callers of swp_pager_getswapspace get either as many blocks as they
requested, or none, and in the latter case it is up to them to pick a
smaller request to make - which they always do by halving the failed
request. This change to swp_pager_getswapspace leaves the task of
downsizing the request to the function and not its caller. It still
does so by halving the original request.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20228

5 years agoWhen bitpos can't be implemented with an inline ffs* instruction,
dougm [Sat, 11 May 2019 09:09:10 +0000 (09:09 +0000)]
When bitpos can't be implemented with an inline ffs* instruction,
change the binary search so that it does not depend on a single bit
only being set in the bitmask. Use bitpos more generally, and avoid
some clearing of bits to accommodate its current behavior.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20237

5 years agotuntap: Improve style
kevans [Sat, 11 May 2019 04:18:06 +0000 (04:18 +0000)]
tuntap: Improve style

No functional change.

tun_flags of the tuntap_driver was renamed to ident_flags to reflect the
fact that it's a subset of the tun_flags that identifies a tuntap device.
This maps more easily (visually) to the TUN_DRIVER_IDENT_MASK that masks off
the bits of tun_flags that are applicable to tuntap driver ident. This is a
purely cosmetic change.

5 years agoRevert r347469.
dougm [Sat, 11 May 2019 02:13:52 +0000 (02:13 +0000)]
Revert r347469.

Approved by: kib (mentor)

5 years agoFactor out some exportlist list operations into separate functions.
rmacklem [Fri, 10 May 2019 23:52:17 +0000 (23:52 +0000)]
Factor out some exportlist list operations into separate functions.

This patch moves the code that removes and frees all exportlist elements
out into a separate function called free_exports().
It does the same for the insertion of a new exportlist entry into a list.
It also adds a second argument to ex_search() for the list to use.
None of these changes have any semantic effect. They are being done to
prepare the code for future patches that convert the single linked list
for the exportlist to a hash table of lists and a patch that will do
incremental changes of exports in the kernel.
And it fixes the argument for SLIST_HEAD_INITIALIZER() to be a pointer,
which doesn't really matter, since SLIST_HEAD_INITIALIZER() doesn't use
the argument.

MFC after: 1 month

5 years agonetdump: Ref the interface we're attached to
cem [Fri, 10 May 2019 23:12:59 +0000 (23:12 +0000)]
netdump: Ref the interface we're attached to

Serialize netdump configuration / deconfiguration, and discard our
configuration when the affiliated interface goes away by monitoring
ifnet_departure_event.

Reviewed by: markj, with input from vangyzen@ (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20206

5 years agoDon't use _Generic, as many systems don't know about it. Go back to a lo-tech switch...
dougm [Fri, 10 May 2019 23:12:37 +0000 (23:12 +0000)]
Don't use _Generic, as many systems don't know about it.  Go back to a lo-tech switch statement.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20235

5 years agonetdump: Fix boot-time configuration typo
cem [Fri, 10 May 2019 23:10:22 +0000 (23:10 +0000)]
netdump: Fix boot-time configuration typo

Boot-time netdump configuration is much more useful if one can configure the
client and gateway addresses.  Fix trivial typo.

(Long-standing bug, I believe it dates to the original netdump commit.)

Spotted by: one of vangyzen@ or markj@
Sponsored by: Dell EMC Isilon

5 years agoImplement linux_pci_unregister_drm_driver in linuxkpi so that drm drivers
johalun [Fri, 10 May 2019 23:10:22 +0000 (23:10 +0000)]
Implement linux_pci_unregister_drm_driver in linuxkpi so that drm drivers
can be unloaded.

This patch is a part of D19565.

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoWhen bitpos can't be implemented with an inline ffs* instruction,
dougm [Fri, 10 May 2019 22:49:01 +0000 (22:49 +0000)]
When bitpos can't be implemented with an inline ffs* instruction,
change the binary search so that it does not depend on a single bit
only being set in the bitmask. Use bitpos more generally, and avoid
some clearing of bits to accommodate its current behavior.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20232

5 years agoAdd a (q)uit option to the subr_blist test program.
dougm [Fri, 10 May 2019 22:02:29 +0000 (22:02 +0000)]
Add a (q)uit option to the subr_blist test program.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20234

5 years agonetdump: Don't store sensitive key data we don't need
cem [Fri, 10 May 2019 21:55:11 +0000 (21:55 +0000)]
netdump: Don't store sensitive key data we don't need

Prior to this revision, struct diocskerneldump_arg (and struct netdump_conf
with embedded diocskerneldump_arg before r347192), were copied in their
entirety to the global 'nd_conf' variable.  Also prior to this revision,
de-configuring netdump would *not* remove the the key material from global
nd_conf.

As part of Encrypted Kernel Crash Dumps (EKCD), which was developed
contemporaneously with netdump but happened to land first, the
diocskerneldump_arg structure will contain sensitive key material
(kda_key[]) when encrypted dumps are configured.

Netdump doesn't have any use for the key data -- encryption is handled in
the core dumper code -- so in this revision, we no longer store it.

Unfortunately, I think this leak dates to the initial import of netdump in
r333283; so it's present in FreeBSD 12.0.

Fortunately, the impact *seems* relatively minor.  Any new *netdump*
configuration would overwrite the key material; for active encrypted netdump
configurations, the key data stored was just a duplicate of the key material
already in the core dumper code; and no user interface (other than
/dev/kmem) actually exposed the leaked material to userspace.

Reviewed by: markj, rpokala (earlier commit message)
MFC after: 2 weeks
Security: yes (minor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20233

5 years agoFix regression from r347375: do not panic when sending an IP multicast
glebius [Fri, 10 May 2019 21:51:17 +0000 (21:51 +0000)]
Fix regression from r347375: do not panic when sending an IP multicast
packet from an interface that doesn't have IPv4 address.

Reported by: Michael Butler <imb protected-networks.net>

5 years agoApply r280991 to ip6_fragment.
jhb [Fri, 10 May 2019 20:15:40 +0000 (20:15 +0000)]
Apply r280991 to ip6_fragment.

This uses m_dup_pkthdr() to copy all of the metadata about a packet to
each of its fragments including VLAN tags, mbuf tags, etc. instead of
hand-copying a few fields.

Reviewed by: bz
MFC after: 1 month
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20117

5 years agoReplace the expression "-mask & ~mask" with a function call that does
dougm [Fri, 10 May 2019 19:55:29 +0000 (19:55 +0000)]
Replace the expression "-mask & ~mask" with a function call that does
the same thing, but is commented so that it might be better
understood.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20231

5 years agopowerpc: Initialize the Hardware Interrupt Offset Register (HIOR) earlier for ppc970
jhibbits [Fri, 10 May 2019 19:36:14 +0000 (19:36 +0000)]
powerpc: Initialize the Hardware Interrupt Offset Register (HIOR) earlier for ppc970

Since we now have a much larger KVA on powerpc64, it's possible to get SLB
traps earlier in boot, possibly even before the HIOR is properly configured
for us.  Move the HIOR setup to immediately after reset, so that we use our
exception handlers instead of Open Firmware's.

PR: 233863
Submitted by: Mark Millard (partial)
Reported by: Mark Millard
MFC after: 2 weeks

5 years agoblist_next_leaf_alloc walks over all the meta-nodes between one leaf
dougm [Fri, 10 May 2019 18:25:06 +0000 (18:25 +0000)]
blist_next_leaf_alloc walks over all the meta-nodes between one leaf
and the next one, and if blocks are allocated from the next leaf, it
walks back toward where it started, as long as there are interleaving
meta-nodes to be updated on account of the last free blocks under
those meta-nodes being allocated. Only if the walk goes all the way
back to the starting point must we calculate the position of the
meta-node that is the least-comment parent of one leaf and the next,
and update a bit in that meta-node to indicate the allocation of its
last free block.

There's no need to start calculating the position of that least-common
parent until the walk back reaches the original starting point, and
there's no need for a calculation that updates 'radius' to tell us
when we've walked back to the beginning, since comparing scan to next
suffices for that.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20229

5 years agoReplace panic() with KASSERT() and provide more useful information when failure happens.
dougm [Fri, 10 May 2019 18:22:40 +0000 (18:22 +0000)]
Replace panic() with KASSERT() and provide more useful information when failure happens.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20226

5 years agoFix build race with machine links and genoffset.o.
bdrewery [Fri, 10 May 2019 18:09:27 +0000 (18:09 +0000)]
Fix build race with machine links and genoffset.o.

Generate the ilinks for all dependency objects not just the ones
in the CLEAN list.

Possibly related to r345351

Reported by: kmoore
MFC after: 2 weeks
X-MFC-with: r345351
Sponsored by: Dell EMC Isilon

5 years agoFix build issue with clang 8.0.1
luporl [Fri, 10 May 2019 17:05:40 +0000 (17:05 +0000)]
Fix build issue with clang 8.0.1

The algorithm header is needed to use std::remove_if

5 years agoarm64: rockchip: Don't always put PLL to normal mode
manu [Fri, 10 May 2019 16:45:17 +0000 (16:45 +0000)]
arm64: rockchip: Don't always put PLL to normal mode

We used to put every PLL in normal mode (meaning that the output would
be the result of the PLL configuration) instead of slow mode (the output
is equal to the external oscillator frequency, 24-26Mhz) but this doesn't
work for most of the PLLs as when we put them into normal mode the registers
configuring the output frequency haven't been set.
Add a normal_mode member in clk_pll_def/clk_pll_sc struct and if it's true
we then set the PLL to normal mode.
For now only set it to the LPLL and BPLL (Little cluster PLL and Big cluster
PLL respectively).

Reviewed by: ganbold
Differential Revision: https://reviews.freebsd.org/D20174

5 years agoefibootmgr: Do not add the new boot entry in dry-run is specified
manu [Fri, 10 May 2019 16:44:35 +0000 (16:44 +0000)]
efibootmgr: Do not add the new boot entry in dry-run is specified

While here fix a typo.

Sponsored-by: Ampere Computing, LLC
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D20212

5 years agoahci: Check if bus is cache-coherent
manu [Fri, 10 May 2019 16:43:53 +0000 (16:43 +0000)]
ahci: Check if bus is cache-coherent

We do this for FDT systems but not for ACPI ones.
Check the presence of the _CCA attribute.

Sponsored by: Ampere Computing, LLC
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D20144

5 years agoAtomically update the global gMsgId in libnetgraph.
markj [Fri, 10 May 2019 16:43:47 +0000 (16:43 +0000)]
Atomically update the global gMsgId in libnetgraph.

Otherwise concurrently running threads may inadvertently use the same
token for different messages.

Preserve the behaviour of disallowing negative message tokens, but allow
a message token value of zero since this simplifies the code a bit and
tokens are documented to be non-negative.

PR: 234442
Reported and tested by: eugen
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

5 years agoA major change to subr_blist.c failed to update all the comments about
dougm [Fri, 10 May 2019 16:01:25 +0000 (16:01 +0000)]
A major change to subr_blist.c failed to update all the comments about
changes to struct fields. Update those now.

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

5 years agoBind TCP HPTS (pacer) threads to NUMA domains
gallatin [Fri, 10 May 2019 13:41:19 +0000 (13:41 +0000)]
Bind TCP HPTS (pacer) threads to NUMA domains

Bind the TCP pacer threads to NUMA domains and build per-domain
pacer-thread lookup tables. These tables allow us to use the
inpcb's NUMA domain information to match an inpcb with a pacer
thread on the same domain.

The motivation for this is to keep the TCP connection local to a
NUMA domain as much as possible.

Thanks to jhb for pre-reviewing an earlier version of the patch.

Reviewed by: rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20134

5 years agoifconfig(8): Add kld mappings for ipsec/enc
kevans [Fri, 10 May 2019 13:18:22 +0000 (13:18 +0000)]
ifconfig(8): Add kld mappings for ipsec/enc

Additionally, providing mappings makes the comparison for already loaded
modules a little more strict. This should have been done at initial
introduction, but there was no real reason- however, it proves necessary for
enc which has a standard enc -> if_enc mapping but there also exists an
'enc' module that's actually CAM. The mapping lets us unambiguously
determine the correct module.

Discussed with: ae
MFC after: 4 days

5 years agoRISC-V ISA does not specify how to manage physical memory attributes (PMA).
br [Fri, 10 May 2019 11:21:57 +0000 (11:21 +0000)]
RISC-V ISA does not specify how to manage physical memory attributes (PMA).
So do nothing in pmap_page_set_memattr() and don't panic.

Reviewed by: markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D20209

5 years agoTry to unbreak the build after r347425.
trasz [Fri, 10 May 2019 08:16:29 +0000 (08:16 +0000)]
Try to unbreak the build after r347425.

MFC after: 2 weeks

5 years agoAdd simple regression tests for tree(3). Those are ATF-ified versions
trasz [Fri, 10 May 2019 07:46:14 +0000 (07:46 +0000)]
Add simple regression tests for tree(3).  Those are ATF-ified versions
of OpenBSD's regress/sys/sys/tree/.

Reviewed by: ngie
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D20186

5 years agoAvoid returning a NULL pointer from the Intel hw PRNG ifunc resolver.
markj [Fri, 10 May 2019 04:28:17 +0000 (04:28 +0000)]
Avoid returning a NULL pointer from the Intel hw PRNG ifunc resolver.

DTrace expects kernel function symbols of a non-zero size to have an
implementation, which is a reasonable invariant to preserve.

Reported and tested by: ler
Reviewed by: cem, kib
Approved by: so (delphij)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20218

5 years agoAllow dcons(4) to be unloaded when loaded as a module.
ian [Fri, 10 May 2019 02:30:16 +0000 (02:30 +0000)]
Allow dcons(4) to be unloaded when loaded as a module.

When the module is unloaded, the tty devices are destroyed.  That requires
implementing the tsw_free callback to avoid a panic.  This driver requires
no particular cleanup to be done from the callback, but the module itself
must remain in memory until the deferred tsw_free callbacks are invoked.
These changes implement that by incrementing a reference count variable in
the detach routine, and decrementing it in the tsw_free callback.  The
MOD_UNLOAD event handler doesn't return until the count drops to zero.

PR: 237758

5 years agoiflib: use default ntxd and nrxd when user value is not power of 2
erj [Fri, 10 May 2019 00:41:42 +0000 (00:41 +0000)]
iflib: use default ntxd and nrxd when user value is not power of 2

From Jake:
A user may set a sysctl to override the default number of Tx or Rx
descriptors. However, certain calculations in the iflib core expect the
number of descriptors to be a power of 2.

Update _iflib_assert to verify that all of the shared context parameters
for the number of descriptors are powers of 2.

Modify iflib_reset_qvalues to check that the provided isc_nrxd value is
a power of 2. If it's not, print a warning message and then use the
default value.

An alternative might be to try rounding the number down instead.
However, this creates problems in case the rounded down value is below
the minimum value that the driver would support.

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: marius@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D19880

5 years agoRefactor tests/sys/opencrypto/runtests
ngie [Fri, 10 May 2019 00:03:32 +0000 (00:03 +0000)]
Refactor tests/sys/opencrypto/runtests

* Convert from plain to TAP for slightly improved introspection when skipping
  the tests due to requirements not being met.
* Test for the net/py-dpkt (origin) package being required when running the
  tests, instead of relying on a copy of the dpkt.py module from 2014. This
  enables the tests to work with py3. Subsequently, remove
  `tests/sys/opencrypto/dpkt.py(c)?` via `make delete-old`.
* Parameterize out `python2` as `$PYTHON`.

PR: 237403
MFC after: 1 week

5 years agoMFV: r347413
jkim [Thu, 9 May 2019 23:03:10 +0000 (23:03 +0000)]
MFV: r347413

Import ACPICA 20190509.

5 years agoRemove IPSEC from GENERIC due to performance issues
gallatin [Thu, 9 May 2019 22:38:15 +0000 (22:38 +0000)]
Remove IPSEC from GENERIC due to performance issues

Having IPSEC compiled into the kernel imposes a non-trivial
performance penalty on multi-threaded workloads due to IPSEC
refcounting. In my benchmarks of multi-threaded UDP
transmit (connected sockets), I've seen a roughly 20% performance
penalty when the IPSEC option is included in the kernel (16.8Mpps
vs 13.8Mpps with 32 senders on a 14 core / 28 HTT Xeon
2697v3)). This is largely due to key_addref() incrementing and
decrementing an atomic reference count on the default
policy. This cause all CPUs to stall on the same cacheline, as it
bounces between different CPUs.

Given that relatively few users use ipsec, and that it can be
loaded as a module, it seems reasonable to ask those users to
load the ipsec module so as to avoid imposing this penalty on the
GENERIC kernel. Its my hope that this will make FreeBSD look
better in "out of the box" benchmark comparisons with other
operating systems.

Many thanks to ae for fixing auto-loading of ipsec.ko when
ifconfig tries to configure ipsec, and to cy for volunteering
to ensure the the racoon ports will load the ipsec.ko module

Reviewed by: cem, cy, delphij, gnn, jhb, jpaetzel
Differential Revision: https://reviews.freebsd.org/D20163

5 years agolibsecureboot: make it easier to customize trust anchors
sjg [Thu, 9 May 2019 22:25:12 +0000 (22:25 +0000)]
libsecureboot: make it easier to customize trust anchors

Avoid making hash self-tests depend on X.509 certs.
Include OpenPGP keys in trust store count.

Reviewed by: stevek
MFC after: 1 week
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org/D20208

5 years agoDon't use C++ style comments.
tuexen [Thu, 9 May 2019 21:00:15 +0000 (21:00 +0000)]
Don't use C++ style comments.

These where introduced in r347382.
Reported by: ngie@

5 years agonfsd.8: Fix mandoc -Tlint and igor warnings
0mp [Thu, 9 May 2019 19:03:52 +0000 (19:03 +0000)]
nfsd.8: Fix mandoc -Tlint and igor warnings

- Remove Tn macros
- Refernce sysctl(8) instead of sysctl(1)
- Start new sentences on new lines
- Capitalize NFS where needed
- Use Fx for FreeBSD
- Remove a list block (Bl) that was added to the manual page
  by accident in r335174

Reviewed by: bcr
Approved by: doc (bcr)
Differential Revision: https://reviews.freebsd.org/D20215

5 years agotuntap: Don't down tap interfaces if LINK0 is set
kevans [Thu, 9 May 2019 18:54:29 +0000 (18:54 +0000)]
tuntap: Don't down tap interfaces if LINK0 is set

5 years agoAdd if_ipsec.ko symlink to ipsec.ko kernel module.
ae [Thu, 9 May 2019 18:06:11 +0000 (18:06 +0000)]
Add if_ipsec.ko symlink to ipsec.ko kernel module.

This add ability to automatically load ipsec kernel module, when
if_ipsec(4) virtual interface is created using ifconfig(8).

Reviewed by: gallatin
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20169

5 years agotuntap: Properly detach tap ifp
kevans [Thu, 9 May 2019 14:06:24 +0000 (14:06 +0000)]
tuntap: Properly detach tap ifp

5 years agoloader: use DPRINTF in biosdisk.c and define safe DPRINTF
tsoome [Thu, 9 May 2019 13:12:43 +0000 (13:12 +0000)]
loader: use DPRINTF in biosdisk.c and define safe DPRINTF

r345066 did miss biosdisk.c.

Also define DPRINTF as ((void)0) for case we do not want debug printouts.

MFC after: 1 week

5 years agoifconfig(8): Partial revert of r347241
kevans [Thu, 9 May 2019 12:58:33 +0000 (12:58 +0000)]
ifconfig(8): Partial revert of r347241

r347241 introduced an ifname <-> kld mapping table, mostly so tun/tap/vmnet
can autoload the correct module on use. It also inadvertently made bogus
some previously valid uses of sizeof().

Revert back to ifkind on the stack for simplicity sake. This reduces the
diff from the previous version of ifmaybeload for easiser auditing.

5 years agoloader: no-TERM_EMU is broken now
tsoome [Thu, 9 May 2019 12:14:52 +0000 (12:14 +0000)]
loader: no-TERM_EMU is broken now

If TERM_EMU is not defined, we do not have curx variable. Use conout mode
for efi and expose get_pos() for i386.

5 years ago- Merge r338254 from cxgbe(4):
marius [Thu, 9 May 2019 11:34:46 +0000 (11:34 +0000)]
- Merge r338254 from cxgbe(4):
  Use fcmpset instead of cmpset when appropriate.
- Revert r277226 of cxgbe(4), obsolete since r334320.

5 years agoloader: ptable_print() needs two tabs sometimes
tsoome [Thu, 9 May 2019 11:04:10 +0000 (11:04 +0000)]
loader: ptable_print() needs two tabs sometimes

Since the partition/slice names do vary in length, check the length
of the fixed part of the line against 3 * 8, if the lenth is less than
3 tab stops, print out extra tab.

use snprintf() instead of sprintf.

5 years agoloader: implement proper 8 char tab stops
tsoome [Thu, 9 May 2019 10:37:57 +0000 (10:37 +0000)]
loader: implement proper 8 char tab stops

The current console code is printing out 8 spaces for tab, calculate
the amount of spaces based on tab stops.