Commit Graph

15842 Commits

Author SHA1 Message Date
Baptiste Daroussin
52f92d8c1d Fix regression: ensure when try to create the group and the user with the same
id if possible and nothing in particular was specified
2015-07-11 23:56:55 +00:00
Baptiste Daroussin
9c56d9c5e4 Remove now unused variable 2015-07-11 23:17:13 +00:00
Baptiste Daroussin
10e6a51cf3 Replace custom string array with stringlist(3) 2015-07-11 23:07:17 +00:00
Baptiste Daroussin
5ebd525aab Rework groupmod modification:
Use gr_add(3) when possible to avoid code duplication.
Use a simpler logic to delete members of a group
2015-07-11 22:35:07 +00:00
Baptiste Daroussin
8970fe5251 Remove unused argument from pm_passwd 2015-07-11 21:12:28 +00:00
Baptiste Daroussin
49c195e61e check the gecos format early: at the moment the -c option is parsed 2015-07-11 21:09:50 +00:00
Baptiste Daroussin
81e683d636 Remove useless use of goto 2015-07-11 20:18:34 +00:00
Baptiste Daroussin
04c25b678f Isolate pw lock/unlock into a separate function 2015-07-11 20:10:12 +00:00
Baptiste Daroussin
9dd1a593d2 homedir can only be populate during useradd 2015-07-11 19:14:09 +00:00
Baptiste Daroussin
d14c48479c Make a separate groupdel/userdel from the main function 2015-07-11 19:07:47 +00:00
Baptiste Daroussin
ae73dd9f37 Make separate functions to show users and groups 2015-07-11 18:09:27 +00:00
Baptiste Daroussin
8daa3a67ff Move the quiet flag into the configuration structure 2015-07-11 17:01:08 +00:00
Baptiste Daroussin
f936ccb5f8 Separate usernext/groupnext from the main functions 2015-07-11 16:58:47 +00:00
Baptiste Daroussin
0fc58d1446 Do not try to set password on group if the group is added as a consequence of
of creating a user (regression from r285136)

Reported by:	Fabian Keil <fk@fabiankeil.de>
2015-07-09 14:14:44 +00:00
Hiroki Sato
64bb8a3881 Implement PF_IMMUTABLE flag and apply it to "name" and "jid" in
jail.conf parameters.  This flag disallows redefinition of the parameter.

"name" and/or "jid" are automatically defined in jail.conf by using
the jail names at the front of jail parameter definitions.  However,
one could override them by using a variable with the same name like
$name = "foo".  This confused the parser and could end up with SIGSEGV.

Note that this change also affects a case when all of parameters are
defined in the command line arguments, not in jail.conf.  Specifically,
"jail -c name=j1 name=j2" no longer works.  This should be harmless.

PR:		196574
Reviewed by:	jamie
Differential Revision:	https://reviews.freebsd.org/D3017
2015-07-08 16:37:48 +00:00
Patrick Kelsey
8bdc5a6251 MFV r285191: tcpdump 4.7.4.
Also, the changes made in r272451 and r272653 that were lost in the
merge of 4.6.2 (r276788) have been restored.

PR: 199568
Differential Revision: https://reviews.freebsd.org/D3007
Reviewed by: brooks, hiren
Approved by: jmallett (mentor)
MFC after: 1 month
2015-07-08 16:19:32 +00:00
Patrick Kelsey
fe3ff217dd Replace use of .Po Pc with the preferred .Pq for single line
enclosures in iovctl.conf(5), iovctl(8), pci(9), and
pci_iov_schema(9).

Differential Revision: https://reviews.freebsd.org/D3000
Reviewed by: wblock
Approved by: jmallett (mentor)
2015-07-08 16:16:44 +00:00
Hiroki Sato
882efc9ac2 Fix offset calculation in variable substitution
in jail.conf.  The following did not work correctly:

 A="A_${B}_C_${D}"
 B="BBBBB"
 D="DDDD_${E}_FFFFF"
 E="EEEEE"

PR:		189139
Reviewed by:	jamie
Differential Revision:	https://reviews.freebsd.org/D3018
2015-07-08 00:51:53 +00:00
Baptiste Daroussin
59856c7d26 pw: fail if an invalid entry is found while parsing master.passwd and group
PR:		198554
Reported by:	diaran <fbsd@centraltech.co.uk>
MFC after:	2 days
2015-07-07 21:05:20 +00:00
Gregory Neil Shapiro
ccbcdcd550 Temporarily disable WARNS while addressing a non-issue with the upstream code 2015-07-07 02:30:35 +00:00
Neel Natu
ccfe4c3f74 Always assert DCD and DSR in bhyve's uart emulation.
The /etc/ttys entry for a serial console in FreeBSD/x86 is as follows:
ttyu0   "/usr/libexec/getty 3wire"      vt100   onifconsole secure

The initial terminal type passed to getty(8) is "3wire" which sets the
CLOCAL flag. However reset(1) clears this flag and any programs that try
to open the terminal will hang waiting for DCD to be asserted.

Fix this by always asserting DCD and DSR in the emulated uart.

The following discussion on virtualization@ has more details:
https://lists.freebsd.org/pipermail/freebsd-virtualization/2015-June/003666.html

Reported by: jmg
Discussed with: grehan
2015-07-06 19:33:29 +00:00
Patrick Kelsey
2ccda62ff8 Fix range upper bound for uint32_t and uint64_t, and reformat range
description for uint8_t, uint16_t, uint32_t, and uint64_t.

