Commit Graph

17471 Commits

Author SHA1 Message Date
David Bright
9176635592 Fix two memory leaks in syslogd
A memory leak in syslogd for processing of forward actions was
reported. This modification adapts the patch submitted with that bug
to fix the leak. While testing the modification, another leak was also
found and fixed.

PR:		198385
Submitted by:	Sreeram <sreeramabs@yahoo.com>
Reported by:	Sreeram <sreeramabs@yahoo.com>
Reviewed by:	hrs
MFC after:	1 week
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D14510
2018-02-26 19:27:59 +00:00
Alan Somers
93b9f3b114 Delete copypasta
Reported by:	rpokala
MFC after:	20 days
X-MFC-With:	329845
Sponsored by:	Spectra Logic Corp
2018-02-23 17:20:53 +00:00
Alan Somers
b1d757bc1d libifconfig: multiple feature additions
Added the ability to:

* Create virtual interfaces
* Create vlan interfaces
* Get interface fib
* Get interface groups
* Get interface status
* Get nd6 info
* Get media status
* Get additional ifaddr info in a convenient struct
* Get vhids
* Get carp info
* Get lagg and laggport status
* Iterate over all interfaces and ifaddrs

And add more examples, too.

Note that this is a backwards-incompatible change. But that's ok, because it's
a private library.

MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D14463
2018-02-23 03:11:43 +00:00
Alan Somers
d68b76a9de Fix numerous Coverity issues in mptutil
Most are memory or file descriptor leaks. Three were unannotated
fallthroughs in a switch/case statement. One was an integer overflow before
widen.

Reported by:	Coverity
CID:		1007463 1007462 1007461 1007460 1007459 1007458 1007457
CID:		1006855 1006854 1006853 1006852 1006851 1006850 1006849
CID:		1006848 1006845 1006844 1006843 1006842 1006841 1006840
CID:		1006839 1006838 1006837 1006836 1006835 1006834 1006833
CID:		1006832 1006831 1006831 1006830 1006829 1008334 1008170
CID:		1008169 1008168
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D11013
2018-02-23 00:17:50 +00:00
Ravi Pokala
b235f015f8 mountd: Return proper errno values in a few error paths
When attempting to mount a non-directory which exists, return ENOTDIR instead
of ENOENT. If stat() or statfs() failed, don't pass part of the invalid
(struct statfs) to ex_search(). In that same case, preserve the value of "bad"
rather than overwriting with EACCES.

Submitted by:	Bruce Leverett (Panasas)
Reviewed by:	rmacklem
MFC after:	1 week
Sponsored by:	Panasas
Differential Revision:	https://reviews.freebsd.org/D14438
2018-02-21 00:19:02 +00:00
Warner Losh
a35ddacab7 Fixup minor nits in the PNP_INFO protocol.
Sponsored by: Netflix
2018-02-17 06:57:03 +00:00
Conrad Meyer
9531d560cf trpt(8): Clean up build hack to detect ancient compiler
Detect ancient GCC specifically, rather than using target architecture as a
crude heuristic.

Side note: compilers should really ignore -Wno- and -Wno-error= flags they
don't recognize.  Seems like modern compilers produce warnings instead of
errors.  Though, with -Werror they turn into errors.  Clang's error can be
disabled with -Wno-error=unknown-warning-option, but GCC doesn't seem to
have a named method to disable the specific warning.

Submitted by:	rpokala@ (earlier version)
Suggested by:	rpokala@
Reviewed by:	tinderbox
Sponsored by:	Dell EMC Isilon
2018-02-16 20:46:44 +00:00
Conrad Meyer
648905e629 trpt(8): Work around GCC4 shenanigans
Reduce warns to known good value and do not add -Wno- flag the ancient GCC4
does not understand.

Reported by:	jhibbits
Sponsored by:	Dell EMC Isilon
2018-02-16 04:30:57 +00:00
Conrad Meyer
808c12715c trpt(8): Sprinkle style(9) and adddress warnings
Update function definitions to post-ISO style; remove deprecated "register"
keyword.  Correct indentation.  Sprinkle 'static' on file-local variables.

Appease warnings at WARNS=6, for both Clang and GCC.

