Commit Graph

214919 Commits

Author SHA1 Message Date
Konstantin Belousov
295af703a0 Add an implementation of fdatasync(2).
The syscall is a trivial wrapper around new VOP_FDATASYNC(), sharing
code with fsync(2).  For all filesystems, this commit provides the
implementation which delegates the work of VOP_FDATASYNC() to
VOP_FSYNC().  This is functionally correct but not efficient.

This is not yet POSIX-compliant implementation, because it does not
ensure that queued AIO requests are completed before returning.

Reviewed by:	mckusick
Discussed with:	avg (ZFS), jhb (AIO part)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D7471
2016-08-15 19:08:51 +00:00
Ed Schouten
576a9e496f Disable tests for non-standard behaviour of dirname(3)/basename(3).
The NetBSD ATF tests explicitly check that these functions do not modify
their input. These tests are NetBSD-specific. They test for something
that is not part of POSIX.

PR:		211873
Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D7506
2016-08-15 19:05:41 +00:00
Konstantin Belousov
c73fb33115 VOP_FSYNC() does not take cred as an argument. Correct comment.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-15 18:55:33 +00:00
Bruce Evans
430320729d Fix restoring the kbd_mode part of the keyboard state in grab/ungrab.
Simply change the mode to K_XLATE using a local variable and use the
grab level as a flag to tell screen switches not to change it again,
so that we don't need to switch scp->kbd_mode.  We did the latter,
but didn't have the complications to update the keyboard mode switch
for every screen switch.  sc->kbd_mode remains at its user setting
for all scp's and ungrabbing restores to it.
2016-08-15 18:02:37 +00:00
John Baldwin
8b2246b349 Add support for register dumps on VF devices.
- Add handling of VF register sets to t4_get_regs_len() and t4_get_regs().
- While here, use t4_get_regs_len() in the ioctl handler for regdump
  instead of inlining it.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7484
2016-08-15 17:42:54 +00:00
John Baldwin
e5e9897c5f Update mailbox writes to work with VF devices.
- Use alternate register locations for the data and control registers for
  VFs.
- Do a dummy read to force the writes to the  mailbox data registers to
  post before the write to the control register on VFs.
- Do not check the PCI-e firmware register for errors on VFs.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7483
2016-08-15 17:41:34 +00:00
John Baldwin
59c1e950b9 Make SGE parameter handling more VF-friendly.
Add fields to hold the SGE control register and free list buffer sizes to
the sge_params structure.  Populate these new fields in
t4_init_sge_params() for PF devices and change t4_read_chip_settings() to
pull these values out of the params structure instead of reading
registers directly.  This will permit t4_read_chip_settings() to be reused
for VF devices which cannot read SGE registers directly.

While here, move the call to t4_init_sge_params() to
get_params__post_init().  The VF driver will populate the SGE parameters
structure via a different method before calling t4_read_chip_settings().

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7476
2016-08-15 17:40:05 +00:00
Bruce Evans
1388e8b13e [Oops, the previous commit was missing the update to syscons.h.]
Like scr_lock, the grab count needs to be per-physical-device to work.

This bug corrupted the grab count on both vtys if the ungrabbed vty is
different from the console, and failed to restore the keyboard state
on the ungrabbed vty, but not restoring it usually left the keyboard
mode part of the keyboard state uncorrupted at 1 (K_XLATE), while
after this fix the keyboard mode part is usually corrupted to 0 (K_RAW).

While here, rename the grab count from grabbed to grab_level.
2016-08-15 17:11:05 +00:00
Bruce Evans
71e40e4a49 Like scr_lock, the grab count needs to be per-physical-device to work.
This bug corrupted the grab count on both vtys if the ungrabbed vty is
different from the console, and failed to restore the keyboard state
on the ungrabbed vty, but not restoring the latter usually left the
keyboard mode part of it uncorrupted at 1 (K_XLATE), while after this
fix the keyboard mode part is usually corrupted to 0 (K_RAW).

While here, rename the grab count from 'grabbed' to grab_level.
2016-08-15 17:08:25 +00:00
Bruce Evans
304c3654d7 Disable some more unsafe things in (low level) console mode:
- never call up to the tty layer to restart output for keyboard input in
  console mode.  This was already disallowed in kdb mode.  Other cases
  are rarely reached.
- disable the reboot, halt and powerdown keys in console mode.  The suspend,
  standby and panic keys are still allowed, and aren't even conditonal
  on excessive configuration options.  Some of these actions are still
  available in ddb mode as ddb commands which are equally unsafe.  Some
  are useful at input prompts and should be restored when the locking is
  fixed.
