Commit Graph

249575 Commits

Author SHA1 Message Date
Gleb Smirnoff
e5c3941009 Move M_RPC malloc type into XDR. Both RPC and XDR libraries use
this type, but since RPC depends on XDR (not vice versa) we need
it defined in XDR to make the module loadable without RPC.

Reviewed by:	rmacklem
Differential Revision:	https://reviews.freebsd.org/D24408
2020-04-17 06:02:13 +00:00
Gleb Smirnoff
2ffded5e53 Don't initialize m->m_data to m->m_pktdat, this is already done by the
mbuf allocator.  That was the last remnant of such code in the kernel.
2020-04-17 05:59:38 +00:00
Kyle Evans
c17dd0e88b tests: kqueue: use a more precise timer for the NOTE_ABSTIME test
Originally noticed while attempting to run the kqueue tests under
qemu-user-static, this apparently just happens sometimes when running in a
jail in general -- the timer will fire off "too early," but it's really just
the result of imprecise measurements (noted by cem).

Kicking this over to NOTE_USECONDS still tests the correct thing while
allowing it to work more consistently; a basic sanity test reveals that we
often end up coming in just less than 200 microseconds after the timer
fired off.

MFC after:	3 days
2020-04-17 02:22:15 +00:00
Rick Macklem
82164bdd76 Add a sanity check for nes_numsecflavor to the NFS server.
Ryan Moeller reported crashes in the NFS server that appear to be
caused by stack corruption in nfsrv_compound(). It appears that
the stack got corrupted just after a NFSv4.1 Lookup that crosses
a server mount point.
Although it is just a "theory" at this point, the most obvious way
the stack could get corrupted would be if nfsvno_checkexp() somehow
acquires an export with a bogus nes_numsecflavor value. This would
cause the copying of the secflavors to run off the end of the array,
which is allocated on the stack below where the corruption occurs.

This sanity check is simple to do and would stop the stack corruption
if the theory is correct. Otherwise, doing the sanity check seems to
be a reasonable safety belt to add to the code.

Reported by:	freqlabs
MFC after:	2 weeks
2020-04-17 02:21:46 +00:00
Kyle Evans
cc62118e65 audit_canon_path_vp: don't panic if cdir == NULL
cdir may have simply failed to resolve (e.g. fget_cap failure in namei
leading to NULL dp passed to AUDIT_ARG_UPATH*_VP); restore the pre-rS358191
behavior of setting cpath[0] = '\0' and bailing out instead of panicking.

This was found by inadvertently running the libc/c063 tests with auditing
enabled, resulting in a panic.

Reviewed by:	mjg (committed version actually his)
Differential Revision:	https://reviews.freebsd.org/D24445
2020-04-17 02:09:31 +00:00
Adrian Chadd
4d0b267a1f [sh] Fix a "may be unused" warning on mips-gcc
mips-gcc for mips32 was complaining that c was potentially used before
being set.  Setting it to 0 before calling fdgetsc() looks like the right
thing to do in this instance; there's an explicit check for c == 0 later
on.

Tested: mips-gcc mips32 build, running /bin/sh on mips32
2020-04-16 23:31:39 +00:00
Adrian Chadd
6c88ef1c81 [libsa] Fix typecast of pointer for st_dev
This code was trying to use a pointer value for st_dev, which is definitely
not a pointer.  Instead, cast to uintptr_t so it becomes a non-pointer value
before casting it.

Tested: mips-gcc cross compile, mips32 build
2020-04-16 23:29:49 +00:00
Adrian Chadd
2538a4b1b4 Remove an duplicate definition of nhops_dump_sysctl()
One of the source files included both nhop.h and shared.h, leading to this
clashing.

Tested with: mips-gcc cross toolchain
2020-04-16 23:28:47 +00:00
Colin Percival
a620e53d52 Alert devd when acpi_video brightness changes
On my Dell Latitude 7390 laptop, the brightness hotkeys
(Fn+<up/down arrow>) send ACPI notifications which acpi_video
handles by adjusting its brightness setting; but ACPI does not
actually do anything with the backlight.

Announcing brightness changes via devd makes it possible to close
the loop by triggering the intel_backlight utility to perform the
required backlight adjustment.

Reviewed by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D24424
2020-04-16 21:56:52 +00:00
Brooks Davis
b24e6ac8b7 Convert canary, execpathp, and pagesizes to pointers.
Use AUXARGS_ENTRY_PTR to export these pointers.  This is a followup to
r359987 and r359988.

Reviewed by:	jhb
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24446
2020-04-16 21:53:17 +00:00
John Baldwin
d3920c5b12 Use %zu to print a size_t value instead of %ju.
This fixes the build for 32-bit kernels.
2020-04-16 20:46:35 +00:00
John Baldwin
fdbb2410cb Add 'gpio' since mmc now requires gpio_if.h. 2020-04-16 20:45:54 +00:00
Emmanuel Vadot
8738027377 arm: nvidia: pcie: Rename class name to pcib
Reported by:	jhb
2020-04-16 20:44:23 +00:00
Jonathan T. Looney
5d6e356cb0 Avoid calling protocol drain routines more than once per reclamation event.
mb_reclaim() calls the protocol drain routines for each protocol in each
domain. Some protocols exist in more than one domain and share drain
routines. In the case of SCTP, it also uses the same drain routine for
its SOCK_SEQPACKET and SOCK_STREAM entries in the same domain.

On systems with INET, INET6, and SCTP all defined, mb_reclaim() calls
sctp_drain() four times. On systems with INET and INET6 defined,
mb_reclaim() calls tcp_drain() twice. mb_reclaim() is the only in-tree
caller of the pr_drain protocol entry.

Eliminate this duplication by ensuring that each pr_drain routine is only
specified for one protocol entry in one domain.

Reviewed by:	tuexen
MFC after:	2 weeks
Sponsored by:	Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D24418
2020-04-16 20:17:24 +00:00
Jonathan T. Looney
631d525dc1 Add a regression test for the changes in r359922 and r359923.
Note that the Python code has been tested on both Python 2.7 and 3.7.

Reviewed by:	olivier
MFC after:	2 weeks
Sponsored by:	Netflix, Inc.
2020-04-16 20:07:34 +00:00
Emmanuel Vadot
5b2a48fb40 arm: Fix duplicate pcib DRIVER_MODULE
Name each pcib driver uniquely.
This remove the warning printed at each arm boot :
module_register: cannot register simplebus/pcib from kernel; already loaded from kernel
2020-04-16 18:37:11 +00:00
Alexander V. Chernikov
5cdc484410 Fix userland build broken by r360014. 2020-04-16 17:53:23 +00:00
John Baldwin
6231ed472f Document TCP_TLS_MODE_TOE. 2020-04-16 17:41:32 +00:00
Brooks Davis
19112958cf style(9): end continued line with operator. 2020-04-16 17:24:13 +00:00
Alexander V. Chernikov
539642a29d Add nhop parameter to rti_filter callback.
One of the goals of the new routing KPI defined in r359823 is to
 entirely hide`struct rtentry` from the consumers. It will allow to
 improve routing subsystem internals and deliver more features much faster.
This change is one of the ongoing changes to eliminate direct
 struct rtentry field accesses.

Additionally, with the followup multipath changes, single rtentry can point
 to multiple nexthops.

With that in mind, convert rti_filter callback used when traversing the
 routing table to accept pair (rt, nhop) instead of nexthop.

Reviewed by:	ae
Differential Revision:	https://reviews.freebsd.org/D24440
2020-04-16 17:20:18 +00:00
Emmanuel Vadot
f943f61c08 arm: Fix duplicate ehci DRIVER_MODULE
Name each ehci driver uniquely.
This remove the warning printed at each arm boot :
module_register: cannot register simplebus/ehci from kernel; already loaded from kernel

A similar fix was done in r333074 but imx_ehci wasn't renamed and generic_ehci wasn't
present at that time.
2020-04-16 16:59:37 +00:00
Conrad Meyer
b645fd4531 vmm(4): Expose instruction decode to userspace build
Permit instruction decoding logic to be compiled outside of the kernel for
rapid iteration and validation.

Reviewed by:	grehan
Differential Revision:	https://reviews.freebsd.org/D24439
2020-04-16 16:50:33 +00:00
Emmanuel Vadot
cbba9a7bda arm: allwinner: aw_mmc: Make it possible to unload the module
While here, add a makefile in sys/modules/allwinner so it is built.
Also add the PNP info so devmatch will load this module automatically.

MFC after:	1 month
2020-04-16 16:00:21 +00:00
Richard Scheffenegger
d7ca3f780d Reduce default TCP delayed ACK timeout to 40ms.
Reviewed by:	kbowling, tuexen
Approved by:	tuexen (mentor)
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D23281
2020-04-16 15:59:23 +00:00
Emmanuel Vadot
0f2f8632dc mmc_fdt_helpers: Drain the cd pin taskqueue in mmc_fdt_gpio_teardown
We have no use for it now.

MFC after:	1 month
2020-04-16 15:58:58 +00:00
Emmanuel Vadot
4fda71e8d9 mmc_fdt_helpers: Always init the timout
We use the taskqueue to schedule card detection so always init it.
This is a proper solution instead of r359965.

MFC after:	1 month
MFH:		r359924
2020-04-16 12:32:28 +00:00
Emmanuel Vadot
ac8dcddd8b Revert r359965
This cause board without a cd-gpio to not schedule a card detection.
2020-04-16 12:31:12 +00:00
Scott Long
0d9abbcf51 Fix ps_strings type change for i386 2020-04-16 05:27:13 +00:00
Scott Long
3859e5c3c6 Add support for some IOCFacts fields that are available with mpr (12Gb)
controllers.  It's ugly due to the single codebase for mpr and mps and
not being able to share their respective headers.
2020-04-16 04:17:06 +00:00
Scott Long
39e2d6bc38 Don't keep a private copy of mpr_ioctl.h and mps_ioctl.h, since they
easily get out of sync with the real files from the driver.
2020-04-16 03:33:46 +00:00
Scott Long
8fae77f50c Add a small hack to the ioctl header files so that both mpr and mps can
be included.  This isn't a great solution, but fixing it correctly is a
bigger task and this is the lesser of the existing evils.
2020-04-16 03:28:28 +00:00
Xin LI
02371ceb33 Sync with NetBSD/OpenBSD. 2020-04-16 03:23:19 +00:00
Kyle Evans
c318828929 Preload hostuuid for early-boot use
prison0's hostuuid will get set by the hostid rc script, either after
generating it and saving it to /etc/hostid or by simply reading /etc/hostid.

Some things (e.g. arbitrary MAC address generation) may use the hostuuid as
a factor in early boot, so providing a way to read /etc/hostid (if it's
available) and using it before userland starts up is desirable. The code is
written such that the preload doesn't *have* to be /etc/hostid, thus not
assuming that there will be newline at the end of the buffer or even the
exact shape of the newline. White trailing whitespace/non-printables
trimmed, the result will be validated as a valid uuid before it's used for
early boot purposes.

The preload can be turned off with hostuuid_load="NO" in /boot/loader.conf,
just as other preloads; it's worth noting that this is a 37-byte file, the
overhead is believed to be generally minimal.

It doesn't seem necessary at this time to be concerned with kern.hostid.

One does wonder if we should consider validating hostuuids coming in
via jail_set(2); some bits seem to care about uuid form and we bother
validating format of smbios-provided uuid and in-fact whatever uuid comes
from /etc/hostid.

