]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoClamp tuklib_physmem() return value to SIZE_T_MAX.
kib [Sun, 6 Jan 2019 23:59:04 +0000 (23:59 +0000)]
Clamp tuklib_physmem() return value to SIZE_T_MAX.

On 32bit platforms it is possible to have (much) more physical RAM
than is mappable into single address space.  In this case liblzma
scales the value into a request to mmap more address space than it is
theoretically possible.

Reported and tested by: pho
Reviewed by: delphij
Discussed with: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoasmc: Add support for Mac mini 4,1 (Mid-2010)
dab [Sun, 6 Jan 2019 23:43:12 +0000 (23:43 +0000)]
asmc: Add support for Mac mini 4,1 (Mid-2010)

MFC after: 1 week

5 years agogetconf(1): Minor mdoc fix
jilles [Sun, 6 Jan 2019 21:43:14 +0000 (21:43 +0000)]
getconf(1): Minor mdoc fix

MFC after: 1 week

5 years agothr_wake(2): Minor mdoc fixes
jilles [Sun, 6 Jan 2019 21:34:05 +0000 (21:34 +0000)]
thr_wake(2): Minor mdoc fixes

MFC after: 1 week

5 years agoRemove ipsd (IP Scan Detetor). It is unused and to my knowledge has
cy [Sun, 6 Jan 2019 21:24:44 +0000 (21:24 +0000)]
Remove ipsd (IP Scan Detetor). It is unused and to my knowledge has
never been used on any platform that ipfilter has been on. However
it looks like it could be a useful utility, therefore there are plans
to make it a port one day. It lacks a man page as well.

MFC after: 1 month

5 years agoRemove unneeded assert.h (there is no assertion in this file).
delphij [Sun, 6 Jan 2019 20:42:09 +0000 (20:42 +0000)]
Remove unneeded assert.h (there is no assertion in this file).

MFC after: 2 weeks

5 years agoRemove unneeded headers.
delphij [Sun, 6 Jan 2019 20:39:23 +0000 (20:39 +0000)]
Remove unneeded headers.

MFC after: 1 month

5 years agoGive sh(1) a proper default prompt instead of just "$".
trasz [Sun, 6 Jan 2019 16:23:28 +0000 (16:23 +0000)]
Give sh(1) a proper default prompt instead of just "$".

Reviewed by: jilles
MFC after: 2 weeks
Relnotes: totally
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18697

5 years agodtsec: Fix formatting of addresses in translation error messages
jhibbits [Sun, 6 Jan 2019 05:07:52 +0000 (05:07 +0000)]
dtsec: Fix formatting of addresses in translation error messages

Don't clamp addresses to 8 hex digits, particularly since this is primarily
used now on a 64-bit platform.

MFC after: 1 week

5 years agopowerd(8): allow to force a method of battery state query
avos [Sun, 6 Jan 2019 02:39:03 +0000 (02:39 +0000)]
powerd(8): allow to force a method of battery state query

This change allows to determine power source via sysctl or /dev/apm
when devd(8) is running (used by default).

Based on patch from PR; other changes on top of it:
- '-f' (force) -> '-s' (source) parameter renaming;
- allow 'apm' -> 'devd' transition when '-s devd' is set
(if APM is enabled);
- man page update.

Checked on amd64 with -s devd / sysctl and apm
(an extra build with forced USE_APM define set was done)

PR: 125707
Submitted by: Konstantin Stepanov <milezv@yandex.ru>
Reviewed by: bcr, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18742

5 years agorc.subr: Fix typo
kevans [Sun, 6 Jan 2019 01:39:01 +0000 (01:39 +0000)]
rc.subr: Fix typo

Originally intended as 'in case in needs to be re-invoked', but it was later
decided (by myself) that 're-invoke itself' makes it more clear that the
script is expected to use this in a way.

Reported by: Jose Luis Duran (jlduran @ github)
X-MFC-With: r342792

5 years agoMK_ZFS -> {MK_ZFS|MK_LOADER_ZFS}, this is so we can diable userland / kernel
mmacy [Sat, 5 Jan 2019 22:45:20 +0000 (22:45 +0000)]
MK_ZFS -> {MK_ZFS|MK_LOADER_ZFS}, this is so we can diable userland / kernel
ZFS but keep the boot-loaders when using ZoL port.

MFC after: 1 week
Reviewed by: rgrimes
Differential Revision: https://reviews.freebsd.org/D18739

5 years agorc.subr: Provide rc_service variable for service scripts
kevans [Sat, 5 Jan 2019 21:23:25 +0000 (21:23 +0000)]
rc.subr: Provide rc_service variable for service scripts

Some rc scripts in ports (e.g. uwsgi, apache, openvpn) allow for
'application profiles' that usually require the rc script to be invoked
again for each active profile. Because there's no consistent way to
determine the path because it differs between manual/service(8) invocations
and /etc/rc invocations, this leads to patterns like these:

- www/uwsgi hardcodes the script path
- security/openvpn guesses either $_file or $0 based on $0 = /etc/rc

