]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoUse EVENTHANDLER_DIRECT_INVOKE for [un]mount events, for better performance.
ian [Sun, 7 Jan 2018 18:07:22 +0000 (18:07 +0000)]
Use EVENTHANDLER_DIRECT_INVOKE for [un]mount events, for better performance.

6 years agoUse EVENTHANDLER_DIRECT_INVOKE() for device events, for better performance.
ian [Sun, 7 Jan 2018 18:06:30 +0000 (18:06 +0000)]
Use EVENTHANDLER_DIRECT_INVOKE() for device events, for better performance.

6 years agovchiq: Use mallocarray() to provide kcalloc()
kp [Sun, 7 Jan 2018 13:41:06 +0000 (13:41 +0000)]
vchiq: Use mallocarray() to provide kcalloc()

This means we now also provide integer overflow protection, like the
Linux kcalloc().

6 years agolinuxkpi: Implement kcalloc() based on mallocarray()
kp [Sun, 7 Jan 2018 13:39:12 +0000 (13:39 +0000)]
linuxkpi: Implement kcalloc() based on mallocarray()

This means we now get integer overflow protection, which Linux code
might expect as it is also provided by kcalloc() in Linux.

6 years agopf: Avoid integer overflow issues by using mallocarray() iso. malloc()
kp [Sun, 7 Jan 2018 13:35:15 +0000 (13:35 +0000)]
pf: Avoid integer overflow issues by using mallocarray() iso. malloc()

pfioctl() handles several ioctl that takes variable length input, these
include:
- DIOCRADDTABLES
- DIOCRDELTABLES
- DIOCRGETTABLES
- DIOCRGETTSTATS
- DIOCRCLRTSTATS
- DIOCRSETTFLAGS

All of them take a pfioc_table struct as input from userland. One of
its elements (pfrio_size) is used in a buffer length calculation.
The calculation contains an integer overflow which if triggered can lead
to out of bound reads and writes later on.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>

6 years agoIntroduce mallocarray() in the kernel
kp [Sun, 7 Jan 2018 13:21:01 +0000 (13:21 +0000)]
Introduce mallocarray() in the kernel

Similar to calloc() the mallocarray() function checks for integer
overflows before allocating memory.
It does not zero memory, unless the M_ZERO flag is set.

Reviewed by: pfg, vangyzen (previous version), imp (previous version)
Obtained from: OpenBSD
Differential Revision: https://reviews.freebsd.org/D13766

6 years agostddef.h is not used by cat.c, remove the include.
delphij [Sun, 7 Jan 2018 07:08:59 +0000 (07:08 +0000)]
stddef.h is not used by cat.c, remove the include.

6 years agoldconfig(8): clarify language for files
eadler [Sun, 7 Jan 2018 05:38:53 +0000 (05:38 +0000)]
ldconfig(8): clarify language for files

The previous language did not make it clear that 'Files' are
the files specified above. Clarify it.

Reported by: dana <dana@dana.is>
Reviewed by: dana <dana@dana.is>
MFC After: 1 week

6 years agoaw_sid(4): Add support for Allwinner H3
kevans [Sun, 7 Jan 2018 04:59:28 +0000 (04:59 +0000)]
aw_sid(4): Add support for Allwinner H3

The sid controller on the H3 is generally identical in location, size, and
efuse offset to the a64 and the a83t. The main difference is that the H3 has
a silicon bug that sometimes causes the rootkey (at least) to be garbled
unless first read by the prctl registers.

This device is currently not in our DTS and, as of now, is not yet present
in mainline Linux DTS.

Tested on: OrangePi One

6 years agoaw_sid: Add method for reading keys via prctl registers
kevans [Sun, 7 Jan 2018 03:31:55 +0000 (03:31 +0000)]
aw_sid: Add method for reading keys via prctl registers

Technically supported on the later SoCs, this will only really be used to
add support for the H3 sid. The H3 has a silicon bug that manifests itself
by returning garbled rootkeys unless first read via the prctl registers.

6 years agogeli: fix parallel execution of tests
asomers [Sun, 7 Jan 2018 02:30:08 +0000 (02:30 +0000)]
geli: fix parallel execution of tests

The trick is not to destroy an md(4) device during a test.  That can create
a "double-free" situation, because we also destroy md devices during test
cleanup.

MFC after: 2 weeks

6 years agoFix bogus pass for syscon_generic introduced in r327621
kevans [Sun, 7 Jan 2018 02:19:54 +0000 (02:19 +0000)]
Fix bogus pass for syscon_generic introduced in r327621

ian@ pointed out that BUS_PASS_DEFAULT + $anything is bogus, given that
BUS_PASS_DEFAULT is defined as __INT_MAX. Instead, we take a page out of
imx6_usbphy's book and use BUS_PASS_DEFAULT - 1000 to achieve the desired
effect of syscon_generic attaching before if_awg and other potential
consumers, but late enough that more specialized implementations should have
no problem attaching instead.

