Commit Graph

247237 Commits

Author SHA1 Message Date
Warner Losh
dea247463c Add note to remind me there are three choices for arm32 floating point.
hard	use floating point hardware, pass registers to functions in
	floating point registers.
softfp	use floating point hardware, but pass registers to functions
	in integer registers.
soft	do floating point calcuations without using floating point
	hardware. Pass arguments in integer registers.

FreeBSD 11 and newer assumes hard. 10 and earlier assumed softfp.  We have no
real support, at the moment, for soft. It's untested, though, if softfp still
works.

Add a note here since this is a whack-a-doodle combination relative to all other
platforms.

softfp is likely to go away in the future because it was retained for people
using FreeBSD 10 + armv6 needing to transition more slowly from softfp -> hard
than the project. It likely is no longer needed, and may be getting in the
way of people needing 'soft' support.
2020-01-09 18:14:48 +00:00
Alexander V. Chernikov
ead85fe415 Add fibnum, family and vnet pointer to each rib head.
Having metadata such as fibnum or vnet in the struct rib_head
 is handy as it eases building functionality in the routing space.
This change is required to properly bring back route redirect support.

Reviewed by:	bz
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D23047
2020-01-09 17:21:00 +00:00
Warner Losh
0b4da9c8e4 Const-poison the cam_sim_* convenience accessor functions.
These don't modify the cam_sim, so make that parameter const.
2020-01-09 16:34:54 +00:00
Gleb Popov
dfead4180e Fix typo: MANGAEMENT_PROTOCOL_OUT -> MANAGEMENT_PROTOCOL_OUT.
Approved by:	allanjude
2020-01-09 15:21:42 +00:00
Mark Johnston
dc727127f1 Change malloc_domain() to return the allocation size to the caller.
Otherwise the malloc type accounting in malloc_domainset(9) is wrong
after r355203.

Reviewed by:	rlibby
Reported by:	kaktus
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23095
2020-01-09 15:02:48 +00:00
Mark Johnston
c23df8eafa lagg: Further cleanup of the rr_limit option.
Add an option flag so that arbitrary updates to a lagg's configuration
do not clear sc_stride.  Preseve compatibility for old ifconfig
binaries.  Update ifconfig to use the new flag and improve the casting
used when parsing the option parameter.

Modify the RR transmit function to avoid locklessly reading sc_stride
twice.  Ensure that sc_stride is always 1 or greater.

Reviewed by:	hselasky
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23092
2020-01-09 14:58:41 +00:00
Ed Maste
f8c319da66 Revert r356515 - add LLVM_LIBUNWIND back to sparc64 BROKEN_OPTIONS
r356552 reverted the untested build fix for LLVM libunwind on sparc64,
so mark it broken again.
2020-01-09 14:12:57 +00:00
Ed Maste
8e4aef429a revert r356513: libunwind: untested attempt to fix sparc64 build
The patch is untested and is almost certainly insufficient. Per the
author's request, revert until someone with access to sparc64 hardware
can test and report.
2020-01-09 14:10:11 +00:00
Eugene Grosbein
693d381624 arp(8): avoid segfaulting due to out-of-bounds memory access
Fix obvious mistake that sometimes results in reading memory
past end of an array.

PR:		240825
MFC after:	1 week
2020-01-09 11:58:26 +00:00
Andrew Turner
f2792e5e55 Add atomic_testandset/clear on arm64.
These will reportedly be used in future uma changes.

MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D23019
2020-01-09 10:26:36 +00:00
Konstantin Belousov
8707334301 rtld: Return error if $ORIGIN for a dlopen-ed library cannot be resolved ...
instead of killing the process.  The same behaviour of terminating
image activation if the $ORIGIN cannot be resolved for the main
object, is kept.

Reported by:	Greg V <greg@unrelenting.technology>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D23053
2020-01-09 10:05:45 +00:00
Konstantin Belousov
f160596397 Resolve relative argv0 for direct exec mode to absolute path for AT_EXECPATH.
We know the binary relative name and can reliably calculate cwd path.
Because realpath(3) was already linked into ld-elf.so.1, reuse it
there to resolve dots and dotdots making the path more canonical.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D23014
2020-01-09 10:00:24 +00:00
Hans Petter Selasky
7ba6c62fa0 Fix a XHCI driver issue with Intel's Gemini Lake SOC.
Do not configure any endpoint twice, but instead keep track of which
endpoints are configured on a per device basis, and use an evaluate
endpoint context command instead. When changing the configuration make
sure all endpoints get deconfigured and the configured endpoint mask
is reset.

This fixes an issue where an endpoint might stop working if there is
an error and the endpoint needs to be reconfigured as a part of the
error recovery mechanism in the FreeBSD USB stack.