Sponsored by:	Dell EMC Isilon
2018-02-15 21:06:56 +00:00
Conrad Meyer
54b4d5e106 trpt(8): Fully remove and undocument '-t' option disabled in 1999
The relevant code was commented out in r50680.

PR:		57045
Submitted by:	Fernando Apesteguía <fernando.apesteguia AT gmail.com>
2018-02-15 18:26:45 +00:00
Warner Losh
590682b6e6 Move devmatch to sbin from usr/sbin.
Since we want to use devmatch in context before a split /,/usr system
has mounted /usr, move devmatch to /sbin.

Sponsored by: Netflix
2018-02-12 14:44:21 +00:00
Eugene Grosbein
6cd3353ba3 ppp(8): fix code producing debugging logs
Fix several cases when long buffer is copied to shorter one
using snprintf that results in contents truncation and
clobbering unsaved errno value and creation of misleading logs.

PR:		218517
Approved by:	avg (mentor)
MFC after:	1 month
2018-02-10 17:09:51 +00:00
Jung-uk Kim
ff879b0799 MFV: r329072
Merge ACPICA 20180209.
2018-02-09 21:49:38 +00:00
Pedro F. Giffuni
2614eccf45 su_data: correct macro expansion.
Protect su_data() users from strange macro expansion.

Obtained from:	linux libtirpc
2018-02-08 14:53:34 +00:00
Conrad Meyer
354fce2869 mountd(8): Produce vaguely meaningful error messages
Sponsored by:	Dell EMC Isilon
2018-02-08 01:34:35 +00:00
Allan Jude
229c92e7a8 Add the ThinkPad X1 (sandybridge) to the bsdinstall blacklist
MFC after:	2 weeks
Sponsored by:	FOSDEM IllumOS Table
2018-02-04 12:16:36 +00:00
Eitan Adler
a184696e5a newsyslog: fix typeo for 'zstd'
Reported by:	swildner@DragonFlyBSD.org
MFC After:	1 week
2018-02-03 20:53:21 +00:00
Brooks Davis
46b59ac82b Check for cd9660 support before attempting to mount created images
This extends the set in r316028 to allow all tests to pass or be skipped
on a system without cd9660 support.

A better approach using tar is possible, but this works today.

Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10516
2018-02-02 23:34:33 +00:00
Pedro F. Giffuni
d282086dec pppctl88) Avoid strcpy() copies on overlapping string.
This may lead to unpredicatable behaviour on different platforms or C
library implementations. Use an intermediate variable.

Obtained from:	DragonFlyBSD (git a861a526)
2018-01-29 14:23:44 +00:00
Michael Tuexen
51eff8efd9 When using SCTP for sending probe packets, use INIT chunks for payloads
larger than or equal to 32 bytes. For smaller probe packets, keep using
SHUTDOWN-ACK chunks, possibly bundled with a PAD chunk.
Packets with INIT chunks more likely pass through firewalls. Therefore,
use them when possible.

MFC after:	1 week
2018-01-27 19:23:42 +00:00
Maxim Konovalov
53c2c7918d o A command line flag for the syslog_facility fixed in the SYNOPSIS.
PR:		225441
2018-01-26 08:52:28 +00:00
Kirk McKusick
dffce2150e Refactoring of reading and writing of the UFS/FFS superblock.
Specifically reading is done if ffs_sbget() and writing is done
in ffs_sbput(). These functions are exported to libufs via the
sbget() and sbput() functions which then used in the various
filesystem utilities. This work is in preparation for adding
subperblock check hashes.

No functional change intended.

Reviewed by: kib
2018-01-26 00:58:32 +00:00
Ed Maste
4a8b3e41f5 bsdinstall: enable SUJ by default (revert r327890)
fsck should be fixed as of r328092.

PR:		225110
Tested by:	dumbbell, Arshan Khanifar <arshankhanifar gmail.com>
2018-01-25 19:57:21 +00:00
Edward Tomasz Napierala
abdd394564 Add SPDX tags for automount(8) et al.
MFC after:	2 weeks
2018-01-24 16:39:02 +00:00
Edward Tomasz Napierala
8eebe1bf66 Add missing SPDX tags for ctld(8).
MFC after:	2 weeks
2018-01-24 16:37:29 +00:00
Edward Tomasz Napierala
827904b134 Add missing SPDX identifier in iscsid(8).
MFC after:	2 weeks
2018-01-24 16:34:37 +00:00
Edward Tomasz Napierala
1aa6f9aea2 Add SPDX identifiers for uefisign(8) sources.
MFC after:	2 weeks
2018-01-24 16:33:33 +00:00
Kyle Evans
d5b15ddbfc usr.sbin/service: Fix -j to not be order dependant
The introduced -j option is highly dependant on the ordering of arguments,
and it exhibited broken behavior in some other circumstances. Fix these
issues, and simplify the feature by removing the unneessary double parsing
of options.

