Commit Graph

239237 Commits

Author SHA1 Message Date
Kirk McKusick
cd29c58eae Update tunefs and newfs error messages for the -L (volume label) option
to note that underscores are valid.

PR:           235182
Reported by:  Rodney W. Grimes (rgrimes@)
Sponsored by: Netflix
2019-01-26 22:27:12 +00:00
Stefan Eßer
59ba78ccae Slightly improve previous commit that silenced a Clang Scan warning.
The strdup() call does not take advantage of the known length of the
source string. Replace by malloc() and memcpy() utilizimng the pre-
calculated string length.

Submitted by:	cperciva
Reported by:	rgrimes
MFC after:	2 weeks
2019-01-26 22:24:15 +00:00
Marius Strobl
3db348b54a - In _iflib_fl_refill(), don't mark an RX buffer as available in the
corresponding bitmap before adding an mbuf has actually succeeded.
  Previously, m_gethdr(M_NOWAIT, ...) failing caused a "hole" in the
  RX ring but not in its bitmap. One implication of such a hole was
  that in a subsequent call to _iflib_fl_refill() with the RX buffer
  accounting still indicating another reclaimable buffer, bit_ffc(3)
  nevertheless returned -1 in frag_idx which in turn caused havoc
  when used as an index. Thus, additionally assert that frag_idx is
  0 or greater.
  Another possible consequence of a hole in the RX ring was a NULL-
  dereference when trying to use the unallocated mbuf, for example
  in iflib_rxd_pkt_get().

  While at it, make the variable declarations in _iflib_fl_refill()
  conform to style(9) and remove redundant checks already performed
  by bit_ffc{,_at}(3).

- In iflib_queues_alloc(), don't pass redundant M_ZERO to bit_alloc(3).

Reported and tested by: pho
2019-01-26 21:35:51 +00:00
Stefan Eßer
4268f3b3e0 Silence Clang Scan warning about potentially unsafe use of strcpy.
While this is a false positive, the use of strdup() simplifies the code.

MFC after:	2 weeks
2019-01-26 21:30:26 +00:00
Stefan Eßer
71bc4af6ed Fix potential buffer overflow and undefined behavior.
The buffer allocated in read_chat() could be 1 element too short, if the
chatstr parameter passed in is 1 or 3 charachters long (e.g. "a" or "a b").
The allocation of the pointer array does not account for the terminating
NULL pointer in that case.

Overlapping source and destination strings are undefined in strcpy().
Instead of moving a string to the left by one character just increment the
char pointer before it is assigned to the results array.

MFC after:	2 weeks
2019-01-26 20:43:28 +00:00
Alexander Leidinger
030a1f8ba2 Catch up with some years of driver development.
Most impressive in terms of doxygen stuff are the isci and
ocs_fc drivers.
2019-01-26 18:23:19 +00:00
Bjoern A. Zeeb
b294eac56b Fix logic errors in iwm_pcie_load_firmware_chunk introduced in r314065.
* There's no reason to have a while() loop here, because:
    - if msleep returns 0, that means we were woken up by the interrupt handler,
      and we are going to exit immediately as sc_fw_chunk_done will now be 1
      (there is nothing else that sleeps on sc_fw.)
    - if msleep doesn't return 0 (i.e. it returned ETIMEDOUT) then we will
      exit immediately because of the if-test.
   So, just use a single msleep() and then check sc_fw_chunk_done as before.
 * The comment said we were sleeping for 5 seconds, but the msleep was only
   for 1. Before r314065, this was 1 second and so was the comment,
   and in that commit the comment was changed and the function call wasn't.

Possibly fixes failures to initialize uCode on certain devices.

Submitted by:	Augustin Cavalier (waddlesplash gmail.com)
Obtained from:	Haiku 132990ecdcb072f2ce597b5d497ff3e5b1f09c20
MFC after:	10 days
2019-01-26 17:52:12 +00:00
Andriy Voskoboinyk
4aa37fe4fc ObsoleteFiles.inc: remove adv(4) / adw(4) man pages after r339567 2019-01-26 17:27:12 +00:00
Andriy Voskoboinyk
81df432ecf geom_uzip(4): set 'gp != NULL' assertion on top of the function
There was yet another access to this variable in g_trace() few
lines upper.

PR:		203499
Reported by:	cem
MFC after:	5 days
MFC with:	343473
2019-01-26 17:17:25 +00:00
Andriy Voskoboinyk
b84b36380e Remove 2GHz channel list copies from wireless drivers.
Wrap ieee80211_add_channel_list_2ghz into another function
which supplies default (1-14) channel list to it and drop
its copies from drivers.

Checked with RTL8188EE, country US / JP / KR / UA.