Tested by:	Shichun.Ma@dell.com
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-01-09 09:29:24 +00:00
Kyle Evans
6a38cd3a54 kern/Makefile: systrace_args.c is also generated 2020-01-09 06:10:25 +00:00
Kyle Evans
20e8d8d554 md(4): improve documentation of preloading
It's not immediately clear by what mechanism loader(8) will be loading the
preloaded file. Specifically name-drop loader.conf(5) with a pointer to the
module loading section and a description of what the 'name' should look
like, because that certainly isn't clear from the loader.conf(5) standpoint.

The default loader.conf already has a pointer to md(4) where it appears and
the reference to loader.conf in the new version of this manpage should make
it more clear that this is where one should look for information.

Reported by:	swills
Reviewed by:	swills, manpages (bcr)
With revision by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D22844
2020-01-09 04:39:37 +00:00
Kyle Evans
cc03366097 stand/fdt: Scale blob size better as overlays apply
Currently, our overlay blob will grow to include the size of the complete
overlay blob we're applying. This doesn't scale very well with a lot of
overlays- they tend to include a lot of overhead, and they will generally
only add a fraction of their total size to the blob they're being applied
to.

To combat this, pack the blob as we apply new overlays and keep track of how
many overlays we've applied. Only ubldr has any fixups to be applied after
overlays, so we only need to re-pad the blob in ubldr. Presumably the
allocation won't fail since we just did a lot worse in trying to apply
overlays and succeeded.

I have no intention of removing the padding in make_dtb.sh. There might be
an argument to be had over whether it should be configurable, since ubldr
*is* the only loader that actually has fixups to be applied and we can do
this at runtime, but I'm not too concerned about this.

This diff has been sitting in Phabricator for a year and a half, but I've
decided to flush it as it does make sure that we're scaling the blob
appropriately and leave room at the end for fixups in case of some freak
circumstance where applying overlays leaves us with a blob of insufficient
size.

Reviewed by:	gonzo (a long time ago)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D14133
2020-01-09 04:34:42 +00:00
Kyle Evans
39eae263cd shmfd: posix_fallocate(2): only take rangelock for section we need
Other mechanisms that resize the shmfd grab a write lock from 0 to OFF_MAX
for safety, so we still get proper synchronization of shmfd->shm_size in
effect. There's no need to block readers/writers of earlier segments when
we're just reserving more space, so narrow the scope -- it would likely be
safe to narrow it completely to just the section of the range that extends
beyond our current size, but this likely isn't worth it since the size isn't
stable until the writelock is granted the first time.

Suggested by:	cem (passing comment)
2020-01-09 04:03:17 +00:00
Kyle Evans
c7bab2a7ca if_vmove: return proper error status
if_vmove can fail if it lost a race and the vnet's already been moved. The
callers (and their callers) can generally cope with this, but right now
success is assumed. Plumb out the ENOENT from if_detach_internal if it
happens so that the error's properly reported to userland.

Reviewed by:	bz, kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22780
2020-01-09 03:52:50 +00:00
Ryan Libby
4a8b575c6b uma: unify layout paths and improve efficiency
Unify the keg layout selection paths (keg_small_init, keg_large_init,
keg_cachespread_init), and slightly improve memory efficiecy by:
 - using the padding of the final item to store the slab header,
 - not going OFFPAGE if we have a choice unless it improves efficiency.

Reviewed by:	jeff, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D23048
2020-01-09 02:03:17 +00:00
Ryan Libby
54c5ae804f uma: reorganize flags
- Garbage collect UMA_ZONE_PAGEABLE & UMA_ZONE_STATIC.
 - Move flag VTOSLAB from public to private.
 - Introduce public NOTPAGE flag and make HASH private.
 - Introduce public NOTOUCH flag and make OFFPAGE private.
 - Update man page.

The net effect of this should be to make the contract with clients more
clear.  Clients should choose constraints, UMA will figure out how to
implement them.  This also breaks the confusing double meaning of
OFFPAGE.

Reviewed by:	jeff, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D23016
2020-01-09 02:03:03 +00:00
Bjoern A. Zeeb
1459a8eb24 Run netoptions startup script in vnet jails.
People use rc.conf inside vnet jails to configure networking setups.
Presumably because some sysctl were not virtualised up until r356527 the
script was not run for vnet jails leaving the rc.conf options without
effect for non-obvious reasons.  Run the netoptions startup script also
for VNET jails now to make the rc.conf options work.

PR:		243193
MFC after:	2 weeks
2020-01-08 23:34:50 +00:00
Bjoern A. Zeeb
334fc5822b vnet: virtualise more network stack sysctls.
Virtualise tcp_always_keepalive, TCP and UDP log_in_vain.  All three are
set in the netoptions startup script, which we would love to run for VNETs
as well [1].

