Commit Graph

239037 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
9b35e90238 Implement dlopenat(3).
MFC after:	3 weeks
2019-01-16 12:12:40 +00:00
Andriy Voskoboinyk
8733962697 rtwn(4): clear 'basic' rate bit before calculating RTS/CTS rate.
Rate tables have this bit set to indicate minimal set of basic rates;
however, it overlappes with MCS bit, so rate2ridx() will treat them as
an 11n rate.

Due to the current rates setup the issue can be reproduced only
in 5GHz band with 11n / protection enabled.

Tested with RTL8821AU, HOSTAP mode.

MFC after:	5 days
2019-01-16 12:11:29 +00:00
Michael Tuexen
d9ba240c1c Limit the user-controllable amount of memory the kernel allocates
via IPPROTO_SCTP level socket options.

This issue was found by running syzkaller.

MFC after:	1 week
2019-01-16 11:33:47 +00:00
Andriy Voskoboinyk
a461b7e5db rtwn_usb(4): add new USB id for RTL8821AU
Reported by:	Mike Tancsa <mike@sentex.net>
Tested by:	Mike Tancsa <mike@sentex.net>
MFC after:	3 days
2019-01-16 10:33:51 +00:00
Konstantin Belousov
62ee17d2ee Style(9) fixes for x86/busdma_bounce.c.
Remove extra parentheses.  Adjust indents and lines fill.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-01-16 06:10:55 +00:00
Konstantin Belousov
e471df6670 Remove unused prototype.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-01-16 05:51:03 +00:00
Konstantin Belousov
8a04b53dce Improve iflib busdma(9) KPI use.
- Specify BUS_DMA_NOWAIT for bus_dmamap_load() on rx refill, since
  callbacks are not supposed to be used.
- Match tso/non-tso tags to corresponding tx map operations.  Create
  separate tso maps for tx descriptors.  In particular, do not use
  non-tso tag to load, unload, or destroy a map created with tso tag.
- Add missed bus_dmamap_sync() calls.
  Submitted by: marius.

Reported and tested by:	pho
Reviewed by:	marius
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-01-16 05:44:14 +00:00
Konstantin Belousov
ea7e7006db Implement shmat(2) flag SHM_REMAP.
Based on the description in Linux man page.

Reviewed by:	markj, ngie (previous version)
Sponsored by:	Mellanox Technologies
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18837
2019-01-16 05:15:57 +00:00
Konstantin Belousov
b87850b96e Trim spaces at the end of lines.
Reviewed by:	markj, ngie
Sponsored by:	Mellanox Technologies
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18837
2019-01-16 05:09:29 +00:00
Gleb Smirnoff
b68d692a3d Whitespace. 2019-01-16 04:02:08 +00:00
Justin Hibbits
bd326619e8 powerpc: Fix FPU fsqrt emulation special case results
If fsqrts is emulated with +INF as its argument, the 0 return value causes a
NULL pointer dereference, panicking the system.  Follow the PowerISA and
return +INF with no FP exception.

MFC after:	1 week
2019-01-16 03:52:43 +00:00
Marcelo Araujo
73f6ccd9e7 Fix broken uart on Win2016 guest.
Obtained from:	Joyent (commit/2bf1a940afbd1382faff159e7c93c72779ca10f4)
MFC after:	3 weeks.
2019-01-16 03:46:27 +00:00
Conrad Meyer
15b7da10ac vmm(4): Take steps towards multicore bhyve AMD support
vmm's CPUID emulation presented Intel topology information to the guest, but
disabled AMD topology information and in some cases passed through garbage.
I.e., CPUID leaves 0x8000_001[de] were passed through to the guest, but
guest CPUs can migrate between host threads, so the information presented
was not consistent.  This could easily be observed with 'cpucontrol -i 0xfoo
/dev/cpuctl0'.

Slightly improve this situation by enabling the AMD topology feature flag
and presenting at least the CPUID fields used by FreeBSD itself to probe
topology on more modern AMD64 hardware (Family 15h+).  Older stuff is
probably less interesting.  I have not been able to empirically confirm it
is sufficient, but it should not regress anything either.

