Commit Graph

17471 Commits

Author SHA1 Message Date
Mateusz Guzik
cfcabed65f Whack procctl(8)
It was supposed to provide a recovery mechanism against bugs in procfs's
long deprecated tracing capabilities.

Remove the tool as a prerequisite to axing the kernel side.

The tracing facility to use is ptrace(2).

MFC after:	2 weeks
2017-09-27 01:03:00 +00:00
Emmanuel Vadot
92e73ccc73 mountd: Avoid memory leak by freeing dp_dirp
Introduced in r324007, the data alloced by strdup was never free'ed.
While here, remove cast to caddr_t when freeing dp.

Reported by:	bde
MFC after:	1 week
X MFC With:	r324007
2017-09-26 12:15:13 +00:00
Emmanuel Vadot
89b859e39a mountd: Remove unneeded cast
Reported by:	kib
MFC after:	1 week
X MFC With:	r324007
2017-09-26 11:11:17 +00:00
Emmanuel Vadot
380a3fcd05 mountd: Replace malloc+strcpy to strdup
Reviewed by:	bapt
MFC after:	1 week
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D12503
2017-09-26 09:18:18 +00:00
Mariusz Zaborski
2560d18180 We use a few different ifdef's names to check if we are using Casper or not,
let's standardize this. Now we are always use WITH_CASPER name.

Discussed with:	emaste@
MFC after:	1 month
2017-09-21 14:41:41 +00:00
Gordon Tetlow
eb039c2661 Revert tcpdump to using the source manpage instead of having a copy here.
This helps future maintainability of tcpdump so we don't forget to update
the manpage (like we have previously).