Reviewed by:	jilles
Differential Revision:	https://reviews.freebsd.org/D13952
2018-01-22 03:38:10 +00:00
John Baldwin
66f8917bea Adjust format string to fix build. 2018-01-18 00:24:05 +00:00
John Baldwin
449af04fc9 Tidy some whitespace. 2018-01-18 00:23:11 +00:00
John Baldwin
65eefbe422 Save and restore guest debug registers.
Currently most of the debug registers are not saved and restored
during VM transitions allowing guest and host debug register values to
leak into the opposite context.  One result is that hardware
watchpoints do not work reliably within a guest under VT-x.

Due to differences in SVM and VT-x, slightly different approaches are
used.

For VT-x:

- Enable debug register save/restore for VM entry/exit in the VMCS for
  DR7 and MSR_DEBUGCTL.
- Explicitly save DR0-3,6 of the guest.
- Explicitly save DR0-3,6-7, MSR_DEBUGCTL, and the trap flag from
  %rflags for the host.  Note that because DR6 is "software" managed
  and not stored in the VMCS a kernel debugger which single steps
  through VM entry could corrupt the guest DR6 (since a single step
  trap taken after loading the guest DR6 could alter the DR6
  register).  To avoid this, explicitly disable single-stepping via
  the trace flag before loading the guest DR6.  A determined debugger
  could still defeat this by setting a breakpoint after the guest DR6
  was loaded and then single-stepping.

For SVM:
- Enable debug register caching in the VMCB for DR6/DR7.
- Explicitly save DR0-3 of the guest.
- Explicitly save DR0-3,6-7, and MSR_DEBUGCTL for the host.  Since SVM
  saves the guest DR6 in the VMCB, the race with single-stepping
  described for VT-x does not exist.

For both platforms, expose all of the guest DRx values via --get-drX
and --set-drX flags to bhyvectl.

Discussed with:	avg, grehan
Tested by:	avg (SVM), myself (VT-x)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D13229
2018-01-17 23:11:25 +00:00
Ed Maste
559d4a5216 kldxref: additional sytle(9) cleanup
Reported by:	kib (via comments in D13957)
Sponsored by:	The FreeBSD Foundation
2018-01-17 20:43:30 +00:00
Ed Maste
e2d0802c6b kldxref: improve style(9)
Address style issues including some previously raised in D13923.

- Use designated initializers for structs
- Always use bracketed return style
- No initialization in declarations
- Align function prototype names
- Remove old commented code/unused includes

Submitted by:	Mitchell Horne <mhorne063@gmail.com>
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13943
2018-01-17 19:59:43 +00:00
Fabien Thomas
cb43ed2815 Only call flush in pipe mode.
It fixes a crash with a socket in top mode.

Ex:
# pmcstat -R 127.0.0.1:8080 -T -w1
then
# pmcstat -n1 -Sclock.prof -Slock.failed -O 127.0.0.1:8080

MFC after:	1 week
Sponsored by:	Stormshield
2018-01-17 16:55:35 +00:00
Alex Richardson
5f40118235 Allow xinstall and makefs to be crossbuilt on Linux and Mac
I need these tools in order to install the crossbuilt FreeBSD and create a
disk image. Linux does not have a st_flags in struct stat so unfortunately
I need a bunch of ugly ifdefs. The resulting binaries allow me to
sucessfully install a MIPS64 world and create a disk-image that boots.

Reviewed By:	brooks, bdrewery, emaste
Approved By:	jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D13307
2018-01-16 21:43:46 +00:00
Kyle Evans
a6f9024f20 service(8): Reset OPTIND properly now that we're parsing args twice
r328032 introduced a second round of argument parsing to proxy the request
through to a jail as needed, but failed to reset OPTIND before getting to
the second round of parsing to allow other flags to be set.