- disallow bells in kdb mode (should be in console mode, but the flag for
  that is not available).  Visual bell gives very alarming behaviour by
  trying to use callouts which don't work in kdb mode.  Audio bell uses
  timeouts and hardware resources with mutexes that can deadlock in
  reasonable use of ddb.

Screen switches in kdb mode are not very safe, but they are important
functionality and there is a lot of code to make them sort of work.
2016-08-15 15:34:53 +00:00
Alan Somers
55f27b093d Decrease the anti-congestion sleep in 480.leapfile-ntpd to 1 hour
24 hours is too long. Periodic scripts are executed serially, so when
combined with the sleep in 410.pkg-audit periodic could actually take more
than 24 hours and block the next invocation.

Reviewed by:	cy
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D7481
2016-08-15 14:58:25 +00:00
Bruce Evans
abf3a584b6 Change all uses of 'debugger' to kdb_active and remove this variable. This
restores avoidance of doing dangerous things like calling wakeup() and
callouts while in ddb.

Initialization of 'debugger' was broken by removing the cndbctl() console
method that was used mainly in this driver to initialize 'debugger' and
switch to the console screen on entry to ddb.  The screen switch was
restored using the cngrab() method, but cngrab() is more general so it
should not initialize 'debugger' and never did.  'debugger' was just
an over-engineered alias for kdb_active anyway.  It existed because
kdb_active (when it was named ddb_active) was considered as a private
kdb variable, and there are ordering problems initializing the variables
atomically with the state that they represent, but an extra variable and
method to set it increased these problems.

The bug caused LORs, but WITNESS is normally misconfigured with
WITNESS_SKIPSIN so it doesn't check the spinlocks used by wakeup() and
callouts.
2016-08-15 14:28:16 +00:00
Ed Maste
e85c2b0b12 elfcopy: add elf64-littleaarch64 output target support
Sponsored by:	The FreeBSD Foundation
2016-08-15 14:28:08 +00:00
Oleg Bulyzhin
e7560c836f Fix command: ipfw set (enable|disable) N (where N > 4).
enable_sets() expects set bitmasks, not set numbers.

MFC after:	3 days
2016-08-15 13:06:29 +00:00
Bruce Evans
40de550ba7 Quick fix for locking fixes in r172250. The lock added there was per-
virtual-device, but needs to be per-physical-device so that it protects
shared data.  Usually, scp->sc->write_in_progress got corrupted first
and further corruption was limited when this variable was left at nonzero
with no write in progress.

Attempt to fix missing lock destruction in r162285.  Put it with the
lock destruction for r172250 after moving the latter.  Both might be
unreachable.

To demonstrate the bug, find a buggy syscall or sysctl that calls
printf(9) and run this often.  Run hd /dev/zero >/dev/ttyvN for any
N != 0.  The console spam goes to ttyv0 and the non-console spam goes
to ttyvN, so the lock provided no protection (but it helped for
N == 0).
2016-08-15 12:56:45 +00:00
Kristof Provost
0df377cbb8 pf: Add missing byte-order swap to pf_match_addr_range
Without this, rules using address ranges (e.g. "10.1.1.1 - 10.1.1.5") did not
match addresses correctly on little-endian systems.

PR:		211796
Obtained from:	OpenBSD (sthen)
MFC after:	3 days
2016-08-15 12:13:14 +00:00
Ed Maste
07410fe461 elfcopy: silence GCC 5.3 unitialized variable warning
Although it's a false positive there is little cost to initializing it
always.

Submitted by:	adrian
2016-08-15 11:54:39 +00:00
Sean Bruno
e760e292ae e1000: Add support for Kaby Lake IDs
Fixup some errors when transitioning to/from low power states.

Submitted by:	erj
Reviewed by:	Jeffery Piper (jeffrey.e.piper@intel.com)
MFC after:	3 days
Relnotes:	yes
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D7478
2016-08-15 11:24:30 +00:00
Bruce Evans
5bd90da0ef Remove duplicate definition of get_pcb_td(). gcc works for detecting
this error.
2016-08-15 10:46:33 +00:00
Michael Tuexen
dcb436c936 Ensure that sctp_it_ctl.cur_it does not point to a free object (during
a small time window).
Thanks to Byron Campen for reporting the issue and
suggesting a fix.

MFC after: 3 days
2016-08-15 10:16:08 +00:00
Dag-Erling Smørgrav
47ead00d5b Ensure that the sector size is a multiple of 4096 to avoid creating
unaligned partitions when the actual sector size is hidden from us.