Stolen from:	usr.bin/file/Makefile
Reviewed by:	jilles
Approved by:	delphij (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D12403
2017-09-18 16:42:13 +00:00
Michael Tuexen
7c9470c075 Remove empty line accidently introduced in r323626. 2017-09-15 20:41:12 +00:00
Michael Tuexen
c3c1d365de Add references. Suggested by Maxim Konovalov.
Sponsored by:	Netflix, Inc.
2017-09-15 20:34:52 +00:00
Scott Long
ed26c389bf Add support for parsing the Watchdog Descriptor Table (WDDT)
Sponsored by:	Netflix
2017-09-15 15:41:07 +00:00
Michael Tuexen
507a9c432b Bump date missed in r323596. Trim trailing whitespace.
Sponsored by:	Netflix, Inc.
2017-09-14 20:42:19 +00:00
Michael Tuexen
314e8196ea Add a description how tcpdrop handles the case of specifying the
-s and the -S option.

Sponsored by:		Netflix, Inc.
2017-09-14 18:50:40 +00:00
Ryan Libby
6a6b7210d7 zic: -Wno-error=strict-overflow
Reviewed by:	emaste
Sponsored by:	Dell EMC Isilon
X-Differential Revision:	https://reviews.freebsd.org/D12284
2017-09-14 03:39:42 +00:00
Gordon Tetlow
4572fb3faf Deorbit catman. The tradeoff of disk for performance has long since tipped
in favor of just rendering the manpage instead of relying on pre-formatted
catpages. Note, this does not impede the ability to use existing catpages,
it just removes the utility to generate them.

Reviewed by:	imp, allanjude
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D12317
2017-09-13 16:35:16 +00:00
Navdeep Parhar
7f7a2bce78 cxgbetool(8): mode must be specified when creating the dump file.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-09-13 00:37:42 +00:00
Ravi Pokala
40f0d8dc4a When doing a non-interactive installation, don't display an interactive
warning about a filesystem which doesn't have a mountpoint. Presumably, the
person who wrote the install script knew what they were doing.

Submitted by:	Brian Mueller <bmueller@panasas.com>
MFC after:	1 month
Sponsored by:	Panasas
Differential Revision:	https://reviews.freebsd.org/D12346
2017-09-12 22:19:21 +00:00
Ryan Stone
7c1b51d6dc Fix incorrect error message in iovctl
If the iovctl command was invoked with only the -C flag, the user would
receive a message claiming that they needed to also supply either the
-d flag or the -f flag.  However, in the case of the -C mode, only the
-f flag is acceptable.  Correct this error message in this case.

PR:		222050
Submitted by:	Heinz N. Gies
Reported by:	Heinz N. Gies
MFC after:	1 week
2017-09-12 21:12:04 +00:00
Michael Tuexen
e1418fa5ef Allow TCP connections to be filtered by stack and state.
Choose the command line options to be consistent with the ones of
sockstat.

Sponsored by:	Netflix, Inc.
2017-09-12 13:39:44 +00:00
Ian Lepore
c3c16dce19 Make i2c -s (device scan) work on hardware that supports only full xfers.
The existing scan code is based on sending an i2c START condition and if
there is no error it assumes there is a device at that i2c address.  Some
i2c controllers don't support sending individual start/stop signals on the
bus, they can only perform complete data transfers with start/stop handled
in the silicon.

This adds a fallback mechanism that attempts to read a single byte from each
i2c address.  It's less reliable than looking for an an ACK repsonse to a
start, because some devices will NAK an attempt to read that isn't preceeded
by a write of a register address.  Writing to devices to probe them is too
dangerous to even consider.  The user is told that a less-reliable scan is
being done, so even if the read-scan comes up empty too, it's still a vast
improvement over the old situation where it would just claim there were no
devices on the bus even though the devices were there and working fine.

If the i2c controller responds with a proper ENODEV (device doesn't support
operation) or an almost-proper EOPNOTSUPP, the START/STOP scan is switched
to a read-scan right away.  Most controllers respond with ENXIO or EIO if
they don't support START/STOP, so no quick-out is available.  For those,
if a scan of all 127 addresses and come up empty, the scan is re-done using
the read method.

Reported by:	Maxim Filimonov <che@bein.link>
2017-09-11 21:49:38 +00:00
Ed Maste
c12530ca4c Ignore error return from newaliases(1)
This was originally added as "exit $SUCCESS" but with nothing to set the
SUCCESS variable. Thus it became an exit with no argument, which just
exits with the status of the preceding command.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-09-11 17:39:21 +00:00
Gordon Tetlow
5f16669804 The purge option hasn't been implemented since 1994 when we imported this
code. I think it is safe to say it's not going to be. I'm also working to
de-orbit catman, so remove the reference in the manpage.

Reviewed by:	allanjude
2017-09-09 03:09:02 +00:00
Ryan Libby
e881ec1646 crunchgen: quiet -Wmissing-prototypes
Reviewed by:	emaste (previous version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12107
2017-09-07 17:20:47 +00:00
Warner Losh
5709a4b5a1 Create efi utility printing routines
Split out asciidump, utf8dump, bindump, and hexdump into a separate
file efiutil.c. Implement new efi_print_load_option for printing out
the EFI_LOADER_OPTION data structure used to specify different options
to the UEFI boot manager.

Sponsored by: Netflix
2017-09-07 07:30:19 +00:00
Justin Hibbits
9cede44051 Correct the binmiscctl(8) man page for powerpc64
Magic for powerpc64 erroneously specified ELFCLASS32 instead of ELFCLASS64.

Submitted by:	luca.pizzamiglio _AT_ gmail DOT com
MFC after:	3 days
2017-09-04 20:57:38 +00:00
Benjamin Kaduk
fe8b4983b4 Fix mdoc typo in auto_master.5
There needs to be a space after the no-space macro in order for it
to be interpreted.

PR:		221986
Submitted by:	Paul Townsend <pt@zendware.com>
2017-09-01 22:04:45 +00:00
Jung-uk Kim
2f6a1a81bb Merge ACPICA 20170831. 2017-08-31 22:47:04 +00:00
Warner Losh
b0da7c79f1 Add UCS2->UTF8 option.
Many UEFI variables are UCS2 strings (some NUL terminated, others
not). Add --utf8 (-u) to convert UCS2 strings to UTF8 before printing.

Sponsored by: Netflix
2017-08-31 17:53:50 +00:00
Alexander Motin
d4c2de2e0b Fix flags field decoding in ACPI_NFIT_CONTROL_REGION.
It looked like incomplete copy/paste, printing absolute garbage.

While there, print ValidFields field ax hex, since it is a bitmask.

MFC after:	3 days
2017-08-31 09:08:06 +00:00
Benno Rice
88e2cc9eb5 Replace makefs' hand-rolled unescaping with strunvis
mtree path names and link attributes are encoded, generally using strvis. Newer
versions of mtree will use C-style escapes but previously the accepted form was
octal escapes. makefs' mtree code spots the C-style escapes but fails to deal
with octal escapes correctly.

Remove mtree's escape-decoding code (except for a few instances where it's
needed) and instead pass pathnames and link targets through strunvis prior to
use.

Reviewed by:	marcel
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12104
2017-08-25 16:10:16 +00:00
Bruce Evans
9bc7c36337 Support setting the colors of cursors for the VGA renderer.
Advertise this by changing the defaults to mostly red.  If you don't like
this, change them (almost) back using:
   vidcontrol -c charcolors,base=7,height=0
   vidcontrol -c mousecolors,base=0[,height=15]

The (graphics mode only) mouse cursor colors were hard-coded to a black
border and lightwhite interior.  Black for the border is the worst
possible default, since it is the same as the default black background
and not good for any dark background.  Reversing this gives the better
default of X Windows.  Coloring everything works better still.  Now
the coloring defaults to a lightwhite border and red interior.

Coloring for the character cursor is more complicated and mode
dependent.  The new coloring doesn't apply for hardware cursors.  For
non-block cursors, it only applies in graphics mode.  In text mode,
the cursor color was usually a hard-coded (dull)white for the background
only, unless the foreground was white when it was a hard-coded black
for the background only, unless the foreground was white and the
background was black it was reverse video.  In graphics mode, it was
always reverse video for the block cursor.  Reverse video is worse,
especially over cutmarking regions, since cutmarking still uses simple
reverse video (nothing better is possible in text mode) and double
reverse video for the cursor gives normal video.  Now, graphics mode
uses the same algorithm as the best case for text mode in all cases
for graphics mode.  The hard-coded sequence { white, black, } for the
background is now { red, white, blue, } where the first 2 colors can
be configured.  The blue color at the end is a sentinel which prevents
reverse video being used in most cases but breaks the compatibility
setting for white on black and black on white characters.  This will
be fixed later.  The compatibility setting is most needed for mono modes.

The previous commit to syscons.c changed sc_cnterm() to be more careful.
It followed null pointers in some cases.  But sc_cnterm() has been
unreachable for 15+ years since changes for multiple consoles turned
off calls to the the cnterm destructor for all console drivers.  Before
them, it was only called at boot time.  So no driver with an attached
console has ever been unloadable and not even the non-console destructors
have been tested much.
2017-08-25 07:04:41 +00:00
Kenneth D. Merry
2d73f7e208 Fix a resource leak in an error case in camdd_buf_sg_create().
Submitted by:	Coverity
CID:		1341622
MFC after:	3 days
Sponsored by:	Spectra Logic
2017-08-23 17:52:49 +00:00
Benno Rice
8e7cd863dd Correct typo in usage string.
Submitted by:	peterpakos (GitHub username)
MFC after:	1 day
2017-08-22 23:55:09 +00:00
Glen Barber
ce5dff88a9 Revert part of r322770 in usr.sbin/chown/tests/chown_test.sh,
which incorrectly adds atf_expect_fail() where there is no
failure case.

MFC after:	3 days
MFC with:	r322770
Sponsored by:	The FreeBSD Foundation
2017-08-22 17:23:29 +00:00
Kenneth D. Merry
988bd0d72b Restructure camdd(8) slightly to make it easier to add support for
additional protocols.

Submitted by:	Chuck Tuffli <chuck@tuffli.net>
MFC after:	1 week
Differential Revision:	D11230
2017-08-22 13:08:22 +00:00
Glen Barber
6e810e514a Apply changes from bin/chmod/tests/chmod_test.sh (r321949, r321950,
and r322101), adding atf_expect_fail() before chflags(8) is invoked
if the filesystem is ZFS, which does not support UF_IMMUTABLE.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-08-21 20:23:05 +00:00
Bruce Evans
dd51fceb15 Reduce complexity and backwards compatibilty a little by removing new aliases
and repurposing "blink".  Improve accuracy of documentation of historical
mistakes and other bugs.

"blink" now means "set the blink attribute for the target(s)" instead of
"set the blink attribute and clear other attributes [and control flags]".
It was even more confusing to use "blinking" for the single attribute to
keep the old meaning for "blink".

"destructive" is not as historically broken or gone as the previous version
said.

The bugs involving resetting from defaults are now understood and partly
documented (the defaults are mis-initialized).
2017-08-19 12:14:46 +00:00
Ed Maste
8d2dbd281f pw useradd: Validate the user name before creating the entry
Previouly it was possible to create users with spaces in the name with:
pw useradd -u 1234 -g 1234 -n 'test user'

The "-g 1234" is relevant, without it the name was already rejected
as expected:

[fk@test ~]$ sudo pw useradd -u 1234 -n 'test user'
pw: invalid character ` ' at position 4 in userid/group name

Bug unintentionally found with a salt config without explicit name entry:

test user:
  user.present:
    - uid: 1234
    - gid: 1234
    - fullname: Test user
    - shell: /usr/local/bin/bash
    - home: /home/test
    - groups:
      - wheel
      - salt

"Luckily" salt modules rarely bother with input validation either ...

PR:		221416
Submitted by:	Fabian Keil
Obtained from:	ElectroBSD
MFC after:	1 week
2017-08-19 00:32:26 +00:00
Ed Maste
3dc869c257 pw usermod: Properly deal with empty secondary group lists (-G '')
"pw usermod someuser -G ''" is supposed make sure that someuser
doesn't have any secondary group memberships.

Previouly it was a nop because split_groups() only intitialised
"groups" if at least one group was specified. As a result the
existing secondary group memberships were kept.

PR:		221417
Submitted by:	Fabian Keil
Obtained from:	ElectroBSD
MFC after:	1 week
Relnotes:	yes
2017-08-19 00:19:23 +00:00
Enji Cooper
c78c36cd9c Don't leak bpf on early return when YP isn't defined (NIS support)
MFC after:	1 week
Reported by:	cppcheck
2017-08-17 20:41:28 +00:00
Enji Cooper
c354522292 Fix WARNS
- Remove ad hoc inet_ntoa prototype declaration; it's already handled
  by the included headers.
- De-K&Rify the function prototypes for eachres_whoami(..),
  eachres_getfile(..), and main(..).

MFC after:	1 week
PR:		71667
Tested with:	clang (5.0), gcc (4.2.1, 5)
2017-08-17 20:37:01 +00:00
Bruce Evans
eb4fa1ad8c I misplaced a newline in the previous commit. Fix this, and move line
breaks in the vt case to the same places that the man(1) puts then in
the SYNOPSIS.  This was already done for the syscons case.  Man pages
can't depend on the driver, and the SYNOPSIS is hard-coded for syscons
except for -f where it is hard-coded for vt.  The usage message reverses
this for sc.  The only other differences are whitespace and removing
-[dL] and -l for vt.
2017-08-17 20:25:50 +00:00
Bruce Evans
92dedf1b1b Update vidcontrol -c to support all cursor appearance setting
capabilities.

Most of the capabilities (all of the arcane ones) were in FreeBSD-2.0.5,
but were harder to use then, and vidcontrol didn't try.  FreeBSD-4.1.0
added per-vty support, fixed the destructivness of the "destructive"
cursor, and improved APIs.  Start using the new APIs, support all of
their capabilities, and document all of the capabilities and some of
the historical mistakes.

vt doesn't support any of this before or after the change.

Fix minor unrelated bitrot in the usage message for the syscons case.
2017-08-17 18:08:45 +00:00
Bruce Evans
03096857fd Fix setting of the border color. Teken doesn't support syscons' escape
sequence "ESC [ %d A" for this although that was used here.  I will fix
teken later, but use the more portable ioctl KDSBORDER here.

The ioctl is also much easier to use if you check that it works.  For
-b, check it and complain and exit if it failed, so that it is more
obvious that that vt doesn't support border colors.  Don't check it
when restoring the border color in revert(), since revert() is used
on vt for handling other errors.

Fix nearby error handling and style.  For the error of an invalid
color, revert() and print a specific error message using err() instead
of not revert()ing and printing spam using usage().
2017-08-16 15:14:46 +00:00
Enji Cooper
188e46ab03 Add supporting changes for Add limited sandbox capability to "make check"
Non-tests/... changes:
- Add HAS_TESTS= to Makefiles with libraries and programs to enable iteration
  and propagate the appropriate environment down to *.test.mk.

tests/... changes:
- Add appropriate support Makefile.inc's to set HAS_TESTS in a minimal manner,
  since tests/... is a special subdirectory tree compared to the others.

MFC after:	2 months
MFC with:	r322511
Reviewed by:	arch (silence), testing (silence)
Differential Revision:	D12014
2017-08-14 19:21:37 +00:00
Konstantin Belousov
32cb21c90b Remove confusion in the line explaining syntax of the msr read.
Specify words order in the display.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2017-08-14 11:19:31 +00:00
Vladimir Kondratyev
a9a8884bf9 bthidd(8): Add support for Apple's magic mouse
Note: Mouse's bthidd.conf record should contain vendor and device IDs
to make proper device detection. If it does not contain IDs,
regenerate record with "Query" command of recent bthidcontrol(8).

Submitted by:		Dirk Engling <erdgeist@erdgeist.org>
Reviewed by:		emax
Approved by:		bapt (mentor), gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D3702
2017-08-12 21:23:33 +00:00
Vladimir Kondratyev
6032284eb9 bthidd(8): Add support for vendor_id, product_id and version.
Extend bthidd.conf format to store vendor and product IDs of remote
Bluetooth HID devices to make possible implementation of device
specific quirks inside bthidd(8).
Add support for querying of this information from device's SDP records
with bthidcontrol(8) "Query" command.

Submitted by:		Dirk Engling <erdgeist@erdgeist.org>
Reviewed by:		emax
Approved by:		bapt (mentor), gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D3702
2017-08-12 21:20:51 +00:00
Ed Maste
a230b8a753 bsdinstall: record DHCP config after obtaining lease
Previously we added an ifconfig_$INTERFACE line to rc.conf for each
unsuccessful DCHP attempt.

PR:		219515
Reviewed by:	allanjude
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11967
2017-08-10 20:26:07 +00:00
Alexander Motin
fb1cf2a9e5 Add two NFIT fields missed in r321298.
MFC after:	2 weeks
2017-08-10 10:59:05 +00:00
Jeremie Le Hen
ac0ced90e0 rwho/ruptime/rwhod shouldn't be gated by RCMDS.
As peter@ points out in pr/220953:
"rwho, rwhod and ruptime are not part of the remote login suite (rsh, rlogin
etc).

They should *not* be in the rcmds package which is disabled by default.  We
rely on rwho/rwhod/ruptime in the freebsd.org cluster."

This commit is a re-commit of r322029 and r322031 with a better commit log, as
pointed out by ngie@.

This also includes the necesary changes to OptionalObsoleteFiles.inc, as
requested by jhb@.

PR:		220953
Reported by:	peter@, jhb@
Differential Revision:	https://reviews.freebsd.org/D11743
2017-08-08 20:17:07 +00:00
Jeremie Le Hen
eba789dcca Revert r322029 and r322031 so as to recommit them with a better commit log.
PR:		220953
Reported by:	ngie@
2017-08-08 20:07:08 +00:00
Marius Strobl
eabfbad050 Revert the parts of r322097 related to /etc/wall_cmos_clock handling as
the previous behavior actually is required for setting up configurations
in which the RTC is using UTC but the timezone is not. Still, besides
uniform error handling, that file should get the same treatment in the
non-interactive variants supported by tzsetup(8).
2017-08-07 21:38:10 +00:00
Andriy Voskoboinyk
c69b68f502 rfcomm_pppd.8: fix a typo (SPD -> SDP).
MFC after:	3 days
2017-08-06 21:54:43 +00:00
Marius Strobl
4b38286169 - Move creation and unlinking of /etc/wall_cmos_clock from the handling
of the initial UTC dialog to install_zoneinfo() so that file gets the
  necessary treatment also when that dialog is skipped via "-s", when
  selecting UTC from the time zone menu or on the command-line instead
  etc.
- Make the initial UTC dialog actually work by giving the relevant files
  the necessary treatment and then exit when choosing "Yes" there instead
  of moving on to the time zone menu regardless.
- Since r301131, /etc/localtime is also installed when selecting UTC in
  interactive configurations (which previously meant only via the time
  zone menu, though). Thus, the code added in r230298 which treats a
  NULL zone file name as UTC and removes /etc/localtime in that case can
  go again.
- Consistently refer to "could not delete" (as chosen by the oldest such
  code in here) when unlink(2) fails instead of a to mixture of "delete"
  and "unlink" in error messages.
2017-08-05 12:59:03 +00:00
Konstantin Belousov
e28f262a86 Fix off by one in calculation of the number of buckets for the pc
addresses.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D11864
2017-08-04 18:02:54 +00:00
Enji Cooper
7921075587 MFhead@r322057 2017-08-04 17:41:49 +00:00
Jeremie Le Hen
4542ad8688 Remove deprecation notice for ruptime/rwho/rwhod.
PR:		220953
Reported by:	peter
2017-08-03 21:37:57 +00:00
Jeremie Le Hen
881d286b1d rwho/ruptime/rwhod shouldn't be gated by RCMDS.
PR:		220953
Reported by:	peter@
Differential Revision:	https://reviews.freebsd.org/D11743
2017-08-03 21:30:12 +00:00
Enji Cooper
f2381beb2c MFhead@r322021 2017-08-03 17:43:26 +00:00
Navdeep Parhar
f856f099cb cxgbe(4): Initial import of the "collect" component of Chelsio unified
debug (cudbg) code, hooked up to the main driver via an ioctl.

The ioctl can be used to collect the chip's internal state in a
compressed dump file.  These dumps can be decoded with the "view"
component of cudbg.

Obtained from:	Chelsio Communications
MFC after:	2 months
Sponsored by:	Chelsio Communications
2017-08-03 14:43:30 +00:00
Enji Cooper
86cc58dc96 MFhead@r321960 2017-08-02 22:28:12 +00:00
Enji Cooper
d2435d7c28 Require strings(1) with :o_flag_preparer and :o_flag_publisher
strings(1) might not be installed on the system, e.g., if MK_TOOLCHAIN == no

MFC after:	1 week
2017-08-02 20:42:39 +00:00
Enji Cooper
d511b20a69 Add HAS_TESTS to all Makefiles that are currently using the
`SUBDIR.${MK_TESTS}+= tests` idiom.

This is a follow up to r321912.
2017-08-02 08:50:42 +00:00
Enji Cooper
4b330699f8 Convert traditional ${MK_TESTS} conditional idiom for including test
directories to SUBDIR.${MK_TESTS} idiom

This is being done to pave the way for future work (and homogenity) in
^/projects/make-check-sandbox .

No functional change intended.

MFC after:	1 weeks
2017-08-02 08:35:51 +00:00
Marcelo Araujo
4271417a84 Log when we have finished pushing users and groups.
Obtained from:	OpenBSD (rev 1.4)
MFC after:	3 weeks.
2017-08-01 05:26:20 +00:00
Ed Maste
e39a96781e bsdinstall: default to UEFI-only boot on arm64
Reviewed by:	allanjude
Sponsored by:	The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D11721
2017-07-30 23:15:30 +00:00
Ed Schouten
4f6a15dd39 Be a bit more liberal about sysctl naming.
On the systems on which I tested this exporter, I never ran into metrics
that were named in such a way that they couldn't be exported to
Prometheus metrics directly. Now it turns out that on systems with NUMA,
the sysctl tree contains metrics named dev.${driver}.${index}.%domain.
For these metrics, the % in the name is problematic, as Prometheus
doesn't allow this symbol to be used.

Remove the assertions that were originally put in place to prevent the
exporter from generating malformed output and add code to deal with it
accordingly. For metric names, convert any unsupported character to an
underscore. For label values, perform string escaping.

PR:		https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221035
Reported by:	lifanov@
2017-07-29 08:35:07 +00:00
Jung-uk Kim
5f9b24fa43 Merge ACPICA 20170728. 2017-07-28 22:23:29 +00:00
Ryan Libby
07451638fa bhyve/vga.c: fix atc_color_select_67 bit shift
Gcc noticed that the result of the bit shift is always zero.  Shift so
that the ATC_CS_C67 bits end up in bits 6 & 7.

Reviewed by:	grehan, tychon
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D11775
2017-07-28 21:47:10 +00:00
Ryan Libby
558e4950b3 bhyve/pci_e82545.c: squelch gcc warning for noreturn procedure
Gcc complained that e82545_tx_thread has a return type declared but
doesn't return anything.  Annotate the procedure with _Noreturn.

Reviewed by:	grehan
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D11774
2017-07-28 21:42:59 +00:00
Sean Bruno
4b5e2f8ea0 binmiscctl should use modfind instead of kldfind
kldfind() only matches kernel modules, so if you link imgact_binmisc directly
into the kernel, binmiscctl can't find it, tries to load it, and errors
out with:
  Can't load imgact_binmisc kernel module: File exists

A quick search of other base commands shows that the correct procedure is to
call modfind(), and then try kldload() if that fails.

PR:		218593
Submitted by:	Dan Nelson <dnelson_1901@yahoo.com>
MFC after:	1 week
2017-07-28 18:11:53 +00:00
Scott Long
99cc4d5177 Fix some broken logic used in obtaining the certain config pages. I'm
surprised that this even pretended to work.

PR:		215793
Submitted by:	longwitz@incore.de
2017-07-27 05:31:48 +00:00
Bartek Rutkowski
391aafd7ab Remove stack guard option from hardening menu.
Since kib's change the stack guard is now ON by default,
this option in hardening menu of bsdinstall is no longer needed.

Submitted by:	Bartlomiej Rutkowski <robak@FreeBSD.org>
Reviewed by:	bapt
Approved by:	bapt
MFC after:	1 day
Sponsored by:	Pixeware LTD
Differential Revision:	https://reviews.freebsd.org/D11686
2017-07-21 08:50:22 +00:00
Ed Maste
cebb7b191c acpidump: add GIC ITS srat type
From ACPI 6.2, 5.2.16.5

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2017-07-20 17:36:17 +00:00
Ed Maste
340c00225f acpidump: add ACPI NFIT (NVDIMM Firmware Interface Table)
Submitted by:	Guangyuan Yang <yzgyyang@outlook.com>
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11479
2017-07-20 17:31:27 +00:00
Ed Maste
27941afae6 acpidump: use C99 designated initializers
Submitted by:	Guangyuan Yang <yzgyyang@outlook.com>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11659
2017-07-20 15:52:36 +00:00
Enji Cooper
b024603382 Clean up leading whitespace (convert single column spaces to hard tabs)
MFC after:	now
2017-07-20 00:40:03 +00:00
Rick Macklem
6242e8c886 Update the nfsv4 man page to reflect recent changes to support
the newer RFCs (5661 and 7530). The main man changes are for the
case of "numbers in strings" for user/groups that RFC7530 allows
and avoids use of nfsuserd(8).

This is a content change.

Reviewed by:	trasz (earlier version)
MFC after:	1 week
2017-07-19 20:57:41 +00:00
Enji Cooper
d7938e0594 cron(8) manpage updates
- Document /etc/cron.d and /usr/local/etc/cron.d under FILES.
- Reword documentation for -n: add appropriate soft-stop and remove
  contraction to appease igor.

MFC after:	3 days
2017-07-19 19:53:07 +00:00
Enji Cooper
4555b2ad92 Fix trivial whitespace bug introduced in usage message changes for -n
support (r304570).

MFC after:	now
2017-07-19 19:38:25 +00:00
Mark Johnston
5a3924b985 Allow matches of truncated version strings.
Long objdir paths make it easy to hit the version string length limit in
kernel dump headers. The build number and timestamp are unlikely to be
truncated and ought to be sufficient to protect against false positives.

Discussed with:	jhb
MFC after:	1 week
2017-07-19 18:41:16 +00:00
Ed Maste
2775c1d7d5 bsdinstall: improve checksum mismatch error for snapshots
The usual case of a mismatched checksum for installer snapshots
(e.g., -CURRENT, -ALPHA*) is that a newer snapshot has been built and
the old install sets have been replaced.  Provide a specific error
message for checksum mismatches there that suggests looking for a newer
snapshot.

Submitted by:	Guangyuan Yang <yzgyyang@outlook.com>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11641
2017-07-19 18:25:52 +00:00
Ed Maste
9acc904146 bsdinstall: remove EOL whitespace 2017-07-18 23:35:19 +00:00
Navdeep Parhar
8f82718fb2 cxgbetool(8): Add loadboot and loadboot-cfg subcommands to install or
remove bootrom and boot config.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-07-18 03:58:59 +00:00
Benedict Reuschling
4718651cb3 The ctladm man page incorrectly duplicated the text for the
delete subcommand in the modify section. Rewrite the
modify description text in two places to say modify/modified
instead of remove/removed.

PR:		220710
Submitted by:	sseekamp@risei.net
Reviewed by:	mav@
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D11608
2017-07-15 17:59:28 +00:00
Bryan Drewery
7c2f06da87 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-07-10 23:52:04 +00:00
Rick Macklem
3ab05e8674 Document the changes done to nfsuserd by r320757.
This is a content change.
2017-07-06 22:34:34 +00:00
Rick Macklem
77193c0508 Modify the nfsuserd daemon so that it uses an AF_LOCAL socket for upcalls.
This patch modifies the nfsuserd daemon so that it uses an AF_LOCAL socket
for upcalls by default. This should fix the problem with using a UDP
socket upcall to 127.0.0.1 when jails are used.
The AF_LOCAL socket case only supports a single server daemon, since hangs
were observed by the original problem reporter when multiple daemons
were used.
The patch adds a command line option called "-use-udpsock" which makes
the daemon revert to its prepatched behaviour.

Suggested by:	dfr
PR:		205193
Relnotes:	yes
2017-07-06 22:04:37 +00:00
Ed Maste
f5d0a8f7c7 acpidump: warn and exit loop on invalid subtable length
Submitted by:	Guangyuan Yang <yzgyyang@outlook.com>
Sponsored by:	The FreeBSD Foundation
2017-07-06 14:35:47 +00:00
Bartek Rutkowski
2669f7ebf1 usr.sbin/bsdinstall/scripts/hardening: fix options numbers
Submitted by:	Bartek Rutkowski <robak@FreeBSD.org>
Reviewed by:	bapt
Approved by:	bapt
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D11505
2017-07-06 12:19:15 +00:00
Alexander Motin
321728cef1 Report device descr in addition to ident.
Serial number without device model is somewhat less useful.

MFC after:	2 weeks
2017-07-06 09:05:38 +00:00
Enji Cooper
01df7d10a5 Remove SUBDIR ordering/uniquifying in *bin/Makefile
After the addition of SUBDIR.yes, uniquifying/ordering the SUBDIRs doesn't
make a whole lot of sense, and it's in effect a half measure.

Ordering SUBDIR (after adding SUBDIR.yes to it) in bsd.subdir.mk is a
separate change that warrants more discussion/testing, because while
the SUBDIR_PARALLEL work largely fixed dependency ordering for SUBDIRs,
there might be downstream FreeBSD consumers that rely on the SUBDIR
ordering.

MFC after:	2 months
Reviewed by:	bdrewery
Differential Revision:	D11398
2017-07-06 04:15:30 +00:00
Alexander Motin
1a01f934bf Add naive benchmark for SSDs in ZFS SLOG role.
ZFS SLOGs have very specific access pattern with many cache flushes,
which none of benchmarks I know can simulate.  Since SSD vendors rarely
specify cache flush time, this measurement can be useful to explain why
some ZFS pools are slower then expected.  This test writes data chunks
of different size followed by cache flush, alike to what ZFS SLOG does,
and measures average time.

To illustrate, here is result for 6 years old SATA Intel 710 Series SSD:

Synchronous random writes:
         0.5 kbytes:    138.3 usec/IO =      3.5 Mbytes/s
           1 kbytes:    137.7 usec/IO =      7.1 Mbytes/s
           2 kbytes:    151.1 usec/IO =     12.9 Mbytes/s
           4 kbytes:    158.2 usec/IO =     24.7 Mbytes/s
           8 kbytes:    175.6 usec/IO =     44.5 Mbytes/s
          16 kbytes:    210.1 usec/IO =     74.4 Mbytes/s
          32 kbytes:    274.2 usec/IO =    114.0 Mbytes/s
          64 kbytes:    416.5 usec/IO =    150.1 Mbytes/s
         128 kbytes:    776.6 usec/IO =    161.0 Mbytes/s
         256 kbytes:   1503.1 usec/IO =    166.3 Mbytes/s
         512 kbytes:   2968.7 usec/IO =    168.4 Mbytes/s
        1024 kbytes:   5866.8 usec/IO =    170.5 Mbytes/s
        2048 kbytes:  11696.6 usec/IO =    171.0 Mbytes/s
        4096 kbytes:  23329.6 usec/IO =    171.5 Mbytes/s
        8192 kbytes:  46779.5 usec/IO =    171.0 Mbytes/s

, and much newer and supposedly much faster NVMe Samsung 950 PRO SSD:

Synchronous random writes:
         0.5 kbytes:   2092.9 usec/IO =      0.2 Mbytes/s
           1 kbytes:   2013.1 usec/IO =      0.5 Mbytes/s
           2 kbytes:   2014.8 usec/IO =      1.0 Mbytes/s
           4 kbytes:   2090.7 usec/IO =      1.9 Mbytes/s
           8 kbytes:   2044.5 usec/IO =      3.8 Mbytes/s
          16 kbytes:   2084.8 usec/IO =      7.5 Mbytes/s
          32 kbytes:   2137.1 usec/IO =     14.6 Mbytes/s
          64 kbytes:   2173.4 usec/IO =     28.8 Mbytes/s
         128 kbytes:   2923.9 usec/IO =     42.8 Mbytes/s
         256 kbytes:   3085.3 usec/IO =     81.0 Mbytes/s
         512 kbytes:   3112.2 usec/IO =    160.7 Mbytes/s
        1024 kbytes:   2430.6 usec/IO =    411.4 Mbytes/s
        2048 kbytes:   3788.9 usec/IO =    527.9 Mbytes/s
        4096 kbytes:   6198.0 usec/IO =    645.4 Mbytes/s
        8192 kbytes:  10764.9 usec/IO =    743.2 Mbytes/s

While the first one obviously has maximal throughput limitations, the
second one has so high cache flush latency (about 2 millisecond), that
it makes one almost useless in SLOG role, despite of its good throughput
numbers.  Power loss protection is out of scope of this test, but I
suspect it can be related.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2017-07-05 16:20:22 +00:00
Bartek Rutkowski
82ec242f2e Add option to bsdinstall to disable insecure console, update stack guard option
This patch adds new bsdinstall option to hardening section that allows users
to change this behaviour to secure one and updates stack guard option so it
would set the value of relevant sysctl to 512 (2MB)

Submitted by:	Bartek Rutkowski
Reviewed by:	adrian, bapt, emaste
Approved by:	bapt, emaste
MFC after:	1 day
Sponsored by:	Pixeware LTD
Differential Revision:	https://reviews.freebsd.org/D9700
2017-07-05 13:37:27 +00:00
Rick Macklem
2ced567240 Add a Bugs section that indicates that the nfsuserd doesn't work
when jails are being used on the system.
It is hoped that the patches in PR#205193 will someday get tested/debugged
so that they can be committed to fix this.

This is a content change.

PR:		205193
MFC after:	2 weeks
2017-07-04 22:20:30 +00:00
Allan Jude
1f3f7ac7ba Add deprecation notices for all rcmd tools
Submitted by:	bcr
Reviewed by:	emaste, bapt, jhl
MFC after:	immediate
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D11471
2017-07-04 15:44:30 +00:00
Allan Jude
875a1f776c diskinfo(8): correct typo in man page
Reported by:	N.J. Mann <njm@njm.me.uk>
2017-07-02 16:20:49 +00:00
Allan Jude
278a04f5c8 Add -s (serial) and -p (physpath) to diskinfo
Return the bare requested information, intended for scripting.

The serial number of a SAS/SCSI device can be returned with
'camcontrol inquiry disk -S', but there is no similar switch for SATA.

This provides a way to get this information from both SAS and SATA disks

the -s and -p flags are mutually exclusive, and cannot be used with any
other flags.

Reviewed by:	rpokala, wblock
MFC after:	1 month
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D7828
2017-07-01 21:34:57 +00:00
Baptiste Daroussin
d25c1ff64f Add libxo(3) support to sesutil(8)
This is useful to simplify parsing "sesutil map"

Submitted by:	nikita.kozlov@blade-group.com
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	blade
2017-06-29 18:52:36 +00:00
Steve Wills
d8061eff49 Add hardening menu item for security.bsd.see_jail_proc
Approved by:		allanjude
Differential Revision:	https://reviews.freebsd.org/D11283
2017-06-29 16:39:55 +00:00
Xin LI
97e832c1da Chase malloc() change by removing lg_chunk malloc_conf settings.
In jemalloc 5, there are no longer chunks, and as configured on
FreeBSD (the "retain" option defaults to false), the mmap()
requests are precisely sized for the specific needs, which means
the virtual memory overhead should be lower for small applications.

Reviewed by:	jasone, ian
Differential Revision:	https://reviews.freebsd.org/D11366
2017-06-28 04:19:54 +00:00
Ed Maste
0661ef2af2 makefs: add copies of NetBSD makefs msdos source files
We do not treat makefs as contrib code.  Import copies of makefs msdos
files from NetBSD so that we can track our changes to these files.

These are copied from NetBSD, with only a change to use __FBSDID and
$FreeBSD$ instead of __KERNEL_RCSID and $NetBSD$.  A copy of the
original $NetBSD$ tag remains in each source file.

These two files were missed in r320212.  Also remove a stray blank line
added in msdosfs_vfsops.c.

Submitted by:	Siva Mahadevan
Sponsored by:	The FreeBSD Foundation
2017-06-23 18:58:28 +00:00
Baptiste Daroussin
4d17a48343 sesutil no longer depends on libsbuf
Sponsored by:	Gandi.net
2017-06-23 15:27:23 +00:00
Baptiste Daroussin
20a957e37a Directly print the extra status instead of filling a buffer
then printing it.

This prepares the code to make it libxo friendly

Reviewed by:	manu, Nikita Kozlov (nikita elyzion.net)
MFC after:	2 weeks
Sponsored by:	Gandi.net
2017-06-23 15:09:08 +00:00
Baptiste Daroussin
b556669269 Do not use sprintf(3) when not needed, while here,
prefer snprintf(3) over sprintf(3)
2017-06-23 13:26:13 +00:00
Ed Maste
237d1b14f2 makefs: add copies of NetBSD makefs msdos source files
We do not treat makefs as contrib code.  Import copies of makefs msdos
files from NetBSD so that we can track our changes to these files.

These are copied from NetBSD, with only a change to use __FBSDID and
$FreeBSD$ instead of __KERNEL_RCSID and $NetBSD$.  A copy of the
original $NetBSD$ tag remains in each source file.

Submitted by:	Siva Mahadevan
Sponsored by:	The FreeBSD Foundation
2017-06-22 02:46:36 +00:00
Andriy Gapon
6589ee29df bhyveload: correctly query size of disks
On FreeBSD fstat(2) works fine for querying sizes of plain files,
but not so much for character devices.
So, use DIOCGMEDIASIZE to try to get the correct size for disks
and disk-like devices (e.g. zvols).

PR:		220186
Reviewed by:	tsoome, grehan
MFC after:	1 week
2017-06-21 18:19:27 +00:00
Xin LI
8a3cd533f1 Reduce code duplication in rpc.lockd.
Reuse create_service code instead of duplicating it in
lookup_addresses for kernel NLM.

As a (good) side effect this also fixed a few issues that were
already fixed in the former but never applied to the latter.

Reviewed by:	kevlo
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D11259
2017-06-21 06:34:06 +00:00
Alan Somers
6bd94a4679 Fix usr.sbin/makefs/makefs_ffs_tests when /etc/fstab does not exist
dumpfs prints a harmless warning message (via ufs_disk_fillout(3) and
getfsfile(3)), when /etc/fstab does not exist.  We can ignore it.

PR:		220165
Reported by:	gjb
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-06-20 19:00:55 +00:00
Andriy Gapon
d6609e6a12 fstyp: move sys/ include path after zfs include paths
The reason is that FreeBSD refcount.h shadows ZFS refcount.h and that
will lead to a build error after a planned import of the ARC buf data
scatter-ization.
It's possible that some day we will have an opposite problem where
a ZFS header would shadow an essential FreeBSD header.
So, we need to think about a better long term solution.

Discussed with:	allanjude
MFC after:	17 days
2017-06-20 16:45:48 +00:00
Steven Hartland
98b9d3847d Fixed bsdinstall location of vfs.zfs.min_auto_ashift
vfs.zfs.min_auto_ashift is a sysctl only not a tunable so updated bsdinstall
to use the correct location /etc/sysctl.conf instead of /boot/loader.conf

Reported by:	Aaron Caza
Reviewed by:	allanjude
MFC after:	2 days
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D11278
2017-06-20 08:03:50 +00:00
Enji Cooper
84c8bb4fbc periodic(8): delete trailing whitespace
MFC after:	1 month
2017-06-20 06:20:09 +00:00
Bryan Drewery
c99b67a794 Utilize SYSROOT from r320119 in places where DESTDIR may be wanting WORLDTMP.
Since buildenv exports SYSROOT all of these uses will now look in
WORLDTMP by default.

sys/boot/efi/loader/Makefile
        A LIBSTAND hack is no longer required for buildenv.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-19 20:47:24 +00:00
Xin LI
df9abd97ac Check return value of seteuid() and bail out if we fail.
MFC after:	2 weeks
2017-06-19 07:02:52 +00:00
Sean Bruno
4c26331158 Quiesce clang warning while building lpc.
usr.sbin/lpr/lpc/lpc.c
  Warning
    passing 'char *[20]' to parameter of type 'const char **' discards
    qualifiers in nested pointer types
    [-Wincompatible-pointer-types-discards-qualifiers]
  Fix:
     Explicitly cast the variable "margv" to const char ** only for it's
     use as a parameter to suppress the error

Submitted by:	Aaron Prieger <aprieger@llnw.com>
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D11019
2017-06-16 20:00:39 +00:00
Ed Maste
c0fcb86aee bsdinstall: correct comment after r320007
Submitted by:	vangyzen
2017-06-16 19:26:33 +00:00
Ed Maste
4ca43ae5f2 bsdinstall: use consistent EFI configuration across platforms
- increase arm64 EFI partition to 200M, as x86
- use EFI_BOOTPART_SIZE and EFI_BOOTPART_PATH macros on x86
- increase ZFS EFI partition to 200M

PR:		201898
Reviewed by:	allanjude, manu
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11239
2017-06-16 18:58:48 +00:00
Marcelo Araujo
daaa9bf1df Check if pthread_create(3) successfully created the thread prior to call
pthread_join(3). The variable tid is not yet initialized in case
the authentication fails at early stage, that would lead pthread_join be
called with an uninitialized variable.

CID:		1375950
Reported by:	Coverity, cem
Reviewed by:	cem
MFC after:	3 weeks.
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D11150
2017-06-16 01:26:01 +00:00
Marcelo Araujo
bd4862e596 Use nitems() from sys/param.h.
MFC after:	4 weeks.
2017-06-15 06:48:36 +00:00
Marcelo Araujo
d42456e128 Use nitems() from sys/param.h.
MFC after:	4 weeks.
2017-06-15 06:46:40 +00:00
Marcelo Araujo
426729f77f Initialize variables and use byteorder(9) instead of aliasing char array
buf via uint32_t pointer.

CID:		1375949
Reported by:	Coverity, cem
Reviewed by:	cem
MFC after:	3 weeks
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D11153
2017-06-15 06:21:01 +00:00
Glen Barber
1a20115c11 Modernize FreeBSD version numbers in freebsd-update(8).
While here, expand a contraction to make textproc/igor happy.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-06-14 18:34:22 +00:00
Allan Jude
3735bba384 bsdinstall: support Auto ZFS mode for ARM64
Reported by:	Shawn Webb
MFC after:	3 days
2017-06-12 19:31:26 +00:00
Allan Jude
46c380e6db bsdinstall: Make ZFS min_auto_ashift adjustment persistent
Reported by:	feld
Reviewed by:	dteske, tsoome
MFC after:	3 days
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D10895
2017-06-12 19:29:31 +00:00
Ed Maste
83b6064de1 makefs: use C standard memcpy/memset in userland
This file does not exist in NetBSD's makefs, but make the chance for
consistency with memcpy/memset used in the rest of makefs.

Sponsored by:	The FreeBSD Foundation
2017-06-12 13:49:57 +00:00
Xin LI
d5c2c66dba Fix buffer lengths.
After r319369, the RPC code validates caller supplied buffer length in
taddr2uaddr.  When no -h is specified, the sizeof(ai_addr) is used,
which is always smaller than the required size and therefore uaddr
would be NULL, causing the kernel to copyin() from userland NULL
and fail with EFAULT.

Reviewed by:	kevlo (via Telegram)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D11151
2017-06-12 09:11:31 +00:00
Enji Cooper
c19afa1c20 Add more simple positive tests for chown(1)
The tests are largely symmetric with the tests for chmod(1)--added in r319642.

Remove chown-f_test (added in r268030) since the test coverage is now being
provided by `chown_test`.

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-06-11 19:31:42 +00:00
Marcelo Araujo
1d1a17a342 Make the VNC authentication build with LibreSSL on HardenedBSD and TrueOS.
PR:		219790
Submitted by:	Shirkdog <mshirk@daemon-security.com>
Reviewed by:	grehan and rgrimes
MFC after:	4 weeks.
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D11071
2017-06-08 04:54:15 +00:00
Stephen J. Kiernan
63c1ff65d1 When the input parameter node is NULL, memory is allocated to it.
To later free the memory, introduce a new variable lnode to track when
this happens.

Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	emax
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9878
2017-06-06 22:17:55 +00:00
Stephen J. Kiernan
ba01ab64cc Before returning because of an memory allocation error, free the memory
already allocated to buf.

Found using clang's static analyzer - scan-build

Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	stevek
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9852
2017-06-06 21:51:04 +00:00
Allan Jude
e28f9b7d03 Jails: Optionally prevent jailed root from binding to privileged ports
You may now optionally specify allow.noreserved_ports to prevent root
inside a jail from using privileged ports (less than 1024)

PR:		217728
Submitted by:	Matt Miller <mattm916@pulsar.neomailbox.ch>
Reviewed by:	jamie, cem, smh
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D10202
2017-06-06 02:15:00 +00:00
Allan Jude
24ffc64926 usr.sbin/sesutil: 'locate all off' does not deactivate empty slots
PR:		217409
Reported by:	asomers
Reviewed by:	asomers, bapt
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D10458
2017-06-06 02:03:22 +00:00
Enji Cooper
649c9a25d5 Remove TODO for sub testcases added for bug 212160
On closer inspection, the past failures no longer occur on ^/head.

PR:		212160
Sponsored by:	Dell EMC Isilon
2017-06-03 18:20:23 +00:00
Enji Cooper
81341eb139 Fix the testplan after ^/head@r318960
The number of executed testcases is 128, not 126.

MFC after:	18 days
MFC with:	r318960
Sponsored by:	Dell EMC Isilon
2017-06-03 18:12:00 +00:00
Enji Cooper
f54f69008f Don't execute the TODO cases in a subshell
This messes up the testcase counter, as seen in bug 219756.

PR:		212160, 219756
Sponsored by:	Dell EMC Isilon
2017-06-03 18:10:04 +00:00
Ed Maste
423c834342 makefs: rename variable for NetBSD diff reduction 2017-06-03 14:28:19 +00:00
Marcelo Araujo
13eb5b4943 Bump manpage date. 2017-06-02 02:37:17 +00:00
Marcelo Araujo
f4d34383f9 Add VNC Authentication support based on RFC6143 section 7.2.2.
Submitted by:	Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Reworked by:	myself
Reviewed by:	grehan, rgrimes and jilles
MFC after:	1 week.
Relnotes:	Yes.
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D10818
2017-06-02 02:35:16 +00:00
Eric van Gyzen
1f1ed24cc5 crashinfo: add "batch" mode and use it during boot
In batch mode, most messages go into the core.txt.N file instead of stdout.

Reviewed by:	jhb
MFC after:	3 days
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D10429
2017-06-01 21:23:04 +00:00
Xin LI
6448ec89e7 * limit size of buffers to RPC_MAXDATASIZE
* don't leak memory
 * be more picky about bad parameters

From:

https://raw.githubusercontent.com/guidovranken/rpcbomb/master/libtirpc_patch.txt
https://github.com/guidovranken/rpcbomb/blob/master/rpcbind_patch.txt

via NetBSD.

Reviewed by:	emaste, cem (earlier version)
Differential Revision:	https://reviews.freebsd.org/D10922
MFC after:	3 days
2017-06-01 06:12:25 +00:00
Jung-uk Kim
af05116143 Merge ACPICA 20170531. 2017-06-01 00:01:19 +00:00
Ed Maste
5d7af8bb02 makefs: free buf in case of error
CID:		270190
Submitted by:	Siva Mahadevan <smahadevan@freebsdfoundation.org>
Reported by:	Coverity
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11011
2017-05-31 16:28:29 +00:00
Alan Somers
43a251d687 Fix uninitialized variable in bootparamd.c
Restore line that was accidentally deleted in change 318790

Reported by:	Coverity
CID:		1375855
MFC after:	1 week
X-MFC-With:	318790
Sponsored by:	Spectra Logic Corp
2017-05-31 14:53:50 +00:00
Edward Tomasz Napierala
aa21218504 Minor tweaks to iscsi(4) and iscsid(8).
MFC after:	2 weeks
2017-05-28 17:02:29 +00:00
Edward Tomasz Napierala
33481e53e7 Make ctld(8) mention cfiscsi(4).
MFC after:	2 weeks
2017-05-28 16:41:42 +00:00
Enji Cooper
b8504cc0a6 pw: add some basic testcases for groupshow and usershow
- groupshow: test out -a/-g/-n .
- usershow: test out -a/-n/-u .

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-05-28 02:15:57 +00:00
David Bright
b326fec486 Add newsyslog capability to write RFC5424 compliant rotation message.
This modification adds the capability to newsyslog to write the
rotation message in a format that is compliant with RFC5424. This
capability is enabled on a per-log file basis through a new value
("T") in the flags field in newsyslog.conf. This is useful on systems
that use the RFC5424 format for log files so that the rotation message
format matches that of the other log messages. There has been recent
mention of adding an RFC5424 compliant mode to syslogd and at least
one alternative system log daemon (rsyslogd) that already has the
capability to use that format.

Reviewed by:	vangyzen, ngie
Approved by:	vangyzen (mentor)
MFC after:	2 months
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D10253
2017-05-26 16:36:30 +00:00
Ed Maste
b79f050a88 makefs: add -O (offset) option
NetBSD revs:
ffs.c		1.60
makefs.8	1.44
makefs.c	1.48
makefs.h	1.33
ffs/buf.c	1.20
ffs/mkfs.c	1.27

Obtained from:	NetBSD
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10780
2017-05-26 15:49:20 +00:00
Marcelo Araujo
85a9cb4440 Simplify parseval() by allocating a buffer the size of the input string,
which will always be big enough to hold the output string.

Obtained from:	OpenBSD (revision 1.36)
2017-05-26 03:27:06 +00:00
Ed Maste
6160cc37f4 makefs: make buf generic
it has nothing to do with ffs and will eventually be moved.
gc sectorsize.

This is a corrected version of r317744.

NetBSD versions:
ffs.c		1.58
ffs/buf.c	1.14 1.18
ffs/buf.h	1.8

Submitted by:	Siva Mahadevan <smahadevan@freebsdfoundation.org>
Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10803
2017-05-25 21:41:06 +00:00
Devin Teske
ab00ac327a Fix long standing issue in bsdconfig's keymap selection
Since the translation to vt as terminal emulator, the keymaps files
path has changed and this change does not get followed in bsdconfig.
This implicates boot time warnings about a wrong keymap file, what
is very confusing for the new users and for me too, so initialize
the default keymaps search path depending on terminal type.

Differential Revision:	https://reviews.freebsd.org/D8734
Submitted by:	Oliver Pinter <oliver.pinter@hardenedbsd.org>
Reviewed by:	ed, jilles, dteske
MFC after:	3 days
X-MFC-to:	stable/11
Sponsored by:	HardenedBSD
Signed-off-by:	Oliver Pinter <oliver.pinter@hardenedbsd.org>
2017-05-25 18:16:17 +00:00
Edward Tomasz Napierala
a9a393b390 Don't end up manpage titles with a full stop.
MFC after:	2 weeks
2017-05-24 21:02:53 +00:00
Glen Barber
9a7af23f46 Update the "first appeared in" version in several manual pages.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-05-24 17:47:49 +00:00
Alan Somers
6e3c30637d Fix a buffer overflow in bootparamd(8)
If /etc/bootparams contains a line with an excessively long pathname, and a
client asks for that path, then bootparamd will overflow a buffer and crash
while parsing that line.  This is not remotely exploitable since it requires
a malformed /etc/bootparams file.

Reported by:	Coverity
CID:		1305954
MFC after:	1 week
Sponsored by:	Spectra Logic Corp
2017-05-24 16:30:38 +00:00
Pedro F. Giffuni
880f26f3eb bhyvegc_resize: make use of reallocarray(3) for bounds-checking.
Also add __FBSDID.

Reviewed by:	grehan

This file lacks a license(!) so for this change the following declaration
applies:

To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably
and unconditionally waives, abandons, and surrenders all of Affirmer's
Copyright and Related Rights and associated claims and causes of action,
whether now known or unknown (including existing as well as future claims
and causes of action).
2017-05-24 14:24:47 +00:00
Konstantin Belousov
6992112349 Commit the 64-bit inode project.
Extend the ino_t, dev_t, nlink_t types to 64-bit ints.  Modify
struct dirent layout to add d_off, increase the size of d_fileno
to 64-bits, increase the size of d_namlen to 16-bits, and change
the required alignment.  Increase struct statfs f_mntfromname[] and
f_mntonname[] array length MNAMELEN to 1024.

ABI breakage is mitigated by providing compatibility using versioned
symbols, ingenious use of the existing padding in structures, and
by employing other tricks.  Unfortunately, not everything can be
fixed, especially outside the base system.  For instance, third-party
APIs which pass struct stat around are broken in backward and
forward incompatible ways.

Kinfo sysctl MIBs ABI is changed in backward-compatible way, but
there is no general mechanism to handle other sysctl MIBS which
return structures where the layout has changed. It was considered
that the breakage is either in the management interfaces, where we
usually allow ABI slip, or is not important.

Struct xvnode changed layout, no compat shims are provided.

For struct xtty, dev_t tty device member was reduced to uint32_t.
It was decided that keeping ABI compat in this case is more useful
than reporting 64-bit dev_t, for the sake of pstat.

Update note: strictly follow the instructions in UPDATING.  Build
and install the new kernel with COMPAT_FREEBSD11 option enabled,
then reboot, and only then install new world.

Credits: The 64-bit inode project, also known as ino64, started life
many years ago as a project by Gleb Kurtsou (gleb).  Kirk McKusick
(mckusick) then picked up and updated the patch, and acted as a
flag-waver.  Feedback, suggestions, and discussions were carried
by Ed Maste (emaste), John Baldwin (jhb), Jilles Tjoelker (jilles),
and Rick Macklem (rmacklem).  Kris Moore (kris) performed an initial
ports investigation followed by an exp-run by Antoine Brodin (antoine).
Essential and all-embracing testing was done by Peter Holm (pho).
The heavy lifting of coordinating all these efforts and bringing the
project to completion were done by Konstantin Belousov (kib).

Sponsored by:	The FreeBSD Foundation (emaste, kib)
Differential revision:	https://reviews.freebsd.org/D10439
2017-05-23 09:29:05 +00:00
Enji Cooper
5a7c7dc571 bsdinstall(8): fix manpage issues
- Start new sentences on new lines.
- Separate e.g. (more of an igor thing) with commas, and rewrite some examples
  not to be enclosed in parentheses.

Reported by:	igor, make manlint
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-05-23 08:01:11 +00:00
Enji Cooper
ab9ff47abc sade(8): start new sentence on new line
Reported by:	make manlint
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-05-23 07:50:42 +00:00
Enji Cooper
d6f6b20128 style(9): sort headers
MFC after:	2 weeks
MFC with:	r318693
Sponsored by:	Dell EMC Isilon
2017-05-23 06:05:54 +00:00
Enji Cooper
d547c56fdf Some minor style(9) fixes
- Wrap at <80 columns.
- Sort by type

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-05-23 06:04:38 +00:00
Glen Barber
f0c9042b38 Correct the "first appeared in" version for efivar(8).
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-05-22 13:55:59 +00:00
Roger Pau Monné
d7640440fb bsdinstall: do not use distextract in scripted mode
It requires a tty, which might not be available in scripted installs. Instead
extract the sets manually using tar.

Reviewed by:		tsoome
Sponsored by:		Citrix Systems R&D
MFC after:		1 week
Differential revision:	https://reviews.freebsd.org/D10736
2017-05-22 11:41:17 +00:00
Roger Pau Monné
2f34d6c344 bsdinstall: mount is not needed for the ZFS install case
Because the datasets are already mounted by zfsboot, and the mount script
doesn't know anything about ZFS. Also do not execute the "umount" script for
ZFS for the same reasons.

Reviewed by:		dteske, tsoome
Sponsored by:		Citrix Systems R&D
MFC after:		1 week
Differential revision:	https://reviews.freebsd.org/D10738
2017-05-22 11:38:39 +00:00
Benjamin Kaduk
98120473ab Updates for efivar.8
Fix spelling [1], appease igor and mandoc -Tlint, and adopt the
language style to be more consistent with our corpus.

PR:		219434 [1]
Submitted by:	olgeni [1]
2017-05-21 22:10:08 +00:00
Rick Macklem
6ab9e0df87 Update the exports.5 man page to reflect the change in default uid/gid
made by r318262.

This is a content change.
2017-05-20 23:25:07 +00:00
Cy Schubert
1232628506 Fix up two assertions following malloc(). vangyzen@ notified me of
the second one. The first one is fixed as well.

Reported by:	vangyzen@
MFC after:	1 week
2017-05-20 18:16:26 +00:00
Cy Schubert
8af0c00bd6 Fix non-recoverable name resolution failures due to negative cache
entries never expiring. This patch honours the negative cache timeout.

To test/experience the failure do the following:

1. Edit /etc/ncd.conf to adjust the cache timeouts as follows:

	positive-time-to-live hosts 30
	negative-time-to-live hosts 1

2. Ensure that nsswitch.conf hosts line contains something like:

	hosts: files cache dns

	Note that cache must be specified before dns.

3. Start nscd.

4. Run the following command:

	while true; do nc -z -w 3 www.google.com 80; sleep 5; done

5. While running the command, remove or comment out all nameserver
   statements in /etc/resolv.conf. After a short while you will notice
   non-recoverable name rsolution failures.

6. Uncomment or replace all nameserver statements back into
   /etc/resolv.conf. Take note that name resolution never recovers.
   To recover nscd must be restarted. This patch fixes this.

PR:		207804
Submitted by:	Jov <amutu@amutu.com>
MFC after:	1 week
2017-05-20 16:58:48 +00:00
Maxim Konovalov
6dce7e9908 o Missed flag restored.
PR:		219395
Submitted by:	Tiwei Bie
2017-05-19 20:02:32 +00:00
Ed Maste
7092a907e5 makefs: drop WARNS back to 2
GCC warns about additional signed comparision issues compared to Clang.
Drop WARNS for now until the underlying issue is fixed.
2017-05-18 17:55:33 +00:00
Emmanuel Vadot
d91e611798 makefs: Add soft-updates option
Add the ffs option to enable soft-updates.
The option is only processed is ufs2 has been selected.

Reviewed by:	emaste, bapt (earlier version), allanjude (earlier version)
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D10773
2017-05-18 14:19:06 +00:00
Ed Maste
3afe6a68e0 makefs: clean up signedness warnings and bump WARNS to 3
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10650
2017-05-18 14:05:29 +00:00
Rick Macklem
947572b4ee Change the default uid/gid values for nobody/nogroup to 65534/65533.
The default values found in /etc/passwd and /etc/group are 65534, 65533.
In mountd.c, the defaults were -2, which was 65534 back when uid_t was 16bits.
Without this patch, a file created by root on an NFS exported volume without
the "-root=" export option will end up owned by uid 4**32 - 2.
When discussed on freebsd-current@, it seemed that users preferred the
values being changed to 65534/65533.
I have not added code to acquire these values from the databases, since
the mountd daemon might get "stuck" during startup waiting for a non-responsive
password database server.

Discussed on:	freebsd-current
2017-05-14 00:38:41 +00:00
Alan Somers
0ce59aa848 Don't depend on assert(3) getting evaluated
Reported by:	imp
MFC after:	3 weeks
X-MFC-With:	318141, 318143
Sponsored by:	Spectra Logic Corp
2017-05-10 16:06:22 +00:00
Alan Somers
daccabe958 strcpy => strlcpy
Reported by:	Coverity
CID:		1006715
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-05-10 15:38:06 +00:00
Bryan Drewery
07676084ec DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-05-09 01:48:23 +00:00
Bryan Drewery
6106a50ee6 DIRDEPS_BUILD: Connect new directories.
Sponsored by:	Dell EMC Isilon
2017-05-09 01:48:14 +00:00
Enji Cooper
ca7f276c93 Restore sectorsize global to unbreak makefs after r317744
This also unbreaks the fstyp tests.

Reported by:	Alastair Hogge <agh@fastmail.fm>, Jenkins
Sponsored by:	Dell EMC Isilon
2017-05-08 18:42:38 +00:00
Ed Maste
c5a0915477 makefs: further size_t warning cleanup (missing from r317944)
Sponsored by:	The FreeBSD Foundation
2017-05-08 16:57:33 +00:00
Ed Maste
243a297a95 makefs: cast snprintf return value to size_t to clear warning
Sponsored by:	The FreeBSD Foundation
2017-05-08 16:34:39 +00:00
Ed Maste
856d87c5af makefs: use size_t as appropriate to clean up warnings
Sponsored by:	The FreeBSD Foundation
2017-05-08 13:09:27 +00:00
Scott Long
e8262ee824 Show more fields in the IOCFact message 2017-05-05 17:01:54 +00:00
Edward Tomasz Napierala
d4acedbc64 Revert r317804; apparently I forgot the auto_master syntax.
MFC after:	2 weeks
2017-05-04 19:55:32 +00:00
Edward Tomasz Napierala
1638f1d3e4 Make automount(8) error out when the map name is missing.
MFC after:	2 weeks
2017-05-04 19:41:19 +00:00
Gleb Smirnoff
5c3ec67603 Improve documentation of fbuf device.
Submitted by:	novel
Reviewed by:	grehan, bcr
Differential Revision:	https://reviews.freebsd.org/D10014
2017-05-03 21:44:04 +00:00
Poul-Henning Kamp
67c9f60e86 Flush stdout before yes/no confirmations, to force question
through pipes/tee(1)/whatever
2017-05-03 20:41:26 +00:00
Ed Maste
9e96f90b50 makefs: clean up warnings
- make functions and variables static where appropriate
- use const char * where appropriate
- remove unused variables

Sponsored by:	The FreeBSD Foundation
2017-05-03 14:57:04 +00:00
Ed Maste
15fc093acc makefs: make buf generic
it has nothing to do with ffs and will eventually be moved.
gc sectorsize.

NetBSD versions:
ffs.c		1.58
ffs/buf.c	1.14 1.18
ffs/buf.h	1.8

Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2017-05-03 14:21:18 +00:00
Marcelo Araujo
63128851f3 Use nitems() from sys/param.h.
Reviewed by:	ngie
MFC after:	2 weeks.
Differential Revision:	https://reviews.freebsd.org/D9942
2017-05-03 14:03:46 +00:00
Marcelo Araujo
049e195404 Free the memory allocated to trackbuf before exiting, it might fix a potential
memory leak.

Submitted by:	trix@juniper.net
MFC after:	2 weeks.
Differential Revision:	https://reviews.freebsd.org/D9856
2017-05-03 13:57:31 +00:00
Ed Maste
e651540a68 makefs: remove unused cd9660_defaults_set global
Sponsored by:	The FreeBSD Foundation
2017-05-01 00:53:07 +00:00
Pedro F. Giffuni
2b223a01ef mixer(8): Prevent possible sscanf() overflow.
Fix %s buffer sizes in sscanf().

Obtained from:	DragonflyBSD (git dab952e2)
MFC after:	5 days
2017-04-29 19:12:44 +00:00
Maxim Konovalov
7c415819be o Clean the whole array of IPv4 addresses not just a local part.
PR:		218923
Submitted by:	Daniel McRobb
2017-04-28 09:17:16 +00:00
Gleb Smirnoff
6c87a2c0ee Document raw framebuffer device and XHCI device configurations. 2017-04-28 05:43:27 +00:00
Gleb Smirnoff
bc5d44ec53 - For security reasons by default listen on localhost address,
not on wildcard. [1]
- Move the default port assignment from pci_fbuf.c to rfb.c,
  to avoid polluting pci_fbuf.c with network things.

Suggested by:	grehan
2017-04-28 05:32:26 +00:00
Gleb Smirnoff
3909a600a5 When no "rfb" configuration specified bind to the default VNC
port instead of binding to a random one.
2017-04-28 05:13:27 +00:00
Gleb Smirnoff
60bfcbd605 Make comments match the code. No functional change. 2017-04-28 05:09:51 +00:00
Brooks Davis
0607c830b3 More ATM and NATM removal
Submitted by:	ak
Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D10511
2017-04-27 16:05:12 +00:00
Takanori Watanabe
4aa92fe2f3 Make cached Bluetooth LE host advertise information visible from userland.
Differential Revision:	https://reviews.freebsd.org/D10362
2017-04-27 15:03:24 +00:00
Gleb Smirnoff
007e172d64 We need CAP_MMAP_RW on memfd, since init_msix_table() may call mmap(). 2017-04-27 05:48:52 +00:00
Edward Tomasz Napierala
56226f9c30 Make fstyp(8) recognize exFAT even without the -u option.
While it's not directly mountable with mount(8), it's something that's
mountable - differently from GELI or zpools.

MFC after:	2 weeks
2017-04-26 19:34:41 +00:00
John Baldwin
73ad3fb536 Add a new GDB_LIBEXEC option to install gdb and kgdb to /usr/libexec.
When this option is enabled, only gdb and kgdb are installed to
/usr/libexec for use by crashinfo(8). Other bits of GDB such as
gdbserver and gdbtui are not installed. For this option to be
effective, GDB must be enabled.

Rework r317094 to re-enable GDB on all platforms but enable
GDB_LIBEXEC on platforms for which the GDB in ports is a superset of
functionality.

Reviewed by:	emaste, kib
Suggested by:	kib
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D10449
2017-04-25 18:08:56 +00:00
Brooks Davis
5477372324 Use the approved syntax to build no man pages.
MFC after:	1 week
Sponsored by:	DARPA, AFRL
2017-04-24 21:55:59 +00:00
Brooks Davis
a7dc31283a Remove the NATM framework including the en(4), fatm(4), hatm(4), and
patm(4) devices.

Maintaining an address family and framework has real costs when we make
infrastructure improvements.  In the case of NATM we support no devices
manufactured in the last 20 years and some will not even work in modern
motherboards (some newer devices that patm(4) could be updated to
support apparently exist, but we do not currently have support).

With this change, support remains for some netgraph modules that don't
require NATM support code. It is unclear if all these should remain,
though ng_atmllc certainly stands alone.

Note well: FreeBSD 11 supports NATM and will continue to do so until at
least September 30, 2021.  Improvements to the code in FreeBSD 11 are
certainly welcome.

Reviewed by:	philip
Approved by:	harti
2017-04-24 21:21:49 +00:00
Rick Macklem
c1c63967cb Fix the default uid/gid values in nfsuserd.c
This patch sets the default uid/gid values for "nobody" and "nogroup"
to the values in the password and group databases. Normally nfsuserd(8)
will override these with whatever is in the password/group databases,
so these values are only used when the databases entries aren't available.
It would be nice to use the definitions in sys/conf.h, but those are
in the _KERNEL section of the file.

Reported by:	tez@pkgsrc.org
Submitted by:	tez@pkgsrc.org
MFC after:	2 weeks
2017-04-23 23:09:02 +00:00
Pedro F. Giffuni
780154cbaf pmcstat(8); unsign some allocation variables and use reallocarray(3).
Use unsigned values in some internal variables that will be used during
allocation. The variables are used in reduced scope and have no chance of
becoming negative.

Provide bounds checking through reallocarray(3).

MFC after:	2 weeks
2017-04-22 16:02:40 +00:00
Rick Macklem
97662c7c33 Get rid of bogus statement in the nfsuserd.8 man page.
The nfsuserd.8 man page stated that a usertimeout of 0 would disable
the cache timeout. This was simply not true, so this patch deletes
the sentence.

This is a content change.

PR:		217406
MFC after:	2 weeks
2017-04-21 20:53:51 +00:00
Enji Cooper
609b7b269d Add a knob, WITH*_RPCBIND_WARMSTART_SUPPORT, to allow the end-user to build
rpcbind(8) with/without warmstart support.

The knob defaults to off to preserve POLA for the feature.

See rpcbind(8) for more details about the warmstart feature.

MFC after:	7 weeks
Relnotes:	yes
Sponsored by:	Dell EMC Isilon
2017-04-19 20:45:46 +00:00
Enji Cooper
ebb27fd055 Fix indentation per style.Makefile(5)
MFC after:	7 weeks
Sponsored by:	Dell EMC Isilon
2017-04-19 20:27:13 +00:00
Enji Cooper
bffe25839c rpcbind(8): post-humously document -w (warmstart) support added in r74462
warmstart support saves portmap/rpcbind(8) registration state on exit and
restores the saved registration state on restart.

MFC after:	7 weeks
Sponsored by:	Dell EMC Isilon
2017-04-19 20:23:27 +00:00
Enji Cooper
7e84e1cb45 rpcbind(8): add a description for /var/run/rpcbind.sock under the FILES section
MFC after:	7 weeks
Sponsored by:	Dell EMC Isilon
2017-04-19 20:04:45 +00:00
Enji Cooper
218d5aa052 rpcbind(8): wordsmith -h description and mention -W in the SYNOPSIS section
-W was already documented in the OPTIONS section.

MFC after:	7 weeks
Reported by:	igor (-h wordsmith'ing)
Sponsored by:	Dell EMC Isilon
2017-04-19 18:01:53 +00:00
Enji Cooper
fadafdfa69 Print out the signal number on exit in terminate(..) if WARMSTART is compiled
into rpcbind.

The signal number can provide helpful diagnostic info.

MFC after:	1 week
Obtained from:	Isilon OneFS
Sponsored by:	Dell EMC Isilon
2017-04-19 17:51:32 +00:00
Patrick Kelsey
2f8c6c0a58 Fix userland tools that don't check the format of routing socket
messages before accessing message fields that may not be present,
removing dead/duplicate/misleading code along the way.

Document the message format for each routing socket message in
route.h.

Fix a bug in usr.bin/netstat introduced in r287351 that resulted in
pointer computation with essentially random 16-bit offsets and
dereferencing of the results.

Reviewed by:	ae
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10330
2017-04-16 19:17:10 +00:00
Baptiste Daroussin
1af6dc18b9 Add a new Y flag to newsyslog.conf
This makes newsyslog use zstandard to compress log files.

Given Z is already taken for gzip and zstandard compression level stands in
between gzip and xz (which has the X flag) chosing Y sounds ok :)
2017-04-15 20:37:34 +00:00
Maxim Sobolev
023653459a Fix another logic bug that came out of recent syslogd refactoring and exposed by
the r316874: don't call shutdown(2) on all sockets, but only net ones, which seems
to be the behaviour existed before that refactoring. Also don't call listen(2)
in datagram sockets and fix misplaced debug messages while I am here.

Reported by: peter
2017-04-15 18:20:11 +00:00
Maxim Sobolev
b98582b146 Since shutdown(2) on datagram socket is no longer a NOP after rev 316874
don't bother to select/recv on that socket. This prevents syslogd(8)
from spinning endlessly when started with the -s option (default).

Reported by:	peter
2017-04-15 02:24:22 +00:00
Conrad Meyer
6c546e77b6 bsdinstall(8): Sprinkle a snprintf to fixed size buffer
Use a snprintf to write an environment variable to a fixed-size buffer to
avoid stack overflow.

Reported by:	Coverity (CWE-120)
CID:		1238926
Sponsored by:	Dell EMC Isilon
2017-04-14 00:36:45 +00:00
Conrad Meyer
9c363a12fb ctm: Fix some trivial argv buffer overruns
It may not do the right thing with these obviously wrong inputs, but at
least it won't smash the stack.

Reported by:	Coverity (CWE-120)
CIDs:		1006697, 1006698
Sponsored by:	Dell EMC Isilon
2017-04-13 22:59:17 +00:00
Alexander Motin
9215e501b9 Do not register in CTL portal groups without portals.
From config synthax point of view such portal groups are not incorrect,
but they are useless since can not receive any connection.  And since
CTL port resource is very limited, it is good to save it.

MFC after:	2 weeks
2017-04-10 10:38:12 +00:00
Alexander Kabaev
e64aaeac2a Use int to receive the return value of getopt function.
getopt returns int and not char, so assigning the value to
char is not ideal, especially on platforms with unsigned
chars.
2017-04-07 22:58:31 +00:00
Sevan Janiyan
ea566940e1 Remove the last vestiges of FDC_DEBUG & FD_DEBUG
FDC_DEBUG is not referenced in any c or header files but traces of it
still remain in other files.

PR:		105608
Reported by:	Eugene Grosbein <ports AT grosbein DOT net>
Reviewed by:	imp
Approved by:	bcr (mentor)
MFC after:	7 days
Differential Revision:	https://reviews.freebsd.org/D10303
2017-04-07 16:14:25 +00:00
Ed Maste
37ca9f42fd makefs: Sync with NetBSD (fix unused variable warnings)
NetBSD revs:
cd9660.c		1.45
cd9660/cd9660_write.c	1.17

Obtained from:	NetBSD
2017-04-07 02:31:55 +00:00
Brooks Davis
08069ae688 Point out that -F probably does not do what the user expects.
Users attempting to create images from mtree METALOG files created by
installworld often use -F when they should be passing the METALOG file
in place of a directory. This is often produces difficult to debug
error reports.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10038
2017-04-06 23:35:10 +00:00
Renato Botelho
a2ac74c148 Introduce libxo support to arp(8)
Reviewed by:	wblock, gnn, allanjude, phil
Approved by:	allanjude
MFC after:	1 week
Sponsored by:	Rubicon Communications (Netgate)
Differential Revision:	https://reviews.freebsd.org/D9563
2017-04-06 22:50:28 +00:00
Ed Maste
5f5598b130 makefs: use emalloc and friends
The emalloc set of error-checking memory allocation routines were added
to libnetbsd in r316572. Use them in makefs to reduce differences with
NetBSD.

NetBSD revs:
cd9660.c			1.39
ffs.c				1.56
makefs.c			1.42
walk.c				1.27
cd9660/cd9660_archimedes.c	1.2
cd9660/cd9660_eltorito.c	1.20
cd9660/cd9660_write.c		1.16
cd9660/iso9660_rrip.c		1.12
ffs/buf.c			1.17
ffs/mkfs.c			1.26

Obtained from:	NetBSD
2017-04-06 16:18:42 +00:00
Ed Maste
07e89ad740 makefs: zero memory
NetBSD revs:
ffs/buf.c	1.14

Obtained from:	NetBSD
2017-04-06 00:07:11 +00:00
Enji Cooper
ba8c8a0ca2 Don't assume NAME_MAX is 255
Query the filesystem limit via getconf(3) instead

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-04 21:36:13 +00:00
Enji Cooper
d2d2a79c1a Clean up more trailing whitespace in the licensing tort that
happened to be spaces, not tabs

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-04 21:30:24 +00:00
Enji Cooper
9bf377826e Clean up trailing whitespace
MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-04 21:29:37 +00:00
Bruce Evans
6be33b8301 Fix a missing const in my previous commit which broke the build at
normal WARNS.

Reported by:	lwhsu
2017-04-03 15:11:28 +00:00
Bruce Evans
b60e1b8142 Show high (blinking foreground/bright background) background colors. Format
output and source better for this.  Format output for 40 columns if there
are less than 80 columns.
2017-04-03 13:06:28 +00:00
Bruce Evans
8f92a81b81 Remove the global variable 'info' and fix associated bugs and style bugs.
This variable was used 4 times in 1 function and all uses were wrong.
The 4 uses were in he test_frame() (show) function, to try to restore
4 colors, 2 unnecessarily and these 2 now broken.  This was wrong
because it is the previous colors that must be restored, but the global
holds the original colors.  Excessive setting of colors at the end
restored the previous colors correctly in most cases, but I removed
this a couple of revisions ago.

Originally, this variable had 1 correct use, to test for being on a vty
as a side effect of initializing it.  This is now down in init(), and
init() also leaves a better-named global with the same contents.

Fix this by reading the current console info into a local variable in
test_frame(), as is done for several other functions.  Fix style bugs
in this reading for all callers:
- extra blank lines
- all error messages different.  The first one now in init() is not as
  specific as the old one, but it is after a different specific one for
  another ioctl and is unlikely to be reached when the first ioctl
  succeeds.  Ones after the first are to repeat the ioctl, so are even
  more likely to be reached.  The correctness of full removal of the
  old global depends on the error handling for failure to initialize
  it being unreachable.
- err() instead of warn() for failure in load_font().  This is almost
  unreachable, and it makes no sense to continue after undoing previous
  changes with revert().
- unreachable return after err() for failure in dump_screen().

Undo large renaming of local variables from the good name 'info' to the
bad name _info, which was done to protect the buggy global's bad name
from -Wshadow warnings.
2017-04-03 10:47:01 +00:00
Bruce Evans
2b881cf4c6 Save errno across revert().
Change 25 uses of errc() to err().  2 of these were correct.  23 used
errno for the arg so were just a verbose spelling of err().  5 of these
were just style bugs, and 18 depended on revert() saving errno.

1 warn() also depended on revert() saving errno.

Remove 2 warnx()'s that duplicate the message from a later errx().
These used to be before returns, and should have reported errno in
some cases.  errno is also not reported for for openguess() failures.

Only "restore" the video mode in revert() if the mode was just set
(necessarily partially).  Setting the mode to its current setting
doesn't "restore" it, but resets it, with the least harmful change
being to clear the screen.  revert() is called even for some harmless
syntax errors and usually did nothing except reset the mode.  Now it
usually does nothing.  The only things that it tries to restore apart
from the mode are the active vty number, the screen map, 2 colors that
only need to be restored (only after a mode change) to fix kernel bugs,
and 3 colors that can't be restored due to kernel bugs.  (This is
mostly for sc, since vt doesn't support mode changes.)

revert() is not called for syntax and setting errors after [mode], so
the mode reset is only done for failures to set raster mode after
setting graphics mode.  normal colors can only be set after [mode],
and that is why reverting them should be unnecessary.
2017-04-03 09:21:00 +00:00
Bruce Evans
1b8c842e06 Fix some parsing and error handling bugs.
r146736 added an undocumented syntax and many bugs handling it.  The
documented syntax is "... [mode] [fg [bg]] [show]", where it is critical
for reducing ambiguity and keeping things simple that the mode is
parsed first.  r146736 added buggy support for "... [mode] [fg [bg]]
[show] [mode] [fg [bg]]".  One error was that after for failing to set
a partially-supported graphics mode, argv[optind] remains pointing to
the mode so doesn't match the first [fg [bg]], so the setting is
attempted again, with slightly worse error handling.

Fix this by removing it (support for the trailing '[mode] [fg [bg]]')
and cleaning up.  The cleanups are mostly to remove convolutions and
bugs that didn't work to handle the ambiguous syntax '[fg [bg]] [fg [bg]]'
when [mode] and [show] are not present.  Globals were set to allow
repeating the color settings at the end.  The functions that set the
colors earlier were misnamed from set* to get*.  All that they "got" is
is settings from argv.  They applied the settings to the kernel and
the globals.

Fix restoration of colors in revert() by restoring 2 after the mode
change.  Colors should not need to be restored, but a bug in scteken
clobbers them on any mode change, including ones for restoration.  Don't
move the restoration of the other 3.  Teken doesn't clobber them on
mode changes because it doesn't support them at all (sc still supports
the border color, but only using a non-teken ioctl).

Add restoration of colors after a successful mode change to work around
the scteken bug there too.  The bug was previously masked by the general
setting of colors at the end.

Fix a longstanding parsing/error handling bug by exiting almost immediately
after matching the [mode] arg but failing to set the mode.  Just revert
if necessary.  Don't return to continue parsing but do it wrong.  This
bug caused spamming the output with a usage() message and exiting with
status 1 whenever [mode] is not present bug [fg [bg]] or [show].  The
exit code 1 was actualy an ambiguous internal code for failure to match
[mode] or failure to set [mode].  This 1 was obfuscated by spelling it
EXIT_FAILURE, but actual exit codes spell EXIT_FAILURE as 1.  Remove
another global which could have been used to disambiguate this but was
only used to micro-optimize the (unnecessary except for other bugs)
setting of colors at the end.
2017-04-03 06:52:02 +00:00
Alexander Motin
ec46b9208d Fix variable for sizeof() in previous commit.
MFC after:	2 weeks
2017-04-02 20:57:59 +00:00
Alexander Motin
4e183a48fe Add Log directory and SATA NCQ Send and Receive Log.
Those are used at least by Linux guests to detect queued TRIM support.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2017-04-02 20:39:51 +00:00
Bruce Evans
12dd1cd388 Remove checks that background (bg) colors are not bright and buggy
attempts to keep them that way.  The bg brightness bit is interpreted
as blinking in some modes, but it would barely be useful to disallow
setting it when it would give blinking in code which knew when that
is.  The old code mostly knew this wrong, and added handling errors.
It is in fact impossible to know, since future mode switches may
change the meaning of the bit many times on the screen and in history.

Old versions of vidcontrol disallowed bg color numbers >= 8 in all
cases.  This is very VGA/syscons-centric.  Syscons uses the VGA defaults
of blinking fg instead of bright bg in text mode and bright bg in
graphics mode.  On VGA, this is very easy to toggle at any time, and
vt blows away the VGA text mode default at boot time.

r146736 changed this to try to allow bg color numbers in graphics mode
only.  This is even more VGA/syscons-centric, and there are many bugs
in this, and many nearby bugs in the parser.  These are increased or
decreased by differences and bugs in vt and teken.

Perhaps the most obvious bug was that almost any vidcontrol command
which changes any color or the mode causes an error if the initial fg
color is bright.  E.g., in syscons text mode, after "vidcontrol
lightwhite" to make the fg bright, another "vidcontrol lightwhite" is
rejected and buggy fixup code changes the fg to white.  This is because
the bright fg color creates a bright bg color for the phantom reverse
video attribute, so was rejected.  (The reverse video attribute is
phantom because teken ignores the user's setting of it and simply
reverses the fg attributes to create the bg attributes.  Sometimes
some layer masks off the brightness/blinking bit, but not here.)

Perhaps the next most obvious one was that "vidcontrol lightgreen
lightblue" was misparsed as 2 settings of the fg instead of 1 setting
of the fg and 1 invalid setting of the bg.  This is because the
parser supports an undocumented syntax with many parsing bugs (an
ambiguity gives this one).

I recently fix bugs in teken that broke setting of bright fg's and
bg's in the normal way.  This gave more settings of then, so the old
bugs showed up more often.
2017-04-02 16:39:39 +00:00
Roman Bogorodskiy
0ee3a4b4ae Minor style improvements in bhyve.8
Replace "as of now" with "at present". As the change is a really minor one,
don't bump .Dd.

Suggested by:	wblock
Approved by:	wblock (implicit)
2017-04-01 15:01:10 +00:00
Alan Somers
86571b9c01 Consolidate random sleeps in periodic scripts
Multiple periodic scripts sleep for a random amount of time in order to
mitigate the thundering herd problem. This is bad, because the sum of
multiple uniformly distributed random variables approaches a normal
distribution, so the problem isn't mitigated as effectively as it would be
with a single sleep.

This change creates a single configurable anticongestion sleep. periodic
will only sleep if at least one script requires it, and it will never sleep
more than once per invocation. It also won't sleep if periodic was run
interactively, fixing an unrelated longstanding bug.

PR:		217055
PR:		210188
Reviewed by:	cy
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D10211
2017-04-01 04:42:35 +00:00
Enji Cooper
653e7d6396 Split iscsi(4) ctl frontend off of ctl(4) as cfiscsi(4)
The goal of this work is to remove the explicit dependency for ctl(4)
on iscsi(4), so end-users without iscsi(4) support in the kernel can
use ctl(4) for its other functions.

This allows those without iscsi(4) support built into the kernel to use
ctl(4) as a test mechanism. As a sidenote, this was possible around the
10.0-RELEASE period, but made impossible for end-users without iscsi(4)
between 10.0-RELEASE and 11.0-RELEASE.

Automatically load cfiscsi(4) from ctladm(8) and ctld(8) for backwards
compatibility with previously releases. The automatic loading feature is
compiled into the beforementioned tools if MK_ISCSI == yes when building
world.

Add a manpage for cfiscsi(4) and refer to it in ctl(4).

Differential Revision:	D10099
MFC after:	2 months
Relnotes:	yes
Reviewed by:	mav, trasz
Sponsored by:	Dell EMC Isilon
2017-03-30 04:56:27 +00:00
Conrad Meyer
34a1b5b258 rrenumd(8): Fix a trivial Coverity warning
Coverity warns that it is invalid to access following struct members by
accessing the current struct member pointer plus one.  Assuming the
compilers aren't abusing this kind of UB yet, this cleanup isn't a
functional change.

Reported by:	Coverity
CID:		1368713
Sponsored by:	Dell EMC Isilon
2017-03-29 21:04:39 +00:00
Ed Maste
cfa6282553 makefs: sync with NetBSD
This is a collection of minor changes as diff reduction against NetBSD.

NetBSD revs:
cd9660.c		1.39
cd9660.h		1.19
makefs.c		1.34

Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2017-03-29 20:49:41 +00:00
Ed Maste
10d64b7788 makefs: free specfile structure once it has been applied
NetBSD revs:
walk.c		1.21

Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2017-03-29 15:45:19 +00:00
Ed Maste
6c5f7c4725 makefs: sort roundup with the other off_t members in fsinfo_t
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2017-03-27 20:24:18 +00:00
Enji Cooper
ced3474819 ctldadm: sort #includes per style(9)
- Only include sys/types.h or sys/param.h, not both.
- Sort alphabetically.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-27 19:01:34 +00:00
Enji Cooper
9118b1b092 ctld: sort #includes per style(9)
- Only include sys/types.h or sys/param.h, not both.
- Sort alphabetically.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-27 18:59:49 +00:00
Enji Cooper
f040054c54 Allow WARNS to be overridden by the end-user
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-27 18:40:20 +00:00
Brad Davis
f43b687262 Check to see if the kernel has cd9660 before running tests that require it
Approved by:	ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10096
2017-03-27 15:20:31 +00:00
Jamie Gritton
6bd211bb87 Same as r316022 (Fix hexadecimal escape codes in jail.conf(5)),
but do it right this time.

Reported by:	Kyle Evans <Kyle Evans>
MFC after:	3 days
2017-03-27 13:37:40 +00:00
Jamie Gritton
acf8ec5684 Fix hexadecimal escape codes in jail.conf(5).
PR:		218154
Submitted by:	Masahiro Konishi <mkonishi@sea.plala.or.jp>
MFC after:	3 days
2017-03-27 13:27:39 +00:00
Robert Watson
5e386598a6 Merge OpenBSM 1.2-alpha5 from vendor branch to FreeBSD -CURRENT:
- Add a new "qsize" parameter in audit_control and the getacqsize(3) API to
  query it, allowing to set the kernel's maximum audit queue length.
- Add support to push a mapping between audit event names and event numbers
  into the kernel (where supported) using new A_GETEVENT and A_SETEVENT
  auditon(2) operations.
- Add audit event identifiers for a number of new (and not-so-new) FreeBSD
  system calls including those for asynchronous I/O, thread management, SCTP,
  jails, multi-FIB support, and misc. POSIX interfaces such as
  posix_fallocate(2) and posix_fadvise(2).
- On operating systems supporting Capsicum, auditreduce(1) and praudit(1) now
  run sandboxed.
- Empty "flags" and "naflags" fields are now permitted in audit_control(5).

Many thanks to Christian Brueffer for producing the OpenBSM release and
importing/tagging it in the vendor branch.  This release will allow improved
auditing of a range of new FreeBSD functionality, as well as non-traditional
events (e.g., fine-grained I/O auditing) not required by the Orange Book or
Common Criteria.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, AFRL
MFC after:	3 weeks
2017-03-26 21:14:49 +00:00