Reported by: ian

6 years agogeli: convert most tests from TAP to ATF
asomers [Sun, 7 Jan 2018 00:44:22 +0000 (00:44 +0000)]
geli: convert most tests from TAP to ATF

I'm leaving readonly_test and nokey_test alone for now. In a future commit
they should be broken up into several smaller test cases and distributed
between multiple files.

Reviewed by: ngie
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13717

6 years agoarm64: Remove old clock driver for Allwinner 64bit SoC
manu [Sat, 6 Jan 2018 20:32:14 +0000 (20:32 +0000)]
arm64: Remove old clock driver for Allwinner 64bit SoC

All the clocks are now handled by the clkng driver.

Tested On: Pine64-LTS (A64)
Tested On: OrangePi PC2 (H5)

6 years agoDocument kern.smp.disabled tunable.
kib [Sat, 6 Jan 2018 16:29:00 +0000 (16:29 +0000)]
Document kern.smp.disabled tunable.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agomorse(6): update documentation
eadler [Sat, 6 Jan 2018 15:52:28 +0000 (15:52 +0000)]
morse(6): update documentation

- bump Dd
- use 'r' instead of 'D' from the original submission

6 years agoMove syscon_generic to attach much later
kevans [Sat, 6 Jan 2018 14:21:32 +0000 (14:21 +0000)]
Move syscon_generic to attach much later

It still needs to be before if_awg at least in order to be available for
other operations, but it should not be attaching before interrupt
controllers at the very least.

This should make errors involving syscon register space colliding with other
devices a little more innocent, but these conflicts should really be tracked
down and resolved. One such conflict is with the Raspberry Pi 3 local
interrupt controller, noticed by tuexen@

Reported by: tuexen

6 years agoThe source strings are from the password database which guarantees
imp [Sat, 6 Jan 2018 12:46:04 +0000 (12:46 +0000)]
The source strings are from the password database which guarantees
that the data going into it is sane.  Out of an abundance of caution,
limit the string copies to prevent an overflow.

CID: 1019035

6 years agoSanity check sysconf return value to ensure it's positive before we
imp [Sat, 6 Jan 2018 12:45:59 +0000 (12:45 +0000)]
Sanity check sysconf return value to ensure it's positive before we
use it. Use proper cast to convert long to size_t (instead of
blksize_t) to preclude sign extension issues.

CID: 1193754

6 years agoSanity check media size and sector counts to ensure that we don't
imp [Sat, 6 Jan 2018 12:34:03 +0000 (12:34 +0000)]
Sanity check media size and sector counts to ensure that we don't
produce negative sector numbers in the testing algorithm.

CID: 1198994

6 years agoUnbreak build after r327614
lwhsu [Sat, 6 Jan 2018 09:48:04 +0000 (09:48 +0000)]
Unbreak build after r327614

Approved by: mjg (on IRC)
Differential Revision: https://reviews.freebsd.org/D13782

6 years agomorse(6): minor nits
eadler [Sat, 6 Jan 2018 07:48:17 +0000 (07:48 +0000)]
morse(6): minor nits

- Use copyright comment header
- Make it easier to compile on !FreeBSD
- Diff reduction against DragonFlyBSD

6 years agomorse(6): implement support for decoding morse code
eadler [Sat, 6 Jan 2018 07:02:24 +0000 (07:02 +0000)]
morse(6): implement support for decoding morse code

- Use `-r` for "reverse" mode and to match DragonFlyBSD.
- Move defines around to clear up logic
- use `errx` instead of `fprintf` and `exit`

PR: 35109
Submitted By: philipp.mergenthaler@stud.uni-karlsruhe.de
Submitted on: 2002-02-19
Reviewed by: kevans

6 years agoInvent new #defines for the biospci_{read,write}_config function to
imp [Sat, 6 Jan 2018 06:00:45 +0000 (06:00 +0000)]
Invent new #defines for the biospci_{read,write}_config function to
specify the width and use them everywhere.

Sponsored by: Netflix

6 years agoThere's no need / benefit from deleting the variable before we set it.
imp [Sat, 6 Jan 2018 06:00:40 +0000 (06:00 +0000)]
There's no need / benefit from deleting the variable before we set it.

Sponsored by: Netflix

6 years agoFix usage strings. -d and -p were removed before this was committed to
imp [Sat, 6 Jan 2018 06:00:34 +0000 (06:00 +0000)]
Fix usage strings. -d and -p were removed before this was committed to
FreeBSD, but the strings weren't updated.

Sponsored by: Netflix

