]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agogxemul:
sbruno [Mon, 6 Feb 2017 11:37:20 +0000 (11:37 +0000)]
gxemul:

Add a format string to call to g_new_providerf() found when compiling
mips64 target with clang.

Reviewed by: brooks

7 years agoloader: 313329 missed ZFS guard in loader/main.c
tsoome [Mon, 6 Feb 2017 10:57:54 +0000 (10:57 +0000)]
loader: 313329 missed ZFS guard in loader/main.c

Missing guard added.

Reviewed by: imp, allanjude
Approved by: imp (mentor), allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D9458

7 years agoAdd ObsoleteFiles entries for bdes(1) missed in r313329
allanjude [Mon, 6 Feb 2017 10:51:53 +0000 (10:51 +0000)]
Add ObsoleteFiles entries for bdes(1) missed in r313329

Reported by: delphij
Reviewed by: bapt, imp
Differential Revision: https://reviews.freebsd.org/D9457

7 years agolocks: fix recursion support after recent changes
mjg [Mon, 6 Feb 2017 09:40:14 +0000 (09:40 +0000)]
locks: fix recursion support after recent changes

When a relevant lockstat probe is enabled the fallback primitive is called with
a constant signifying a free lock. This works fine for typical cases but breaks
with recursion, since it checks if the passed value is that of the executing
thread.

Read the value if necessary.

7 years agoloader: Replace EFI part devices.
tsoome [Mon, 6 Feb 2017 09:18:47 +0000 (09:18 +0000)]
loader: Replace EFI part devices.

Rewrite EFI part device interface to present disk devices in more
user friendly way.

We keep list of three types of devices: floppy, cd and disk, the
visible names: fdX: cdX: and diskX:

Use common/disk.c and common/part.c interfaces to manage the
partitioning.

The lsdev -l will additionally list the device path.

Reviewed by: imp, allanjude
Approved by: imp (mentor), allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D8581

7 years agoloader: bcache read ahead block count should take account the large sectors
tsoome [Mon, 6 Feb 2017 08:58:40 +0000 (08:58 +0000)]
loader: bcache read ahead block count should take account the large sectors

The loader bcache is implementing simple read-ahead to boost the cache.
The bcache is built based on 512B block sizes, and the read ahead is attempting
to read number of cache blocks, based on amount of the free bcache space.

However, there are devices using larger sector sizes than 512B, most obviously
the CD media is based on 2k sectors. This means the read-ahead can not be just
random number of blocks, but we should use value suitable also for use with
larger sectors, as for example, with CD devices, we should read multiple of 2KB.
Since the sector size from disk interface is not too reliable, i guess we can
just use "good enough" value, so the implementation is rounding down the read
ahead block count to be multiple of 16.

This means we have covered sector sizes to 8k.

In addition, the update does implement the end of cache marker, to help to
detect the possible memory corruption - I have not seen it happening so far,
but it does not hurt to have the detection mechanism in place.

Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D9179

7 years agoAdd removed headers into the ObsoleteFiles.inc.
ae [Mon, 6 Feb 2017 08:56:04 +0000 (08:56 +0000)]
Add removed headers into the ObsoleteFiles.inc.

7 years agoMerge projects/ipsec into head/.
ae [Mon, 6 Feb 2017 08:49:57 +0000 (08:49 +0000)]
Merge projects/ipsec into head/.

 Small summary
 -------------

o Almost all IPsec releated code was moved into sys/netipsec.
o New kernel modules added: ipsec.ko and tcpmd5.ko. New kernel
  option IPSEC_SUPPORT added. It enables support for loading
  and unloading of ipsec.ko and tcpmd5.ko kernel modules.
o IPSEC_NAT_T option was removed. Now NAT-T support is enabled by
  default. The UDP_ENCAP_ESPINUDP_NON_IKE encapsulation type
  support was removed. Added TCP/UDP checksum handling for
  inbound packets that were decapsulated by transport mode SAs.
  setkey(8) modified to show run-time NAT-T configuration of SA.
o New network pseudo interface if_ipsec(4) added. For now it is
  build as part of ipsec.ko module (or with IPSEC kernel).
  It implements IPsec virtual tunnels to create route-based VPNs.
o The network stack now invokes IPsec functions using special
  methods. The only one header file <netipsec/ipsec_support.h>
  should be included to declare all the needed things to work
  with IPsec.
o All IPsec protocols handlers (ESP/AH/IPCOMP protosw) were removed.
  Now these protocols are handled directly via IPsec methods.
o TCP_SIGNATURE support was reworked to be more close to RFC.
o PF_KEY SADB was reworked:
  - now all security associations stored in the single SPI namespace,
    and all SAs MUST have unique SPI.
  - several hash tables added to speed up lookups in SADB.
  - SADB now uses rmlock to protect access, and concurrent threads
    can do SA lookups in the same time.
  - many PF_KEY message handlers were reworked to reflect changes
    in SADB.
  - SADB_UPDATE message was extended to support new PF_KEY headers:
    SADB_X_EXT_NEW_ADDRESS_SRC and SADB_X_EXT_NEW_ADDRESS_DST. They
    can be used by IKE daemon to change SA addresses.
o ipsecrequest and secpolicy structures were cardinally changed to
  avoid locking protection for ipsecrequest. Now we support
  only limited number (4) of bundled SAs, but they are supported
  for both INET and INET6.
o INPCB security policy cache was introduced. Each PCB now caches
  used security policies to avoid SP lookup for each packet.
o For inbound security policies added the mode, when the kernel does
  check for full history of applied IPsec transforms.