Reviewed by:	araujo (previous version)
Relnotes:	sure
2019-01-16 02:19:04 +00:00
Marcin Wojtas
4c220feb7e Suppress excessive error prints in ENA TX hotpath
In FreeBSD, this is normal situation that the Tx ring is being full. In
hat case, the packet is put back into drbr and the next attempt to send
it is taken after the cleanup.

Too much logs like this can cause system instability and even cause the
device reset (because keep alive or cleanup could be missed).

To fix that, the log level of this message is changed to debug.

Upon this change upgrade the driver version to v0.8.2.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.
2019-01-16 02:13:21 +00:00
Cy Schubert
636a29ff4f Remove an IRIX-only source file.
MFC after:	1 week
2019-01-16 02:05:42 +00:00
Marcin Wojtas
e8887c3139 Suppress excessive print in ENA HAL
In FreeBSD, this is normal situation that the Tx ring is being full. In
that case, the packet is put back into drbr and the next attempt to send
it is taken after the cleanup.

Too much logs like this can cause system instability and even cause the
device reset (because keep alive or cleanup could be missed).

To fix that, the log level of this message is changed to debug.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.
2019-01-16 01:54:04 +00:00
Oleksandr Tymoshenko
00a4815fc6 [rpi] Reorganize spigen(4) overlays for Raspberry Pi
- Remove CS=2 entry from spigen-rpi2 since it didn't work
- Add spigen-rpi3 overlay for Raspberry Pi 3
- Enable rpi overlay modules for GENERIC kernel on aarch64

PR:		233489
Submitted by:	bobf@mrp3.com
Reviewed by:	db
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D16088
2019-01-16 01:08:34 +00:00
Marcelo Araujo
abfa3c39e7 Use capsicum_helpers(3) that allow us to simplify the code and its functions
will return success when the kernel is built without support of
the capability mode.

It is important to note, that I'm taking a more conservative approach
with these changes and it will be done in small steps.

Reviewed by:	jhb
MFC after:	6 weeks
Differential Revision:	https://reviews.freebsd.org/D18744
2019-01-16 00:39:23 +00:00
Simon J. Gerraty
fe868b9bd2 Fix STAGE_DIR.* to handle indirect *DIR variables.
bsd.{files,conf}.mk recently changed to allow *DIR to name a variable
rather than a path.
STAGE_DIR.* need to adapt.

Reviewed by:	bdrewery
Differential Revision:	D18847
2019-01-15 23:37:49 +00:00
Simon J. Gerraty
fee919421d Use .undef per variable
Attempting to expand a variable to a list of vars to .undef
does not actually work.

Reviewed by:	bdrewery
Differential Revision:	D17251
2019-01-15 23:35:53 +00:00
Bjoern A. Zeeb
b20d0a438e With the sync from Dragonfly BSD in r318216 a bug slipped in (also still present
upstream it seems).

The tlv variable was changed to a pointer but the advancement of the data pointer
was left as sizeof(tlv).  While the sizeof the (now) pointer equals the
sizeof 2 x uint32_t (size of the struct) on 64bit platforms, on 32bit platforms
the size of the advancement of the data pointer was wrong leading to
firmware load issues.

Correctly advance the data pointer by the size of the structure and not by
the size of a pointer.

PR:		219683
Submitted by:	waddlesplash gamil.com (Haiku) on irc
MFC after:	1 week
2019-01-15 22:31:54 +00:00
Oleksandr Tymoshenko
89ec2f414c [drm] Fix off-by-one error when accessing driver-specific ioctl handlers array
PR:		231513
Submitted by:	Young_X <YangX92@hotmail.com>
Approved by:	imp
MFC after:	1 week
2019-01-15 21:06:58 +00:00
Gleb Smirnoff
396694153f Fix compilation failures on different arches that have vm_machdep.c not
aware of counter_u64_t by including counter.h into uma_int.h. I'm not
happy about this inclusion, but it fixes compilation ASAP.
2019-01-15 19:33:47 +00:00
John Baldwin
475d54fac3 Reject new sessions if the necessary queues aren't initialized.
ccr reuses the control queue and first rx queue from the first port on
each adapter.  The driver cannot send requests until those queues are
initialized.  Refuse to create sessions for now if the queues aren't
ready.  This is a workaround until cxgbe allocates one or more
dedicated queues for ccr.