6 years agoFix a header inclusion missed in the previous commit.
jkim [Sat, 6 Jan 2018 03:41:35 +0000 (03:41 +0000)]
Fix a header inclusion missed in the previous commit.

Reported by: Michael Butler (imb at protected-networks dot net)

6 years agoHandle misconfigured/nonexistent pcidev for comconsole instead of BTX panic.
sbruno [Fri, 5 Jan 2018 23:50:50 +0000 (23:50 +0000)]
Handle misconfigured/nonexistent pcidev for comconsole instead of BTX panic.

PR: 203319
Reviewed by: imp jhb
MFC after: 2 weeks
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D13776

6 years agoMerge ACPICA 20180105.
jkim [Fri, 5 Jan 2018 23:21:47 +0000 (23:21 +0000)]
Merge ACPICA 20180105.

6 years agoImport ACPICA 20180105.
jkim [Fri, 5 Jan 2018 23:02:12 +0000 (23:02 +0000)]
Import ACPICA 20180105.

6 years agoRevert r327599. I missed a new file.
jkim [Fri, 5 Jan 2018 22:59:03 +0000 (22:59 +0000)]
Revert r327599.  I missed a new file.

Pointyhat to: jkim

6 years agoImport ACPICA 20180105.
jkim [Fri, 5 Jan 2018 22:51:18 +0000 (22:51 +0000)]
Import ACPICA 20180105.

6 years agoRemove LINK_MAX.
jhb [Fri, 5 Jan 2018 22:26:23 +0000 (22:26 +0000)]
Remove LINK_MAX.

After recent changes to change filesystems to use filesystem-specific
limits, LINK_MAX is no longer used in the base system.  Applications
should in theory be able to cope with a lack of LINK_MAX by using
pathconf().

PR: 224628 (exp-run)
Approved by: imp, kib
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D13658

6 years agoMake it possible to re-evaluate cpu_features.
kib [Fri, 5 Jan 2018 21:06:19 +0000 (21:06 +0000)]
Make it possible to re-evaluate cpu_features.

Add cpuctl(4) ioctl CPUCTL_EVAL_CPU_FEATURES which forces re-read of
cpu_features, cpu_features2, cpu_stdext_features, and
std_stdext_features2.

The intent is to allow the kernel to see the changes in the CPU
features after micocode update.  Of course, the update is not atomic
across variables and not synchronized with readers.  See the man page
warning as well.

Reviewed by: imp (previous version), jilles
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D13770

6 years agoIn sendfile_iodone() both pru_abort and sorele need to be executed
glebius [Fri, 5 Jan 2018 20:21:46 +0000 (20:21 +0000)]
In sendfile_iodone() both pru_abort and sorele need to be executed
with proper VNET context set.

Reported by: sbruno
MFC after: 2 weeks

6 years agoFix a couple of comments in AMD Virtual Machine Control Block structure
avg [Fri, 5 Jan 2018 19:15:24 +0000 (19:15 +0000)]
Fix a couple of comments in AMD Virtual Machine Control Block structure

MFC after: 1 week

6 years agoCorrect comment. procfs_doprocfile implements 'file', not 'self'.
jhb [Fri, 5 Jan 2018 18:32:46 +0000 (18:32 +0000)]
Correct comment.  procfs_doprocfile implements 'file', not 'self'.

6 years agoAdd 64bit feature support.
fsu [Fri, 5 Jan 2018 10:04:01 +0000 (10:04 +0000)]
Add 64bit feature support.

Reviewed by:    kevlo, pfg (mentor)
Approved by:    pfg (mentor)
MFC after:      6 months

Differential Revision:    https://reviews.freebsd.org/D11530

6 years agoBuild service tests with Casper support.
oshogbo [Fri, 5 Jan 2018 09:31:41 +0000 (09:31 +0000)]
Build service tests with Casper support.

6 years agoFix typo & build
lwhsu [Fri, 5 Jan 2018 08:29:32 +0000 (08:29 +0000)]
Fix typo & build

Approved by: kevlo

6 years agoRemove dead code (comma is either 0 or 1 for sure, no need to test).
imp [Fri, 5 Jan 2018 07:29:02 +0000 (07:29 +0000)]
Remove dead code (comma is either 0 or 1 for sure, no need to test).
Close /dev/pci when we're done with it.

CID: 1007450100744910086151008614

6 years agobits is never null when we call ot. Add an assert to that effect and
imp [Fri, 5 Jan 2018 07:28:58 +0000 (07:28 +0000)]
bits is never null when we call ot. Add an assert to that effect and
remove test for NULL.

CID: 270774

6 years agoTag 'a' case as one we're intentionally falling through to
imp [Fri, 5 Jan 2018 07:28:48 +0000 (07:28 +0000)]
Tag 'a' case as one we're intentionally falling through to
the 'F' case.

CID: 1008176