PR:		211361
MFC after:	3 days
2016-08-15 09:30:21 +00:00
Andrew Turner
2bafd72fdb Add the ARMv8.1 identification registers to the list we print when booting.
MFC after:	1 week
Sponsored by:	ABT Systems Ltd
2016-08-15 09:23:08 +00:00
Sepherosa Ziehau
0f9b848541 hyperv/hn: Switch to vmbus xact APIs for sub-channel alloc request.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7480
2016-08-15 05:08:41 +00:00
Sepherosa Ziehau
a04b666a04 hyperv/hn: Simplify chimney sending buffer disconnection.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7479
2016-08-15 05:00:37 +00:00
Sepherosa Ziehau
3539b9b06d Unbreak LINT build.
Sponsored by:	Microsoft
2016-08-15 04:59:38 +00:00
Xin LI
854023f054 Add timingsafe_bcmp and timingsafe_memcmp.
Obtained from:	OpenBSD
Reviewed by:	trasz
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D7280
2016-08-14 23:38:50 +00:00
Alan Cox
ce3ee09b53 Eliminate unneeded vm_page_xbusy() and vm_page_xunbusy() operations when
neither vm_pager_has_page() nor vm_pager_get_pages() is called.

Reviewed by:	kib, markj
MFC after:	3 weeks
2016-08-14 22:00:45 +00:00
Adrian Chadd
cb916ce754 [mips] convert over =v to =r for the inline assembly.
Later gcc and clang have deprecated =v (which maps to a specific temp
register) and instead we should just use =r to have the assembler
(hopefully!) save/restore things appropriately after choosing
a register.

Tested:

* AR9344 SoC, with userreg support
* AR9331 SoC, with no userreg support

Sponsored by:	Sponsored by: DARPA, AFRL (MIPS TLS user register work)
2016-08-14 19:04:37 +00:00
Andrey V. Elsukov
4a2ea55b11 Add an ability to attach comment to check-state rules.
MFC after:	1 week
2016-08-14 18:34:16 +00:00
Andrey V. Elsukov
58d358e5a1 Do not warn about ambiguous state name when we inspect a comment token.
Reported by:	lev
2016-08-14 18:05:41 +00:00
Bruce Evans
258b53d151 Fix the variables $esp, $ds, $es, $fs, $gs and $ss in vm86 mode.
Fix PC_REGS() so that printing of instructions works in some useful
cases.  ddb only understands a single flat address space, but this
macro allows mapping $cs:$eip into vm86's flat address space well
enough for the MI parts of ddb.  This doesn't work for the MD parts
that do stack traces, and there are no similar macros for data addresses.