Reported by:	Oleg Ginzburg <olevole olevole ru>
2018-01-16 20:14:31 +00:00
Ed Maste
da67e6e62c kldxref: handle modules with md_cval at the end of allocated sections
Attempting to retrieve an md_cval string from a kernel module with
kldxref would throw a offset error for modules created using lld, since
this value would be placed at the end of all allocated sections.

Add an ef_read_seg_string method to the ef interface, to allow reading
strings of varying size without attempting to read beyond the segment's
bounds.

PR:		224875
Submitted by:	Mitchell Horne <mhorne063@gmail.com>
Reviewed by:	cem, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13923
2018-01-16 18:20:12 +00:00
John Baldwin
7de32ca317 Sort the list of flags in newsyslog.conf entries.
Move the 'X' and 'Y' entries into their sorted location in the list
of flags just above 'Z'.

Reviewed by:	bcr
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D13904
2018-01-16 00:47:53 +00:00
Kyle Evans
65136f65bd service(8): Add support for interfacing with services in jails
Provide a -j option that can take a jail name or id. If -j is specified,
check that the jail exists and proxy the service request through to
service(8) in the jail.

This allows for cleaner workflows when updating services in a jail, turning
the following:

pkg -j dns upgrade
jexec dns service named restart

into:

pkg -j dns upgrade
service -j dns named restart

PR:		223325
Submitted by:	David O'Rourke (with slight changes)
MFC after:	2 weeks
2018-01-15 22:24:11 +00:00
Dimitry Andric
e04518a677 Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r321788).  Upstream has branched for the
6.0.0 release, which should be in about 6 weeks.  Please report bugs and
regressions, so we can get them into the release.

Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
support to build; see UPDATING for more information.

MFC after:	3 months
2018-01-14 00:08:34 +00:00
Eitan Adler
c0848584c3 timed: slave is an infinite loop, mark it as such 2018-01-13 20:35:32 +00:00
Dimitry Andric
72bfb31a82 Merge ^/head r327886 through r327930. 2018-01-13 17:52:55 +00:00
Ed Maste
643139e5b1 bsdinstall: disable SUJ by default
SUJ + cg checksums produce spurious warnings after an unclean shutdown
(e.g. a crash).  For now disable SUJ for UFS installs so installing from
a FreeBSD 12 snapshot results in a usable filesystem, until this can be
fixed.

PR:		225110
Submitted by:	Arshan Khanifar <arshankhanifar gmail.com>
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13890
2018-01-12 20:25:57 +00:00
Dimitry Andric
c79126f2e4 Merge ^/head r327624 through r327885. 2018-01-12 18:23:35 +00:00
Warner Losh
018caaaed0 Fix error in determining the next available boot slot.
Sponsored by: Netflix
2018-01-12 15:30:48 +00:00
Warner Losh
bdd31a5287 Remove vestiges of digi(4) driver, first attempted in r305235 with
more in r317426. There's nothing in the tree that references digiio.h
(apart from digictl(8)), so no driver implements it. Since digictl(8)
was only used to control digi(4) devices, it too should go.
2018-01-10 14:58:58 +00:00
Dimitry Andric
de82c38b72 Add explanatory comment for r327622: clang 6.0.0 and higher warn about
the ACPI_ROOT_OBJECT and ACPI_TO_POINTER macros from acpica's actypes.h
header, that they use arithmetic on a null pointer treated as a cast
from integer to pointer, which is a GNU extension.  We turn off the
warning, because this is in contributed code.

Requested by:	rakuco
2018-01-08 18:42:40 +00:00
Dimitry Andric
4b49587c3d Merge ^/head r327341 through r327623. 2018-01-06 16:13:17 +00:00
Dimitry Andric
ec2bf1e7b1 Revert r327338, undoing the changes to the ACPI_ADD_PTR and ACPI_SUB_PTR
macros.  Instead, turn off clang 6.0.0 warnings about null pointer
arithmetic in usr.sbin/acpi/acpidb instead.
2018-01-06 15:52:21 +00:00
Warner Losh
1723a6e523 Sanity check media size and sector counts to ensure that we don't
produce negative sector numbers in the testing algorithm.

CID: 1198994
2018-01-06 12:34:03 +00:00