6 years agounits(1): add missing ':' for two short arguments
eadler [Fri, 5 Jan 2018 07:24:43 +0000 (07:24 +0000)]
units(1): add missing ':' for two short arguments

PR: 209850
MFC After: 3 days

6 years agocam/da: QUIRK: Add 4K quirks for WD Red and Black MHDDs
eadler [Fri, 5 Jan 2018 07:14:39 +0000 (07:14 +0000)]
cam/da: QUIRK: Add 4K quirks for WD Red and Black MHDDs

PR: 188685
Submitted by: Jeremy Chadwick <jdc@koitsu.org>
Reported by: Martin Birgmeier <d8zNeCFG@aon.at>

6 years agoAdd a number of sanity checks to the data that we're handling from the
imp [Fri, 5 Jan 2018 07:09:40 +0000 (07:09 +0000)]
Add a number of sanity checks to the data that we're handling from the
CIS. Coverity has tagged it as tainted. While this data is more
trusted than your average data, we still need to do some basic
validation on it. Check ioctl return value to ensure we switch memory
targets between common and attribute as well as the lseek.

CID: 1210464100664010068681007292100909110098221009824

6 years agoNeed to convert '/' back to '\' when creating a path. Ideally, this
imp [Fri, 5 Jan 2018 07:09:29 +0000 (07:09 +0000)]
Need to convert '/' back to '\' when creating a path. Ideally, this
would be filesystem type dependent, but that's difficult to accomplish
and it's unclear how the UEFI firmware will cope. Be conservative and
make boot loaders cope instead.

Sponsored by: Netflix

6 years agoSet dp to NULL when we free it, and tree a NULL dp as an error
imp [Fri, 5 Jan 2018 07:09:24 +0000 (07:09 +0000)]
Set dp to NULL when we free it, and tree a NULL dp as an error
condition. This should prevent a double free. In addition, prevent a
leak by freeing dp each loop and when we're done.

CID: 1383577
Sponsored by: Netflix

6 years agoFree options before setting them. This will prevent us from leaking
imp [Fri, 5 Jan 2018 07:09:19 +0000 (07:09 +0000)]
Free options before setting them. This will prevent us from leaking
memory when we have multiple copies of the same option from being
specified.

Sponsored by: Netflix

6 years agoEnsure that we have a description string. When unspecified, default to "".
imp [Fri, 5 Jan 2018 07:09:09 +0000 (07:09 +0000)]
Ensure that we have a description string. When unspecified, default to "".

Sponsored by: Netflix

6 years agoDon't close fd twice. This line should have been deleted in r327279.
imp [Fri, 5 Jan 2018 05:34:20 +0000 (05:34 +0000)]
Don't close fd twice. This line should have been deleted in r327279.

CID: 1384015

6 years agoOnly call close if fd and fd1 are not -1.
imp [Fri, 5 Jan 2018 05:34:14 +0000 (05:34 +0000)]
Only call close if fd and fd1 are not -1.

CID: 13840181384017

6 years agoFix cut and paste error from devinfo.8 origin of this file
imp [Fri, 5 Jan 2018 05:02:09 +0000 (05:02 +0000)]
Fix cut and paste error from devinfo.8 origin of this file

Noticed by: kevans@

6 years agohexdump(1): Speed up -s flag on devices
kevans [Fri, 5 Jan 2018 01:46:41 +0000 (01:46 +0000)]
hexdump(1): Speed up -s flag on devices

Using the -s flag on devices is extraordinarily slow due to using fseek(3) a
little too conservatively. Address this by using fseek on character/block
devices as well, falling back to getchar(3) only if we fail to seek or we're
operating on tape drives, where fseek may succeed while not actually being
supported.

PR: 86485
Submitted by: arundel (originally; modified since then)
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D10939

6 years agoRevert r327360, which can cause boot problems on high-CPU-count (>60)
nwhitehorn [Thu, 4 Jan 2018 23:07:51 +0000 (23:07 +0000)]
Revert r327360, which can cause boot problems on high-CPU-count (>60)
POWER8 and POWER9 systems, pending further analysis.

PR: 224841

6 years agofind: Speed up tests by using touch -d instead of sleep for timestamps
jilles [Thu, 4 Jan 2018 22:59:24 +0000 (22:59 +0000)]
find: Speed up tests by using touch -d instead of sleep for timestamps

I have verified that the tests still detect the absence of the r327362 fix.

6 years agoif_awg: Use syscon prop if it exists
kevans [Thu, 4 Jan 2018 22:37:15 +0000 (22:37 +0000)]
if_awg: Use syscon prop if it exists

The emac bindings that are landing in Linux 4.15 specify a syscon property
on the emac node that point to /soc/syscon. Use this property if it's
specified, but maintain backwards compatibility with the old method.