Instead of forcing rc scripts to guess, provide an rc_service variable to
the scripts that gets set appropriately both for direct execution or when a
script is being executed via run_rc_script (e.g. /etc/rc).

This is our analog of an OpenRC variable with the same name, different case
(RC_SERVICE).

PR: 234614
Reported by: koobs
Reviewed by: dteske, jilles
MFC after: 3 days

5 years agoFix an old typo in the element status display bits:
joerg [Sat, 5 Jan 2019 21:07:49 +0000 (21:07 +0000)]
Fix an old typo in the element status display bits:

INEAB -> INENAB (import is eNabled)

Note that this kernel definition is exported into chio(1), and used
for element display there.

MFC after: 1 week

5 years agoCapsicumize rtsol(8) and rtsold(8).
markj [Sat, 5 Jan 2019 16:05:39 +0000 (16:05 +0000)]
Capsicumize rtsol(8) and rtsold(8).

These programs parse ND6 Router Advertisement messages; rtsold(8) has
required an SA, SA-14:20.rtsold, for a bug in this code.  Thus, they
are good candidates for sandboxing.

The approach taken is to run the main executable in capability mode
and use Casper services to provide functionality that cannot be
implemented within the sandbox.  In particular, several custom services
were required.

- A Casper service is used to send Router Solicitation messages on a
  raw ICMP6 socket.  Initially I took the approach of creating a
  socket for each interface upon startup, and connect(2)ing it to
  the all-routers multicast group for the interface.  This permits
  the use of sendmsg(2) in capability mode, but only works if the
  interface's link is up when rtsol(d) starts.  So, instead, the
  rtsold.sendmsg service is used to transmit RS messages on behalf
  of the main process.  One could alternately define a service
  which simply creates and connects a socket for each destination
  address, and returns the socket to the sandboxed process.  However,
  to implement rtsold's -m option we also need to read the ND6 default
  router list, and this cannot be done in capability mode.
- rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
  options in received RA messages.  A Casper service is used to
  fork and exec resolvconf(8), and to reap the child process.
- A service is used to determine whether a given interface's
  link-local address is useable (i.e., not duplicated or undergoing
  DAD).  This information is supplied by getifaddrs(3), which reads
  a sysctl not available in capability mode.  The SIOCGIFCONF socket
  ioctl provides equivalent information and can be used in capability
  mode, but I decided against it for now because of some limitations
  of that interface.

In addition to these new services, cap_syslog(3) is used to send
messages to syslogd.

Reviewed by: oshogbo
Tested by: bz (previous versions)
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17572

5 years agoAdd a bounds check to the tws(4) passthrough ioctl handler.
markj [Sat, 5 Jan 2019 15:28:20 +0000 (15:28 +0000)]
Add a bounds check to the tws(4) passthrough ioctl handler.

tws_passthru() was doing a copyin of a user-specified request
without validating its length, so a malicious request could overrun
the buffer.  By default, the tws(4) device file is only accessible
as root.

admbug: 825
Reported by: Anonymous of the Shellphish Grill Team
Reviewed by: delphij
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18536

5 years agoWith buggy int13 ah=15, we can mis-identify the floppy devices.
tsoome [Sat, 5 Jan 2019 07:20:00 +0000 (07:20 +0000)]
With buggy int13 ah=15, we can mis-identify the floppy devices.

We have no option than trust INT13 ah=08 return code during the init phase.

PR: 234460
Reported by: Oleh Hushchenkov
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18723

5 years agopf: Remove references to pflow from the pf.conf man page
kp [Sat, 5 Jan 2019 05:50:16 +0000 (05:50 +0000)]
pf: Remove references to pflow from the pf.conf man page

pflow no longer exists. It was removed as part of a pf update back in 2012
(r240233).

PR: 223957
MFC after: 1 week

5 years agoRemove unneeded NULL check for td_ucred
kp [Fri, 4 Jan 2019 21:12:17 +0000 (21:12 +0000)]
Remove unneeded NULL check for td_ucred

td_ucred is always set, so we don't need the ternary expression to check for
it.

5 years agoReduce timeout for reading the USB HUB port status to 1000ms and try to filter
hselasky [Fri, 4 Jan 2019 21:09:38 +0000 (21:09 +0000)]
Reduce timeout for reading the USB HUB port status to 1000ms and try to filter
out dead USB HUB devices by implementing an error counter, so that the USB
enumeration thread does not spend all its time reading from non-responding
devices, blocking user-space access in the end.

Tested by: Matthias Apitz <guru@unixarea.de>
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoDisable savecore(8)'s libcasper support when WITHOUT_DYNAMICROOT=yes.
markj [Fri, 4 Jan 2019 19:20:19 +0000 (19:20 +0000)]
Disable savecore(8)'s libcasper support when WITHOUT_DYNAMICROOT=yes.

This follows the example of other Capsicumized programs in /sbin.

Reported by: Manfred Antar <manfredantar@gmail.com>
MFC with: r342699
Sponsored by: The FreeBSD Foundation

