]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoAllow bootstrapping libopenbsd on Linux
arichardson [Wed, 5 Dec 2018 10:58:02 +0000 (10:58 +0000)]
Allow bootstrapping libopenbsd on Linux

The getdtablecount.c file won't compile on Linux but it seems like none of
the bootstrap tools actually need it.

Reviewed By: emaste, brooks
Differential Revision: https://reviews.freebsd.org/D14244

5 years agoFix newvers.sh with BUILD_WITH_STRICT_TMPPATH=1
arichardson [Wed, 5 Dec 2018 10:57:57 +0000 (10:57 +0000)]
Fix newvers.sh with BUILD_WITH_STRICT_TMPPATH=1

newvers.sh runs mkfifo which did not exist before this change.
However, I didn't notice before because it is run from a function
where a missing command does cause a noticeable failure.

Reviewed By: emaste, markj
Differential Revision: https://reviews.freebsd.org/D18377

5 years agoTidy up arm64 reloc_jmpslots() implementation.
mmel [Wed, 5 Dec 2018 10:30:53 +0000 (10:30 +0000)]
Tidy up arm64 reloc_jmpslots() implementation.
- don't relocate jump slots multiple times (if LD_BIND_NOW is defined).
- process only R_AARCH64_JUMP_SLOT here, other relocation types are handled
  by reloc_plt().

MFC after: 1 week

5 years agoImplement arm64 version of __tls_get_addr().
mmel [Wed, 5 Dec 2018 10:23:38 +0000 (10:23 +0000)]
Implement arm64 version of __tls_get_addr().

MFC after: 1 week

5 years agoFix style(9).
mmel [Wed, 5 Dec 2018 10:22:14 +0000 (10:22 +0000)]
Fix style(9).
Not a functional change.

MFC after: 1 week

5 years agoEnsure that cylinder-group check-hashes are properly updated when first
mckusick [Wed, 5 Dec 2018 06:31:50 +0000 (06:31 +0000)]
Ensure that cylinder-group check-hashes are properly updated when first
creating them and when correcting them when they are found to be corrupted.

Reported by:  Don Lewis (truckman@)
Sponsored by: Netflix

5 years agoRemove MD __sys_* private symbols.
brooks [Wed, 5 Dec 2018 00:46:09 +0000 (00:46 +0000)]
Remove MD __sys_* private symbols.

No references to any of these exist in the tree. The list was also
erratic with different architectures exporting different things
(arm64 and riscv exported none).

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18425

5 years agoaltq: manual cleanup after r341507
vangyzen [Tue, 4 Dec 2018 23:53:42 +0000 (23:53 +0000)]
altq:  manual cleanup after r341507

Remove a file that became practically empty.
Fix indentation.

Like r341507, I do not plan to MFC, but anyone else can.

5 years agoaltq: remove ALTQ3_COMPAT code
vangyzen [Tue, 4 Dec 2018 23:46:43 +0000 (23:46 +0000)]
altq: remove ALTQ3_COMPAT code

This code has apparently never compiled on FreeBSD since its
introduction in 2004 (r130365).  It has certainly not compiled
since 2006, when r164033 added #elsif [sic] preprocessor directives.
The code was left in the tree to reduce the diff from upstream (KAME).
Since that upstream is no longer relevant, remove the long-dead code.