The older method is still used for boards that we get .dtb from u-boot, such
as pine64, that did not yet have stable emac bindings.

Tested on: Banana Pi-M3 (a83t)
Tested on: Pine64 (a64)
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D13296

6 years agoAlways use atomic_fetchadd() when updating per-user accounting values.
jhb [Thu, 4 Jan 2018 22:07:58 +0000 (22:07 +0000)]
Always use atomic_fetchadd() when updating per-user accounting values.

This avoids re-reading a variable after it has been updated via an
atomic op.  It is just a cosmetic cleanup as the read value was only
used to control a diagnostic printf that should rarely occur (if ever).

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D13768

6 years agoReport offset relative to the backing object for kinfo_vmentry structures.
jhb [Thu, 4 Jan 2018 21:59:34 +0000 (21:59 +0000)]
Report offset relative to the backing object for kinfo_vmentry structures.

For the pathname reported in kinfo_vmentry structures (kve_path), the
sysctl handlers walk the object chain to find the bottom-most VM object.
This permits a COW mapping of a file with dirty pages to report the
pathname of the originally mapped file.  Do the same for the object
offset (kve_offset) computing a cumulative offset during the same object
walk so that the reported offset is relative to the reported pathname.

Note that ptrace(PT_VM_ENTRY) already returns a cumulative offset
rather than the raw offset of the VM map entry.

Note also that this does not affect procstat -v output (even structured
output) since that output does not include the kve_offset field.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D13767

6 years agoAllow timed waits with relative timeouts on locks and condvars.
ed [Thu, 4 Jan 2018 21:57:37 +0000 (21:57 +0000)]
Allow timed waits with relative timeouts on locks and condvars.

Even though pthreads doesn't support this, there are various alternative
APIs that use this. For example, uv_cond_timedwait() accepts a relative
timeout. So does Rust's std::sync::Condvar::wait_timeout().

Though I personally think that relative timeouts are bad (due to
imprecision for repeated operations), it does seem that people want
this. Extend the existing futex functions to keep track of whether an
absolute timeout is used in a boolean flag.

MFC after: 1 month

6 years agoDisabled the use of flowid for lagg by default
smh [Thu, 4 Jan 2018 20:05:47 +0000 (20:05 +0000)]
Disabled the use of flowid for lagg by default

Disabled the use of RSS hash from the network card aka flowid for
lagg(4) interfaces by default as it's currently incompatible with
the lacp and loadbalance protocols.

The incompatibility is due to the fact that the flowid isn't know
for the first packet of a new outbound stream which can result in
the hash calculation method changing and hence a stream being
incorrectly split across multiple interfaces during normal
operation.

This can be re-enabled by setting the following in loader.conf:
net.link.lagg.default_use_flowid="1"

Discussed with: kmacy
Sponsored by: Multiplay

6 years agobhnd(4): Add missing BCM4312 backplane clock speed entry.
landonf [Thu, 4 Jan 2018 19:47:01 +0000 (19:47 +0000)]
bhnd(4): Add missing BCM4312 backplane clock speed entry.

The default 80MHz clock speed returned by bhnd_pmu_si_clock() was already
correct; this just prevents the "No backplane clock specified" warning
printf from being emitted when querying backplane clock speed.

Sponsored by: The FreeBSD Foundation

6 years agoRestructure swapout tests after vm map locking was removed.
kib [Thu, 4 Jan 2018 18:14:58 +0000 (18:14 +0000)]
Restructure swapout tests after vm map locking was removed.

Consolidate the regions covered by the process lock.
Combine similar conditions tests into one, e.g. all process flags can
be test with one logical operation.
Add check for in-exec state, since p_vmspace is dererenced.
Remove labels and goto by explicitly tracking state.
Update comments.

Reviewed by: alc, markj (previous version)
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D13693

6 years agoRemove myself from ports-secteam
junovitch [Thu, 4 Jan 2018 17:58:48 +0000 (17:58 +0000)]
Remove myself from ports-secteam

I will be moving on to other life commitments this year and will not have
the time to support contributions as a ports committer, if able, until life
settles at the end of the year.

Discussed with: portmgr

6 years agocap_unwrap should return a descriptor but also free the structure.
oshogbo [Thu, 4 Jan 2018 08:23:23 +0000 (08:23 +0000)]
cap_unwrap should return a descriptor but also free the structure.

6 years agoCorrect function name in description block.
cy [Thu, 4 Jan 2018 04:11:40 +0000 (04:11 +0000)]
Correct function name in description block.

MFC after: 3 days

6 years agoAdd missing macro in man page.
oshogbo [Thu, 4 Jan 2018 04:04:29 +0000 (04:04 +0000)]
Add missing macro in man page.

Reported by: brueffer@