o References counting rules for security policies and security
  associations were changed. The proper SA locking added into xform
  code.
o xform code was also changed. Now it is possible to unregister xforms.
  tdb_xxx structures were changed and renamed to reflect changes in
  SADB/SPDB, and changed rules for locking and refcounting.

Reviewed by: gnn, wblock
Obtained from: Yandex LLC
Relnotes: yes
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D9352

7 years agoRemove bdes(1)
allanjude [Mon, 6 Feb 2017 08:27:19 +0000 (08:27 +0000)]
Remove bdes(1)

The use of DES for anything is discouraged, especially with a static IV of 0

If you still need bdes(1) to decrypt Kirk's video lectures, see
security/bdes in ports.

This commit brought to you by the FOSDEM DevSummit and the
"remove unneeded dependancies on openssl in base" working group

Reviewed by: bapt, brnrd
Relnotes: yes
Sponsored by: FOSDEM DevSummit
Differential Revision: https://reviews.freebsd.org/D9424

7 years agoloader: Implement disk_ioctl() to support DIOCGSECTORSIZE and DIOCGMEDIASIZE.
tsoome [Mon, 6 Feb 2017 08:26:45 +0000 (08:26 +0000)]
loader: Implement disk_ioctl() to support DIOCGSECTORSIZE and DIOCGMEDIASIZE.

Need interface to extract information about disk abstraction,
to read disk or partition size depending on the provided argument
and adjust disk size based on information in partition table.

The disk handle from disk_open() has d_offset field to point to
partition start. So we can use this fact to return either whole disk
size or partition size. For this we only need to record partition size
we get from disk_open() anyhow.

In addition, this will also make it possible to adjust the disk media size
based on information from partition table. The problem with disk size is
about some BIOS systems reporting bogus disk size for 2+TB disks, but
since such disks are using GPT partitioning, and GPT does have information
about disk size (alternate LBA + 1), we can use this fact to record disk
size based on partition table.

This patch does exactly this: implements DIOCGSECTORSIZE and DIOCGMEDIASIZE
ioctl, and DIOCGMEDIASIZE will report either disk media size or partition size.

Adds ptable_getsize() call to read partition size in bytes from ptable pointer.
Updates disk_open() to use ptable_getsize() to update mediasize value.

Implements GPT detection function to update ptable size (used by
ptable_getsize()) according to alternate lba (which is location of backup copy
of GPT header table).

Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D8594

7 years agoReflect actual NetBSD revision we already have.
delphij [Mon, 6 Feb 2017 07:02:17 +0000 (07:02 +0000)]
Reflect actual NetBSD revision we already have.

MFC after: 3 days

7 years agoo Add mkimg to the cross tools, and use the TMPPATH as PATH to pick up
imp [Mon, 6 Feb 2017 06:15:38 +0000 (06:15 +0000)]
o Add mkimg to the cross tools, and use the TMPPATH as PATH to pick up
  mkimg for building on systems like FreeBSD 11.0 that don't have my
  -a changes.
o Set NANO_ROOT and NANO_ALTROOT for std-* since their values don't
  change when we set NANO_SLICE*.

PR: 216829
PR: 216830

7 years ago[iwm] Use notification wait API to wait for calibration to complete.
adrian [Mon, 6 Feb 2017 05:35:11 +0000 (05:35 +0000)]
[iwm] Use notification wait API to wait for calibration to complete.

Tested:

* 7260, STA mode (2g, 5g)

Obtained from: DragonflyBSD commit 1e0cf8ec6fcd77978f5336297ece61a415790f84

7 years ago[iwm] Add implementation of the notification wait api from iwlwifi.
adrian [Mon, 6 Feb 2017 05:27:07 +0000 (05:27 +0000)]
[iwm] Add implementation of the notification wait api from iwlwifi.

Obtained from: Linux iwlwifi
Obtained from: DragonflyBSD commit 94dc1dadceb57b688036211262d678bc6bbdde37

7 years agocxgbe(4): Allow tunables that control the number of queues to be set to
np [Mon, 6 Feb 2017 05:19:29 +0000 (05:19 +0000)]
cxgbe(4):  Allow tunables that control the number of queues to be set to
'-n' to tell the driver to create _up to_ 'n' queues if enough cores are
available.  For example, setting hw.cxgbe.nrxq10g="-32" will result in
16 queues if the system has 16 cores, 32 if it has 32.

There is no change in the default number of queues of any type.

MFC after: 1 week
Sponsored by: Chelsio Communications

7 years ago[iwm] Change 2nd arg of iwm_phy_db_set_section() to struct iwm_rx_packet.
adrian [Mon, 6 Feb 2017 05:09:42 +0000 (05:09 +0000)]
[iwm] Change 2nd arg of iwm_phy_db_set_section() to struct iwm_rx_packet.

* This matches the function declaration in Linux's iwlwifi.

Obtained from: DragonflyBSD commit de7995a5e0ebf2d0016a87a0142a98c75db58fb4

7 years ago[iwm] Store paging_mem_size field in firmware image information struct.
adrian [Mon, 6 Feb 2017 05:08:21 +0000 (05:08 +0000)]
[iwm] Store paging_mem_size field in firmware image information struct.

Obtained from: DragonflyBSD commit a8524cc6c440e5ce9490ba2b0507c99ff6777c6d

7 years ago[iwm] Get rid of some gratuitous constant renaming wrt. Linux iwlwifi.
adrian [Mon, 6 Feb 2017 05:07:15 +0000 (05:07 +0000)]
[iwm] Get rid of some gratuitous constant renaming wrt. Linux iwlwifi.