Differential Revision: https://reviews.freebsd.org/D2988
Reviewed by: rstone, wblock
Approved by: jmallett (mentor)
Sponsored by: Norse Corp, Inc.
2015-07-06 01:48:23 +00:00
Cy Schubert
21e17e1fc8 Update ntp version number. (This is a manual update that was missed.) 2015-07-05 16:48:40 +00:00
Cy Schubert
276da39af9 MFV ntp-4.2.8p3 (r284990).
Approved by:	roberto, delphij
Security:	VuXML: 0d0f3050-1f69-11e5-9ba9-d050996490d0
Security:	http://bugs.ntp.org/show_bug.cgi?id=2853
Security:	https://www.kb.cert.org/vuls/id/668167
Security:	http://support.ntp.org/bin/view/Main/SecurityNotice#June_2015_NTP_Security_Vulnerabi
2015-07-05 15:42:16 +00:00
Baptiste Daroussin
391ad8ceb8 Remove dead code 2015-07-05 10:14:34 +00:00
Baptiste Daroussin
f6eae381a5 Also validate hours via strptime_l(3)
Simplify the code, by only using one parser, ensure the dates (hours and dates)
are valid
2015-07-05 10:11:35 +00:00
Baptiste Daroussin
330e423084 Validate expiration dates
Use strptime_l(3) to validate the dates provided in input
2015-07-05 09:48:03 +00:00
Marcelo Araujo
68c32d3559 Remove duplicate header string.h. 2015-07-04 18:36:02 +00:00
Baptiste Daroussin
1f8d909274 Fix validation of crypted password
Small cleanups
2015-07-04 15:56:59 +00:00
Baptiste Daroussin
9d028e08ce Also validate inputs of pw groupmod -h and groupmod -H 2015-07-04 15:54:11 +00:00
Baptiste Daroussin
11621f9650 Validate input of pw usermod -h and pwusermod -H
Push the code that set the password into a separate function to improve
readability

Add regression tests about pw usermod -h and pw usermod -H
2015-07-04 15:27:04 +00:00
Edward Tomasz Napierala
19c46d8cf7 Staticize some stuff in mountd(8); no functional changes.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-07-04 08:40:48 +00:00
Edward Tomasz Napierala
424a3f57a2 Remove OpenSSL dependency from iscsid(8) and ctld(8).
Differential Revision:	https://reviews.freebsd.org/D2866
Submitted by:	Tony Morlan <tony at scroner.com> (earlier version)
Reviewed by:	bapt@, delphij@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-07-03 10:08:10 +00:00
Edward Tomasz Napierala
23902fd260 User proper terminology - iSCSI sessions, not iSCSI connections.
Sponsored by:	The FreeBSD Foundation
2015-07-03 10:04:41 +00:00
Simon J. Gerraty
96a11afdff Updated depends 2015-07-03 06:11:54 +00:00
Ed Maste
e2a78b0008 mfiutil: increase buffer size to accommodate sprintf string
PR:		201289
MFC after:	1 week
2015-07-03 01:43:11 +00:00
Mariusz Zaborski
c36e54bb32 Let the nv.h and dnv.h includes be only in sys directory.
Change consumers to include those files from sys.
Add duplicated files to ObsoleteFiles.

Approved by:	pjd (mentor)
2015-07-02 21:58:10 +00:00
Renato Botelho
d32a66b2a2 When passwd or group information is changed (by pw, vipw, chpass, ...)
temporary file is created and then a rename() call move it to official file.
This operation didn't have any check to make sure data was written to disk
and if a power cycle happens system could end up with a 0 length passwd
or group database.

There is a pfSense bug with more infor about it:

https://redmine.pfsense.org/issues/4523

The following changes were made to protect passwd and group operations:

* lib/libutil/gr_util.c:
 - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file
 - After rename(), fsync() call on directory for faster result

* lib/libutil/pw_util.c
 - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file

* usr.sbin/pwd_mkdb/pwd_mkdb.c
 - Added O_SYNC flag on dbopen() calls
 - After rename(), fsync() call on directory for faster result

* lib/libutil/pw_util.3
 - pw_lock() returns a file descriptor to master password file on success

Differential Revision:	https://reviews.freebsd.org/D2978
Approved by:	bapt
Sponsored by:	Netgate
2015-07-02 17:30:59 +00:00
Pedro F. Giffuni
3237628999 dconschat(8): Use NULL instead of 0 for the last argument in execl(3)
Found while experimenting with the gcc sentinel attribute.

MFC after:	3 days
2015-06-28 20:32:03 +00:00
Neel Natu
f429b905b8 Fix issues detected by 'mandoc -Tlint bhyveload.8'
Pointed out by:		wblock
Differential Revision:	https://reviews.freebsd.org/D2762
2015-06-27 18:24:23 +00:00
Alexander Motin
0bb4b98984 Plug minor memory leak at r284765.
Reported by:	Coverity
CID:		1308401
MFC after:	3 days
2015-06-26 16:14:00 +00:00
Cy Schubert
b1cf398e01 Add support for additional architectures in ntp.
Differential Revision:	D2720
Reviewed by:	jmg, reoberto, andrew, ian, imp
2015-06-26 03:29:23 +00:00
Alexander Motin
d83595b2a8 Teach ctld about CTL's physical_port and virtual_port fields.
This allows ctld to work with isp(4) virtual ports, specifying them as
isp0/1, isp0/2, etc.  There are still problems on isp(4) layer with
disabling those ports after enabling, but hopefully they can be fixed.

MFC after:	3 days
Sponsored by:	iXsystems, Inc.
2015-06-24 15:13:27 +00:00
Allan Jude
69f172f27d Switch fstyp build to toggle ZFS support on WITHOUT_ZFS rather than WITHOUT_CDDL
PR:		200976
Approved by:	imp
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D2045
2015-06-23 16:34:43 +00:00
Allan Jude
e3ef9bb29e Fix the build for gcc by lowering the WARNS level
Approved by:	sbruno
X-MFC-With:	r284589
2015-06-20 15:03:02 +00:00
John-Mark Gurney
4afea7f994 add SO_REUSEADDR when starting debug port, lets you still bind when
a TIME_WAIT socket is still around...

Reviewed by:	grehan
Review:		https://reviews.freebsd.org/D2875
2015-06-20 07:49:08 +00:00
Devin Teske
e8e8c93935 Interim fix for "Login not found" error.
PR:		bin/196514
MFC after:	3 days
X-MFC-to:	stable/10
2015-06-19 21:32:20 +00:00
Allan Jude
398e498e49 Add the ability to detect ZFS and GELI encrypted file systems to fstyp(8)
Functionality is hidden behind the -u flag to avoid confusing automounters