While virtualising the log_in_vain sysctls seems pointles at first for as
long as the kernel message buffer is not virtualised, it at least allows
an administrator to debug the base system or an individual jail if needed
without turning the logging on for all jails running on a system.

PR:		243193 [1]
MFC after:	2 weeks
2020-01-08 23:30:26 +00:00
Ian Lepore
e371a9e6cc Remove some trailing whitespace; no functional changes. 2020-01-08 23:06:13 +00:00
Ian Lepore
ca16c2b8de Split the code to find and add iicbus children out to its own function.
Move the decision to take an early exit from that function after adding
children based on FDT data into the #ifdef FDT block, so that it doesn't
offend coverity's notion of how the code should be written.  (What's the
point of compilers optimizing away dead code if static analyzers won't
let you use the feature in conjuction with an #ifdef block?)

Reported by:	coverity via vangyzen@
2020-01-08 23:03:47 +00:00
Vincenzo Maffione
332eff95e3 bhyve: add wrapper for debug printf statements
Add printf() wrapper to use CR/CRLF terminators depending on whether
stdio is mapped to a tty open in raw mode.
Try to use the wrapper everywhere.
For now we leave the custom DPRINTF/WPRINTF defined by device
models, but we may remove them in the future.

Reviewed by:	grehan, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D22657
2020-01-08 22:55:22 +00:00
Ian Lepore
a5910414d4 Change some KASSERT to device_printf + return EINVAL. There's no need to
bring the whole kernel down due to a configuration error detected when a
module is loaded, it suffices to just not attach the device.
2020-01-08 22:48:14 +00:00
Ian Lepore
b29fdcf8b3 Init sc->maxbus to -1, not 0. It represents the highest array index that
has a non-NULL child bus stored in it, so the "none" value can't be zero
since that's a valid array index.  Also, when adding all possible buses
because there is no specific per-bus config, there's no need to reset
sc->maxbus on each loop iteration, it can be set once after the loop.
2020-01-08 22:45:32 +00:00
John Baldwin
ec212149ad Remove no-longer-used function prototype.
Reported by:	amd64-gcc
2020-01-08 22:16:26 +00:00
Ian Lepore
d9b35549d4 Ensure any reserved gpio pins get released if an early exit is taken
from the attach function.
2020-01-08 22:06:31 +00:00
Ed Maste
305f30cc29 Retire build support for GCC's DWARF unwinder
As of r356514 LLVM's libunwind is used as the DWARF unwinder on all
supported CPU architectures, and GCC and its libraries will be removed
soon.  Retire the build infrastructure for GCC's unwinder; from here
if there are any unwinder bugs (on any arch) the path forward is to fix
LLVM's libunwind.
2020-01-08 21:07:55 +00:00
Ed Maste
7c88377010 Remove prereq lib support for GNU unwinder
LLVM's libunwind is used for all archs, as of r356514.  As GCC 4.2.1
will soon be removed, and with it the GNU unwinder, start simplifying
the prereq/startup lib logic in Makefile.inc1.  From here if there are
any unwinder bugs (on any arch) the path foward is to fix LLVM's
libunwind.
2020-01-08 20:56:30 +00:00
Ed Maste
3b957e38ef src.opts.mk: Remove sparc64 LLVM_LIBUNWIND BROKEN_OPTIONS
After r356513 it should build.
2020-01-08 20:51:07 +00:00
Ed Maste
b05bd0b93b src.opts.mk: enable LLVM_UNWIND by default for all archs
Only sparc64 did not enable LLVM_LIBUNWIND. After r356513 LLVM_LIBUNWIND
should at least build on sparc64. The old DWARF unwinder will be removed
along with GCC 4.2.1 in the near future, so switch sparc64 to use LLVM's
unwinder in advance of the removal.  Someone with access to the obsolete
sparc64 hardware supported by FreeBSD will have to test, and investigate
any failures. I will gladly help, but I don't have any suitable hardware
myself.

PR:		233405
2020-01-08 20:45:18 +00:00
Ed Maste
7cf3f9952d libunwind: untested attempt to fix sparc64 build
sparc64 is the only architecture currently using the DWARF unwinder from
GCC 4.2.1.  Old GCC and related libraries are being removed soon; absent
other changes sparc64 would be left with no unwinder when that happens.

Instead, commit these changes which should at least allow the LLVM
unwinder to build.  Someone with access to the obolete sparc64 hardware
supported by FreeBSD will need to test the result.

PR:		233405
Submitted by:	cem
2020-01-08 20:37:03 +00:00
Kyle Evans
f10405323a posixshm: implement posix_fallocate(2)
Linux expects to be able to use posix_fallocate(2) on a memfd. Other places
would use this with shm_open(2) to act as a smarter ftruncate(2).