6 years agoOnce we have decided to swap out a process, don't delay the laundering of
alc [Thu, 4 Jan 2018 03:16:32 +0000 (03:16 +0000)]
Once we have decided to swap out a process, don't delay the laundering of
its per-thread kernel stack pages by making them pass through the inactive
queue first.  Instead, immediately place them in the laundry so that they
might be cleaned and made available for reclamation sooner.

Reviewed by: kib, markj
MFC after: 1 week

6 years agoThe recent bump of MAXDSIZ made 32-bit binary execution on 64-bit powerpc fail.
andreast [Wed, 3 Jan 2018 20:20:43 +0000 (20:20 +0000)]
The recent bump of MAXDSIZ made 32-bit binary execution on 64-bit powerpc fail.
The data segement was too big.

Add a fix-up function like on ia32 for MAXDSIZ.

While here, bring also the MAXSSIZ closer to amd64 and add an equal fix-up
function for MAXSSIZ.

Reviewed by: jhibbits@
Obtained from:  jhibbits@
Differential Revision: https://reviews.freebsd.org/D13753

6 years agoath: fix possible memory disclosure in ioctl handler
emaste [Wed, 3 Jan 2018 19:28:13 +0000 (19:28 +0000)]
ath: fix possible memory disclosure in ioctl handler

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC after: 1 week

6 years agocxgbe(4): Add a knob to enable/disable PCIe relaxed ordering. Disable it by
np [Wed, 3 Jan 2018 19:24:57 +0000 (19:24 +0000)]
cxgbe(4): Add a knob to enable/disable PCIe relaxed ordering.  Disable it by
default when running on Intel CPUs.

This is a crude fix for the performance issues alluded to in these Linux commits:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=87e09cdec4dae08acdb4aa49beb793c19d73e73e
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a99b646afa8a02571ea298bedca6592d818229cd

MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoath: revert accidental change committed with r327526
emaste [Wed, 3 Jan 2018 19:24:21 +0000 (19:24 +0000)]
ath: revert accidental change committed with r327526

It will be recommitted with the correct commit message.

6 years agoembed_mfs: correctly test grep return value
emaste [Wed, 3 Jan 2018 19:22:10 +0000 (19:22 +0000)]
embed_mfs: correctly test grep return value

Reported by: br
MFC with: r326992
Sponsored by: The FreeBSD Foundation

6 years agoAdd missing newlines to a couple of error messages.
markj [Wed, 3 Jan 2018 18:19:47 +0000 (18:19 +0000)]
Add missing newlines to a couple of error messages.

Keep error messages on a single line so that they're easier to grep for.

Reported by: pho
MFC after: 1 week

6 years agoUse 'extern uint8_t' instead of 'extern void' for external symbols.
jhb [Wed, 3 Jan 2018 17:40:51 +0000 (17:40 +0000)]
Use 'extern uint8_t' instead of 'extern void' for external symbols.

The beri boot loaders depend on symbols defined in linker scripts or
assembly files.  The boot loaders do not care about the type of these
symbols but just want to extract a pointer to them.  Older versions of
GCC permitted external symbols to be declared of type 'void' and then
'&foo' generated a void pointer to the memory at the symbol's address.
However, void objects are not valid C and newer versions of GCC error if
these are used.  Instead, declare these symbols as being bytes (or
an array of bytes in the cheri_sdcard_vaddr case).

Sponsored by: DARPA / AFRL

6 years agoDon't clobber system LDFLAGS for beri boot loaders.
jhb [Wed, 3 Jan 2018 17:35:38 +0000 (17:35 +0000)]
Don't clobber system LDFLAGS for beri boot loaders.

Prior to r325114, bsd.init.mk was included after assignments to CFLAGS and
LDFLAGS in these Makefiles.  After r325114, bare assignments (= rather than
+=) lost system-assigned default values that are needed when compiling with
an external toolchain.  CFLAGS in both Makefiles already uses +=.  This
commit changes LDFLAGS to use +=.  While here, depend on the LDFLAGS update
in the parent Makefile.inc to set -nostdlib.

Sponsored by: DARPA / AFRL

6 years agoFix warnings from "mandoc -Tlint -Wwarning".
trasz [Wed, 3 Jan 2018 17:28:01 +0000 (17:28 +0000)]
Fix warnings from "mandoc -Tlint -Wwarning".

Reported by: Yuri Pankov <yuripv at gmx.com>
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agomorse(6): fix two typod
eadler [Wed, 3 Jan 2018 17:04:13 +0000 (17:04 +0000)]
morse(6): fix two typod

6 years agoUse the new SDM-approved way to serialize x2APIC MSR writes.
kib [Wed, 3 Jan 2018 11:23:47 +0000 (11:23 +0000)]
Use the new SDM-approved way to serialize x2APIC MSR writes.