PR:		233851
MFC after:	1 week
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D18478
2019-01-15 18:53:45 +00:00
Gleb Smirnoff
e7e4bcd856 style(9): break long line. 2019-01-15 18:50:11 +00:00
Gleb Smirnoff
f8c86a5fde Remove harmless leftover from code that cycles over zone's kegs. Just use +
instead of +=. There is no functional change.
2019-01-15 18:49:31 +00:00
Gleb Smirnoff
cf64f5197b This was missed in r343051: make uz_allocs, uz_frees and uz_fails counter(9). 2019-01-15 18:47:19 +00:00
Gleb Smirnoff
bb45b411e2 Only do uz_items accounting for zones that have a limit set in uz_max_items.
This reduces amount of locking required for these zones.

Also, for cache only zones (UMA_ZFLAG_CACHE) accounting uz_items wasn't
correct at all, since they may allocate items directly from their backing
store and then free them via UMA underflowing uz_items.

Tested by:	pho
2019-01-15 18:32:26 +00:00
Gleb Smirnoff
2efcc8cbca Make uz_allocs, uz_frees and uz_fails counter(9). This removes some
atomic updates and reduces amount of data protected by zone lock.

During startup point these fields to EARLY_COUNTER. After startup
allocate them for all early zones.

Tested by:	pho
2019-01-15 18:24:34 +00:00
John Baldwin
7f124c950a Update the note about the need for COMPAT_FREEBSD<n> kernel options.
Rather than mentioning the requirement for 4.x binaries but not
explaining why (it was assuming an upgrade from 4.x to 5.0-current),
explain when compat options are needed (for running existing host
binaries) in a more general way while using a more modern example
(COMPAT_FREEBSD11 for 11.x binaries).  While here, explicitly mention
that a GENERIC kernel should always work.

Reported by:	Robert Huff <roberthuff@rcn.com>
Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D18740
2019-01-15 18:20:20 +00:00
Stephen Hurd
500759395a Fix window update issue when scaling disabled
When the TCP window scale option is not used, and the window
opens up enough in one soreceive, a window update will not be sent.

For example, if recwin == 65535, so->so_rcv.sb_hiwat >= 262144, and
so->so_rcv.sb_hiwat <= 524272, the window update will never be sent.
This is because recwin and adv are clamped to TCP_MAXWIN << tp->rcv_scale,
and so will never be >= so->so_rcv.sb_hiwat / 4
or <= so->so_rcv.sb_hiwat / 8.

This patch ensures a window update is sent if the window opens by
TCP_MAXWIN << tp->rcv_scale, which should only happen when the window
size goes from zero to the max expressible.

This issue looks like it was introduced in r306769 when recwin was clamped
to TCP_MAXWIN << tp->rcv_scale.

MFC after:	1 week
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D18821
2019-01-15 17:40:19 +00:00
Ed Maste
d366f891b1 scp: disallow empty or current directory
Obtained from:	OpenBSD scp.c 1.198
Security:	CVE-2018-20685
Sponsored by:	The FreeBSD Foundation
2019-01-15 15:35:14 +00:00
Andrew Turner
cd0c606fda Ensure the I-Cache is correctly handled in arm64_icache_sync_range
The cache_handle_range macro to handle the arm64 instruction and data
cache operations would return when it was complete. This causes problems
for arm64_icache_sync_range and arm64_icache_sync_range_checked as they
assume they can execute the i-cache handling instruction after it has been
called.

Fix this by making this assumption correct.