* IWM_UCODE_SECT_MAX -> IWM_UCODE_SECTION_MAX

* IWM_UCODE_TYPE_* -> IWM_UCODE_* (except for IWM_UCODE_TYPE_MAX which
  stays).

Obtained from: DragonflyBSD commit ff4d1fc3ed002c9fb362423da6c45d711b65658a

7 years ago[iwm] Sync valid_tx_ant and valid_rx_ant mask handling with iwlwifi.
adrian [Mon, 6 Feb 2017 05:03:41 +0000 (05:03 +0000)]
[iwm] Sync valid_tx_ant and valid_rx_ant mask handling with iwlwifi.

* This fixes the phy_cfg field sent in the iwm_send_phy_cfg_cmd()
  command, which wasn't taking into account the valid_rx_ant and
  valid_tx_ant masks from nvm_data before.

Tested:

* 7260, STA mode, 2G and 5G

Obtained from: DragonflyBSD commit cbb82693c18fd71b4eb86855b82d03995f352d65

7 years ago[iwm] Use chipset configuration structs like iwlwifi does.
adrian [Mon, 6 Feb 2017 03:29:50 +0000 (03:29 +0000)]
[iwm] Use chipset configuration structs like iwlwifi does.

* This makes it a bit easier to factor out common parts for e.g. the
  7000 chipset family.

* Add iwm7265d config, and recognize the 7265D chipset variant via the
  hardware revision.

Tested:

* 7260, STA mode (2ghz)

Obtained from: Dragonflybsd commit cc8d6ccf5583fd45964f3bde9b057ee4f834c0e0

7 years ago[iwm] Sync nvm parsing code with Linux iwlwifi.
adrian [Mon, 6 Feb 2017 03:06:11 +0000 (03:06 +0000)]
[iwm] Sync nvm parsing code with Linux iwlwifi.

* sc->sc_nvm becomes sc->nvm_data and is now a pointer instead of an
  inlined struct.

* Add sc->eeprom_size and sc->nvm_hw_section_num configuration values to
  struct iwm_softc.

* For now continue to avoid negative error return-values, and use pointer
  variables for some return values, as before.

* Continue to omit LAR (location aware regulatory) related code as well.

Tested:

* Intel 7260, STA mode (2GHz)

Obtained from: dragonflybsd commit 39f8331b1a6f295291e08c377da12a8e7a5436c0

7 years ago[iwm] make sure we call iwm_detach_local() only once.
adrian [Mon, 6 Feb 2017 02:20:05 +0000 (02:20 +0000)]
[iwm] make sure we call iwm_detach_local() only once.

Obtained from: DragonflyBSD git ebd4ceab76a6f161362029cbfd08efaedaab0519

7 years ago[iwm] Sync if_iwm_phy_db code with Linux iwlwifi.
adrian [Mon, 6 Feb 2017 02:14:34 +0000 (02:14 +0000)]
[iwm] Sync if_iwm_phy_db code with Linux iwlwifi.

Obtained from: Dragonflybsd commit c1019b6bfff36c856f7b4fccbdf3bb13ac27750c

7 years ago[iwm] The HW Revision stepping constants should be in if_iwmreg.h.
adrian [Mon, 6 Feb 2017 02:01:22 +0000 (02:01 +0000)]
[iwm] The HW Revision stepping constants should be in if_iwmreg.h.

Obtained from: dragonflybsd 84292f0c38594c462c719c0e59da5908b93aba5f

7 years ago[iwm] TODO for QOS support.
adrian [Mon, 6 Feb 2017 01:57:59 +0000 (01:57 +0000)]
[iwm] TODO for QOS support.

7 years ago[iwm] free node reference if rxparams addition fails.
adrian [Mon, 6 Feb 2017 01:57:41 +0000 (01:57 +0000)]
[iwm] free node reference if rxparams addition fails.

7 years agoAdd tsw_busy support to usb_serial (ucom).
ian [Sun, 5 Feb 2017 15:45:31 +0000 (15:45 +0000)]
Add tsw_busy support to usb_serial (ucom).

The tty layer uses tsw_busy to poll for busy/idle status of the transmitter
hardware during close() and tcdrain(). The ucom layer defines ULSR_TXRDY and
ULSR_TSRE bits for the line status register; when both are set, the
transmitter is idle. Not all chip drivers maintain those bits in the sc_lsr
field, and if the bits never get set the transmitter will always appear
busy, causing hangs in tcdrain().