This commit is the direct result of:

    unifdef -m -UALTQ3_COMPAT sys/net/altq/*

A later commit will do some manual cleanup.

I do not plan to MFC this.  If that would help you, go for it.

5 years agoext2fs.4: basic updates.
pfg [Tue, 4 Dec 2018 22:51:13 +0000 (22:51 +0000)]
ext2fs.4: basic updates.

Starting with FreeBSD 12 we fully support writing ext4 filesystems.
Mention some features that we don't support while here.

MFC after: 3 days

5 years agoRegen after r341495: Remove NOARGS from oaccept.
brooks [Tue, 4 Dec 2018 21:57:26 +0000 (21:57 +0000)]
Regen after r341495: Remove NOARGS from oaccept.

5 years agoRemove NOARGS from oaccept.
brooks [Tue, 4 Dec 2018 21:56:45 +0000 (21:56 +0000)]
Remove NOARGS from oaccept.

This was in the orignal patch, but lost in a rebase.

Reported by: andrew
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15816

5 years agoAnother attempt to fix issue with the DIOCGDELETE ioctl(2) not
sobomax [Tue, 4 Dec 2018 21:48:56 +0000 (21:48 +0000)]
Another attempt to fix issue with the DIOCGDELETE ioctl(2) not
handling slightly out-of-bound requests properly (r340187).
Perform range check here rather then rely on g_delete_data() to DTRT.

The g_delete_data() would always return success for requests
starting just the next byte after providers media boundary.

MFC after: 4 weeks

5 years agoOnly gnu/lib/csu when MK_BSD_CRTBEGIN is off.
andrew [Tue, 4 Dec 2018 18:51:28 +0000 (18:51 +0000)]
Only gnu/lib/csu when MK_BSD_CRTBEGIN is off.

We were still building it from Makefile.inc1. Disable it there so we don't
try to build the GNU crtbegin/crtend when the BSD version was asked for.

PR: 233733
Reported by: lwhsu
Reviewed by: emaste
MFC with: r339738
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18428

5 years agoAlways treat firmware request and response sizes as unsigned.
gordon [Tue, 4 Dec 2018 18:28:25 +0000 (18:28 +0000)]
Always treat firmware request and response sizes as unsigned.

This fixes an incomplete bounds check on the guest-supplied request
size where a very large request size could be interpreted as a negative
value and not be caught by the bounds check.

Submitted by: jhb
Reported by: Reno Robert
Approved by: so
Security: FreeBSD-SA-18:14.bhyve
Security: CVE-2018-17160

5 years agoRegen after r341474: Normalize COMPAT_43 syscall declarations.
brooks [Tue, 4 Dec 2018 16:49:14 +0000 (16:49 +0000)]
Regen after r341474: Normalize COMPAT_43 syscall declarations.

5 years agoNormalize COMPAT_43 syscall declarations.
brooks [Tue, 4 Dec 2018 16:48:47 +0000 (16:48 +0000)]
Normalize COMPAT_43 syscall declarations.

Have ogetkerninfo, ogetpagesize, ogethostname, osethostname, and oaccept
declare o<foo>_args structs rather than non-compat ones. Due to a
failure to use NOARGS in most cases this adds only one new declaration.

No changes required in freebsd32 as only ogetpagesize() is implemented
and it has a 32-bit specific implementation.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15816

5 years agoFix args cross-threading between gptboot(8) and loader(8) with zfs support.
ian [Tue, 4 Dec 2018 16:43:50 +0000 (16:43 +0000)]
Fix args cross-threading between gptboot(8) and loader(8) with zfs support.

When loader(8) is built with zfs support enabled, it assumes that any extarg
data present is a zfs_boot_args struct, but if the first-stage loader was
gptboot(8) the extarg data is actually a geli_boot_args struct.  Luckily,
zfsboot(8) and gptzfsboot(8) have always passed KARGS_FLAGS_ZFS along with
KARGS_FLAGS_EXTARG, so we can use KARGS_FLAGS_ZFS to decide whether the
extarg data is a zfs_boot_args struct.

To avoid similar problems in the future, gptboot(8) now passes a new
KARGS_FLAGS_GELI to indicate that extarg data is geli_boot_args.  In
loader(8), if the neither KARGS_FLAGS_ZFS nor KARGS_FLAGS_GELI is set but
extarg data is present (which will be the case for gptboot compiled before
this change), we now check for the known size of the geli_boot_args struct
passed by the older versions of gptboot as a way of confirming what type of
extarg data is present.

In a semi-related tidying up, since loader's main() has already decided
what type of extarg data is present and set the global 'zargs' var
accordingly, don't repeat the check in extract_currdev, just check whether
zargs is NULL or not.

X-MFC after: a few days, along with prior related changes.

5 years agoAdd ability to request listing and deleting only for dynamic states.
ae [Tue, 4 Dec 2018 16:12:43 +0000 (16:12 +0000)]
Add ability to request listing and deleting only for dynamic states.

This can be useful, when net.inet.ip.fw.dyn_keep_states is enabled, but
after rules reloading some state must be deleted. Added new flag '-D'
for such purpose.

Retire '-e' flag, since there can not be expired states in the meaning
that this flag historically had.

Also add "verbose" mode for listing of dynamic states, it can be enabled
with '-v' flag and adds additional information to states list. This can
be useful for debugging.

Obtained from: Yandex LLC
MFC after: 2 months
Sponsored by: Yandex LLC

5 years agoReimplement how net.inet.ip.fw.dyn_keep_states works.
ae [Tue, 4 Dec 2018 16:01:25 +0000 (16:01 +0000)]
Reimplement how net.inet.ip.fw.dyn_keep_states works.

Turning on of this feature allows to keep dynamic states when parent
rule is deleted. But it works only when the default rule is
"allow from any to any".

Now when rule with dynamic opcode is going to be deleted, and
net.inet.ip.fw.dyn_keep_states is enabled, existing states will reference
named objects corresponding to this rule, and also reference the rule.
And when ipfw_dyn_lookup_state() will find state for deleted parent rule,
it will return the pointer to the deleted rule, that is still valid.
This implementation doesn't support O_LIMIT_PARENT rules.

The refcnt field was added to struct ip_fw to keep reference, also
next pointer added to be able iterate rules and not damage the content
when deleted rules are chained.

Named objects are referenced only when states are going to be deleted to
be able reuse kidx of named objects when new parent rules will be
installed.

ipfw_dyn_get_count() function was modified and now it also looks into
dynamic states and constructs maps of existing named objects. This is
needed to correctly export orphaned states into userland.

ipfw_free_rule() was changed to be global, since now dynamic state can
free rule, when it is expired and references counters becomes 1.

External actions subsystem also modified, since external actions can be
deregisterd and instances can be destroyed. In these cases deleted rules,
that are referenced by orphaned states, must be modified to prevent access
to freed memory. ipfw_dyn_reset_eaction(), ipfw_reset_eaction_instance()
functions added for these purposes.

Obtained from: Yandex LLC
MFC after: 2 months
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D17532

5 years agoggated: do not expose stack data in sendfail()
emaste [Tue, 4 Dec 2018 15:25:15 +0000 (15:25 +0000)]
ggated: do not expose stack data in sendfail()

admbugs: 590
Submitted by: Fabian Keil <fk@fabiankeil.de>
Obtained from: ElectroBSD

5 years agoAdd assertion to check that named object has correct type.
ae [Tue, 4 Dec 2018 15:12:28 +0000 (15:12 +0000)]
Add assertion to check that named object has correct type.

Obtained from: Yandex LLC
MFC after: 1 week

5 years agoRestore /var/crash permissions to 0750, as declared in mtree file. After
garga [Tue, 4 Dec 2018 12:34:22 +0000 (12:34 +0000)]
Restore /var/crash permissions to 0750, as declared in mtree file. After
r337337 it changed to 0755.

Reviewed by: loos
Approved by: loos
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D18355

5 years agoAs part of the general cleanup of the ipfilter code, special cases
cy [Tue, 4 Dec 2018 06:11:04 +0000 (06:11 +0000)]
As part of the general cleanup of the ipfilter code, special cases
are committed separately to document fixing them separately from
the general cleanup. In this case we don't want to hide the utter
brokenness of what is being fixed.

Clean up a discombobulated block of #if's, with one block unreachable.
ip_fil.c is used in ipftest which is used to dry-run test ipfilter
rules in userspace without loading them in the kernel. The call to
(*ifp->if_output) matches that in the FreeBSD kernel.

Further testing and work will be required to make ipftest fully
functional.

MFC after: 1 week

5 years agoSprinkle EARLY_DRIVER_MODULE around the tree
jhibbits [Tue, 4 Dec 2018 04:55:49 +0000 (04:55 +0000)]
Sprinkle EARLY_DRIVER_MODULE around the tree

Mark some buses as BUS_PASS_BUS, and some resources as BUS_PASS_RESOURCE.
This also decouples some resource attachment orderings from being races by
device tree ordering, instead relying on the bus pass to provide the
ordering.

This was originally intended to support multipass suspend/resume, but it's
also needed on PowerMacs when using fdt, as the device tree seems to get
created in reverse of the OFW tree.
Reviewed by: nwhitehorn (long ago)
Differential Revision: https://reviews.freebsd.org/D918

5 years agopowerpc: preload_addr_relocate is no longer necessary for booke
jhibbits [Tue, 4 Dec 2018 03:51:10 +0000 (03:51 +0000)]
powerpc: preload_addr_relocate is no longer necessary for booke

The same behavior was moved to machdep.c, paired with AIM's relocation,
making this redundant.  With this, it's now possible to boot FreeBSD with
ubldr on a uboot Book-E platform, even with a
KERNBASE != VM_MIN_KERNEL_ADDRESS.

5 years agoRevert r340997 at the request of multiple users.
sbruno [Tue, 4 Dec 2018 03:23:14 +0000 (03:23 +0000)]
Revert r340997 at the request of multiple users.
- breaks ports-mgmt/pkg build for mips64, powerpc64 and i386 for some users.

--- pkg-static ---
/usr/lib/liblzma.a(stream_encoder_mt.o): In function `mythread_cond_init':
/usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:230:
undefined reference to `pthread_condattr_init'

Reported by: jhibbits zeising

5 years agoRemove test for KSE (removed in 2008).
brooks [Tue, 4 Dec 2018 00:22:08 +0000 (00:22 +0000)]
Remove test for KSE (removed in 2008).

Approved by: julian

5 years agoRemove a needlessly clever hack to start init with sys_exec().
brooks [Tue, 4 Dec 2018 00:15:47 +0000 (00:15 +0000)]
Remove a needlessly clever hack to start init with sys_exec().

Construct a struct image_args with the help of new exec_args_*() helper
functions and call kern_execve().

The previous code mapped a page in userspace, copied arguments out
to it one at a time, and then constructed a struct execve_args all so
that sys_execve() can call exec_copyin_args() to copy the data back in
to a struct image_args.

Opencode the part of pre_execve()/post_execve() that releases a
reference to the initial vmspace. We don't need to stop threads like
they do.

Reviewed by: kib, jhb (prior version)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15469

5 years agoPrint type designator 'D' for the KF_TYPE_DEV files.
kib [Mon, 3 Dec 2018 23:42:04 +0000 (23:42 +0000)]
Print type designator 'D' for the KF_TYPE_DEV files.

No type-specific data is provided by the kernel.

Sponsored by: Mellanox Technologies
MFC after: 1 week

5 years agoImprove procstat reporting for the linux cdev file descriptors.
kib [Mon, 3 Dec 2018 23:39:45 +0000 (23:39 +0000)]
Improve procstat reporting for the linux cdev file descriptors.

If there is a vnode attached to the linux file, use it to fill
kinfo_file.  Otherwise, report a new KF_TYPE_DEV file type, without
supplying any type-specific information.

KF_TYPE_DEV is supposed to be used by most devfs-specific file types.

Sponsored by: Mellanox Technologies
MFC after: 1 week

5 years agomkisoimages.sh: don't use -p flag when copying loader.efi to msdosfs.
yuripv [Mon, 3 Dec 2018 22:31:57 +0000 (22:31 +0000)]
mkisoimages.sh: don't use -p flag when copying loader.efi to msdosfs.

This fixes 'cdrom' target in the case when world was built by user,
and not root.

Reviewed by: imp
Differential revision: https://reviews.freebsd.org/D18414

5 years agoRemove declarations of syscalls not used in libthr.
brooks [Mon, 3 Dec 2018 22:09:23 +0000 (22:09 +0000)]
Remove declarations of syscalls not used in libthr.

Reviewed by: kib
Sponsored by: DARPA, AFRL

5 years agoAdd a missing definition for the !COMPAT_FREEBSD32 case.
markj [Mon, 3 Dec 2018 21:07:10 +0000 (21:07 +0000)]
Add a missing definition for the !COMPAT_FREEBSD32 case.

Reported by: jenkins
MFC with: r341442
Sponsored by: The FreeBSD Foundation

5 years agoPlug memory disclosures via ptrace(2).
markj [Mon, 3 Dec 2018 20:54:17 +0000 (20:54 +0000)]
Plug memory disclosures via ptrace(2).

On some architectures, the structures returned by PT_GET*REGS were not
fully populated and could contain uninitialized stack memory.  The same
issue existed with the register files in procfs.

Reported by: Thomas Barabosch, Fraunhofer FKIE
Reviewed by: kib
MFC after: 3 days
Security: kernel stack memory disclosure
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18421

5 years agoSome fixes for LD_BIND_NOW + ifuncs.
kib [Mon, 3 Dec 2018 20:03:43 +0000 (20:03 +0000)]
Some fixes for LD_BIND_NOW + ifuncs.

- Do not perform ifunc relocations together with other PLT relocations
  in PLT.  Instead, do it during an additional pass over the init
  list, so that ifuncs are resolved in the order of dso
  dependencies. This allows the ifuncs resolvers to call into depended
  libs.  Init list now includes all objects instead of only objects
  with init/fini callables.
- Disable relro protection around bind_now ifunc relocations.

I considered calling ifunc resolvers of dso after initializers of all
dependencies are processed, and decided that this is wrong/should not
be supported. The order now is normal relocations for all
objects->ifunc resolution in init order->initializers, where each step
does complete pass over all loaded objects before moving to the next
step.

Reported, tested and reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18400

5 years agoClarify that /dev/kmem is not used.
sevan [Mon, 3 Dec 2018 20:01:51 +0000 (20:01 +0000)]
Clarify that /dev/kmem is not used.
Move cross ref to right place while here.

Submitted by: kib
MFC after: 7 days

5 years agoProvide naive but self-contained implementations of memset(3) and
kib [Mon, 3 Dec 2018 19:55:55 +0000 (19:55 +0000)]
Provide naive but self-contained implementations of memset(3) and
bzero(3) for rtld.

This again reduces rtld dependency on libc, and in future, avoid ifunc
relocations when the functions are converted to ifuncs in libc.

Reported by: mjg
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18400

5 years agozfs: we can boot from dataset with large_dnode enabled
tsoome [Mon, 3 Dec 2018 19:35:21 +0000 (19:35 +0000)]
zfs: we can boot from dataset with large_dnode enabled

loader has been supporting large_dnode for some time, no need to block the
feature for boot dataset.

Reviewed by: avg
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18391

5 years agostand/i386: rename .s to .S to use Clang IAS
emaste [Mon, 3 Dec 2018 19:16:34 +0000 (19:16 +0000)]
stand/i386: rename .s to .S to use Clang IAS

As part of the migration away from obsolete binutils we want to retire
GNU as.  Most assembly files used on amd64 have a .S extension and
(via rules in share/mk/bsd.suffixes.mk) are assembled with Clang's
Integrated Assembler (IAS).  Rename files in stand/i386 to .S to use
the integrated assembler.

Clang's IAS supports the defsym option (via -Wa,) but only with one
dash, not two.  As both -defsym and --defsym are accepted by GNU as,
use the former.

PR: 233611
Reviewed by: tsoome
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18369

5 years agoNote these tools use kvm(3) and not procfs as in Solaris.
sevan [Mon, 3 Dec 2018 18:00:46 +0000 (18:00 +0000)]
Note these tools use kvm(3) and not procfs as in Solaris.

Obtained from: NetBSD
MFC after: 7 days

5 years agoMove inclusion of src.opts.mk later.
imp [Mon, 3 Dec 2018 17:51:10 +0000 (17:51 +0000)]
Move inclusion of src.opts.mk later.

src.opts.mk includes bsd.own.mk. This in turn defines CTFCONVERT_CMD
depending on the MK_CTF value. We then set MK_CTF to no, which has no
real effect. The solution is to set all the MK_foo values before
including src.opts.mk.

This should stop the cdboot binary from exploding in size for releases
built WITH_CTF=yes in src.conf.

Sponsored by: Netflix

5 years agonetmap(4): improve man page
vmaffione [Mon, 3 Dec 2018 17:17:59 +0000 (17:17 +0000)]
netmap(4): improve man page

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

5 years agodisable BIND_NOW in libc, libthr, and rtld
emaste [Mon, 3 Dec 2018 15:59:46 +0000 (15:59 +0000)]
disable BIND_NOW in libc, libthr, and rtld

An issue remains with BIND_NOW and processes using threads.  For now,
restore libc's BIND_NOW disable, and also disable BIND_NOW in rtld and
libthr.

A patch is in review (D18400) that likely fixes this issue, but just
disable BIND_NOW pending further testing after it is committed.

PR: 233333
Sponsored by: The FreeBSD Foundation

5 years agoUse less misleading directory name.
trasz [Mon, 3 Dec 2018 13:15:54 +0000 (13:15 +0000)]
Use less misleading directory name.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDisable the BSD CRT code on powerpc and sparc64, they need extra crt*.o
andrew [Mon, 3 Dec 2018 09:40:37 +0000 (09:40 +0000)]
Disable the BSD CRT code on powerpc and sparc64, they need extra crt*.o
files that haven't been implemented.

Reported by: sbruno
MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agopowerpc: Check for a fdt in the metadata if it doesn't already exist
jhibbits [Mon, 3 Dec 2018 04:56:06 +0000 (04:56 +0000)]
powerpc: Check for a fdt in the metadata if it doesn't already exist

It's possible the fdt pointer was passed in via the metadata, as is done in
ubldr.  Check for the fdt here, instead of working with a NULL fdt, and
panicking.

5 years agopowerpc/booke: Check for the metadata address by physical address
jhibbits [Mon, 3 Dec 2018 04:47:28 +0000 (04:47 +0000)]
powerpc/booke: Check for the metadata address by physical address

The metadata pointer will almost never be at or above 'btext', as btext is a
relocated symbol, so will be based at VM_MIN_KERNEL_ADDRESS, not at
KERNBASE.  Check the address against kernload, where the kernel is
physically loaded.

5 years agoEliminate duplicated code and struct member definitions in the handoff
ian [Mon, 3 Dec 2018 03:58:30 +0000 (03:58 +0000)]
Eliminate duplicated code and struct member definitions in the handoff
of args data between gptboot/zfsboot and loader(8).

Despite what seems like a lot of changes here, there are no actual
changes in behavior, or in the data layout in the structures involved.
This is just eliminating identical code pasted into multiple locations.

In detail, the changes are...

- Move struct zfs_boot_args definition from libsa/zfs/libzfs.h to
  i386/common/bootargs.h because it is specific to x86 booting and the
  handoff between zfsboot and loader, and has no relation to the zfs
  library code in general.

- The geli_boot_args and zfs_boot_args structs both contain an identical
  set of member variables containing geli information.  Extract this out
  to a new geli_boot_data struct, and embed it in the arg-passing structs.

- Provide new routines geli_import_boot_data() and geli_export_boot_data()
  that can be shared between gptboot, zfsboot, and loader instead of
  pasting identical code into several different .c files.

- Remove some checks for a NULL pointer that can never be true because the
  pointer being tested was set using pointer math (kargs + 1) and that can
  never result in NULL in this code.

5 years agoFix typo in comment
imp [Sun, 2 Dec 2018 23:13:45 +0000 (23:13 +0000)]
Fix typo in comment

Sponsored by: Netflix

5 years agoDelete the undocumented alias 'wds'.
imp [Sun, 2 Dec 2018 23:13:35 +0000 (23:13 +0000)]
Delete the undocumented alias 'wds'.

This was a typo for wdc. Eliminate it since it was in error. People
should use either 'wdc' or 'hgst' for the vendor from now on. 'hgst'
works for all versions this functionality is present for.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMove Intel specific log pages to intel.c
imp [Sun, 2 Dec 2018 23:13:24 +0000 (23:13 +0000)]
Move Intel specific log pages to intel.c

Move the Intel specific log pages (including the one that samsung
implements) to intel.c. Add comment to the samsung vendor that it will
be going away soon.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoUsage cleanup pt 2
imp [Sun, 2 Dec 2018 23:13:12 +0000 (23:13 +0000)]
Usage cleanup pt 2

Eliminage redundant spaces and nvmecontrol at start of all the usage
strings. Update the usage printing code to add them back when
presenting to the user. Allow multi-line usage messages and print
proper leading spaces for lines starting with a space.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoUsage cleanup pt 1
imp [Sun, 2 Dec 2018 23:12:58 +0000 (23:12 +0000)]
Usage cleanup pt 1

Provide a usage() function that takes a struct nvme_function pointer
and produces a usage mssage. Eliminate all now-redundant usage
functions. Propigate the new argument through the program as needed.
Use common routine to print usage.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoReturn after we find the dispatched function.
imp [Sun, 2 Dec 2018 23:12:48 +0000 (23:12 +0000)]
Return after we find the dispatched function.

If the dispatched function doesn't exit, then we get can get a
spurious function not found message. They all do exit, but this is a
little cleaner.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMove the hgst/wdc log page printing code into wdc.c
imp [Sun, 2 Dec 2018 23:12:37 +0000 (23:12 +0000)]
Move the hgst/wdc log page printing code into wdc.c

These are all hgst/wdc specific, so move them into the wdc.c to live
with the wdc command.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMove common logpage routines into nvmecontrol.h
imp [Sun, 2 Dec 2018 23:12:26 +0000 (23:12 +0000)]
Move common logpage routines into nvmecontrol.h

For the upcoming move of vendor specific code into vendor specific
files, make the common logpage routines global and move them to
nvmecontrol.h.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMake logpage functions a linker set.
imp [Sun, 2 Dec 2018 23:12:16 +0000 (23:12 +0000)]
Make logpage functions a linker set.

Move logpage function def to header. Convert all the logpage_function
elements to elements of the linker set. Leave them all in logpage.c
for the moment.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMove nvmecontrol to using linker sets for commands
imp [Sun, 2 Dec 2018 23:10:55 +0000 (23:10 +0000)]
Move nvmecontrol to using linker sets for commands

More commands will be added to nvmecontrol. Also, there will be a few
more vendor commands (some of which may need to remain private to
companies writing them). The first step on that journey is to move to
using linker sets to dispatch commands. The next step will be using
dlopen to bring in the .so's that have the command that might need
to remain private for seamless integration.

Similar changes to this will be needed for vendor specific log pages.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoFix PCI driver unload for Marvell PCI controller
gonzo [Sun, 2 Dec 2018 21:58:36 +0000 (21:58 +0000)]
Fix PCI driver unload for Marvell PCI controller

Add generic implementation for bus_deactivate_resource method. Without
it bus_release_resource fails with "Failed to release active resource"
message

MFC after: 1 week

5 years agoBuild the dtb for the rock64 board.
andreast [Sun, 2 Dec 2018 19:36:20 +0000 (19:36 +0000)]
Build the dtb for the rock64 board.

Reviewed by: manu@

5 years agoAdd rule to build the dtb for the rock64 board.
andreast [Sun, 2 Dec 2018 19:35:22 +0000 (19:35 +0000)]
Add rule to build the dtb for the rock64 board.

Reviewed by: manu@

5 years agoFix off-by-one (page) errors in checks in d_mmap methods of several drivers.
kib [Sun, 2 Dec 2018 18:30:58 +0000 (18:30 +0000)]
Fix off-by-one (page) errors in checks in d_mmap methods of several drivers.

Reported by: C Turt <ecturt@gmail.com>
Reviewed by: alc, markj
admbug: 781
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoAdd a comment noting that the additional range checks are not needed.
kib [Sun, 2 Dec 2018 13:29:13 +0000 (13:29 +0000)]
Add a comment noting that the additional range checks are not needed.

The object size is set in the dsp_mmap_single() which provides the
range limit by vm_fault().

Reported by: C Turt <ecturt@gmail.com>
Reviewed by: alc, markj
admbug: 781
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoFix off by one in hpet_mmap() csw method.
kib [Sun, 2 Dec 2018 13:27:36 +0000 (13:27 +0000)]
Fix off by one in hpet_mmap() csw method.

Reported by: C Turt <ecturt@gmail.com>
Reviewed by: alc, markj
Tested by: pho
admbug: 781
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoChange the vm_ooffset_t type to unsigned.
kib [Sun, 2 Dec 2018 13:16:46 +0000 (13:16 +0000)]
Change the vm_ooffset_t type to unsigned.

The type represents byte offset in the vm_object_t data space, which
does not span negative offsets in FreeBSD VM.  The change matches byte
offset signess with the unsignedness of the vm_pindex_t which
represents the type of the page indexes in the objects.

This allows to remove the UOFF_TO_IDX() macro which was used when we
have to forcibly interpret the type as unsigned anyway.  Also it fixes
a lot of implicit bugs in the device drivers d_mmap methods.

Reviewed by: alc, markj (previous version)
Tested by: pho
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoCorrect accuracy of the barrier writes accounting.
kib [Sun, 2 Dec 2018 12:53:39 +0000 (12:53 +0000)]
Correct accuracy of the barrier writes accounting.

Discussed with: mckusick
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoReturn computed real memory size, not a value from similarly named
mmel [Sun, 2 Dec 2018 07:39:16 +0000 (07:39 +0000)]
Return computed real memory size, not a value from similarly named
global variable.

MFC after: 1 week

5 years agoUnbreak geli/gmirror testcases if their geom classes cannot be loaded
asomers [Sun, 2 Dec 2018 05:06:37 +0000 (05:06 +0000)]
Unbreak geli/gmirror testcases if their geom classes cannot be loaded

The problem with the logic prior to this commit was twofold:

1. The wrong set of idioms (TAP-compatible) were being applied to the ATF
   testcases when run, resulting in confusing ATF failure results on setup.
2. The cleanup subroutines were broken when the geom classes could not be
   loaded as they exited with 0 unexpectedly.

This commit changes the test code to source the class-specific configuration
(conf.sh) once globally, instead of sourcing it per testcase and per cleanup
subroutine, and to call the ATF-specific setup subroutine(s) inline in
the testcases.

The refactoring done is effectively a no-op for the TAP testcases, modulo
any refactoring done to create common code between the ATF and TAP
testcases.

This unbreaks the geli testcases converted to ATF in r327662 and r327683,
and the gmirror testcases added in r327780, respectively, when the geom
class could not be loaded.

tests/sys/geom/class/mirror/...
    While here, ignore errors when turning debug failpoint sysctl off, which
    could occur if the gmirror class was not loaded.

Submitted by: ngie
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd/pull/241

5 years agoubldr: Force 'usefdt' variable to 1 for powerpc
jhibbits [Sun, 2 Dec 2018 02:20:35 +0000 (02:20 +0000)]
ubldr: Force 'usefdt' variable to 1 for powerpc

The fdt is gated, on powerpc, with a 'usefdt' environment variable.  Force
enable it in ubldr, so that the fdt is passed through the metadata.

5 years agoRemove some dead code from the geli tests
asomers [Sun, 2 Dec 2018 00:41:43 +0000 (00:41 +0000)]
Remove some dead code from the geli tests

This is detritus in the Makefile, leftover from 327662.

MFC after: 2 weeks

5 years agopmcr: Fix pstate setting on Power8
cem [Sat, 1 Dec 2018 21:37:47 +0000 (21:37 +0000)]
pmcr: Fix pstate setting on Power8

Fix p-state setting on Power8 by removing the accidental double-indirection of
the pstate_ids table.

The pstate_ids table comes from the OF property "ibm,pstate-ids."  On Power9,
the values happen to be identical to the indices, so the extra indirection was
harmless.  On Power8, the values were out of the range [0, npstates], so
pmcr_set() would fail the spec[0] range check with EINVAL.

While here, include both the value and index in the driver-specific register
array as spec[0] and spec[1] respectively.  They're redundant, but relatively
harmless, and it may aid debugging.

While here, fix the range check to exclude the index npstates, which is one
past the last valid index.

PR: 233693
Reported and tested by: sbruno
Reviewed by: jhibbits

5 years agoRestore build of the kernel, removed through r341377
cem [Sat, 1 Dec 2018 21:28:05 +0000 (21:28 +0000)]
Restore build of the kernel, removed through r341377

Turns out we already had a path_mtu_discovery variable.

X-MFC-with: r341377

5 years agoFix PowerPC64 ELFv1-specific problem in __elf_phdr_match_addr() leading to crash
jhibbits [Sat, 1 Dec 2018 20:39:20 +0000 (20:39 +0000)]
Fix PowerPC64 ELFv1-specific problem in __elf_phdr_match_addr() leading to crash
in threaded programs that unload libraries.

Summary:
The GNOME update to 3.28 exposed a bug in __elf_phdr_match_addr(), which leads
to a crash when building devel/libsoup on powerpc64.

Due to __elf_phdr_match_addr() limiting its search to PF_X sections, on the
PPC64 ELFv1 ABI, it was never matching function pointers properly.

This meant that libthr was never cleaning up its atfork list in
__pthread_cxa_finalize(), so if a library with an atfork handler was unloaded,
libthr would crash on the next fork.

Normally, the null pointer check it does before calling the handler would avoid
this crash, but, due to PPC64 ELFv1 using function descriptors instead of raw
function pointers, a null check against the pointer itself is insufficient, as
the pointer itself was not null, it was just pointing at a function descriptor
that had been zeroed. (Which is an ABI violation.)

Calling a zeroed function descriptor on PPC64 ELFv1 causes a jump to address 0
with a zeroed r2 and r11.

Submitted by: git_bdragon.rtk0.net
Reviewed By: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18364

5 years agoAdd Silergy SYR827 PMIC driver
manu [Sat, 1 Dec 2018 20:31:49 +0000 (20:31 +0000)]
Add Silergy SYR827 PMIC driver

SYR827 is a PMIC that can output a voltage from 0.7125V to 1.5V in 12.5mV steps
It's controlled via I2C.

MFC after: 1 month

5 years agoarm64: rockchip: rk805: Add basic support for RK808 PMIC
manu [Sat, 1 Dec 2018 20:31:05 +0000 (20:31 +0000)]
arm64: rockchip: rk805: Add basic support for RK808 PMIC

RK808 PMIC is the companion chip for RK3399 SoC.
Add basic regulator support in RK805 since they are similar.

MFC after: 1 month

5 years agoRemove IFF_DRVRLOCK as it is used in IRIX only (and we all know IRIX
cy [Sat, 1 Dec 2018 20:30:18 +0000 (20:30 +0000)]
Remove IFF_DRVRLOCK as it is used in IRIX only (and we all know IRIX
is dead). This includes collaterally removing code shared by HP/UX,
SGI, and Linux, where IP Filter will in all likelihood for various
reasons never run again.

MFC after: 1 week

5 years agoarm64: rockchip: rk_i2c: Use correct clock
manu [Sat, 1 Dec 2018 20:29:42 +0000 (20:29 +0000)]
arm64: rockchip: rk_i2c: Use correct clock

While here add RK3399 support and call clk_set_assigned to set the correct
clock set in the DTS.

MFC after: 1 month

5 years agoarm64/rockchip: add RK3399 support
manu [Sat, 1 Dec 2018 20:28:16 +0000 (20:28 +0000)]
arm64/rockchip: add RK3399 support

Add CRU (Clock and Reset Unit) driver for RK3399.
Add support in rk_pinctrl driver.

Submitted by:  Greg V <greg@unrelenting.technology> (Original version)
Differential Revision: https://reviews.freebsd.org/D16732

MFC after: 1 month

5 years agoarm64: rockchip: Add RK3399_CLK_PLL
manu [Sat, 1 Dec 2018 20:26:59 +0000 (20:26 +0000)]
arm64: rockchip: Add RK3399_CLK_PLL

PLLs on the RK3399 are different than the ones on the RK3328.
Add a new type and some dedicated recalc and set_freq functions.
Rename the RK3328 dedicated rk_clk_pll function with rk3328_ prefix.

MFC after: 1 month

5 years agoRestore handling of PMTU discovery, removed through an unifdef(1)
cy [Sat, 1 Dec 2018 17:59:41 +0000 (17:59 +0000)]
Restore handling of PMTU discovery, removed through an unifdef(1)
following the MFV of r254219 into r255332. In addition the 'FreeBSD'
macro was never defined in ipfilter 5.1.2 thus it never would have
been enabled in the first place.

This work is prompted by a general cleanup of the IP Filter code
prompted by working to resolve a PR. More to follow.

MFC after: 1 week

5 years agoAllow to create swap zone larger than v_page_count / 2.
kib [Sat, 1 Dec 2018 16:50:12 +0000 (16:50 +0000)]
Allow to create swap zone larger than v_page_count / 2.

If user configured the maxswapzone tunable, just take the literal
value for the initial zone sizing attempt.  Before, it was only
possible to reduce the zone by the tunable.

While there, correct the message which was not correct when zone
creation rounded the size up.

Reported by: jmg
Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18381

5 years agoCorrect the tunable name in the message.
kib [Sat, 1 Dec 2018 16:43:18 +0000 (16:43 +0000)]
Correct the tunable name in the message.

Submitted by:  Andre Albsmeier <mail@fbsd.e4m.org>
PR: 231577
MFC after: 1 week

5 years agoamd64: align target memmove buffer to 16 bytes before using rep movs
mjg [Sat, 1 Dec 2018 14:20:32 +0000 (14:20 +0000)]
amd64: align target memmove buffer to 16 bytes before using rep movs

See the review for sample test results.

Reviewed by: kib (kernel part)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18401

5 years agopf tests: Test name handling
kp [Sat, 1 Dec 2018 09:59:32 +0000 (09:59 +0000)]
pf tests: Test name handling

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

5 years agopf: Fix panic on overlapping interface names
kp [Sat, 1 Dec 2018 09:58:21 +0000 (09:58 +0000)]
pf: Fix panic on overlapping interface names

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

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

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

5 years agopf tests: Make pass_block:noalias more robust
kp [Sat, 1 Dec 2018 09:57:29 +0000 (09:57 +0000)]
pf tests: Make pass_block:noalias more robust

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

5 years agoClarify that patterns are extended regular expressions in pkill(1) manual page.
ygy [Sat, 1 Dec 2018 05:58:33 +0000 (05:58 +0000)]
Clarify that patterns are extended regular expressions in pkill(1) manual page.

PR: 231060
Submitted by: naddy
MFC after: 3 days

5 years agoRemove trim(8) by multiple demands.
eugen [Sat, 1 Dec 2018 03:20:10 +0000 (03:20 +0000)]
Remove trim(8) by multiple demands.

5 years agoMaybe make gcc happy
vangyzen [Fri, 30 Nov 2018 23:47:57 +0000 (23:47 +0000)]
Maybe make gcc happy

According to Jenkins, the GCC architectures were unhappy because:

    sigaltstack.c:82: warning: missing initializer
    sigaltstack.c:82: warning: (near initialization for 'oss.ss_size')

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

5 years agoFix reporting of SS_ONSTACK
vangyzen [Fri, 30 Nov 2018 22:44:33 +0000 (22:44 +0000)]
Fix reporting of SS_ONSTACK

Fix reporting of SS_ONSTACK in nested signal delivery when sigaltstack()
is used on some architectures.

Add a unit test for this.  I tested the test by introducing the bug
on amd64.  I did not test it on other architectures.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D18347

5 years agotrim(8): serveral style fixes
eugen [Fri, 30 Nov 2018 21:57:02 +0000 (21:57 +0000)]
trim(8): serveral style fixes

Submitted by: imp
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18380

5 years agoamd64: handle small memmove buffers with overlapping stores
mjg [Fri, 30 Nov 2018 20:58:08 +0000 (20:58 +0000)]
amd64: handle small memmove buffers with overlapping stores

Handling sizes of > 32 backwards will be updated later.

Reviewed by: kib (kernel part)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18387

5 years agoiscsi: simplify the capsicumization
oshogbo [Fri, 30 Nov 2018 19:40:16 +0000 (19:40 +0000)]
iscsi: simplify the capsicumization

Approved by: trasz
Differential Revision: https://reviews.freebsd.org/D17962

5 years agolibcasper: do not fail if Capsicum is not avilable
oshogbo [Fri, 30 Nov 2018 19:27:14 +0000 (19:27 +0000)]
libcasper: do not fail if Capsicum is not avilable

Casper service can be also used on the kernels without Capsicum support.

Reported by: sbruno
Tested by: sbruno

5 years agoAdd missing display messages when toggling modes.
markj [Fri, 30 Nov 2018 18:02:59 +0000 (18:02 +0000)]
Add missing display messages when toggling modes.

PR: 233667
Submitted by: James Wright <james.wright@jigsawdesign.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18331

5 years agoSilence down the example builds a bit.
trasz [Fri, 30 Nov 2018 16:02:27 +0000 (16:02 +0000)]
Silence down the example builds a bit.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd an example of quick kernel rebuild.
trasz [Fri, 30 Nov 2018 16:01:43 +0000 (16:01 +0000)]
Add an example of quick kernel rebuild.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd an example of rebuilding a single piece of userspace.
trasz [Fri, 30 Nov 2018 15:56:14 +0000 (15:56 +0000)]
Add an example of rebuilding a single piece of userspace.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRevert r341337; according to imp@ we still support these.
trasz [Fri, 30 Nov 2018 15:52:03 +0000 (15:52 +0000)]
Revert r341337; according to imp@ we still support these.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL