Commit Graph

249537 Commits

Author SHA1 Message Date
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
Brooks Davis
6671366a55 Fix -Wvoid-pointer-to-enum-cast warnings.
This pattern is used in callbacks with void * data arguments and seems
both relatively uncommon and relatively harmless.  Silence the warning
by casting through uintptr_t.

This warning is on by default in Clang 11.

Reviewed by:	arichardson
Obtained from:	CheriBSD (partial)
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24425
2020-04-15 18:15:58 +00:00
Mateusz Piotrowski
1565e1889a Fix a typo
Reported by:	rgrimes
MFC with:	359967
2020-04-15 17:11:44 +00:00
Pawel Biernacki
f65eac0fc0 sysctl_handle_string: Put logical or in parentheses.
Reported by:	rdivacky
Approved by:	kib (mentor)
Pointy-hat to:	kaktus
2020-04-15 16:55:38 +00:00
Pawel Biernacki
1627b1fd9d sysctl(9): fix handling string tunables.
r357614 changed internals of handling string sysctls, and inadvertently
broke setting string tunables.  Take them into account.

PR:		245463
Reported by:	jhb, np
Reviewed by:	imp, jhb, kib
Approved by:	kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D24429
2020-04-15 16:33:55 +00:00
Brooks Davis
d0fa673e4d Don't directly access userspace memory.
Rather then using the racy useracc() followed by direct access to
userspace memory, perform a copyin() and use the result if it succeeds.

Reviewed by:	jhb
MFC after:	3 weeks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24410
2020-04-15 16:33:27 +00:00
Mateusz Piotrowski
3e58608634 sshd: Warn about missing ssh-keygen only when necessary
The sshd service is using ssh-keygen to generate missing SSH keys.
If ssh-keygen is missing, it prints the following message:

> /etc/rc.d/sshd: WARNING: /usr/bin/ssh-keygen does not exist.

It makes sense when the key is not generated yet and
cannot be created because ssh-keygen is missing.

The problem is that even if the key is present on the host,
the sshd service would still warn about missing ssh-keygen
(even though it does not need it).

Reviewed by:	emaste
Approved by:	emaste (src)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D23911
2020-04-15 14:07:33 +00:00
Emmanuel Vadot
e3637e41e3 arm: allwinner: aw_sid: Fix thermal calibration size for A64
This fixes the aw_thermal driver on A64 SoC.

MFC after:	1 month
X-MFC-With:	r359935
2020-04-15 13:35:28 +00:00
Hans Petter Selasky
a90fb6cf3c Cast all ioctl command arguments through uint32_t internally.
Hide debug print showing use of sign extended ioctl command argument
under INVARIANTS. The print is available to all and can easily fill
up the logs.

No functional change intended.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-15 13:20:51 +00:00
Mateusz Piotrowski
6f2b877647 Document the exit status and the stdout message of nologin(8)
Reviewed by:	debdrup (earlier version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D24196
2020-04-15 13:13:46 +00:00
Alexander V. Chernikov
0f3bf68212 Convert OFED rtable interactions to the new routing KPI.
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D24387
2020-04-15 13:06:55 +00:00
Emmanuel Vadot
85ebd7e10a mmc_fdt_helpers: Do not schedule a card detection is there is no cd gpio
If the fdt node doesn't have a cd-gpios properties or if the node is set
as non-removable we do not init the card detection timeout task as it is
useless so don't schedule it too.

MFC after:	1 month
X-MFC-With:	r359924
2020-04-15 13:02:13 +00:00
Alexander V. Chernikov
643ce94878 Convert pf rtable checks to the new routing KPI.
Switch uRPF to use specific fib(9)-provided uRPF.
Switch MSS calculation to the latest fib(9) kpi.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D24386
2020-04-15 13:00:48 +00:00
Alexander V. Chernikov
53a4886d5d Convert ip6_forward() to the new routing KPI.
Update ip6_forward() internals to use deembedded IPv6 addresses
 to simplify calls to the new KPI and prepare for the future
 scope-embedding cleanup.

Add in6_get_unicast_scopeid() and in6_set_unicast_scopeid() scopeid
 operation functions tailored for unicast processing.

Reviewed by:	ae
Differential Revision:	https://reviews.freebsd.org/D24334
2020-04-15 12:56:05 +00:00
Hiroki Tagato
4afeb43d98 Add my birthday
Approved by:	ehaupt (mentor)
2020-04-15 10:20:18 +00:00
Jung-uk Kim
e946a95233 Do not attempt to remove backward compatibility timezones.
Since r359736, these timezones are unconditionally installed.
2020-04-15 08:18:28 +00:00
Conrad Meyer
38e6153f75 bhyve(8): Correct copyright boilerplate for r359950
Use the text from the canonical sys/copyright.h 2-clause FreeBSD License.

Reported by:	grehan (thanks!)
2020-04-15 05:55:14 +00:00
Kyle Evans
ca6129af19 sys/types.h: adjust #endif comment to match reality
Submitted by:	sigsys gmail com
2020-04-15 04:03:46 +00:00
Kyle Evans
142ffb8bdc kern uuid: break format validation out into a separate KPI
This new KPI, validate_uuid, strictly validates the formatting of the input
UUID and, optionally, populates a given struct uuid.

As noted in the header, the key differences are that the new KPI won't
recognize an empty string as a nil UUID and it won't do any kind of semantic
validation on it. Also key is that populating a struct uuid is optional, so
the caller doesn't necessarily need to allocate a bogus one on the stack
just to validate the string.

This KPI has specifically been broken out in support of D24288, which will
preload /etc/hostid in loader so that early boot hostuuid users (e.g.
anything that calls ether_gen_addr) can have a valid hostuuid to work with
once it's been stashed in /etc/hostid.
2020-04-15 03:59:26 +00:00
Navdeep Parhar
ddde90ac81 cxgbe/iw_cxgbe: Do not start the EP timer if soaccept fails.
This fixes a panic that would occur when the timer tried to close a
stale socket.

Submitted by:	Krishnamraju Eraparaju @ Chelsio
MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-04-15 03:40:33 +00:00
Conrad Meyer
52c39ee643 bhyve(8): Minor cosmetic niceties in instemul failure
Print the failed instruction stream as a contiguous stream of hex.  This
is closer to something you could throw at a disassembler than 0xHH 0xHH
0xHH.

Also, use the debug.h 'raw' stdio-aware printf helper to avoid the
cascading
         line
             effect.
2020-04-15 02:34:44 +00:00
Conrad Meyer
9cb339cc7b bhyve(8): Add VM Generation Counter ACPI device
Add an implementatation of the 'Virtual Machine Generation ID' spec to
Bhyve.  The spec provides a randomly generated GUID (at bhyve start) in
device memory, along with an ACPI device with _CID VM_Gen_Counter and ADDR
evaluating to a Package pointing at that GUID.

A GPE is defined which Notifies the ACPI Device when the generation changes
(such as when a snapshot is rolled back).  At this time, Bhyve does not
support snapshotting, so the GPE is never actually raised.

Suggested by:	rpokala
Discussed with:	grehan
Differential Revision:	https://reviews.freebsd.org/D23165
2020-04-15 02:00:17 +00:00
Conrad Meyer
bb30b08e76 bhyve(8): Add bootrom allocation abstraction
To allow more general use of the bootrom region, separate initialization from
allocation, and allocation from loading a file.

The bootrom segment is the high 16MB of the low 4GB region.

Each allocation in the segment creates a new mapping with specified protection.
By default, allocation begins at the low end of the range.  However, the
BOOTROM_ALLOC_TOP flag is provided to locate a provided bootrom in the high
region it is expected to be in.

The existing ROM-file loading code is refactored to use the new interface.

Reviewed by:	grehan (earlier version)
Differential Revision:	https://reviews.freebsd.org/D24422
2020-04-15 01:58:51 +00:00
Conrad Meyer
102acd72aa bus_dma.9: Remove erroneous usage recommendation
It is not valid to pass BUS_SPACE_UNRESTRICTED to bus_dma_tag_create()'s
nsegments parameter as it is interpreted as a very large segment count.
Subsequent allocation operations on the tag will preallocate some multiple of
that count.  BUS_SPACE_UNRESTRICTED therefore indicates something like:
malloc(infinity).

Discussed with:	bcr, jhb (earlier version)
2020-04-15 01:39:17 +00:00
John Baldwin
e2b9919398 Remove support for geli(4) algorithms deprecated in r348206.
This removes support for reading and writing volumes using the
following algorithms:

- Triple DES
- Blowfish
- MD5 HMAC integrity

In addition, this commit adds an explicit whitelist of supported
algorithms to give a better error message when an invalid or
unsupported algorithm is used by an existing volume.

Reviewed by:	cem
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D24343
2020-04-15 00:14:50 +00:00
Kyle Evans
30b4df2e4a tests: audit: mark closefrom test an expected fail for now
closefrom has been converted to close_range internally; remediation is
underway for this, marking it as an expected fail for now while proper
course is determined.

PR:		245625
2020-04-14 23:36:03 +00:00
Kyle Evans
7851fb8ecb closefrom: clamp lowfd to >= 0; close_range's parameters are unsigned.
Pointy hat:	kevans
Reported by:	CI (lwhsu)
2020-04-14 23:24:24 +00:00
Alexander V. Chernikov
9ac7c6cfed Convert IP/IPv6 forwarding, ICMP processing and IP PCB laddr selection to
the new routing KPI.

Reviewed by:	ae
Differential Revision:	https://reviews.freebsd.org/D24245
2020-04-14 23:06:25 +00:00
Rick Macklem
fb8ed4c5f8 Fix the NFSv2 extended attribute support to handle 0 length attributes.
I did not realize that zero length attributes are allowed, but they are.
This patch fixes the NFSv4.2 client and server to handle zero length
extended attributes correctly.

Submitted by:	Frank van der Linden <fllinden@amazon.com> (earlier version)
Reported by:	Frank van der Linden <fllinder@amazon.com>
2020-04-14 22:57:21 +00:00
Alexander V. Chernikov
dd4776f0cc Reorganise nd6 notification code to avoid direct rtentry field access.
One of the goals of the new routing KPI defined in r359823 is to entirely hide
 `struct rtentry` from the consumers. Doing so will allow to improve routing
 subsystem internals and deliver features more easily. This change is one of
  the ongoing changes to eliminate direct struct rtentry field accesses.

It introduces rtfree_func() wrapper around RTFREE() and reorganises nd6 notification
 code to avoid accessing most of the rtentry fields.

Reviewed by:	ae
Differential Revision:	https://reviews.freebsd.org/D24404
2020-04-14 22:48:33 +00:00
Emmanuel Vadot
47d45507e8 modules: dtb: allwinner: Remove sun50i-a64-sid.dtso
File was removed in r359935

MFC after:	2 month
X-MFC-With:	r359935
2020-04-14 22:16:40 +00:00
Brooks Davis
618a20d4f9 Remove bogus use of useracc() in (clock_)nanosleep.
There's no point in pre-checking that we can access the user's rmtp
pointer before we do it in copyout().

While here, improve style(9) compliance.

Reviewed by:	imp
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24409
2020-04-14 20:53:12 +00:00
Brooks Davis
562894f0dc Centralize compatability translation macros.
Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h
and replace existing definitation with includes where required. This
eliminates duplicate code and allows Linux and FreeBSD compatability
headers to be included in the same files.

Input from:	cem, jhb
Obtained from:	CheriBSD
MFC after:	2 weeks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24275
2020-04-14 20:30:48 +00:00
Emmanuel Vadot
c23ca622a2 modules: dtb: allwinner: Remove non existant files
Those files have been removed in r359935.

MFC after:	2 months
X-MFC-With:	r359935
2020-04-14 20:20:08 +00:00
Emmanuel Vadot
d6b4447496 allwinner: aw_thermal: Cope with DTS changes
The upstream DTS now include the thermal device node and the SID
calibration entry.
Update our driver to cope with this change and remove the DTB
overlays that aren't needed anymore.

MFC after:	2 months
X-MFC-With:	r359934
2020-04-14 19:05:17 +00:00
Emmanuel Vadot
211b4e4259 dts: Import DTS from Linux 5.6 2020-04-14 18:57:00 +00:00
Emmanuel Vadot
62dc472bdb files: Add mmc_fdt_helpers for mmccam enabled config
MFC after:	1 month
X-MFC-With:	r359924
2020-04-14 18:11:54 +00:00
Kyle Evans
e19b97f7a0 sysent: re-roll after r359930 2020-04-14 18:11:26 +00:00
Kyle Evans
7d03e08112 Mark closefrom(2) COMPAT12, reimplement in libc to wrap close_range
Include a temporarily compatibility shim as well for kernels predating
close_range, since closefrom is used in some critical areas.

Reviewed by:	markj (previous version), kib
Differential Revision:	https://reviews.freebsd.org/D24399
2020-04-14 18:07:42 +00:00