Test has been added to go along with this.

Reviewed by:	kib (earlier version)
Differential Revision:	https://reviews.freebsd.org/D23042
2020-01-08 19:08:44 +00:00
Kyle Evans
7ce4072267 Bump __FreeBSD_version after r356510
linuxkpi kmod would need to rebuilt at a minimum; fileops layout has
changed.
2020-01-08 19:06:22 +00:00
Kyle Evans
2856d85ecb posix_fallocate: push vnop implementation into the fileop layer
This opens the door for other descriptor types to implement
posix_fallocate(2) as needed.

Reviewed by:	kib, bcr (manpages)
Differential Revision:	https://reviews.freebsd.org/D23042
2020-01-08 19:05:32 +00:00
John Baldwin
f57d4d4641 Remove unneeded cdevsw methods and D_NEEDGIANT.
Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D23079
2020-01-08 19:05:23 +00:00
John Baldwin
efb7929173 Use falloc_noinstall + finstall for crypto file descriptors.
Reviewed by:	cem, kib
MFC after:	1 week
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D23078
2020-01-08 19:03:24 +00:00
John Baldwin
d2cdaed130 Add a reference count to cryptodev sessions.
This prevents use-after-free races with crypto requests (which may
sleep) and CIOCFSESSION as well as races from current CIOCFSESSION
requests.

admbugs:	949
Reported by:	Yuval Kanarenstein <yuvalk@ssd-disclosure.com>
Reviewed by:	cem
MFC after:	1 week
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D23077
2020-01-08 18:59:23 +00:00
Alexander Motin
b2cdfb72f4 Fix copy-paste bug in HMB free code.
MFC after:	2 weeks
X-MFC-with:	r356474
2020-01-08 18:26:23 +00:00
Ed Maste
4cee74df63 src.conf.5: regen after r356423 and r356499
riscv now using Clang/lld, riscv64sf reenabled, and googletest adjusted
to avoid only the affected fuse test on mips
2020-01-08 17:54:44 +00:00
John Baldwin
79f5991559 Add -mno-relax to CFLAGS in bsd.prog/lib.mk instead of bsd.cpu.mk.
bsd.cpu.mk is included by bsd.init.mk before bsd.linker.mk, so it
was always setting the flag since LINKER_FEATURES wasn't defined.

Reported by:	mhorne
Reviewed by:	imp, mhorne
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D23076
2020-01-08 17:49:34 +00:00
Konstantin Belousov
f26c30a5f3 rtld: fix after r356300
binpath local was changed from char array to a char pointer, update
strlcpy/strlcat uses.

Reported by:	Coverity through vangyzen
CID:	1412239 and 1412240
Reviewed by:	emaste, imp, vangyzen
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D23090
2020-01-08 17:37:20 +00:00
John Baldwin
778b62251c Add notes for MAKE_OBSOLETE_GCC going away and riscv switching to clang/lld. 2020-01-08 17:31:54 +00:00
John Baldwin
8d1df20821 Remove a mention of MAKE_OBSOLETE_GCC.
This should have been included in r356452.
2020-01-08 17:31:18 +00:00
John Baldwin
e48503fffd Use clang and lld as the default toolchain for RISCV.
- Enable clang and lld as system toolchains.
- Don't use external GCC for universe by default.
- Re-enable riscv64sf since it builds fine with clang + lld.

Reviewed by:	emaste, mhorne
Relnotes:	yes
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D23089
2020-01-08 17:25:59 +00:00
Mark Johnston
f8091e2c8f linprocfs: Fix some bugs in the maps file implementation.
- Export the offset into the backing object, not the object size.
- Fix a bug where we would print the previous entry's "offset" when a
  map_entry has no object.
- Try to identify shared mappings.  Linux prints "s" when the mapping
  "may be shared".  This attempt is not perfect, for example, we print
  "p" for anonymous memory that may be shared via
  minherit(INHERIT_SHARE).

PR:		240992
Reviewed by:	kib
MFC after:	1 week
MFC note:	no OBJ_ANON in stable/12
Differential Revision:	https://reviews.freebsd.org/D23062
2020-01-08 16:57:08 +00:00
Maxim Konovalov
4a3c7e6718 o Spell "Redundancy" and "Remember" correctly.
PR:		243187
Submitted by:	mikael.urankar@gmail.com (partially)
2020-01-08 14:01:15 +00:00
Emmanuel Vadot
650a41c6d0 regulator: fix regnode_method_get_voltage
This method is supposed to write the voltage into uvolt
and return an errno compatible value.

Reviewed by:	mmel
Differential Revision:	https://reviews.freebsd.org/D23006
2020-01-08 11:30:42 +00:00