PC_REGS() has to use the trapframe pointer instead of the pcb for this.
For other CPUs, the trapframe pointer is not available except by tracing
back to it.  But tracing back through vm86 trapframes is broken even
starting with one.
2016-08-14 16:51:25 +00:00
Bruce Evans
99061149a3 Print the tid of curthread in "show pcpu" in ddb.
It was remarkably hard to trace all current threads.  "show pcpu" only
showed the pid, and there was nothing (?) better than searching ps output
to find the tids on CPUs.  This change simplifies the search, but you
still have to trace the tid for each CPU manually.
2016-08-14 15:52:00 +00:00
Bruce Evans
2b7a7ace9e In ddb ps, left justify the non-numeric fields 'state' and 'wmesg' and
the fixed-width numeric field 'wchan', as in ps(1).  They were sort
of centered, although the template shows 'state' as right-justified.
The `wmesg' field very rarely has a prefix of '*' (for lock names)
that is still to the left of the header, and the width of this field
is reduced from 8 to 7 (more than 6 is an error).

The 'wmesg' and 'wchan' fields are still misnamed and poorly handled.
They are named sort of backwards relative to ps(1):
- wmesg in ddb = mwchan in ps
- wmesg in ddb = wchan in ps (if it is a wait channel name, not a lock name)
- wchan in ddb = nwchan in ps
ddb ps wastes lots of space for the unimportant 'wchan' field (20
columns altogether on 64-bit arches).  ps(1) documents using a
compressed format, but the compression only omits leading nybbles of
0 so it has neveqr worked on arches that put the kernel in the top half
of the address space.  It just avoids wasting space for an 0x prefix.
2016-08-14 15:26:40 +00:00
Bruce Evans
cecc0aa9f9 Don't print an extra newline after the instruction when printing for
single stepping of multiple instructions (e.g., s/p,<count> and n/p).
db_print_loc_and_inst() already prints a newline on all arches although
it probably shouldn't.

Especially on SMP systems, single stepping tends to deadlock or panic
too quickly to be useful for anything except finding bugs in itself,
but with printing "itself" includes console drivers so it is useful
for generating stress tests for console drivers.
2016-08-14 13:23:02 +00:00
Emmanuel Vadot
29f11c7d8b Correct the size of the softc in a10_ehci
Reported by:	andrew
MFC after:	1 week
2016-08-14 13:17:59 +00:00
Andrey V. Elsukov
c5e85276ac Make statistics nat64lsn, nat64stl an nptv6 output netstat-like:
"@value @description" and fix build due to -Wformat errors.
2016-08-14 13:17:55 +00:00
Martin Matuska
cfa49a9b0b MFV r304060:
Sync libarchive with vendor including three security fixes

Vendor issues fixed:

Issue #744: Very long pathnames evade symlink checks
Issue #748: libarchive can compress, but cannot decompress zip some files
PR #750: ustar: fix out of bounds read on empty string ("") filename
PR #755: fix use of acl_get_flagset_np() on FreeBSD

MFC after:	3 days
2016-08-14 09:26:10 +00:00
Xin LI
ed1202fc80 Now that the portsnap buildbox is generating the raw bits for INDEX-12,
add it to the set of INDEX files built by portsnap.

Switch to INDEX-12 for head/.
2016-08-14 05:18:38 +00:00
Michal Meloun
aa71e06db5 OFWPCI: Don't strip RF_ACTIVE from flags when parent bus method is called.
Reviewed by:	nwhitehorn
MFC after:	3 weeks
2016-08-14 05:10:26 +00:00
Justin Hibbits
466a4ffc98 Return 0 instead of an error code on failure to find dcsr.
mpc85xx_map_dcsr() returns a vm_offset_t, not an error code.
mpc85xx_fix_errata() will gracefully exit if mpc85xx_map_dcsr() returns 0, as
that indicates an error (NULL pointer).
2016-08-14 04:11:36 +00:00
Justin Hibbits
7599d2ddad Only flush bp_kernload from the dcache, no need to sync the icache on the boot CPU.
__syncicache() only syncs the icache on the current CPU, it doesn't touch the
cache on any other core.  Replace the call with cpu_flush_dcache() instead.
Since bp_kernload is not touched again by the boot CPU in this code path, dcbf
is no less efficient than the dcbst from __syncicache() by invalidating the
cache line.
2016-08-14 03:49:37 +00:00
Mark Johnston
da974ed4ab nfsstat depends on libdevstat as of r304058.
X-MFC-With:	r304058
2016-08-14 00:24:00 +00:00
Greg Lehey
7430368a0e Correct date ov VJ day (1945-08-15, about 03:00 UTC). 2016-08-13 23:35:20 +00:00
Andrey V. Elsukov
ecd3637584 Use %ju to print unsigned 64-bit value.
Reported by:	kib
2016-08-13 22:14:16 +00:00
Martin Matuska
5b0ba62993 Update vendor/libarchive to git 6a0d970f70102fe50ee9f1e51a2e4c048985e616
Vendor issues fixed:

Issue #744: Very long pathnames evade symlink checks
Issue #748: libarchive can compress, but cannot decompress zip some files
PR #750: ustar: fix out of bounds read on empty string ("") filename
PR #755: fix use of acl_get_flagset_np() on FreeBSD
2016-08-13 21:20:06 +00:00
Rick Macklem
50f3f9f909 Update the man page to descibe the "-d" option added by r304058.
This is a content change.

Submitted by:	will (earlier version)
Reviewed by:	ken, wblock
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D1626
2016-08-13 20:21:32 +00:00
Rick Macklem
693957f886 Update nfsstat.c to use the new kernel nfsstat structure and
add the new "-d" flag from D1626.
The man page will be updated in a subsequent commit.

Submitted by:	will (earlier version)
Reviewed by:	ken
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D1626
2016-08-13 20:14:44 +00:00
Mark Johnston
eb9da1ada8 Fix handling of forward enum declarations in the CTF tools.
Reported by:	mmacy
MFC after:	2 weeks
2016-08-13 19:51:00 +00:00
Mark Johnston
842ee21e20 Strengthen assertions about the busy state of newly-allocated pages.
Reviewed by:	alc
MFC after:	1 week
2016-08-13 19:49:32 +00:00
Mark Johnston
fc85a6f0c4 Initialize page busy lock state in vm_phys_add_page().
MFC after:	1 week
2016-08-13 19:48:43 +00:00