MFC after:	2 weeks
2019-01-26 17:00:55 +00:00
Andriy Voskoboinyk
34fd9d7000 geom_uzip(4): move NULL pointer KASSERT check before it is dereferenced
PR:		203499
Submitted by:	<chadf@triularity.org>
MFC after:	5 days
2019-01-26 14:54:06 +00:00
Andriy Voskoboinyk
daeb432a7a otus(4): fix a typo in man page (802.11 -> 802.11n)
MFC after:	3 days
2019-01-26 14:14:25 +00:00
Mariusz Zaborski
28f4385e45 libcasper: do not run registered exit functions
Casper library should not use exit(3) function because before setting it up
applications may register it. Casper doesn't depend on any registered exit
function, so it safe to change this.

Reported by:	jceel
MFC after:	2 weeks
2019-01-26 14:10:49 +00:00
Mariusz Zaborski
db009dddfd zfs: allow to change cache flush sysctl
There is no reason for this variable to be tunable.
This variable is used as a barrier in few places.

Discussed with:	pjd
MFC after:	2 weeks
Sponsored by:	Fudo Security
2019-01-26 13:53:00 +00:00
Kirk McKusick
6967c09c69 Expand DDB's set of printable soft dependency data structures. The
set of known soft dependency data structures now includes: sd_worklist,
sd_inodedep, sd_allocdirect, sd_allocindir, and sd_mkdir. DDB can
also print lists of sd_allinodedeps, sd_mkdir_list, and sd_workhead.
The sd_workhead script is useful for listing all the dependencies
associated with a buffer, e.g. bp->b_dep.

Prefix the soft dependency show names with sd_ so that they sort
together when listed by DDB's "show help" and to distinguish them
from other data structures printable by DDB.

Sponsored by: Netflix
2019-01-26 05:35:24 +00:00
Enji Cooper
4ce7bd2527 Fix reporting errors with gai_strerror(..)
The return value (`err`) should be checked; not the `errno` value.

PR:		235200
Approved by:	emaste (mentor)
Reviewed by:	asomers, lwhsu
MFC after:	28 days
MFC with:	r343362, r343365, r343367-r343368
Differential Revision: https://reviews.freebsd.org/D18969
2019-01-26 03:43:12 +00:00
Pedro F. Giffuni
771ec59bb7 ext2fs: Add some extra consistency checks for the superblock.
Maliciously formed, or badly corrupted, filesystems can cause kernel
panics.  In general, such acts of foot-shooting can only be accomplished
by root, but in a world with VM images that is  moving towards automated
mounts it is important to have some form of prevention.

Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert
of Fraunhofer FKIE.
Incidentaly this should also fix a memory corruption issue reported by
Dr Silvio Cesare of InfoSect.

Huge thanks to all reseachers for making us aware of the issue.

admbug:		872, 891
Reviewed by:	fsu
Obtained from:	NetBSD (with minor changes)
MFC after:	3 days
2019-01-25 22:22:29 +00:00
Oleksandr Tymoshenko
f913a5749f Fix format/arg mismatch
USe correct format for int arguments