SDM editions 64 and below stated that it is enough to use MFENCe or
LFENCE to serialize x2APIC register writes.  New edition 65 requires
either full serialization instruction or MFENCE;LFENCE sequence.  Use
the later, FreeBSD needs serialization to ensure that writes done
before IPI request are visible to the target IPI CPU.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoEliminate a paranthesis which is both unneeded and causing trouble.
phk [Wed, 3 Jan 2018 09:33:59 +0000 (09:33 +0000)]
Eliminate a paranthesis which is both unneeded and causing trouble.

6 years agomorse(6): add a few missing characters
eadler [Wed, 3 Jan 2018 09:08:32 +0000 (09:08 +0000)]
morse(6): add a few missing characters

- add ñ, ', and _
- remove lint support
- add missing header for ioctl

6 years agoNLS data and tz can be cached using caspicum helpers.
oshogbo [Wed, 3 Jan 2018 07:43:04 +0000 (07:43 +0000)]
NLS data and tz can be cached using caspicum helpers.

Using them we simplifies and unifies sandboxed code.

6 years agoAdd info about SW_WATCHDOG change to be dynamic in the common case.
karels [Wed, 3 Jan 2018 06:41:39 +0000 (06:41 +0000)]
Add info about SW_WATCHDOG change to be dynamic in the common case.

6 years agoDocument services which we have in libcasper.
oshogbo [Wed, 3 Jan 2018 06:22:40 +0000 (06:22 +0000)]
Document services which we have in libcasper.

Reviewed by: bcr@
Differential Revision: https://reviews.freebsd.org/D13734

6 years agobsd-family-tree: revert r327333
eadler [Wed, 3 Jan 2018 03:46:28 +0000 (03:46 +0000)]
bsd-family-tree: revert r327333

bsd-family-tree should only contain projects that have had actual
releases.

Requested by: core

6 years agomake SW_WATCHDOG dynamic
karels [Wed, 3 Jan 2018 00:56:30 +0000 (00:56 +0000)]
make SW_WATCHDOG dynamic

Enable the hardclock-based watchdog previously conditional on the
SW_WATCHDOG option whenever hardware watchdogs are not found, and
watchdogd attempts to enable the watchdog. The SW_WATCHDOG option
still causes the sofware watchdog to be enabled even if there is a
hardware watchdog. This does not change the other software-based
watchdog enabled by the --softtimeout option to watchdogd.

Note that the code to reprime the watchdog during kernel core dumps is
no longer conditional on SW_WATCHDOG. I think this was previously a bug.

Reviewed by: imp alfred bjk
MFC after: 1 week
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D13713

6 years agokldxref: correct function names in warning messages
emaste [Tue, 2 Jan 2018 21:31:54 +0000 (21:31 +0000)]
kldxref: correct function names in warning messages

Sponsored by: The FreeBSD Foundation

6 years agonctgpio: add new device id for the GPIO chip in PCEngines APU3
gonzo [Tue, 2 Jan 2018 20:58:05 +0000 (20:58 +0000)]
nctgpio: add new device id for the GPIO chip in PCEngines APU3

PR: 224512
Submitted by: mike@sentex.net
MFC after: 2 weeks

6 years agoath: fix possible memory disclosures in ioctl handlers
emaste [Tue, 2 Jan 2018 19:34:23 +0000 (19:34 +0000)]
ath: fix possible memory disclosures in ioctl handlers

Apply the fix from r327499 to additional ioctl handlers.

Reported by: Ilja van Sprundel <ivansprundel@ioactive.com>
MFC after: 1 week
MFC with: r327499
Sponsored by: The FreeBSD Foundation

6 years agoath: fix memory disclosure from ath_btcoex_ioctl
emaste [Tue, 2 Jan 2018 19:29:30 +0000 (19:29 +0000)]
ath: fix memory disclosure from ath_btcoex_ioctl

The ath_btcoex_ioctl handler allocated a buffer without M_ZERO and
returned it to userland without writing to it.

The device has permissions only for root so this is not urgent, and the
fix can be MFCd and considered for a future EN.

Reported by: Ilja van Sprundel <ivansprundel@ioactive.com>
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
Reviewed by: adrian
MFC after: 1 week

6 years agohpt{nr,rr}: plug info leak in hpt_ioctl
emaste [Tue, 2 Jan 2018 18:31:32 +0000 (18:31 +0000)]
hpt{nr,rr}: plug info leak in hpt_ioctl

The hpt{nr,rr} ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

The hpt27{nr,rr} device has permissions only for root so this is not urgent,
and the fix can be MFCd and considered for a future EN.

The same issue was reported in the hpt27xx driver by Ilja Van Sprundel.

Reviewed by: jhb, kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agohpt27xx: plug info leak in hpt_ioctl
emaste [Tue, 2 Jan 2018 18:29:44 +0000 (18:29 +0000)]
hpt27xx: plug info leak in hpt_ioctl