5 years agoFix i386 LINT build after r342769.
kib [Fri, 4 Jan 2019 19:10:46 +0000 (19:10 +0000)]
Fix i386 LINT build after r342769.

It seems that libkern/mcount.c is the only consumer of vm/pmap.h that
does not include machine/atomic.h.  Make it work by bringing
machine/atomic.h when pmap.h is used for kernel non-asm .c file.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoLimit git history searches in newvers.sh
gallatin [Fri, 4 Jan 2019 18:38:27 +0000 (18:38 +0000)]
Limit git history searches in newvers.sh

newvers.sh takes upwards of 4-5 seconds to complete on trees checked
out from github, due to searching the entire history for non-existent
git-svn metadata. Similarly, if one does not check out notes, we
again search the entire history for notes. That makes newvers.sh very
slow for many github users.

To fix this in a fair way, limit the history search to the last 10K
commits: if you're more than 10K commits out of sync, then you've
forked the project, and our SVN rev is no longer very important to you.

Due to how git implements --grep in conjunction with -n, --grep has been
removed for performance reasons (git does not seem to limit its search
to the -n limit in this case, and takes just as long as it did with no
limit).

Reviewed by: emaste, imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18745

5 years agoAdd explicit csu test dependency
emaste [Fri, 4 Jan 2019 18:35:25 +0000 (18:35 +0000)]
Add explicit csu test dependency

lib/csu/tests/dynamiclib requires libh_csu.so be built first.  I'm not
sure this is the most correct/best way to address this but it solves
the issue in my testing.

PR: 233734
Sponsored by: The FreeBSD Foundation

5 years agoBump __FreeBSD_version for r342771
cem [Fri, 4 Jan 2019 18:34:44 +0000 (18:34 +0000)]
Bump __FreeBSD_version for r342771

5 years agoExpose threads-per-core and physical core count information
cem [Fri, 4 Jan 2019 18:31:17 +0000 (18:31 +0000)]
Expose threads-per-core and physical core count information

With new sysctls (to the best of our ability do detect them).  Restructured
smp.4 slightly for clarity (keep relevant stuff closer to the top) while
documenting.

Reviewed by: markj, jhibbits (ppc parts)
MFC after: 3 days
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D18322

5 years agoasmc: Patch to add MacBook Pro 9,2 support
dab [Fri, 4 Jan 2019 18:21:49 +0000 (18:21 +0000)]
asmc: Patch to add MacBook Pro 9,2 support

PR: 211513
Submitted by: William Theesfeld Jr <wtheesfeld@mailbox.org>
Reported by: William Theesfeld Jr <wtheesfeld@mailbox.org>
MFC after: 1 week

5 years agoi386: Use atomic 64bit load to read PDE value from PAE pagetables in
kib [Fri, 4 Jan 2019 17:33:07 +0000 (17:33 +0000)]
i386: Use atomic 64bit load to read PDE value from PAE pagetables in
pmap_kextract().

pmap_kextract() can race with promotion/demotion on the kernel page
table, in which case current non-atomic 64bit read would see torn
value, breaking pmap_kextract().  pmap_kextract() would correctly
handle either promoted or demoted PDE, but not a mix where one word
is from a different state.

It requires PAE and > 4G memory to reproduce.  We observed this in
real loads, both for intensive use of malloc(9)/free(9) where
vtoslab() returned invalid pointer to the slab, and with the use of
busdma_bounce, where incorrect page was bounced.

In collaboration with: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18714

5 years agoSupport MSG_DONTWAIT in send*(2).
markj [Fri, 4 Jan 2019 17:31:50 +0000 (17:31 +0000)]
Support MSG_DONTWAIT in send*(2).

As it does for recv*(2), MSG_DONTWAIT indicates that the call should
not block, returning EAGAIN instead.  Linux and OpenBSD both implement
this, so the change makes porting easier, especially since we do not
return EINVAL or so when unrecognized flags are specified.

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: tuexen
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18728

5 years agox86: Report per-cpu IPI TLB shootdown generation in ddb 'show pcpu' output.
kib [Fri, 4 Jan 2019 17:25:47 +0000 (17:25 +0000)]
x86: Report per-cpu IPI TLB shootdown generation in ddb 'show pcpu' output.

It is useful for inspecting tlb shootdown hangs.  The smp_tlb_generation value
is available using regular ddb data inspection commands.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoDon't enable interrupts in init_secondary().
markj [Fri, 4 Jan 2019 17:14:50 +0000 (17:14 +0000)]
Don't enable interrupts in init_secondary().

The MI kernel assumes that interrupts will not be enabled on APs until
after the first context switch.  In particular, the problem was causing
occasional deadlocks during boot.

Remove an unneeded intr_disable() added in r335005.