These changes add a new sc_flag bit, UCOM_FLAG_LSRTXIDLE. When this flag is
set, ucom_busy() uses the lsr bits to return busy vs. idle state, otherwise
it always returns idle (which is effectively what happened before this
change because tsw_busy wasn't implemented).

For the uftdi chip driver, these changes stop masking out the tx idle bits
when processing the status register (because now they're useful), and it
calls ucom_use_lsr_txbits() to indicate the bits are maintained by the
driver and can be used by ucom_busy().

Differential Revision: https://reviews.freebsd.org/D9183

7 years agoRegen after r313284.
dchagin [Sun, 5 Feb 2017 14:19:19 +0000 (14:19 +0000)]
Regen after r313284.

MFC after: 2 week

7 years agoUpdate syscall.master to 4.10-rc6. Also fix comments, a typo,
dchagin [Sun, 5 Feb 2017 14:17:09 +0000 (14:17 +0000)]
Update syscall.master to 4.10-rc6. Also fix comments, a typo,
and wrong numbering for a few unimplemented syscalls.

For 32-bit Linuxulator, socketcall() syscall was historically
the entry point for the sockets API. Starting in Linux 4.3, direct
syscalls are provided for the sockets API. Enable it.

The initial version of patch was provided by trasz@ and extended by me.

Submitted by: trasz
MFC after: 2 week
Differential Revision: https://reviews.freebsd.org/D9381

7 years agoFix linux_pipe() and linux_pipe2() to close file descriptors on copyout
trasz [Sun, 5 Feb 2017 14:03:25 +0000 (14:03 +0000)]
Fix linux_pipe() and linux_pipe2() to close file descriptors on copyout
error.

Reviewed by: dchagin
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9425

7 years agorwlock: move lockstat handling out of inline primitives
mjg [Sun, 5 Feb 2017 13:37:23 +0000 (13:37 +0000)]
rwlock: move lockstat handling out of inline primitives

See r313275 for details.

One difference here is that recursion handling was removed from the fallback
routine. As it is it was never supposed to see a recursed lock in the first
place. Future changes will move it out of inline variants, but right now
there is no easy to way to test if the lock is recursed without reading
additional words.

7 years agoAdd kern_cpuset_getaffinity() and kern_cpuset_getaffinity(),
trasz [Sun, 5 Feb 2017 13:24:54 +0000 (13:24 +0000)]
Add kern_cpuset_getaffinity() and kern_cpuset_getaffinity(),
and use it in compats instead of their sys_*() counterparts.

Reviewed by: kib, jhb, dchagin
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9383

7 years agosx: move lockstat handling out of inline primitives
mjg [Sun, 5 Feb 2017 09:54:16 +0000 (09:54 +0000)]
sx: move lockstat handling out of inline primitives

See r313275 for details.

7 years agomtx: fixup r313278, the assignemnt was supposed to go inside the loop
mjg [Sun, 5 Feb 2017 09:53:13 +0000 (09:53 +0000)]
mtx: fixup r313278, the assignemnt was supposed to go inside the loop

7 years agomtx: fix up _mtx_obtain_lock_fetch usage in thread lock
mjg [Sun, 5 Feb 2017 09:35:17 +0000 (09:35 +0000)]
mtx: fix up _mtx_obtain_lock_fetch usage in thread lock

Since _mtx_obtain_lock_fetch no longer sets the argument to MTX_UNOWNED,
callers have to do it on their own.

7 years agoRestore r312404:
delphij [Sun, 5 Feb 2017 08:51:41 +0000 (08:51 +0000)]
Restore r312404:

Use S_ISREG instead of manual & (also it's better to compare the
result from & and the pattern instead of just assuming it's one bit
value).

Pointed out by Tianjie Mao <tjmao tjmao com>.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4827

7 years agoUse kldload -n when loading if_deqna
ngie [Sun, 5 Feb 2017 08:24:37 +0000 (08:24 +0000)]
Use kldload -n when loading if_deqna

This fixes if_deqna from being loaded by accident twice if it's already loaded
in the kernel.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agomtx: move lockstat handling out of inline primitives
mjg [Sun, 5 Feb 2017 08:04:11 +0000 (08:04 +0000)]
mtx: move lockstat handling out of inline primitives

Lockstat requires checking if it is enabled and if so, calling a 6 argument
function. Further, determining whether to call it on unlock requires
pre-reading the lock value.

This is problematic in at least 3 ways:
- more branches in the hot path than necessary
- additional cacheline ping pong under contention
- bigger code

Instead, check first if lockstat handling is necessary and if so, just fall
back to regular locking routines. For this purpose a new macro is introduced
(LOCKSTAT_PROFILE_ENABLED).

LOCK_PROFILING uninlines all primitives. Fold in the current inline lock
variant into the _mtx_lock_flags to retain the support. With this change
the inline variants are not used when LOCK_PROFILING is defined and thus
can ignore its existence.

This results in:
   text    data     bss     dec     hex filename
22259667 1303208 4994976 28557851 1b3c21b kernel.orig
21797315 1303208 4994976 28095499 1acb40b kernel.patched

i.e. about 3% reduction in text size.

A remaining action is to remove spurious arguments for internal kernel
consumers.

7 years agosx: add witness support missed in r313272
mjg [Sun, 5 Feb 2017 06:51:45 +0000 (06:51 +0000)]
sx: add witness support missed in r313272

7 years agostyle(9) cleanup
ngie [Sun, 5 Feb 2017 05:36:51 +0000 (05:36 +0000)]
style(9) cleanup

- Delete trailing whitespace
- Fix alignment/variable sorting
- Delete single-line enclosing braces

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agosx: uninline slock/sunlock
mjg [Sun, 5 Feb 2017 05:20:29 +0000 (05:20 +0000)]
sx: uninline slock/sunlock

Shared locking routines explicitly read the value and test it. If the
change attempt fails, they fall back to a regular function which would
retry in a loop.

The problem is that with many concurrent readers the risk of failure is pretty
high and even the value returned by fcmpset is very likely going to be stale
by the time the loop in the fallback routine is reached.

Uninline said primitives. It gives a throughput increase when doing concurrent
slocks/sunlocks with 80 hardware threads from ~50 mln/s to ~56 mln/s.

Interestingly, rwlock primitives are already not inlined.

7 years agosx: switch to fcmpset
mjg [Sun, 5 Feb 2017 04:54:20 +0000 (04:54 +0000)]
sx: switch to fcmpset

Discussed with: jhb
Tested by: pho (previous version)

7 years agorwlock: switch to fcmpset
mjg [Sun, 5 Feb 2017 04:53:13 +0000 (04:53 +0000)]
rwlock: switch to fcmpset

Discussed with: jhb
Tested by: pho

7 years agomtx: switch to fcmpset
mjg [Sun, 5 Feb 2017 03:26:34 +0000 (03:26 +0000)]
mtx: switch to fcmpset

The found value is passed to locking routines in order to reduce cacheline
accesses.

mtx_unlock grows an explicit check for regular unlock. On ll/sc architectures
the routine can fail even if the lock could have been handled by the inline
primitive.

Discussed with: jhb
Tested by: pho (previous version)

7 years agovfs: use atomic_fcmpset in vfs_refcount_*
mjg [Sun, 5 Feb 2017 03:23:16 +0000 (03:23 +0000)]
vfs: use atomic_fcmpset in vfs_refcount_*

7 years agoEnsure that the DOF string length is divisible by 2.
markj [Sun, 5 Feb 2017 02:47:34 +0000 (02:47 +0000)]
Ensure that the DOF string length is divisible by 2.

It is an ASCII encoding of a hexadecimal representation of the DOF file
used to enable anonymous tracing, so its length should always be even.

MFC after: 1 week

7 years agoSearch for _DTRACE_VERSION in sys/sdt.h rather than unistd.h.
markj [Sun, 5 Feb 2017 02:45:35 +0000 (02:45 +0000)]
Search for _DTRACE_VERSION in sys/sdt.h rather than unistd.h.

MFC after: 1 week

7 years agoAvoid using Sun compiler-specific flags.
markj [Sun, 5 Feb 2017 02:44:48 +0000 (02:44 +0000)]
Avoid using Sun compiler-specific flags.

MFC after: 1 week

7 years agoFix a double free of libelf data buffers in the USDT link code.
markj [Sun, 5 Feb 2017 02:44:08 +0000 (02:44 +0000)]
Fix a double free of libelf data buffers in the USDT link code.

libdtrace needs to append to the input object files' string and symbol
tables. Currently it does so by allocating a larger buffer, copying the
existing sections into them, and swapping pointers in the libelf data
descriptors. However, it also frees those buffers when its processing is
complete, which leads to a double free since the elftoolchain libelf
owns them and also frees them in elf_end(3). Instead, free the buffers
originally allocated by libelf.

MFC after: 2 weeks

7 years agoUse PC-relative relocations for USDT probe sites on i386 and amd64.
markj [Sun, 5 Feb 2017 02:39:12 +0000 (02:39 +0000)]
Use PC-relative relocations for USDT probe sites on i386 and amd64.

When recording probe site addresses in the output DOF file, dtrace -G
needs to emit relocations for the .SUNW_dof section in order to obtain
the addresses of functions containing probe sites. DTrace expects the
addresses to be relative to the base address of the final ELF file,
and the amd64 USDT implementation was relying on some unspecified and
incorrect behaviour in the base system GNU ld to achieve this.

This change reimplements the probe site relocation handling to allow
USDT to be used with lld and newer GNU binutils. Specifically, it
makes use of R_X86_64_PC64/R_386_PC32 relocations to obtain the
probe site address relative to the DOF file address, and adds and uses a
new DOF relocation type which computes the final probe site address using
these relative offsets.

Reported by and discussed with: Rafael Espíndola
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D9374

7 years agoMake witness_warn() always print to the console.
markj [Sun, 5 Feb 2017 02:27:04 +0000 (02:27 +0000)]
Make witness_warn() always print to the console.

witness_warn() either breaks into the debugger or panics the system, so its
output should go to the console regardless of the witness(4) output channel
configuration.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agofd: switch fget_unlocked to atomic_fcmpset
mjg [Sun, 5 Feb 2017 01:40:27 +0000 (01:40 +0000)]
fd: switch fget_unlocked to atomic_fcmpset

7 years agoUse ssize_t instead of uint32_t to prevent warnings about a comparison
imp [Sun, 5 Feb 2017 01:20:39 +0000 (01:20 +0000)]
Use ssize_t instead of uint32_t to prevent warnings about a comparison
with different signs. Due to the promotion rules, this would only
happen on 32-bit platforms.

7 years agoAdd the ability to dump log pages directly in binary to stdout.
imp [Sun, 5 Feb 2017 00:55:07 +0000 (00:55 +0000)]
Add the ability to dump log pages directly in binary to stdout.
Update man page to include this flag, and an example of dumping a
vendor-specific page while I'm here.

7 years agoAdd some descriptions to the man page for the supported log pages as
imp [Sun, 5 Feb 2017 00:45:02 +0000 (00:45 +0000)]
Add some descriptions to the man page for the supported log pages as
well as the new wdc commands. Make wdc be an alias for hgst when
specifying the vendor to use to interpret the page.

7 years agoImplement atomic_fcmpset_*() for RISC-V.
br [Sun, 5 Feb 2017 00:32:12 +0000 (00:32 +0000)]
Implement atomic_fcmpset_*() for RISC-V.

Requested by: mjg
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9447

7 years ago[net80211] fix quiet_duration parameter to match what is provided in the manpage.
adrian [Sat, 4 Feb 2017 20:57:12 +0000 (20:57 +0000)]
[net80211] fix quiet_duration parameter to match what is provided in the manpage.

7 years agoFix off by one error that truncated the serial number for filenames.
imp [Sat, 4 Feb 2017 20:43:54 +0000 (20:43 +0000)]
Fix off by one error that truncated the serial number for filenames.

7 years agoFix a typo in usage string for unimplemented command.
imp [Sat, 4 Feb 2017 20:43:45 +0000 (20:43 +0000)]
Fix a typo in usage string for unimplemented command.

7 years agoFix some more overly long lines, whitespace and other bugs according to
marius [Sat, 4 Feb 2017 19:35:38 +0000 (19:35 +0000)]
Fix some more overly long lines, whitespace and other bugs according to
style(9) as well as spelling in comments.

7 years agoStyle, use tab after #define.
kib [Sat, 4 Feb 2017 19:16:19 +0000 (19:16 +0000)]
Style, use tab after #define.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 years agoDelete duplicate break.
sbruno [Sat, 4 Feb 2017 18:25:09 +0000 (18:25 +0000)]
Delete duplicate break.

7 years agoFix bugs found by Coverity in decryptcore(8) and savecore(8):
def [Sat, 4 Feb 2017 14:10:16 +0000 (14:10 +0000)]
Fix bugs found by Coverity in decryptcore(8) and savecore(8):
- Perform final decryption and write decrypted data in case of non-block aligned
input data;
- Use strlcpy(3) instead of strncpy(3) to verify if paths aren't too long;
- Check errno after calling unlink(2) instead of calling stat(2) in order to
verify if a decrypted core was created by a child process;
- Free dumpkey.

Reported by: Coverity, cem, pfg
Suggested by: cem
CID: 1366936136694213669511366952
Approved by: pjd (mentor)

7 years agoDefine the vm_ooffset_t and vm_pindex_t types as machine-independend.
kib [Sat, 4 Feb 2017 12:26:38 +0000 (12:26 +0000)]
Define the vm_ooffset_t and vm_pindex_t types as machine-independend.

The types are for the byte offset and page index in vm object.  They
are similar to off_t, which is defined as 64bit MI integer.  Using MI
definitions will allow to provide consistent MD values of vm
object-related maximum sizes.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRevert r313037
jah [Sat, 4 Feb 2017 06:24:49 +0000 (06:24 +0000)]
Revert r313037

The switch to get_pcpu() in MI code seems to cause hangs on MIPS.
Back out until we can get a better idea of what's happening there.

Reported by: kan, lidl

7 years agoSwitch hastctl and hastd to libmd instead of openssl for sha256
allanjude [Sat, 4 Feb 2017 06:12:48 +0000 (06:12 +0000)]
Switch hastctl and hastd to libmd instead of openssl for sha256

Reviewed by: bapt, brnrd, pjd
Approved by: pjd (maintainer)
Sponsored by: ScaleEngine Inc., FOSDEM DevSummit
Differential Revision: https://reviews.freebsd.org/D9423

7 years agoImplement 5 wdc-specific nvme control options for their HGST drives:
imp [Sat, 4 Feb 2017 05:53:00 +0000 (05:53 +0000)]
Implement 5 wdc-specific nvme control options for their HGST drives:
wdc cap-diag Capture diagnostic data from drive
wdc drive-log Capture drive history data from drive
wdc get-crash-dump Retrieve firmware crash dump from drive

7 years agoMove the usage and command name lookup into functions.
imp [Sat, 4 Feb 2017 05:52:53 +0000 (05:52 +0000)]
Move the usage and command name lookup into functions.

7 years agoBack off using CPUTYPE for the moment. There's still some issues with
imp [Sat, 4 Feb 2017 05:52:51 +0000 (05:52 +0000)]
Back off using CPUTYPE for the moment. There's still some issues with
that.

7 years agoPut the arguments to aligned_alloc in the right order.
imp [Sat, 4 Feb 2017 05:52:50 +0000 (05:52 +0000)]
Put the arguments to aligned_alloc in the right order.

7 years agoOver the years, the code and comments in vm_page_startup() have diverged in
alc [Sat, 4 Feb 2017 05:23:10 +0000 (05:23 +0000)]
Over the years, the code and comments in vm_page_startup() have diverged in
one respect.  When determining how many page structures to allocate,
contrary to what the comments say, the code does not account for the
overhead of a page structure per page of physical memory.  This revision
changes the code to match the comments.

Reviewed by: kib, markj
MFC after: 6 weeks
Differential Revision: https://reviews.freebsd.org/D9081

7 years agoCheck that primary GPT header is valid before wiping partitioning.
ae [Sat, 4 Feb 2017 05:09:47 +0000 (05:09 +0000)]
Check that primary GPT header is valid before wiping partitioning.

This allows safely destroy corrupted GPT when primary header was
rewritten by some data, that do not want to destroy.

MFC after: 1 week

7 years agoRemove LOCAL_LIB_DIRS warning added in r275839.
bdrewery [Sat, 4 Feb 2017 02:15:49 +0000 (02:15 +0000)]
Remove LOCAL_LIB_DIRS warning added in r275839.

The case for which this was added, r274807, causes this warning to
always show.  LOCAL_DIRS=foo LOCAL_LIB_DIRS=foo/lib.  The only case in
which r274807 is a problem is if foo/Makefile does not contain
SUBDIR+=lib, which is a normal convention.  LOCAL_LIB_DIRS is a special
hack only to get a library into the _generic_libs list for the
'make libraries' bootstrapping phase.  The old behavior changed in
r274807 was only in head during the 10.0 cycle, so the warning was
only ever needed until release anyhow.

Reported by: ngie
MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoFix typo in variable name (_REDUNDENT_LIB_DIRS -> _REDUNDANT_LIB_DIRS)
ngie [Sat, 4 Feb 2017 01:21:48 +0000 (01:21 +0000)]
Fix typo in variable name (_REDUNDENT_LIB_DIRS -> _REDUNDANT_LIB_DIRS)

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoFix grammar in getpeereid(3)
vangyzen [Sat, 4 Feb 2017 00:37:25 +0000 (00:37 +0000)]
Fix grammar in getpeereid(3)

7 years agoPCIe HotPlug: remove tests for DL active link capability
vangyzen [Sat, 4 Feb 2017 00:34:00 +0000 (00:34 +0000)]
PCIe HotPlug: remove tests for DL active link capability

As of r313097, the HotPlug code requires the link to support
reporting of the data-link status.  Remove tests for this capability
from code that can now assume its presence.

Suggested by: jhb
Reviewed by: jhb
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9431

7 years agoFiles which implement the new random number system code for DTrace
gnn [Fri, 3 Feb 2017 22:40:13 +0000 (22:40 +0000)]
Files which implement the new random number system code for DTrace

Submitted by: Graeme Jenkinson
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoReplace the implementation of DTrace's RAND subroutine for generating
gnn [Fri, 3 Feb 2017 22:26:19 +0000 (22:26 +0000)]
Replace the implementation of DTrace's RAND subroutine for generating
low-quality random numbers with a modern implementation (xoroshiro128+)
that is capable of generating better quality randomness without compromising performance.

Submitted by: Graeme Jenkinson
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9051

7 years agoClean up documentation of AF_UNIX control messages.
jilles [Fri, 3 Feb 2017 20:33:23 +0000 (20:33 +0000)]
Clean up documentation of AF_UNIX control messages.

Document AF_UNIX control messages in unix(4) only, not split between unix(4)
and recv(2).

Also, warn about LOCAL_CREDS effective uid/gid fields, since the write could
be from a setuid or setgid program (with the explicit SCM_CREDS and
LOCAL_PEERCRED, the credentials are read at such a time that it can be
assumed that the process intends for them to be used in this context).

Reviewed by: wblock
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9298

7 years agoRe-enable an accidentally-disabled temp directory creation test.
wblock [Fri, 3 Feb 2017 20:17:54 +0000 (20:17 +0000)]
Re-enable an accidentally-disabled temp directory creation test.

Reported by: bjk
Sponsored by: iXsystems

7 years agoDecromulate an extra "if".
wblock [Fri, 3 Feb 2017 19:21:28 +0000 (19:21 +0000)]
Decromulate an extra "if".

Reported by: rpokala
Sponsored by: iXsystems

7 years agoClarify some option descriptions, add a line of text to makeman to
wblock [Fri, 3 Feb 2017 19:09:46 +0000 (19:09 +0000)]
Clarify some option descriptions, add a line of text to makeman to
add the slightest hint of a shade of a clue of what it does.

Sponsored by: iXsystems

7 years agoFix VIMAGE-related bugs in TFO. The autokey callout vnet context was
pkelsey [Fri, 3 Feb 2017 17:02:57 +0000 (17:02 +0000)]
Fix VIMAGE-related bugs in TFO.  The autokey callout vnet context was
not being initialized, and the per-vnet fastopen context was only
being initialized for the default vnet.

PR: 216613
Reported by: Alex Deiter <alex dot deiter at gmail dot com>
MFC after: 1 week

7 years agoloader: libefi/env.c warnings in arm build
tsoome [Fri, 3 Feb 2017 16:39:10 +0000 (16:39 +0000)]
loader: libefi/env.c warnings in arm build

The arm build has revealed some of the warnings, the fix for CHAR16
warning is to switch the warning off for env.c (same as for efinet.c).

For error code we need to use macro.

Reported by: gjb
Reviewed by: imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D9422

7 years agonative-xtools: Add missing readelf.
bdrewery [Fri, 3 Feb 2017 16:27:23 +0000 (16:27 +0000)]
native-xtools: Add missing readelf.

The switch to elftoolchain's readelf in r280859 caused native-xtools
to no longer build readelf.  This fixes poudriere builds not using
a native readelf when expected.

Reported by: strejda on freenode
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoReplace Cyrillic characters with Latin (normal) ones.
wblock [Fri, 3 Feb 2017 16:21:30 +0000 (16:21 +0000)]
Replace Cyrillic characters with Latin (normal) ones.

PR: 216534
Submitted by: eborisch+FreeBSD@gmail.com
MFC after: 1 week
Sponsored by: iXsystems

7 years agoresolvconf: restore RESTARTCMD=, CMD1=, CMD2= and sed pattern as before.
pfg [Fri, 3 Feb 2017 16:08:58 +0000 (16:08 +0000)]
resolvconf: restore RESTARTCMD=, CMD1=, CMD2= and sed pattern as before.

r312992 removed RESTARTCMD_WITH_ARG for @RESTARTCMD something@ but
reverted the sed to be '@RESTARTCMD \(.*\)@' and RESTARTCMD= to be
the value of RESTARTCMD_WITH_ARG.

Submitted by: Guy Yur
x_MFC with: r312992

7 years agoFor i386, remove config options CPU_DISABLE_CMPXCHG, CPU_DISABLE_SSE
kib [Fri, 3 Feb 2017 12:51:40 +0000 (12:51 +0000)]
For i386, remove config options CPU_DISABLE_CMPXCHG, CPU_DISABLE_SSE
and device npx.

This means that FPU is always initialized and handled when available,
and SSE+ register file and exception are handled when available.  This
makes the kernel FPU code much easier to maintain by the cost of
slight bloat for CPUs older than 25 years.

CPU_DISABLE_CMPXCHG outlived its usefulness, see the removed comment
explaining the original purpose.

Suggested by and discussed with: bde
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

7 years agoFix the comment showing the meaning of the first argument to sigprocmask.
andrew [Fri, 3 Feb 2017 11:51:06 +0000 (11:51 +0000)]
Fix the comment showing the meaning of the first argument to sigprocmask.

Sponsored by: ABT Systems Ltd

7 years agoRemove an old use of _ARM_ARCH_6, we are moving to using the standard
andrew [Fri, 3 Feb 2017 11:47:57 +0000 (11:47 +0000)]
Remove an old use of _ARM_ARCH_6, we are moving to using the standard
__ARM_ARCH >= 6 spelling.

Sponsored by: ABT Systems Ltd

7 years agoOnly define atomic_fcmpset_long in the kernel. We may include
andrew [Fri, 3 Feb 2017 10:04:17 +0000 (10:04 +0000)]
Only define atomic_fcmpset_long in the kernel. We may include
machine/atomic.h in userspace, however atomic_fcmpset_32 is unimplemented
there.

Sponsored by: ABT Systems Ltd

7 years ago[net80211] don't update quiet time counter values every probe request.
adrian [Fri, 3 Feb 2017 06:04:06 +0000 (06:04 +0000)]
[net80211] don't update quiet time counter values every probe request.

The quiet time counter update is happening each time the IE is added,
which also means it happens for each quiet time IE addition to the probe
response.

Only update the countdown if we request ie (ie, beacon updates.)

7 years ago[ath_hal] [ar9300] link in the CAC enable/diable methods and expose it via the HAL.
adrian [Fri, 3 Feb 2017 05:15:35 +0000 (05:15 +0000)]
[ath_hal] [ar9300] link in the CAC enable/diable methods and expose it via the HAL.

7 years ago[ath_hal] prepare for CAC quiet time.
adrian [Fri, 3 Feb 2017 05:15:08 +0000 (05:15 +0000)]
[ath_hal] prepare for CAC quiet time.

To support DFS, the NIC needs to be very quiet during this time.
No transmissions including ACKs are allowed.

This is just the initial HAL glue.

7 years ago[ath_hal] [ar9300] initial radar decode for AR9380 and later chips.
adrian [Fri, 3 Feb 2017 03:57:06 +0000 (03:57 +0000)]
[ath_hal] [ar9300] initial radar decode for AR9380 and later chips.

7 years agoSync the x86 dis_tables.c with upstream.
markj [Fri, 3 Feb 2017 03:22:47 +0000 (03:22 +0000)]
Sync the x86 dis_tables.c with upstream.

This corresponds to the following illumos issues:

  5755 want support for Intel FMA instrs
  5756 want support for Intel BMI1 instrs
  5757 want support for Intel BMI2 instrs
  5758 want support for Intel AVX2 instrs
  7204 Want broadwell rdseed and adx support
  7208 Want stac/clac disasm support
  7733 Need SHA Instruction dis support
  7756 dis can't handle x86 SSE 3 instructions
  7757 want avx2 disasm tests
  7758 want SSE 4.1 disasm tests

MFC after: 2 weeks

7 years agoEnsure that the passthrough request will fit in MAXPHYS bytes after it
imp [Thu, 2 Feb 2017 23:04:06 +0000 (23:04 +0000)]
Ensure that the passthrough request will fit in MAXPHYS bytes after it
has been rounded to full pages. This avoids a panic in
vm_fault_quick_hold_pages due to this off-by-one error passing one
page too many into vmapbuf.

7 years agoUse aligned buffer for the firmware data. Otherwise, when loading a
imp [Thu, 2 Feb 2017 23:04:00 +0000 (23:04 +0000)]
Use aligned buffer for the firmware data. Otherwise, when loading a
MAXPHYS bytes of data, the I/O would require MAXPHYS + PAGE_SIZE worth
of pages to do the I/O and we'd hit an assertion in
vm_fault_quick_hold_pages unless MAXPHYS was larger than 1M +
PAGE_SIZE.

7 years agoUse ANSI definitions for some i386 functions.
kib [Thu, 2 Feb 2017 22:02:10 +0000 (22:02 +0000)]
Use ANSI definitions for some i386 functions.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoTry to fix the old "he capability is stupid" bug in gettytab(5)/getty(8)
danfe [Thu, 2 Feb 2017 20:30:50 +0000 (20:30 +0000)]
Try to fix the old "he capability is stupid" bug in gettytab(5)/getty(8)

There is one capability explicitly documented in gettytab(5) as stupid: he.
And it is indeed.  It was meant to facilitate system hostname modification,
but is hardly usable in practice because it allows very limited editing
(e.g., it depends on a particular hostname length, making it non-generic).

Replace it with simple implementation that treats ``he'' as POSIX extended
regular expression which is matched against the hostname.  If there are no
parenthesized subexpressions in the pattern, entire matched string is used
as the final hostname.  Otherwise, use the first matched subexpression.
If the pattern does not match, the original hostname is not modified.

Using regex(3) gives more freedom, does not complicate the code very much,
and makes a lot more sense, in turn making ``he'' less stupid and actually
useful (e.g., it is now possible to obtain node or domain names from the
original hostname string, without knowing it in advance).

Reviewed by: jilles, manpages (wblock)
Approved by: jilles (implied)
Differential Revision: https://reviews.freebsd.org/D9244