PR:		229549
Submitted by:	David Binderman <dcb314@hotmail.com>
MFC after:	1 week
2019-01-25 21:38:28 +00:00
Kirk McKusick
dab83bd1e8 Add printing of b_ioflags to DDB `show buffer' command.
Sponsored by: Netflix
2019-01-25 21:24:09 +00:00
John Baldwin
cecf8bebe7 Fix a few more places to handle ofld tx queues for RATELIMIT.
- Drain offload transmit queues when RATELIMIT is enabled but
  TCP_OFFLOAD is not.
- Expose the per-VI nofldtxq and first_ofld_txq sysctls when
  RATELIMIT is enabled but TCP_OFFLOAD is not.
- Clear offload transmit queue stats as part of a 'cxgbetool clearstats'
  request when RATELIMIT is enabled but TCP_OFFLOAD is not.

Reviewed by:	np
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D18966
2019-01-25 20:54:18 +00:00
Cy Schubert
7aef71382b Fix 32-bit buildworld broken by r343438. 2019-01-25 20:53:29 +00:00
Hans Petter Selasky
ee3da13fc6 Add new USB quirk.
PR:			235202
Differential Revision:	https://reviews.freebsd.org/D18917
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2019-01-25 20:20:27 +00:00
Oleksandr Tymoshenko
e4376aaa32 [mips] Fix error condition check that always evaluates to false
Use proper logical operand when checking the value of srcid

PR:		200988
Submitted by:	David Binderman <dcb314@hotmail.com>
MFC after:	1 week
2019-01-25 20:14:28 +00:00
Hans Petter Selasky
232028b34e Add full support for PCI_ANY_ID when matching PCI IDs in the LinuxKPI.
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2019-01-25 20:13:28 +00:00
Oleksandr Tymoshenko
817f9fcca7 [mips] Unbreak kernel build for CI20
- Include header required for boot_parse_XXX functions
- Use boot_parse_args when parsing argc/argv style arguments
- Remove unused function
2019-01-25 20:10:57 +00:00
Kirk McKusick
0cde0ab2d3 Allow tunefs to include '_' as a legal character in label names
to make it consistent with newfs. Document the legality of '_'
in label names in both tunefs(8) and newfs(8).

PR:           235182
Submitted by: darius@dons.net.au
Reviewed by:  Conrad Meyer
MFC after:    3 days
Sponsored by: Netflix
2019-01-25 20:07:18 +00:00
Oleksandr Tymoshenko
04a50a5272 [mips] Fix counter mask in jz4780 timer driver
Fix dublicate value in what is apparent copypaste mistake. The last value
in mask is supposed to be for counter 7, not counter 3.

PR:		229790
Submitted by:	David Binderman <dcb314@hotmail.com>
MFC after:	1 week
2019-01-25 20:02:55 +00:00
Oleksandr Tymoshenko
fc606bb11b [mips] remove check that is always false (unsinged < 0)
cpuid and local cpu variable are unsigned so checking if value is less than zero
always yields false.

PR:		211088
Submitted by:	David Binderman <dcb314@hotmail.com>
MFC after:	1 week
2019-01-25 19:58:56 +00:00
Enji Cooper
2b9ecf4896 Document that sendfile will return an invalid value for sbytes if provided an invalid address
This is meant to clarify the fact that the system call will not fail
with -1/EFAULT, as one might expect, when reading the sendfile(2)
manpage today.

While here, pet the mandoc linter, when dealing with the section that
describes valid values for `flags`.

PR:	232210
MFC after:	2 weeks
Approved by:	emaste (mentor)
Reviewed by:	glebius, 0mp
Differential Revision: https://reviews.freebsd.org/D18949
2019-01-25 19:56:02 +00:00
Oleksandr Tymoshenko
f848b45958 [mips] remove dublicate values in enable mask in nlm_usb_intr_en
PR:		230572
Submitted by:	David Binderman <dcb314@hotmail.com>
MFC after:	1 week
2019-01-25 19:36:20 +00:00
Li-Wen Hsu
24df7b15fa Temporarily mark lib.msun.{cbrt_test.cbrtl_powl,trig_test.reduction}
expected failure after clang700-import merge

PR:		234040
Reviewed by:	ngie, markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18938
2019-01-25 18:48:20 +00:00
Edward Tomasz Napierala
719fd9fb2c Comment out the default sh(1) aliases for root, introduced in r343416.
The rest of this stuff is still to be discussed, but I think at this
point we have the agreement that the aliases should go.

MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2019-01-25 17:09:26 +00:00
Michael Tuexen
f635b1c264 Don't include two header files when not needed.
This allows the part of the rewrite of TCP reassembly in this
files to be MFCed to stable/11 with manual change.

MFC after:		3 days
Sponsored by:		Netflix, Inc.
2019-01-25 17:08:28 +00:00
Takanori Watanabe
877fc2e350 Use ACPI TPM2 table to probe tpmtis and tpmcrb device.
Differential Revision: https://reviews.freebsd.org/D18937
2019-01-25 16:16:10 +00:00
Andrew Gallatin
77102fd6a2 Fix an iflib driver unload panic introduced in r343085
The new loop to sync and unload descriptors was indexed
by "i", rather than "j".   The panic was caused by "i"
being advanced rather than "j", and eventually becoming
out of bounds.

Reviewed by:	kib
MFC after:	3 days
Sponsored by:	Netflix
2019-01-25 15:02:18 +00:00
Ed Maste
ade4db4d04 clang: default to DWARF 4 as of FreeBSD 13
FreeBSD previously defaulted to DWARF 2 because several tools (gdb,
ctfconvert, etc.) did not support later versions.  These have either
been fixed or are deprecated.

Note that gdb 6 still exists but has been moved out of $PATH into
/usr/libexec and is intended only for use by crashinfo(8).  The kernel
build sets the DWARF version explicitly via -gdwarf2, so this should
have no effect there.

PR:		234887 [exp-run]
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17930
2019-01-25 14:46:13 +00:00
Michael Tuexen
7dc90a1de0 Fix a bug in the restart window computation of TCP New Reno
When implementing support for IW10, an update in the computation
of the restart window used after an idle phase was missed. To
minimize code duplication, implement the logic in tcp_compute_initwnd()
and call it. This fixes a bug in NewReno, which was not aware of
IW10.

Submitted by:		Richard Scheffenegger
Reviewed by:		tuexen@
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D18940
2019-01-25 13:57:09 +00:00
Andriy Voskoboinyk
86d535ab47 Garbage collect AH_SUPPORT_AR5416 config option.
It does nothing since r318857.
2019-01-25 13:48:40 +00:00
Kristof Provost
d9d146e67b pf: Fix use-after-free of counters
When cleaning up a vnet we free the counters in V_pf_default_rule and
V_pf_status from shutdown_pf(), but we can still use them later, for example
through pf_purge_expired_src_nodes().

Free them as the very last operation, as they rely on nothing else themselves.

PR:		235097
MFC after:	1 week
2019-01-25 01:06:06 +00:00
Andriy Voskoboinyk
9df9e9361c net80211: reuse TICKS_2_MSEC / MSEC_2_TICKS macros from sys/time.h
Replace in-place implementation with system-wide one; since it
guarantees non-zero result drop all less-than-one checks from
drivers and net80211.

MFC after:	2 weeks
2019-01-25 01:05:18 +00:00
Edward Tomasz Napierala
60315f8f9d Install .shrc for root, and set PS1 for the toor account.
Reviewed by:	jilles
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D18872
2019-01-24 23:34:51 +00:00
Vincenzo Maffione
aa4dd64dfe netmap: fix crash with monitors and VALE ports
Crash report described here:
    https://github.com/luigirizzo/netmap/issues/583
Fixed by providing dummy sync callback in case it is missing.
2019-01-24 22:09:26 +00:00
Enji Cooper
b882e02bc4 Fix a typo/wordsmith a description modified in r343407
r343407 accidentally introduced a typo (folling -> following). While
reading the change out loud, I realized that the original sentence was
wordy. almost sounding like a run-on sentence.

Improve the flow by splitting up the two thoughts into two distinct sentence
fragments.

PR:		194547, 208497
Reviewed by:	emaste
Approved by:	emaste (mentor)
MFC after:	1 month
MFC with:	r343407
Differential Revision: https://reviews.freebsd.org/D18947
2019-01-24 20:35:58 +00:00
Ed Maste
9e8c28fcc0 freebsd-update: Clarify unsupported upgrade message
PR:		204115
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18916
2019-01-24 18:51:15 +00:00
Ed Maste
ed1b6cec4f freebsd-update: fix style from r343271 change
PR:		234771
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
MFC with:	r343271
Sponsored by:	The FreeBSD Foundation
2019-01-24 18:48:15 +00:00
Ed Maste
ae97aa98ea freebsd-update: Stop installing empty component sets
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by:	rgrimes
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18927
2019-01-24 18:41:00 +00:00
Stefan Eßer
f5ce14028c Silence Clang Scan warnings regarding the use of strcp().
While these warnings are false positives, the use of strdup() instead of
malloc() and strcpy() simplifies and clarifies the code.

While checking the remaining uses of strcpy and strcat I noticed an
assignment of a strlen() to a variable "s", whose value needs to be
preserved for use in later output routines (where it is used to allocate
a buffer). I do not think that the value of "s" will come out lower than
its correct value and thus there is no risk of a buffer overflow, in the
general case, but a specially crafter argument might lead to an overflow.

The bogus assignment to "s" is removed since this value was only used a
single time in the following malloc() call, which has been removed.

MFC after:	2 weeks
2019-01-24 18:39:45 +00:00
Ed Maste
fc24ba59ee freebsd-update: open $PAGER only if necessary
PR:		194547, 208497
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2019-01-24 18:26:30 +00:00
Benedict Reuschling
56d417fd5d Add ZFS usage tips to freebsd-tips.
Add a bunch of examples on how to use ZFS features like:
- listing available space,
- setting and displaying a userquota,
- displaying pool I/O statistics and pool history,
- displaying the compression ratio for a dataset,
- various list options (sorting, removing headers),
- performing a dry-run of a snapshot delete,
- removing a range of snapshots,
- setting a custom property,
- preventing removal of a snapshot with ZFS holds,
- permission sets for zfs send/receive.

Additionally, clarify the existing examples a bit when
it comes to displaying space by mentioning UFS explicitly.
Other examples include displaying I/O in top(1), querying
sysctl(8) for active CPUs and available RAM. Mention systat(1)
and its options, too.
While here, reformat the example to upload a dmesg(8) a bit
to wrap properly.

Thanks to Allan Jude for his help with some of the ZFS examples.

Reviewed by:	dru,allanjude
Approved by:	allanjude (earlier version)
MFC after:	3 days
Relnotes:	yes (ZFS examples in freebsd-tips)
Differential Revision:	https://reviews.freebsd.org/D18541
2019-01-24 18:13:23 +00:00
Michael Tuexen
989321df11 Get the arithmetic right...
MFC after:		3 days
Sponsored by:		Netflix, Inc.
2019-01-24 16:47:18 +00:00