PR:		200823
Reviewed by:	asomers, eadler, wblock (man page)
Approved by:	trasz
MFC after:	10 days
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D2045
2015-06-19 05:09:02 +00:00
Edward Tomasz Napierala
628b712826 Fix off-by-one error in fstyp(8) and geom_label(4) that made them use
a single space (" ") as a CD9660 label name when no label was present.
Similar problem was also present in msdosfs label recognition.

PR:		200828
Differential Revision:	https://reviews.freebsd.org/D2830
Reviewed by:	asomers@, emaste@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-06-18 21:55:55 +00:00
Edward Tomasz Napierala
a66d51f3bf Allow '@' in unquoted strings, such as with the "path" statement. Note
that one can use any character they like by using double quotes.

PR:		200895
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-06-18 10:17:47 +00:00
Neel Natu
9b1aa8d622 Restructure memory allocation in bhyve to support "devmem".
devmem is used to represent MMIO devices like the boot ROM or a VESA framebuffer
where doing a trap-and-emulate for every access is impractical. devmem is a
hybrid of system memory (sysmem) and emulated device models.

devmem is mapped in the guest address space via nested page tables similar
to sysmem. However the address range where devmem is mapped may be changed
by the guest at runtime (e.g. by reprogramming a PCI BAR). Also devmem is
usually mapped RO or RW as compared to RWX mappings for sysmem.

Each devmem segment is named (e.g. "bootrom") and this name is used to
create a device node for the devmem segment (e.g. /dev/vmm/testvm.bootrom).
The device node supports mmap(2) and this decouples the host mapping of
devmem from its mapping in the guest address space (which can change).

Reviewed by:	tychon
Discussed with:	grehan
Differential Revision:	https://reviews.freebsd.org/D2762
MFC after:	4 weeks
2015-06-18 06:00:17 +00:00
Simon J. Gerraty
2ef6d5a7b9 new depends 2015-06-16 23:37:19 +00:00
Rui Paulo
baa557331e syslogd: re-read the timezone when receive a SIGHUP.
syslogd already re-reads the configuration file and the hostname when
receiving a SIGHUP, so it makes sense to reset the timezone.
Special care was taken to ensure we don't break installations running
with a custom TZ variable.

PR:		196905
Submitted by:	Kurt Lidl <lidl pix.net>
Sponsored by:	Pi-Coral, Inc.
2015-06-16 22:42:19 +00:00
Rui Paulo
e87161769c syslogd: don't leak finet0.
Submitted by:	Kurt Lidl <lidl pix.net>
Sponsored by:	Pi-Coral, Inc.
2015-06-16 22:31:38 +00:00
Rui Paulo
38076b4ba5 syslogd: support multiple -b options.
It's now possible to bind multiple sockets to different IP addresses.

PR:		159305
Submitted by:	Kurt Lidl <lidl pix.net>
Sponsored by:	Pi-Coral, Inc.
2015-06-16 22:26:22 +00:00
Xin LI
5a74378c7b Skip src component if /usr/src is empty.
Differential Revision:	https://reviews.freebsd.org/D2364
Submitted by:		kczekirda
Reviewed by:		cperciva, delphij, nwhitehorn, allanjude
MFC after:		2 weeks
2015-06-15 20:12:15 +00:00
Tijl Coosemans
19e58304b3 Change -Wl,-r back to -r so gcc doesn't pass --relax to the linker on some
architectures.

PR:		200881
2015-06-15 19:48:28 +00:00
Baptiste Daroussin
4369c82dc6 Change the documentation to reflect where the -V option should be used
Suggested by:	kientzle
2015-06-14 21:50:38 +00:00
Tijl Coosemans
7a51826c2a Tell the compiler that -dc and -r are linker flags.
Reviewed by:	adrian
2015-06-14 15:40:17 +00:00
Adrian Chadd
8d769a021c Fix typo - this upsets llvm/gcc-4.9, but not gcc-4.2 for some reason. 2015-06-14 00:31:22 +00:00
Adrian Chadd
c1e0b4d15b Fix up crunchgen binary generation to work with external cross-build
tools.

* Allow STRIP to be overridden by the environment
* Use CC to tie things together, not LD

Tested:

* i386, mips32

Submitted by:	kan
2015-06-13 22:01:21 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
122b6b61c7 Get rid of some more NO_OBJs
Differential Revision:       D2748
2015-06-12 14:30:27 +00:00
Simon J. Gerraty
5b381db8cc Remove NO_OBJ
For meta mode we will want objdirs.

Differential Revision:	D2748
Reviewed by:	brooks imp
2015-06-11 04:22:17 +00:00
Simon J. Gerraty
b589e6297b Remove extra blank lines 2015-06-10 14:08:36 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Baptiste Daroussin
3bfc59e83b backout remove of -q option for pw [user|group] next
While the return code is broken, some corner case usage depends on the
functionnality, so backout until we get better regression tests covering those
corner case usage.
2015-06-08 05:27:34 +00:00
Baptiste Daroussin
6328a4be57 Fix typo 2015-06-08 05:06:17 +00:00
Baptiste Daroussin
a57d4bf3a1 Fix mistakes than came along with r284139 2015-06-07 21:59:43 +00:00
Baptiste Daroussin
0958dffde2 Remove '-q' support for pw [user|group] next
the intent of -q in this command is to return as exit status the value of the
next group/user id, which does not make sense given exit status are limited to
values between 0 and 255.
2015-06-07 21:57:20 +00:00
Baptiste Daroussin
1718a38ffd Fix setting uid/gid min/max via pw 2015-06-07 20:59:59 +00:00
Baptiste Daroussin
a68fbadb63 Fix generating configuration file 2015-06-07 20:44:06 +00:00
Baptiste Daroussin
91860967e2 Fix duplicate checking 2015-06-07 19:59:01 +00:00
Baptiste Daroussin
c40bbdb4af Remove uneeded code (already done by pw_make_v7) 2015-06-07 19:39:06 +00:00
Baptiste Daroussin
bae068d22e In case of rename validate the length of the new name
Check early that the new name fits MAXLOGNAME and store it in pwconf
2015-06-07 19:33:25 +00:00
Baptiste Daroussin
a923718979 Refactor input validation
Mutualize code to validate inputs of both 'user' and 'group' command
Test that the input name fits into MAXLOGNAME
2015-06-07 19:03:41 +00:00
Baptiste Daroussin
3438d7decf Finish converting -7 to pwconf 2015-06-07 15:54:57 +00:00
Baptiste Daroussin
c86f7ad56d Handle -7 via gloval pwconf 2015-06-07 15:33:08 +00:00
Baptiste Daroussin
bbe09b2e19 Initialize conf using menset(3) 2015-06-07 15:29:58 +00:00
Baptiste Daroussin
2166b4d190 Handle pretty print (-P) via global pwconf 2015-06-07 15:27:17 +00:00
Baptiste Daroussin
363cefdbb1 Handle dryrun (-N) via global pwconf 2015-06-07 15:09:53 +00:00
Baptiste Daroussin
be7f5ba991 Sort headers 2015-06-07 14:57:16 +00:00
Baptiste Daroussin
82a3c75aa8 Handle -C and -Y locally and stop adding them to arglist 2015-06-07 14:54:07 +00:00
Baptiste Daroussin
2cc63cd136 Add a new global struct pwconf to store etcpath, rootdir and struct userconf
Do not add anymore -R and -V to arglist
Add an error message if both -V and -R are set in arguments
2015-06-07 14:34:38 +00:00
Baptiste Daroussin
fe084e12a5 Fix pw userdel -r not deleting homedir 2015-06-07 14:32:52 +00:00
Baptiste Daroussin
a68be5f7eb Test explicitly the result of strcmp to be consistent with the rest of the code 2015-06-07 11:38:26 +00:00
Baptiste Daroussin
fc606d2b2c Improve readability by reducing indentations levels 2015-06-07 11:35:34 +00:00
Baptiste Daroussin
75a030d4f8 Remove one level of indentation 2015-06-07 11:30:33 +00:00
Baptiste Daroussin
581a66ea58 Move user deletion code into a separate function to improve readability 2015-06-07 11:26:28 +00:00
Baptiste Daroussin
1238a919d2 Instead of always casting the pw_checkname input to u_char * and casting it back
to char *, change pw_checkname to directly take char * in input
2015-06-07 10:57:02 +00:00
Xin LI
ac57983523 Whitespace changes for r283981. No actual code changes. 2015-06-04 07:25:40 +00:00
Xin LI
3e08b16eca In r113596, version 4 of entries have been added but pwd_mkdb have
been generating both new (machine independent) and legacy version
entries (endianness sensitive).

The base system have been using the new format for quite some time,
so disable the generation by default.

An interim option, -l, have been added to re-enable old behavior.
The -l, -B and -L options are considered deprecated and will be
removed in FreeBSD 12.0 release.
2015-06-04 07:24:56 +00:00
Glen Barber
a5b912ff43 Document pw(8) '-R' option, added in r283961.
MFC after:	1 week
X-MFC-after:	r283961
Sponsored by:	The FreeBSD Foundation
2015-06-03 19:17:45 +00:00
Baptiste Daroussin
ac72be285f New pw -R rootdir option
This allows to set an alternate root directory in which the users/groups will be
manipulated

Requested by:	gjb, ian
Tested by:	gjb
2015-06-03 19:08:25 +00:00
Alexander Motin
f249b52d9a Fix bug in r278331: unlike some other options MaxRecvDataSegmentLength
is not negotiated as minimum, but only reported by sides to each other.

MFC after:	1 week
2015-06-02 01:47:12 +00:00
Baptiste Daroussin
6138e089bc Cast to gid_t for groups not uid_t 2015-05-31 22:12:31 +00:00
Baptiste Daroussin
68cea7d570 Remove useless cast in printf and printf-like functions:
use %u for uid_t and gid_t
2015-05-31 22:07:03 +00:00
Baptiste Daroussin
ee2582c212 Cast -1 to uid_t and bump WARNING level to 3 2015-05-31 21:44:09 +00:00
Craig Rodrigues
35ee6bbaef Fix some gcc compiler warnings.
Submitted by:   Sascha Wildner <swildner@dragonflybsd.org>
Obtained from:  DragonFlyBSD (commit 51798e10f3dd)
2015-05-31 20:45:35 +00:00
Craig Rodrigues
4a2ec8401f yppoll(8): Comment out -h option.
The implementation of it is missing (see e.g. NetBSD or OpenBSD). Until
someone works on it, comment out the existing code to silence a warning
about 'hostname' being set but unused.

Found-by: gcc47

Submitted by:	Sascha Wildner <swildner@dragonflybsd.org>
Obtained from:	DragonFlyBSD (commit e455855db)
2015-05-31 20:20:24 +00:00
Baptiste Daroussin
7fc593dd82 Move cleanup functions to the right place 2015-05-31 12:04:06 +00:00
Baptiste Daroussin
2e6d97a407 Remove useless test before free() 2015-05-31 11:56:59 +00:00
Baptiste Daroussin
c69b42d00b Return early in case we cannot read the configuration file
This drops one level of indentation
2015-05-31 11:55:28 +00:00
Baptiste Daroussin
5710dc534c Make pw_user()/pw_group() more consitent about errors
Some of errors were returned to the main function, some others caused a direct
exit via err(3).