Reviewed by: jhb (previous version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18738

5 years agoFix dirty bit handling in pmap_remove_write().
markj [Fri, 4 Jan 2019 17:10:16 +0000 (17:10 +0000)]
Fix dirty bit handling in pmap_remove_write().

Reviewed by: jhb, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18732

5 years agoClear PGA_WRITEABLE in pmap_remove_pages().
markj [Fri, 4 Jan 2019 17:08:45 +0000 (17:08 +0000)]
Clear PGA_WRITEABLE in pmap_remove_pages().

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18731

5 years agonewvers: retire p4 version support
emaste [Fri, 4 Jan 2019 16:47:35 +0000 (16:47 +0000)]
newvers: retire p4 version support

Perforce no longer offers a FreeBSD client and it not a viable VCS for
FreeBSD development.  Remove p4 version logic to simplify newvers.sh in
advance of other changes.

Sponsored by: The FreeBSD Foundation

5 years agoFix bhyve's NVMe Completion Queue entry values
chuck [Fri, 4 Jan 2019 15:03:35 +0000 (15:03 +0000)]
Fix bhyve's NVMe Completion Queue entry values

The function which processes Admin commands was not returning the
Command Specific value in Completion Queue Entry, Dword 0 (CDW0). This
effects commands such as Set Features, Number of Queues which returns
the number of queues supported by the device in CDW0. In this case, the
host will only create 1 queue pair (Number of Queues is zero based).
This also masked a bug in the queue counting logic.

Reviewed by: imp, araujo
Approved by: imp (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18703

5 years agoFix bhyve's NVMe queue bookkeeping
chuck [Fri, 4 Jan 2019 15:03:30 +0000 (15:03 +0000)]
Fix bhyve's NVMe queue bookkeeping

Many size / length parameters in NVMe are "0's based", meaning, a value
of 0x0 represents 1, 0x1 represents 2, etc.. While this leads to an
efficient encoding, it can lead to subtle bugs. With respect to queues,
these parameters include:
 - Maximum number of queue entries
 - Maximum number of queues
 - Number of Completion Queues
 - Number of Submission Queues

To be consistent, convert all 0's based values from the host to 1's
based value internally. Likewise, covert internal 1's based values to
0's based values when returned to the host. This fixes an off-by-one bug
when creating IO queues and simplifies some of the code. Note that this
bug is masked by another bug.

While in the neighborhood,
 - fix an erroneous queue ID check (checking CQ count when deleting SQ)
 - check for queue ID of 0x0 in a few places where this is illegal
 - clean up the Set Features, Number of Queues command and check for
   illegal values

Reviewed by: imp, araujo
Approved by: imp (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18702

5 years agonewvers: avoid clearing svn revision information with nested VCS dirs
emaste [Fri, 4 Jan 2019 14:42:36 +0000 (14:42 +0000)]
newvers: avoid clearing svn revision information with nested VCS dirs

Consider the case where FreeBSD is checked out via Subversion with a
(perhaps unrelated) .git or .hg directory at a higher level - for
example,

    .../.git
    .../src/freebsd

Previously newvers obtained the SVN revision information via svnversion,
and then tried to obtain the SVN revision corresponding to the git or hg
commit, overwriting the existing information.

As a short term fix use a different variable for hg-svn or git-svn
information, setting $svn from hg or git info only if not empty.

Reported by: Matthias Apitz
Sponsored by: The FreeBSD Foundation

5 years agortwn_pci(4): sync r88ee_power_on() with OpenBSD
avos [Fri, 4 Jan 2019 04:26:39 +0000 (04:26 +0000)]
rtwn_pci(4): sync r88ee_power_on() with OpenBSD

Tested with RTL8188EE, STA mode

Submitted by: Farhan Khan <khanzf@gmail.com>
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18727

5 years agocxgbe(4): Clear FW_OK if the firmware reports an error.
np [Fri, 4 Jan 2019 04:15:17 +0000 (04:15 +0000)]
cxgbe(4): Clear FW_OK if the firmware reports an error.

Sponsored by: Chelsio Communications

5 years agogetopt_long(3): fix case of malformed long opt
kevans [Fri, 4 Jan 2019 03:13:24 +0000 (03:13 +0000)]
getopt_long(3): fix case of malformed long opt

When presented with an arg string like '-l-', getopt_long will successfully
parse out the 'l' short option, then proceed to match '--' against the first
longopts entry as it later does a strncmp with len=0. This latter bit is
arguably another bug in itself, but presumably not a practical issue as all
callers of parse_long_options are already doing the right thing (except this
one pointed out).

An opt string like '-l-' should be considered malformed and throw a bad
argument rather than behaving as if '--' were passed. It cannot possibly do
what the invoker expects, and it's probably the result of a typo (ls -l- a)
rather than any intent.

Reported by: Tony Overfield <toverfield@yahoo.com>
Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18616

5 years agoThe lam(1) man page is unclear about the uppercase versions of the flags
allanjude [Fri, 4 Jan 2019 02:48:43 +0000 (02:48 +0000)]
The lam(1) man page is unclear about the uppercase versions of the flags

PR: 229571
Submitted by: Tim Chase <freebsd@tim.thechases.com>

5 years agomp_ring: avoid items offset difference between iflib and mp_ring
mmacy [Thu, 3 Jan 2019 23:06:05 +0000 (23:06 +0000)]
mp_ring: avoid items offset difference between iflib and mp_ring
on architectures without 64-bit atomics

Reported by: Augustin Cavalier <waddlesplash@gmail.com>

5 years agozfsboot: support newer ZFS versions
mmacy [Thu, 3 Jan 2019 22:49:11 +0000 (22:49 +0000)]
zfsboot: support newer ZFS versions
declare v3 objset size/layout to fix userboot and possibly other loader issues

- fix for userboot assertion failure in zfs_dev_close in free due to out of bounds write
- fix for zfs_alloc / zfs_free mismatch assertion failure when booting GPT on BIOS

5 years agoAdd man page for dlvsym(3)
romain [Thu, 3 Jan 2019 21:31:17 +0000 (21:31 +0000)]
Add man page for dlvsym(3)

Add a short description of the function to the appropriate man page and add
reference to it where it makes sense.

Reviewed by: bcr, markj, 0mp
Approved by: markj
Differential Revision: https://reviews.freebsd.org/D18725

5 years agoloader.efi: efi variable rework and lsefi command added
tsoome [Thu, 3 Jan 2019 20:27:50 +0000 (20:27 +0000)]
loader.efi: efi variable rework and lsefi command added

This update does add diag and debug capabilities to interpret the efi
variables, configuration and protocols (lsefi).

The side effect is that we add/update bunch of related headers.

5 years agosh: Add test for exported but unset variables
jilles [Thu, 3 Jan 2019 20:23:12 +0000 (20:23 +0000)]
sh: Add test for exported but unset variables

PR: 233545

5 years agosh: Do not place exported but unset variables into the environment
jilles [Thu, 3 Jan 2019 20:22:35 +0000 (20:22 +0000)]
sh: Do not place exported but unset variables into the environment

PR: 233545
Submitted by: Jan Beich
Obtained from: NetBSD

5 years agoFix typo in r342710.
kib [Thu, 3 Jan 2019 19:35:07 +0000 (19:35 +0000)]
Fix typo in r342710.

Noted by: lidl
MFC after: 3 days

5 years agonetmap: unit tests: fix issues found by coverity scan
vmaffione [Thu, 3 Jan 2019 16:47:05 +0000 (16:47 +0000)]
netmap: unit tests: fix issues found by coverity scan

Reported by: asomers
MFC after: 1 week
Sponsored by: Sunny Valley Networks

5 years agoFix a use-after-free in the riscv pmap_release() implementation.
markj [Thu, 3 Jan 2019 16:26:52 +0000 (16:26 +0000)]
Fix a use-after-free in the riscv pmap_release() implementation.

Don't bother zeroing the top-level page before freeing it.  Previously,
the page was freed before being zeroed.

Reviewed by: jhb, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18720

5 years agoSynchronize access to the allpmaps list.
markj [Thu, 3 Jan 2019 16:24:03 +0000 (16:24 +0000)]
Synchronize access to the allpmaps list.

The list will be removed with some future work.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18721

5 years agoFix some issues with the riscv pmap_protect() implementation.
markj [Thu, 3 Jan 2019 16:21:44 +0000 (16:21 +0000)]
Fix some issues with the riscv pmap_protect() implementation.

- Handle VM_PROT_EXECUTE.
- Clear PTE_D and mark the page dirty when removing write access
  from a mapping.
- Atomically clear PTE_W to avoid clobbering a hardware PTE update.

Reviewed by: jhb, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18719

5 years agoSet PTE_U on PTEs created by pmap_enter_quick().
markj [Thu, 3 Jan 2019 16:19:32 +0000 (16:19 +0000)]
Set PTE_U on PTEs created by pmap_enter_quick().

Otherwise prefaulted entries are not accessible from user mode and
end up triggering a fault upon access, so prefaulting has no effect.

Reviewed by: jhb, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18718

5 years agoUse regular stores to update PTEs in the riscv pmap layer.
markj [Thu, 3 Jan 2019 16:15:28 +0000 (16:15 +0000)]
Use regular stores to update PTEs in the riscv pmap layer.

There's no need to use atomics when the previous value isn't needed.
No functional change intended.

Reviewed by: kib
Discussed with: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18717

5 years agoConfigure hz=100 in the QEMU target.
markj [Thu, 3 Jan 2019 16:11:21 +0000 (16:11 +0000)]
Configure hz=100 in the QEMU target.

We currently don't have a good way to dynamically detect whether the
kernel is running as a guest.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18715

5 years agoImprove USB generic debug messages. Print process ID and name when opening
hselasky [Thu, 3 Jan 2019 14:27:51 +0000 (14:27 +0000)]
Improve USB generic debug messages. Print process ID and name when opening
and closing usb/ugenX.Y character device nodes.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoloader.efi: update memmap command to recognize new attributes
tsoome [Thu, 3 Jan 2019 09:03:58 +0000 (09:03 +0000)]
loader.efi: update memmap command to recognize new attributes

Also move memory type to string translation to libefi for later use.

MFC after: 2 weeks

5 years agortwnfw(4): refresh this manpage too (add rtwn-rtl8188eefw module).
avos [Thu, 3 Jan 2019 03:27:37 +0000 (03:27 +0000)]
rtwnfw(4): refresh this manpage too (add rtwn-rtl8188eefw module).

MFC after: 3 days

5 years agoFix typo, use boolean operator instead of bit-wise.
kib [Thu, 3 Jan 2019 01:01:03 +0000 (01:01 +0000)]
Fix typo, use boolean operator instead of bit-wise.

Reviewed by: marius, shurd
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoi386_parsedev() needs to support fd devices
tsoome [Wed, 2 Jan 2019 20:31:15 +0000 (20:31 +0000)]
i386_parsedev() needs to support fd devices

MFC after: 2 weeks

5 years agortwn_usb(4): add USB id for TP-LINK TL-WN821N v5.
avos [Wed, 2 Jan 2019 18:35:40 +0000 (18:35 +0000)]
rtwn_usb(4): add USB id for TP-LINK TL-WN821N v5.

It is already mentioned in manpage, but was missing from the driver.

MFC after: 4 days

5 years agortwn(4): refresh manpages.
avos [Wed, 2 Jan 2019 18:30:22 +0000 (18:30 +0000)]
rtwn(4): refresh manpages.

- Add 'device rtwn' to rtwn_pci(4) and rtwn_usb(4) config sample;
kernel will not compile otherwise.
- Refresh devices list in rtwn_usb(4); add 'chipset' column.
- Bump Dd after this commit and r342682.

MFC after: 4 days

5 years agoFix an error check after r342699.
markj [Wed, 2 Jan 2019 17:34:25 +0000 (17:34 +0000)]
Fix an error check after r342699.

Reported by: gcc
MFC with: r342699
Sponsored by: The FreeBSD Foundation

5 years agortwn_pci(4): fix panic with INVARIANTS (due to inverted assertion logic)
avos [Wed, 2 Jan 2019 17:13:55 +0000 (17:13 +0000)]
rtwn_pci(4): fix panic with INVARIANTS (due to inverted assertion logic)

MFC after: 4 days

5 years agoCapsicumize savecore(8).
markj [Wed, 2 Jan 2019 17:09:35 +0000 (17:09 +0000)]
Capsicumize savecore(8).

- Use cap_fileargs(3) to open dump devices after entering capability
  mode, and use cap_syslog(3) to log messages.
- Use a relative directory fd to open output files.
- Use zdopen(3) to compress kernel dumps in capability mode.

Reviewed by: cem, oshogbo
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18458

5 years agoEscape a new line following r342283.
gjb [Wed, 2 Jan 2019 16:22:33 +0000 (16:22 +0000)]
Escape a new line following r342283.

Sponsored by: The FreeBSD Foundation

5 years agoTypo.
markj [Wed, 2 Jan 2019 16:01:54 +0000 (16:01 +0000)]
Typo.

Reported by: Christian Barthel
MFC after: 3 days

5 years agoUse g_handleattr() to reply to GEOM::candelete queries.
markj [Wed, 2 Jan 2019 15:52:16 +0000 (15:52 +0000)]
Use g_handleattr() to reply to GEOM::candelete queries.

g_handleattr() fills out bp->bio_completed; otherwise, g_getattr()
returns an error in response to the query.  This caused BIO_DELETE
support to not be propagated through stacked configurations, e.g.,
a gconcat of gmirror volumes would not handle BIO_DELETE even when
the gmirrors do.  g_io_getattr() was not affected by the problem.

PR: 232676
Reported and tested by: noah.bergbauer@tum.de
MFC after: 1 week

5 years agoAvoid setting PG_U unconditionally in pmap_enter_quick_locked().
markj [Wed, 2 Jan 2019 15:36:35 +0000 (15:36 +0000)]
Avoid setting PG_U unconditionally in pmap_enter_quick_locked().

This KPI may in principle be used to create kernel mappings, in which
case we certainly should not be setting PG_U.  In any case, PG_U must be
set on all layers in the page tables to grant user mode access, and we
were only setting it on leaf entries.  Thus, this change should have no
functional impact.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoRefresh sys/conf/files after recent rtwn(4) update.
avos [Wed, 2 Jan 2019 15:01:55 +0000 (15:01 +0000)]
Refresh sys/conf/files after recent rtwn(4) update.

MFC after: 4 days

5 years agortwn_pci(4): add support for RTL8188EE chipset.
avos [Wed, 2 Jan 2019 06:48:53 +0000 (06:48 +0000)]
rtwn_pci(4): add support for RTL8188EE chipset.

Initially based on https://reviews.freebsd.org/D15692;
later deduplicated and improved a bit (Tx reports, IQ calibration support).

Submitted by: Farhan Khan <khanzf@gmail.com>
MFC after: 4 days
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D15692

5 years agortwn(4): rename set_name -> set_rom_opts method and reuse it for RTL8188E*
avos [Wed, 2 Jan 2019 06:03:19 +0000 (06:03 +0000)]
rtwn(4): rename set_name -> set_rom_opts method and reuse it for RTL8188E*

MFC after: 4 days

5 years agortwn(4): rename common RTL8188E* structures.
avos [Wed, 2 Jan 2019 05:43:33 +0000 (05:43 +0000)]
rtwn(4): rename common RTL8188E* structures.

No functional change intended.

MFC after: 4 days

5 years agortwn(4): do not try to start RTL8188E* MCU during device shutdown.
avos [Wed, 2 Jan 2019 05:37:30 +0000 (05:37 +0000)]
rtwn(4): do not try to start RTL8188E* MCU during device shutdown.

MFC after: 4 days

5 years agoMove USB-specific parts from rtwn(4) to rtwn_usb(4)
avos [Wed, 2 Jan 2019 05:30:41 +0000 (05:30 +0000)]
Move USB-specific parts from rtwn(4) to rtwn_usb(4)

MFC after: 4 days

5 years agortwn_pci(4): add support for event-based Tx reports.
avos [Wed, 2 Jan 2019 05:21:06 +0000 (05:21 +0000)]
rtwn_pci(4): add support for event-based Tx reports.

It will be used for RTL8188EE (and, probably, others).

MFC after: 4 days

5 years agortwn_pci(4): use proper bus_dmamap_sync flags after Tx (sync with r342672)
avos [Wed, 2 Jan 2019 04:56:36 +0000 (04:56 +0000)]
rtwn_pci(4): use proper bus_dmamap_sync flags after Tx (sync with r342672)

MFC after: 4 days

5 years agortwn(4): drop obsolete comment + use 'nop' function for 92eu calibration
avos [Wed, 2 Jan 2019 04:27:39 +0000 (04:27 +0000)]
rtwn(4): drop obsolete comment + use 'nop' function for 92eu calibration

RTL8192EU was not tested with previously added code.

MFC after: 4 days

5 years agortwn(4): add IQ calibration support for RTL8188E*
avos [Wed, 2 Jan 2019 04:19:28 +0000 (04:19 +0000)]
rtwn(4): add IQ calibration support for RTL8188E*

Tested with:
 * RTL8188EE, STA mode.
 * RTL8188EU, STA mode.

MFC after: 4 days

5 years agortwn(4): provide register definitions for RTL8188CE calibration routines.
avos [Wed, 2 Jan 2019 04:08:37 +0000 (04:08 +0000)]
rtwn(4): provide register definitions for RTL8188CE calibration routines.

No functional change intended.

MFC after: 4 days

5 years agortwn_pci: fix excessive packet loss on Tx with RTL8188EE.
avos [Tue, 1 Jan 2019 23:41:16 +0000 (23:41 +0000)]
rtwn_pci: fix excessive packet loss on Tx with RTL8188EE.

Use proper flags for bus_dmamap_sync() in Tx path.

Tested with: RTL8188EE, STA mode

MFC after: 4 days

5 years agortld-elf: Fix powerpc64 TLS handling, matching powerpc's fix
jhibbits [Tue, 1 Jan 2019 20:12:58 +0000 (20:12 +0000)]
rtld-elf: Fix powerpc64 TLS handling, matching powerpc's fix

We need to subtract the TLS_TCB_SIZE to get to the real data pointer, since
r13 points to the end of the TCB structure.  Prior to this, devel/protobuf-c
port broke with recent update to devel/protobuf, which exposed this issue.

Submitted by: andreast
Reported by: Piotr Kubaj
MFC after: 1 week

5 years agolinuxkpi: Remove extraneous NULL check on M_WAITOK allocation
cem [Tue, 1 Jan 2019 19:56:49 +0000 (19:56 +0000)]
linuxkpi: Remove extraneous NULL check on M_WAITOK allocation

The check was not introduced in r342628, but the subsequent unchecked access to
refs was added then, prompting a Coverity warning about "Null pointer
dereferences (FORWARD_NULL)."  The warning is bogus due to M_WAITOK, but so is
the NULL check that hints it, so just remove it.

CID: 1398588
Reported by: Coverity

5 years agoUpdate the efibootmgr(8) man page to document changes to options.
bcran [Tue, 1 Jan 2019 04:57:46 +0000 (04:57 +0000)]
Update the efibootmgr(8) man page to document changes to options.

5 years agoHappy New Year 2019!
delphij [Tue, 1 Jan 2019 00:25:25 +0000 (00:25 +0000)]
Happy New Year 2019!

5 years agoPort over the SCSI sense handling fix from mpr(4) in r342528, and fix
scottl [Mon, 31 Dec 2018 23:30:31 +0000 (23:30 +0000)]
Port over the SCSI sense handling fix from mpr(4) in r342528, and fix
whitespace to match.

5 years agoFix whitespace from r342528
scottl [Mon, 31 Dec 2018 23:27:56 +0000 (23:27 +0000)]
Fix whitespace from r342528

5 years agoCorrect variable name in two panic messages: num_msi_irq -> num_msi_irqs.
jhb [Mon, 31 Dec 2018 22:46:43 +0000 (22:46 +0000)]
Correct variable name in two panic messages: num_msi_irq -> num_msi_irqs.

MFC after: 1 week

5 years agoAdd NO_RC16 quirk for Chipfancier 16GB USB stick...
imp [Mon, 31 Dec 2018 22:20:30 +0000 (22:20 +0000)]
Add NO_RC16 quirk for Chipfancier 16GB USB stick...

Submitted by: osef.lar@gmail.com
PR: 234503

5 years agoMore references to pmap_cold().
kib [Mon, 31 Dec 2018 18:11:04 +0000 (18:11 +0000)]
More references to pmap_cold().

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoUpdate comments: paging is initialized in pmap_cold().
kib [Mon, 31 Dec 2018 18:05:48 +0000 (18:05 +0000)]
Update comments: paging is initialized in pmap_cold().

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoSupport the SPI mode and bus clock frequency parameters set by the devices
ian [Mon, 31 Dec 2018 16:01:22 +0000 (16:01 +0000)]
Support the SPI mode and bus clock frequency parameters set by the devices
requesting SPI transfers.

Reported by: SAITOU Toshihide <toshi@ruby.ocn.ne.jp>

5 years agomsun: Fix some old typos.
pfg [Mon, 31 Dec 2018 15:43:06 +0000 (15:43 +0000)]
msun: Fix some old typos.

Seen in a posting from July 27 by "CM Graff" in musl-libc.

5 years agonetmap: fix warnings on unit tests
vmaffione [Mon, 31 Dec 2018 12:07:17 +0000 (12:07 +0000)]
netmap: fix warnings on unit tests

Fix some printf() format string warnings raised for ctrl-api-test.c
on some architectures.

MFC after: 1 week
Sponsored by: Sunny Valley Networks

5 years agonetmap: add suite of unit tests
vmaffione [Mon, 31 Dec 2018 11:17:58 +0000 (11:17 +0000)]
netmap: add suite of unit tests

Import the unit tests from upstream (https://github.com/luigirizzo/netmap
ba02539859d46d33), and make them ready for use with Kyua.
There are currently 38 regression tests, which test the kernel control ABI
exposed by netmap to userspace applications:

  1: test for port info get
  2-5: tests for basic port registration
  6-9: tests for VALE
  10-11: tests for getting netmap allocator info
  12-15: tests for netmap pipes
  16: test on polling mode
  17-18: tests on options
  19-27: tests for sync-kloop subsystem
  28-39: tests for null ports
  31-38: tests for the legacy NIOCREGIF registers

Reviewed by: ngie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18490

5 years agoAdd current working directory to the default (although commented out) sh(1)
trasz [Mon, 31 Dec 2018 10:17:42 +0000 (10:17 +0000)]
Add current working directory to the default (although commented out) sh(1)
prompt, so it looks just like the tcsh(1) one when you uncomment it.

Reviewed by: jilles
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18673

5 years agoImport tzdata 2018i
philip [Mon, 31 Dec 2018 07:57:37 +0000 (07:57 +0000)]
Import tzdata 2018i

Changes: https://github.com/eggert/tz/blob/2018i/NEWS

MFC after: 2 days

5 years agoEnsure buffer is nul-terminated.
delphij [Mon, 31 Dec 2018 03:08:01 +0000 (03:08 +0000)]
Ensure buffer is nul-terminated.

MFC after: 2 weeks

5 years agoWhen allocating a new keyboard at vt_upgrade() time, unwind any cngrabs
ian [Mon, 31 Dec 2018 01:09:23 +0000 (01:09 +0000)]
When allocating a new keyboard at vt_upgrade() time, unwind any cngrabs
done on the old keyboard and then do the corresponding number of grabs
on the new keyboard.

This fixes a race that can leave the system with a non-functioning
keyboard.  It goes like this...

 - The bios claims there is an AT keyboard, atkbd attaches.
 - SI_SUB_INT_CONFIG_HOOKS runs.
 - USB probes devices. Devices begin attaching, including disks.
 - GELI prompts for a password for a just-attached disk, which results
   in a cngrab() while atkbd is the keyboard.
 - A USB keyboard attaches.
 - vt_upgrade() runs and switches the keyboard to the new USB keyboard,
   but because cngrab was never called for it, it's not activated and
   keystrokes are ignored.
 - Now there is no functional keyboard and no way to get one; even
   plugging in a different USB keyboard doesn't help, because the console
   is still grabbed, still waiting for a GELI pw.

Discussed with:      ray@

5 years agoUse the --activate efibootmgr(8) flag when creating entries in bootconfig
bcran [Mon, 31 Dec 2018 00:26:35 +0000 (00:26 +0000)]
Use the --activate efibootmgr(8) flag when creating entries in bootconfig

Sponsored by: Netflix