Reviewed by:	karels, delphij, jamie
MFC after:	1 week (don't preload by default, probably)
Differential Revision:	https://reviews.freebsd.org/D24288
2020-04-16 00:54:06 +00:00
Konstantin Belousov
ab23c2784b Improve TSC calibration logic.
Stop attempting to use FADT legacy hardware flag, it is almost always
a lie.

Instead, unless user explicitly disabled the calibration, calibrate
against 8254 ISA clock.  Then, obtain the rough value of the expected
TSC frequency from CPUID leafs 0x15/0x16 or even from the CPU
marketing name string.  If calibration results look unbelievably bogus
comparing with CPUID leafs report, use CPUID one.

Intel does not recommend to use CPUID leaf 0x16 for the value of the
system time frequency, indeed the error there might be up to 1% which
e.g. makes ntpd give up.  If ISA clock is present, we win, if not, we
get some frequency that allows the machine to boot without enormous
delay.

Next improvement would be to use HPET for re-calibration if we decided
that ISA clock gives bogus results, after HPETs are enumerated. This
is a much bigger change since we probably would need to re-evaluate
some constants depending on TSC frequency.

Reviewed by:	emaste, jhb, scottl
Tested by:	scottl
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D24426
2020-04-15 22:28:51 +00:00
Rick Macklem
0bda1ddd33 Fix the NFSv4.2 extended attribute support for remove extended attrbute.
I missed the "atomic" field of the RemoveExtendedAttribute operation's
reply when I implemented it. It worked between FreeBSD client and server,
since it was missed for both, but it did not conform to RFC 8276.
This patch adds the field for both client and server.

Thanks go to Frank for doing interoperability testing of the extended
attribute support against patches for Linux.

Submitted by:	Frank van der Linden <fllinden@amazon.com>
Reported by:	Frank van der Linden <fllinden@amazon.com>
2020-04-15 21:27:52 +00:00
Dimitry Andric
5df2af0809 Revert commit b6cf400aa fro llvm git (by Nemanja Ivanovic):
Fix bots after a9ad65a2b34f

  In the last commit, I neglected to initialize the new subtarget
  feature I added which caused failures on a few bots. This should fix
  that.

This unbreaks the build after r359981, which reverted upstream commit
a9ad65a2b34f.

Reported by:	jhibbits (and jenkins :)
MFC after:	6 weeks
X-MFC-With:	358851
2020-04-15 21:06:38 +00:00
John Baldwin
f91ab858cf Use crypto_contiguous_subsegment().
This driver used a home-rolled version that predated the function and
didn't support mbufs.
2020-04-15 21:05:38 +00:00
Alfredo Dal'Ava Junior
d80a924822 powerpc: autosize bpvo based on physical memory
Default moea64_bpvo_pool_size 327680 was insufficient for initial
memory mapping at boot time on systems with, for example, 64G and
no huge pages enabled.

Submitted by:	Andre Silva <afscoelho@gmail.com>
Reviewed by:	jhibbits, alfredo
Approved by:	jhibbits (mentor)
Sponsored by:	Eldorado Research Institute (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D24102
2020-04-15 20:33:09 +00:00
Brooks Davis
3076591b7a Attempt to use AT_PS_STRINGS to get the ps_strings pointer.
This saves a system call and avoids one of the (relatively rare) cases
of the kernel exporting pointers via sysctl.

As a temporary measure, keep the sysctl support to allow limited
compatability with old kernels.

Fail gracefully if ps_strings can't be found (should never happen).

Reviewed by:	kib
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24407
2020-04-15 20:28:20 +00:00
Brooks Davis
1e4a35add8 Support AT_PS_STRINGS in _elf_aux_info().
This will be used by setproctitle().

Reviewed by:	kib
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24407
2020-04-15 20:26:41 +00:00
Brooks Davis
3780fcd950 Add procstat support for AT_ flags added in r359988.
This includes argc, argv, envc, envv, and ps_strings.

Reviewed by:	kib
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24407
2020-04-15 20:25:38 +00:00
Brooks Davis
9df1c38bbc Export argc, argv, envc, envv, and ps_strings in auxargs.
This simplifies discovery of these values, potentially with reducing the
number of syscalls we need to make at runtime.  Longer term, we wish to
convert the startup process to pass an auxargs pointer to _start() and
use that rather than walking off the end of envv.  This is cleaner,
more C-friendly, and for systems with strong bounds (e.g. CHERI)
necessary.

Reviewed by:	kib
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24407
2020-04-15 20:23:55 +00:00
Brooks Davis
397df744f9 Make ps_strings in struct image_params into a pointer.
This is a prepratory commit for D24407.

Reviewed by:	kib
Obtained from:	CheriBSD
Sponsored by:	DARPA
2020-04-15 20:21:30 +00:00
Brooks Davis
da813b4d95 Introduce an AUXARGS_ENTRY_PTR() macro.
As the name implys, it uses the a_ptr member of the auxarg entry (except
in compat32 where it uses a_val).  This is more correct and required for
systems where a_val is not the same size or hardware type as a_ptr (e.g.
CHERI).

This is a prepratory commit for D24407.

Reviewed by:	kib
Obtained from:	CheriBSD
Sponsored by:	DARPA
2020-04-15 20:19:59 +00:00
John Baldwin
913cacc71f Document removal of deprecated algorithms from geli(4). 2020-04-15 19:33:42 +00:00
John Baldwin
708652acc4 Set inp_flowid's for TOE connections.
KTLS uses the flowid to distribute software encryption tasks among its
pool of worker threads.  Without this change, all software KTLS
requests for TOE sockets ended up on the first worker thread.

Note that the flowid for TOE sockets created via connect() is not a
hash of the 4-tuple, but is instead the id of the TOE pcb (tid).  The
flowid of TOE sockets created from TOE listen sockets do use the
4-tuple RSS hash as the flowid since the firmware provides the hash in
the message containing the original SYN.

Reviewed by:	np (earlier version)
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D24348
2020-04-15 19:28:51 +00:00
John Baldwin
f3b6d8ad2e Clear CPL_GET_TCB_RPL handler on module unload.
This fixes a panic when unloading and reloading t4_tom.ko since the
old pointer is still stored when t4_tom_load tries to set it.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D24358
2020-04-15 19:23:53 +00:00
Dimitry Andric
f64e2fac5d Revert commit a9ad65a2b from llvm git (by Nemanja Ivanovic):
[PowerPC] Change default for unaligned FP access for older subtargets

  This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40554

  Some CPU's trap to the kernel on unaligned floating point access and
  there are kernels that do not handle the interrupt. The program then
  fails with a SIGBUS according to the PR. This just switches the
  default for unaligned access to only allow it on recent server CPUs
  that are known to allow this.

  Differential revision: https://reviews.llvm.org/D71954

This upstream commit causes a compiler hang when building certain ports
(e.g. security/nss, multimedia/x264) for powerpc64.  The hang has been
reported in https://bugs.llvm.org/show_bug.cgi?id=45186, but in the mean
time it is more convenient to revert the commit.

Requested by:	jhibbits
MFC after:	6 weeks
X-MFC-With:	358851
2020-04-15 18:43:44 +00:00
Kyle Evans
3fb92d4cb1 validate_uuid: absorb the rest of parse_uuid with a flags arg
This makes the naming annoyance (validate_uuid vs. parse_uuid) less of an
issue and centralizes all of the functionality into the new KPI while still
making the extra validation optional. The end-result is all the same as far
as hostuuid validation-only goes.
2020-04-15 18:39:12 +00:00
John Baldwin
bfe26b9707 Mark eli_metadata_crypto_supported inline.
This quiets warnings about it not being always used.

Reported by:	kevans
2020-04-15 18:27:28 +00:00