While here add missing instruction barriers and adjust the style to
match the rest of the assembly.

Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D18838
2019-01-15 09:48:18 +00:00
Kristof Provost
032dff662c pf: silence a runtime warning
Sometimes, for negated tables, pf can log 'pfr_update_stats: assertion failed'.
This warning does not clarify anything for users, so silence it, just as
OpenBSD has.

PR:		234874
MFC after:	1 week
2019-01-15 08:59:51 +00:00
Xin LI
305bb04ee4 Use TD_IS_IDLETHREAD instead of unrolled version.
MFC after:	2 weeks
2019-01-15 06:44:37 +00:00
Gleb Smirnoff
5a8eee2bb4 Fix compilation on 32-bit. 2019-01-15 03:43:46 +00:00
Gleb Smirnoff
25e6655a1f Remove pbuf(9) manual page that is now nearly 100% outdated. 2019-01-15 01:19:29 +00:00
Gleb Smirnoff
756a541279 Allocate pager bufs from UMA instead of 80-ish mutex protected linked list.
o In vm_pager_bufferinit() create pbuf_zone and start accounting on how many
  pbufs are we going to have set.
  In various subsystems that are going to utilize pbufs create private zones
  via call to pbuf_zsecond_create(). The latter calls uma_zsecond_create(),
  and sets a limit on created zone. After startup preallocate pbufs according
  to requirements of all pbuf zones.

  Subsystems that used to have a private limit with old allocator now have
  private pbuf zones: md(4), fusefs, NFS client, smbfs, VFS cluster, FFS,
  swap, vnode pager.

  The following subsystems use shared pbuf zone: cam(4), nvme(4), physio(9),
  aio(4). They should have their private limits, but changing that is out of
  scope of this commit.

o Fetch tunable value of kern.nswbuf from init_param2() and while here move
  NSWBUF_MIN to opt_param.h and eliminate opt_swap.h, that was holding only
  this option.
  Default values aren't touched by this commit, but they probably should be
  reviewed wrt to modern hardware.

This change removes a tight bottleneck from sendfile(2) operation, that
uses pbufs in vnode pager. Other pagers also would benefit from faster
allocation.

Together with:	gallatin
Tested by:	pho
2019-01-15 01:02:16 +00:00
Oleksandr Tymoshenko
7c895edb66 [led] propagate error from set_led() to the caller
Do not lose error condition by always returning 0 from set_led.
None of the calls to set_led checks for return value at the moment so
none of API consumers in base is affected.

PR:		231567
Submitted by:	Bertrand Petit <bsdpr@phoe.frmug.org>
MFC after:	1 week
2019-01-15 00:52:41 +00:00
Oleksandr Tymoshenko
6534f93296 [mv_pci] Increase default PCI space size for mv_pci
mv_pci driver reads PCI memory window layout from DTB data and if the
data is incomplete falls back to default value. The value is too small
to fit two PCI spaces for mwlwifi devices on WRT3200ACM so the resource
allocation for them fails. Increase the default to 4Mb from 1Mb so
the devices can be properly attached.

MFC after:	1 week
2019-01-15 00:37:37 +00:00
Gleb Smirnoff
46713135ae Add flag LK_NEW for lockinit() that is converted to LO_NEW and passed
down to lock_init().  This allows for lockinit() on a not prezeroed
memory.
2019-01-15 00:35:19 +00:00
Gleb Smirnoff
bb15d1c778 o Move zone limit from keg level up to zone level. This means that now
two zones sharing a keg may have different limits. Now this is going
  to work:

  zone = uma_zcreate();
  uma_zone_set_max(zone, limit);
  zone2 = uma_zsecond_create(zone);
  uma_zone_set_max(zone2, limit2);

  Kegs no longer have uk_maxpages field, but zones have uz_items. When
  set, it may be rounded up to minimum possible CPU bucket cache size.
  For small limits bucket cache can also be reconfigured to be smaller.
  Counter uz_items is updated whenever items transition from keg to a
  bucket cache or directly to a consumer. If zone has uz_maxitems set and
  it is reached, then we are going to sleep.