The hpt27xx ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

The hpt27xx device has permissions only for root so this is not urgent,
and the fix can be MFCd and considered for a future EN.

Reported by: Ilja van Sprundel <ivansprundel@ioactive.com>
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com> (M_ZERO)
Reviewed by: jhb, kib
MFC after: 3 days
Security: info leak in root-only ioctl
Sponsored by: The FreeBSD Foundation

6 years agoFix some I/O ordering issues in gmirror.
markj [Tue, 2 Jan 2018 18:11:54 +0000 (18:11 +0000)]
Fix some I/O ordering issues in gmirror.

- BIO_FLUSH requests were dispatched to the disks directly from
  g_mirror_start() rather than going through the mirror's I/O request
  queue, so they could have been reordered with preceding writes.
  Address this by processing such requests from the queue, avoiding
  direct dispatch.
- Handling for collisions with synchronization requests was too
  fine-grained and could cause reordering of writes. In particular,
  BIO_ORDERED was not being honoured. Address this by effectively
  freezing the request queue any time a collision with a synchronization
  request occurs. The queue is unfrozen once the collision with the
  first frozen request is over.
- The above-mentioned collision handling allowed reads to jump ahead
  of writes to the same offset. Address this by freezing all request
  types when a collision occurs, not just BIO_WRITEs and BIO_DELETEs.

Also add some more fail points for use in testing error handling.

Reviewed by: imp
MFC after: 3 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13559

6 years agorpcbind: Fix race in signal termination
cem [Tue, 2 Jan 2018 17:25:13 +0000 (17:25 +0000)]
rpcbind: Fix race in signal termination

If a signal was delivered while the main thread was not in poll(2) and after
check was performed, we could reenter poll and never detect termination. Fix
this with the pipefd trick.  (This race was introduced very recently, in
r327482.)

PR: 224503
Reported by: kib
Reviewed by: kib, markj
Sponsored by: Dell EMC Isilon

6 years agoRevert r326844
bapt [Tue, 2 Jan 2018 16:50:57 +0000 (16:50 +0000)]
Revert r326844

There has been some fallout from the change. The change itself was not valueable
enough to spend time investigating the corner cases, let's just back it out.

Reported by: flo

6 years agoaw_sid: Add man page for this driver
kevans [Tue, 2 Jan 2018 14:54:54 +0000 (14:54 +0000)]
aw_sid: Add man page for this driver

Reviewed by: manu, bjk (both earlier version), brueffer (manpages)
Differential Revision: https://reviews.freebsd.org/D13720

6 years agoelfcopy: copy raw (untranslated) contents to binary output
emaste [Tue, 2 Jan 2018 14:07:55 +0000 (14:07 +0000)]
elfcopy: copy raw (untranslated) contents to binary output

Previously elfcopy used elf_getdata to obtain data from ELF sections
being copied to binary output, but elf_getdata returns data that has
been translated - that is, data is in host byte order. When the host and
target differ in endianness (e.g., converting a big-endian MIPS ELF
object to binary on an x86 host) this resulted in byte-swapped data in
certain sections such as .dynamic.

Instead use elf_rawdata to keep data in the original, target endianness.

Reported by: Hiroki Mori <yamori83@yahoo.co.jp>, Bill Yuan
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoshutdown: Fix r327476 by adding init
eadler [Tue, 2 Jan 2018 09:02:42 +0000 (09:02 +0000)]
shutdown: Fix r327476 by adding init

Initialize maybe_today. While here sort.

PR: 32411
Additionally reported by: rgrimes, ian

6 years agoAdd installer support for PS3 and PowerNV systems, also laying the
nwhitehorn [Tue, 2 Jan 2018 05:27:24 +0000 (05:27 +0000)]
Add installer support for PS3 and PowerNV systems, also laying the
foundation for invoking efibootmgr as part of new-style EFI booting on
x86. On PS3 and PowerNV, which are booted using Linux kexec from petitboot
rather than by loader(8), install the kernel and the rest of /boot to a
FAT partition and set up the appropriate petitboot configuration file
there.

The new bootconfig installer stage can do platform-dependent modifications
more complex than partition layout and installation of boot blocks and can
be used to (as here) set up some special configuration files, run efibootmgr,
or boot0cfg.

MFC after: 1 month

6 years agoSkip errors from being unable to set modification and creation times. If
nwhitehorn [Tue, 2 Jan 2018 05:22:54 +0000 (05:22 +0000)]
Skip errors from being unable to set modification and creation times. If
one of the directories in the filesystem hierarchy is a FAT mountpoint,
settings its times will fail, which would cause installation to abort.
Instead, make this a best-effort thing.

Handling this error is a hack and a better internal scheme for handling
this should be added to libarchive.