The main function is only interested in EXIT_SUCCESS, so in all other cases
replace warn(3) + return err by err(3)
2015-05-31 11:23:19 +00:00
Baptiste Daroussin
850f836ad8 Remove uneeded intermediate variable 2015-05-31 10:18:10 +00:00
Baptiste Daroussin
e55af20b47 Remove uneeded intermediate variable 2015-05-31 10:14:13 +00:00
Baptiste Daroussin
197419154e Use asprintf instead of malloc + snprintf and test the memory allocation 2015-05-31 10:02:01 +00:00
Baptiste Daroussin
6b6b47d0e3 Remove dead declaration
PR:		195928
MFC after:	2 days
2015-05-29 10:07:20 +00:00
Neel Natu
248e6799e9 Fix non-deterministic delays when accessing a vcpu that was in "running" or
"sleeping" state. This is done by forcing the vcpu to transition to "idle"
by returning to userspace with an exit code of VM_EXITCODE_REQIDLE.

MFC after:      2 weeks
2015-05-28 17:37:01 +00:00
John Baldwin
ef16b9abd4 Use the cpuset API more consistently:
- Fetch the root set from cpuset_getaffinity() instead of assuming all CPUs
  from 0 to hw.ncpu are the root set.
- Use CPU_SETSIZE and CPU_FFS.
- The original notion of halted CPUs the manpage and code refers to is gone.
  Use the term "available" instead.

Differential Revision:	https://reviews.freebsd.org/D2491
Reviewed by:	emaste
MFC after:	1 week
2015-05-27 13:54:37 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Baptiste Daroussin
ef0cb5db0a Fix overlinking again after recent ntp updates
Fix building WITHOUT_OPENSSL
2015-05-25 20:27:46 +00:00
Allan Jude
dce663816a Fix a syntax error in bsdinstall/zfsboot
Differential Revision:	https://reviews.freebsd.org/D2571
Submitted by:	Michael Dexter
Approved by:	dteske
MFC after:	1 week
X-MFC-With:	r283023, r282443
Sponsored by:	ScaleEngine Inc.
2015-05-22 15:57:42 +00:00
Edward Tomasz Napierala
b853c718a9 Advertise ctlstat(8) a little better.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-05-22 11:59:37 +00:00
Tycho Nightingale
a0df62cd97 The 'hostbridge' device exists to allow guests to infer msi/msix
capablity by advertising pcie capability.

Since the 'hostbridge' device isn't a true pci-to-pci bridge, and
doesn't actaully use the bridge configuration space layout, change
the header-type from type 1 to type 0 to avoid confusion.

Reviewed by:	neel
2015-05-21 20:11:52 +00:00
Neel Natu
4b083d80bf Add an option "--get-vmcs-exit-inst-length" to display the instruction length
of the instruction that caused the VM-exit.

MFC after:	1 week
2015-05-21 18:29:11 +00:00
Warner Losh
4d57a59a83 Remove stray DEBUG_FLAGS=-g that snuck in with r137868 2015-05-21 14:36:15 +00:00
Peter Grehan
fd19881492 Temporarily revert r282922 which bumped the max descriptors.
While there is no issued with the number of descriptors in
a virtio indirect descriptor, it's a guest's choice as to
whether indirect descriptors are used. For the case where
they aren't, the virtio block ring size is still 64 which
is less than the now reported max_segs of 67. This results
in an assertion in recent Linux guests even though it was
benign since they were using indirect descs.

The intertwined relationship between virtio ring size,
max seg size and blockif queue size will be addressed
in an upcoming commit, at which point the max descriptors
will again be bumped up to 67.
2015-05-21 04:19:22 +00:00
Edward Tomasz Napierala
8dca98d787 Remove the warning about invalid PE checksum; apparently nothing
cares about those checksums anyway.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-05-20 09:40:34 +00:00
Jung-uk Kim
a371a5fd85 Merge ACPICA 20150515. 2015-05-18 23:46:11 +00:00
Allan Jude
0db293c171 Fix off-by-one in array index bounds check
bhyveload would allow you to create 33 entries on an array that only has 32 slots

Differential Revision:	https://reviews.freebsd.org/D2569
Reviewed by:	araujo
Approved by:	neel
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
2015-05-18 19:45:46 +00:00
Allan Jude
caa3817d4f bsdinstall/zfsboot: Skip adding swap lines to /etc/fstab if swap is 0 sized
Differential Revision:	https://reviews.freebsd.org/D2571
Reviewed by:	dim
Approved by:	eadler (mentor)
Sponsored by:	ScaleEngine Inc.
2015-05-17 00:55:44 +00:00
Rick Macklem
9896584a4b Add a warning message to mountd for exported file
systems that are automounted, since that configuration
isn't supported. This still allows the export, since
two emails I received felt that this should not be
disabled. It sends the message to syslog(LOG_ERR..), so that
it goes to the same places as the other messages related
to /etc/exports problems, even though it is a warning and not an error.

Reviewed by:	trasz
MFC after:	2 weeks
2015-05-16 12:05:26 +00:00
Xin LI
e8a94f7104 path.h is not needed here. 2015-05-16 08:12:00 +00:00
Peter Grehan
253396a378 Bump the size of the blockif scatter-gather list to 67.
The Windows virtio driver ignores the advertized seg_max
field and assumes the host can accept up to 67 segments
in indirect descriptors, triggering an assert in the bhyve
process.

No objection from:	mav
Reviewed by:	neel
Reported and tested by:	Leon Dang (ldang@nahannisys.com)
MFC after:	2 weeks
2015-05-14 21:08:48 +00:00
Ed Maste
92ee8e8fd6 kbdmap(1): increase description size to 256 bytes
After conversion to UTF-8 some INDEX.keymaps descriptions are longer
than the previous limit of 64 bytes.

PR:		193656
Sponsored by:	The FreeBSD Foundation
2015-05-14 14:20:50 +00:00
Stanislav Sedov
c21fd5b663 Fix pmcstat symbol resolution for userland processes.
When examining existing processes pmcstat fails to
correctly determine the locations of executable sections
of the process due to a miscalculated virtual load address.
This does not affect the newly launched processes as the
same value passed as a "start address" to the pmcstat_image_link()
thus nullifying the effect of it.  The issue manifests itself
in processes not being reported in the pmcstat(8) output and
"dubious frames" being reported.

Fix it for now by ignoring all the sections except the executable
one.  This won't fix the issue for objects with multiple
executable sections but helps in majority of real world usecases.
The real solution would be to modify the MAP-IN event to include
the appropriate load address so pmcstat(8) won't have to manually
parse object files to try to determine it.

PR:		198147, 198148
Reviewed by:	jhb, rpaulo
MFC after:	2 weeks
2015-05-13 18:52:18 +00:00
Peter Grehan
604b521003 Set the subvendor field in config space to the vendor ID.
This is required by the Windows virtio drivers to correctly
match a device.

Submitted by:	Leon Dang (ldang@nahannisys.com)
MFC after:	2 weeks
2015-05-13 17:38:07 +00:00
Ed Maste
9e29d20823 crunchide: remove EOL whitespace 2015-05-12 20:04:17 +00:00
Neel Natu
4e43c1e8b5 Allow configuration of the sector size advertised to the guest.
The default behavior is to infer the logical and physical sector sizes from
the block device backend. However older versions of Windows only work with
specific logical/physical combinations:
- Vista and Windows 7:	512/512
- Windows 7 SP1:	512/512 or 512/4096

For this reason allow the sector size to be specified using the following
block device option: sectorsize=logical[/physical]

Reported by:	Leon Dang (ldang@nahannisys.com)
Reviewed by:	grehan
MFC after:	2 weeks
2015-05-12 00:30:39 +00:00
Peter Grehan
be80efd491 Handling indirect descriptors is a capability of the host and
not one that needs to be negotiated. Use the host capabilities
field and not the negotiated field when verifying that indirect
descriptors are supported.

Found with the Redhat Windows viostor driver, which clears
the indirect capability in the negotiated caps and then starts
using them.

Reported and tested by: Leon Dang (ldang@nahannisys.com)
MFC after:   2 weeks
2015-05-11 21:24:10 +00:00
Baptiste Daroussin
234626f722 Remove extendline definition
Remove now unused PWBUFSZ define
2015-05-10 11:24:16 +00:00
Baptiste Daroussin
a1d3bf2e8f Use calloc(3) instead of malloc(3) + memset(3)
While here check the return of calloc(3)
2015-05-10 11:18:01 +00:00
Baptiste Daroussin
36dc2e6885 The initial logic for allocating the new string was wrong, the conversion
to strndup(3) duplicated the same mistake, actually strdup(3) is good enough
to allocate the new string.
2015-05-10 10:15:36 +00:00
Baptiste Daroussin
a84caa72b0 Use strndup(3) instead of malloc(3) + memcpy(3)
Check the return of strndup
2015-05-10 10:02:09 +00:00
Baptiste Daroussin
2c3065da9c Remove useless call to extendarray 2015-05-10 09:33:15 +00:00
Baptiste Daroussin
35ddfb6d6c The pwdb function is only used once to check the database rename it
pwdb_check and simplify it accordingly
2015-05-10 09:23:03 +00:00
Baptiste Daroussin
b1a215787d if the check of the pw db fails return the failed value 2015-05-10 09:11:12 +00:00
Baptiste Daroussin
ee348c32ad Some style(9) fixes 2015-05-10 09:02:15 +00:00
Baptiste Daroussin
2518db8bb0 Replace sprintf(3) with snprintf(3) 2015-05-09 22:48:48 +00:00
Baptiste Daroussin
5d8ece9a4b Use snprintf(3) instead of sprintf(3)
Remove useless "else"
2015-05-09 22:43:44 +00:00
Baptiste Daroussin
8592cfc58e Remove now unused LNBUFSZ buffer size 2015-05-09 22:08:30 +00:00
Baptiste Daroussin
5963cf64b5 Return from the function as early as possible
This reduces the depth of the if statements and improves clarity of the code
2015-05-09 21:53:33 +00:00
Baptiste Daroussin
4bc8ff0802 Remove some uneeded headers 2015-05-09 19:29:55 +00:00
Baptiste Daroussin
ce82bf7261 Remove unneeded headers 2015-05-09 19:22:33 +00:00
Baptiste Daroussin
b2298745ac Replace malloc(3) + strcpy(3) + strcat(3) by asprintf(3) 2015-05-09 19:12:16 +00:00
Baptiste Daroussin
0602630cc7 Use snprintf(3) instead of strcpy(3) + strncat(3) 2015-05-09 19:09:34 +00:00
Baptiste Daroussin
a8e37ee0ac Use sbuf(9) instead of homebrewed buffered string 2015-05-09 19:00:16 +00:00
Stanislav Sedov
dc599a6bd9 Fix the double space in comment.
While here, change the comment style to match the rest of the file.
2015-05-09 00:48:44 +00:00
John Baldwin
38fd38349a Use the kern.bootfile sysctl to set the default kernel path rather than
hardcoding /boot/kernel. This allows pmcstat(8) to work without -k when
using nextboot -k or 'boot foo' at the loader to boot alternate kernels.

Differential Revision:	https://reviews.freebsd.org/D2425
Reviewed by:	adrian, emaste, gnn
MFC after:	2 weeks
Sponsored by:	Norse Corp, Inc.
2015-05-08 16:02:31 +00:00
Neel Natu
1cba333329 Allow byte reads of AHCI registers.
This is needed to support Windows guests that use byte reads to access certain
AHCI registers (e.g. PxTFD.Status and PxTFD.Error).

Reviewed by:	grehan, mav
Reported by:	Leon Dang (ldang@nahannisys.com)
Differential Revision:	https://reviews.freebsd.org/D2469
MFC after:	2 weeks
2015-05-07 18:35:15 +00:00
Alexander Motin
79f1cdb4fb Add memory barrier to r281764.
While race at this point may cause only a single packet delay and so was
not really reproduced, it is better to not have it at all.

MFC after:	1 week
2015-05-06 18:04:31 +00:00
Neel Natu
9c4d547896 Deprecate the 3-way return values from vm_gla2gpa() and vm_copy_setup().
Prior to this change both functions returned 0 for success, -1 for failure
and +1 to indicate that an exception was injected into the guest.

The numerical value of ERESTART also happens to be -1 so when these functions
returned -1 it had to be translated to a positive errno value to prevent the
VM_RUN ioctl from being inadvertently restarted. This made it easy to introduce
bugs when writing emulation code.

Fix this by adding an 'int *guest_fault' parameter and setting it to '1' if
an exception was delivered to the guest. The return value is 0 or EFAULT so
no additional translation is needed.

Reviewed by:	tychon
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D2428
2015-05-06 16:25:20 +00:00
Alexander Motin
5b3ee130e3 Reimplement queue freeze on error, added in r282429:
It is not required to use CLO to recover from task file error, it should
be enough to do only stop/start, that does not clear the PxTFD.STS.ERR.

MFC after:	13 days
2015-05-06 09:59:19 +00:00
Allan Jude
169ff110e8 Add a sanity check to the swap size in zfsboot of bsdinstall
Loop until the user enters a valid size (>100mb or 0)

Differential Revision:	https://reviews.freebsd.org/D2299
Reported By:	Shawn Webb
Reviewed by:	roberto
Approved by:	brd
MFC after:	2 weeks
Sponsored by:	ScaleEngine Inc.
2015-05-05 03:08:49 +00:00
Alexander Motin
b208a147b9 Implement in-order execution of non-NCQ commands.
Using status updates in r282364, block queue on BSY, DRQ or ERR bits set.
This can be a performance penalization for non-NCQ commands, but it is
required for proper error recovery and standard compliance.

MFC after:	2 weeks
2015-05-04 19:55:01 +00:00
Cy Schubert
36428b7e17 Restore CPU dependent compile time conditionals.
MFC after:	1 month (with r281143 and r282408)
2015-05-04 12:42:52 +00:00
Cy Schubert
a25439b686 MFV ntp 4.2.8p2 (r281348)
Reviewed by:    delphij (suggested MFC)
Approved by:	roberto
Security:       CVE-2015-1798, CVE-2015-1799
Security:       VuXML ebd84c96-dd7e-11e4-854e-3c970e169bc2
MFC after:	1 month
2015-05-04 04:45:59 +00:00
Alexander Motin
9dba9460d9 Implement basic PxTFD.STS.BSY reporting.
MFC after:	2 weeks
2015-05-03 07:43:58 +00:00
Gleb Smirnoff
0fa5aacd8b Remove #ifdef IFT_FOO.
Submitted by:	Guy Yur <guyyur gmail.com>
2015-05-02 20:31:27 +00:00
Mariusz Zaborski
bd1da0a002 Approved, oprócz użycie RESTORE_ERRNO() do ustawiania errno.
Change the nvlist_recv() function to take additional argument that
specifies flags expected on the received nvlist. Receiving a nvlist with
different set of flags than the ones we expect might lead to undefined
behaviour, which might be potentially dangerous.

Update consumers of this and related functions and update the tests.

Approved by:	pjd (mentor)

Update man page for nvlist_unpack, nvlist_recv, nvlist_xfer, cap_recv_nvlist
and cap_xfer_nvlist.

Reviewed by:	AllanJude
Approved by:	pjd (mentor)
2015-05-02 17:45:52 +00:00
Alexander Motin
1025d8e679 Initialize PxCMD on reset and make its read-only bits such.
MFC after:	2 weeks
2015-05-02 16:11:29 +00:00
Alexander Motin
52f224dfbf Handle ATA_SEND_FPDMA_QUEUED as NCQ in ahci_port_stop().
MFC after:	1 week
2015-05-02 14:43:37 +00:00
Neel Natu
fd4e0d4c52 Advertise an additional memory BAR in the "dummy" device emulation.
This is useful for testing the MOVS emulation when both the source and
destination addresses are in the MMIO space.

MFC after:	1 week
2015-05-02 03:25:24 +00:00
Ed Maste
66137b66a4 crunchide: Restore local EM_AARCH64 constant for bootstrapping
Most of the EM_* constants are available in all supported host branches,
but EM_AARCH64 was added relatively recently. Add it back to fix
building HEAD on 10.x.

Noticed by:	adrian, jmallett
2015-04-30 23:48:05 +00:00
Edward Tomasz Napierala
ae3e3df45c Remove oldnfs remnants from nfsd(8).
Reviewed by:	rmacklem@
Sponsored by:	The FreeBSD Foundation
2015-04-30 12:55:27 +00:00
Edward Tomasz Napierala
79b8680737 Remove oldnfs leftovers from mountd(8).
Reviewed by:	rmacklem@
Sponsored by:	The FreeBSD Foundation
2015-04-29 12:33:00 +00:00
Steven Hartland
ad34cace15 Standardise chmod, chflags, chown and chgrp recursive symlink processing
chmod, chflags, chgrp, chmod and chown now affect symlinks in -R mode as
defined in symlink(7); previously symlinks were silently ignored.

Differential Revision:	https://reviews.freebsd.org/D2316
Reviewed by:	jilles
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Multiplay
2015-04-29 00:49:00 +00:00
Neel Natu
f39630c2d6 Implement the century byte in the RTC. Some guests require this field to be
properly set.

Reported by:	Leon Dang (ldang@nahannisys.com)
MFC after:	2 weeks
2015-04-28 23:44:47 +00:00
Ed Maste
e52f97153a crunchide: add basic string table sanity checks
Reported by:	Coverity Scan
CID:		978805, 980919
Sponsored by:	The FreeBSD Foundation
2015-04-28 13:04:51 +00:00
Jason Helfman
b09403abf8 - remove -l option from ntpdate manpage, as it is no longer an option
Differential Revision:	https://reviews.freebsd.org/D2358
Submitted by:	gnn@
Approved by:	wblock (mentor)
MFC after:	after 1 week
2015-04-27 15:22:57 +00:00
Edward Tomasz Napierala
aa32b5e076 Make setproctitle(3) work in Capsicum capability mode. This makes
ctld(8) child processes to indicate initiator address and name in
their titles, similar to what iscsid(8) child processes do.