o Since new limits don't play well with multi-keg zones, remove them. The
  idea of multi-keg zones was introduced exactly 10 years ago, and never
  have had a practical usage. In discussion with Jeff we came to a wild
  agreement that if we ever want to reintroduce the idea of a smart allocator
  that would be able to choose between two (or more) totally different
  backing stores, that choice should be made one level higher than UMA,
  e.g. in malloc(9) or in mget(), or whatever and choice should be controlled
  by the caller.

o Sleeping code is improved to account number of sleepers and wake them one
  by one, to avoid thundering herd problem.

o Flag UMA_ZONE_NOBUCKETCACHE removed, instead uma_zone_set_maxcache()
  KPI added. Having no bucket cache basically means setting maxcache to 0.

o Now with many fields added and many removed (no multi-keg zones!) make
  sure that struct uma_zone is perfectly aligned.

Reviewed by:	markj, jeff
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D17773
2019-01-15 00:02:06 +00:00
Pedro F. Giffuni
76c528d350 msun: reduce diff between src/e_j0.c and src/e_j0f.c
PR:	229501
MFC after:	1 week
2019-01-14 15:48:35 +00:00
Lars Engels
e1bd727904 This new version of bluetooth-config.sh tries to follow the style of other
shell scripts in base, removes the bogus "copyleft", adds the BeerWare license
header and uses rc.subr(8) new 'enable' keyword for adding entries in
rc.conf(5).

Submitted by:	erdgeist <erdgeist@erdgeist.org>
Approved by:	bapt
MFC after:	2 weeks
2019-01-14 08:23:47 +00:00
Konstantin Belousov
28b740da38 Handle overflow in calculating max kmem size.
vm_kmem_size is u_long, and it might be not capable of holding page
count times PAGE_SIZE, even when scaled down by VM_KMEM_SIZE_SCALE.  As
bde reported, 12G PAE config ends up with zero for kmem size.

Explicitly check for overflow and clamp kmem size at vm_kmem_size_max.
If we end up at zero size because VM_KMEM_SIZE_MAX is not defined,
panic with clear explanation rather then failing in a way which is
hard to relate.

Reported by:	bde, pho
Tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18767
2019-01-14 07:31:19 +00:00
Yoshihiro Takahashi
40343be5a1 Use ${SRCTOP}/contrib/com_err/com_err.h instead of the installed com_err.h.
This fixes build when com_err.h is not installed.

PR:		234691
MFC after:	1 week
2019-01-14 06:34:54 +00:00
Oleksandr Tymoshenko
d46dea5037 Add four kerberos CLI utilities to OptionalObsoleteFiles.inc
Add asn1_compile, make-roken, kcc, and slc to the OptionalObsoleteFiles.inc
so they would be removed during delete-old stage if the new world is built
without Kerberos support.

PR:		230725
Submitted by:	Dmitry Wagin <dmitry.wagin@ya.ru>
MFC after:	1 week
2019-01-14 03:13:31 +00:00
Oleksandr Tymoshenko
9883649c84 Add Dell Chromebook to the list of devices with E820 extmem quirk enabled
Just like for Acer C270 chromebook the E820 extmem workaround is required for
FreeBSD to boot on Dell chromebook.

PR:		204916
Submitted by:	Keith White <kwhite@site.uottawa.ca>
MFC after:	1 week
2019-01-14 01:30:48 +00:00
Olivier Houchard
e8d5909c39 Don't forget to add the needed #includes.
Pointy hat to:	cognet
2019-01-13 23:41:56 +00:00
Olivier Houchard
9cd27257d5 Introduce cpu_icache_sync_range_checked(), that does the same thing as
cpu_icache_sync_range(), except that it sets pcb_onfault to catch any page
fault, as doing cache maintenance operations for non-mapped generates a
data abort, and use it in freebsd32_sysarch(), so that a userland program
attempting to sync the icache with unmapped addresses doesn't crash the
kernel.

Spotted out by:	andrew
2019-01-13 23:29:46 +00:00