PR:		181352
Differential Revision:	https://reviews.freebsd.org/D2363
Reviewed by:	rwatson@, mjg@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-04-27 11:18:16 +00:00
Enji Cooper
d7f46fbd10 ath3kfw, bcmfw, bthidcontrol, bthidd all require usb(4); build them
conditionally if MK_USB != no

MFC after: 1 week
2015-04-27 06:34:51 +00:00
Michael Gmelin
202379af84 Expand SMBUS API to add smbus_trans() function.
Differential Revision:	https://reviews.freebsd.org/D1955
Reviewed by:	adrian, jhb, wblock
Approved by:	adrian, jhb
2015-04-25 16:15:01 +00:00
Neel Natu
54335630a7 Don't allow guest to modify readonly bits in the PCI config 'status' register.
Reported by:	Leon Dang (ldang@nahannisys.com)
MFC after:	2 weeks
2015-04-24 19:15:38 +00:00
Joel Dahl
952364486a Fix minor mdoc issues. 2015-04-24 14:36:06 +00:00
John Baldwin
179fa75e6e Reassign copyright statements on several files from Advanced
Computing Technologies LLC to Hudson River Trading LLC.

Approved by:	Hudson River Trading LLC (who owns ACT LLC)
MFC after:	1 week
2015-04-23 14:22:20 +00:00
Edward Tomasz Napierala
6775608bea Add hint about "volmode=dev" to ctl.conf(5).
Differential Revision:	https://reviews.freebsd.org/D2328
Reviewed by:	allanjude@, bcr@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-04-21 09:11:28 +00:00
Rui Paulo
cd4308d21f Fix wpa/hostapd build without OpenSSL. 2015-04-21 02:00:37 +00:00
Rui Paulo
5b9c547c07 Merge wpa_supplicant/hostapd 2.4.
Major changes are: SAE, Suite B, RFC 7268, EAP-PKE, ACS, and tons of
bug fixes.

Relnotes:	yes
2015-04-21 01:45:11 +00:00
Alexander Motin
fdd86701e5 Don't set bits that should be zero for SATA devices.
Old value made Linux think that it is PATA device with SATA bridge.

MFC after:	2 weeks
2015-04-20 19:11:27 +00:00
Ed Maste
a8da2875c6 crunchide: Remove local EM_* ELF definitions provided by system ELF headers
Suggested by:	imp (in review D2314)
2015-04-20 18:30:06 +00:00
Devin Teske
ea15d5bb0a Update usage statement to align with post-r279624 functionality.
MFC after:	3 days
X-MFC-to:	stable/10 stable/9
2015-04-20 17:46:09 +00:00
Ed Maste
16028f6a5a vidcontrol: skip invalid video modes returned by vt(4)
vt(4) has a stub CONS_MODEINFO ioctl that does not provide any data
but returns success. This needs to be fixed in the kernel, but address
it in vidcontrol(1) as well in case it's run on an older kernel.

Reviewed by:	bde
Sponsored by:	The FreeBSD Foundation
2015-04-20 17:43:55 +00:00
Alexander Motin
910280e539 Report link as up if tap device is not specified (black hole).
MFC after:	2 weeks
2015-04-20 14:55:01 +00:00
Alexander Motin
f2c58daab8 Report link as up only if we managed to open tap device.
It would be cool to report tap device status, but it has no such API.

MFC after:	2 weeks
2015-04-20 14:23:18 +00:00
Alexander Motin
d9a6698393 Disable RX/TX queues notifications when not needed.
This reduces CPU load and doubles iperf throughput, reaching 2-3Gbit/s.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2015-04-20 10:29:42 +00:00
Eitan Adler
d5792866b0 identd: restore memcpy
I should not be committing at 2:30am....

Reported by:	pluknet
2015-04-19 09:35:46 +00:00
Eitan Adler
7ebd5ed4d4 identd: also zero se_rpc_highvers
Reported by:	pluknet
2015-04-19 09:27:47 +00:00
Eitan Adler
af5f5a398f identd: remove redundant zeroing
se_rpc_lowvers was set to 0 twice, so remove one of them
	I can not find any other variable which they may have been a typo of.

Reported by:	gcc5.1
2015-04-19 09:07:57 +00:00
Eitan Adler
b1abc63706 tzsetup: remove set but unused variable
- leave a comment explaining which variable it used to be

Reported by:	gcc5.1
2015-04-19 08:45:37 +00:00
Eitan Adler
68c45bf852 config: remove set but unchecked variable
reported by: gcc5.1
2015-04-19 08:30:13 +00:00
Alexander Motin
bb1524af0c Workaround bhyve virtual disks operation on top of GEOM providers.
GEOM does not support scatter/gather lists in its I/Os.  Such requests
are cut in pieces by physio(), that may be problematic, if those pieces
are not multiple of provider's sector size.  If such case is detected,
move the data through temporary sequential buffer.

MFC after:	2 weeks
2015-04-18 20:10:19 +00:00
Simon J. Gerraty
2ef26470c5 No need to delete export from filesystems which are not exported. 2015-04-18 19:52:39 +00:00
Takanori Watanabe
4cae2db2a8 To ensure j formatting string valid, cast uint64_t values to uintmax_t. 2015-04-18 17:41:09 +00:00
Edward Tomasz Napierala
4e25c86f4c Remove some oldnfs remnants.
Differential Revision:	https://reviews.freebsd.org/D2287
Reviewed by:	rmacklem@
Sponsored by:	The FreeBSD Foundation
2015-04-18 16:08:06 +00:00
Takanori Watanabe
4315b1cb29 Change printf formatting to unbroke i386 arch.
Submitted by:david@catwhisker.org
2015-04-18 16:04:32 +00:00
Takanori Watanabe
bf9b5107ef Fix Typo. 2015-04-18 09:08:47 +00:00
Marcelo Araujo
af5c4f8b4b Fix misspelling. 2015-04-18 06:53:13 +00:00
Marcelo Araujo
9c3471fa12 Improve code style(9), no functional changes.
Differential Revision:	D2320
Reviewed by:		takawata
2015-04-18 06:48:03 +00:00