freebsd.git
8 years agopreload_search_info: make sure mod is set
royger [Fri, 21 Aug 2015 15:57:57 +0000 (15:57 +0000)]
preload_search_info: make sure mod is set

Add a check to preload_search_info to make sure mod is set. Most of the
callers of preload_search_info don't check that the mod parameter is
set, which can cause page faults. While at it, remove some now unnecessary
checks before calling preload_search_info.

Sponsored by: Citrix Systems R&D
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D3440

8 years agoxen: allow disabling PV disks and nics
royger [Fri, 21 Aug 2015 15:53:08 +0000 (15:53 +0000)]
xen: allow disabling PV disks and nics

Introduce two new loader tunnables that can be used to disable PV disks and
PV nics at boot time. They default to 0 and should be set to 1 (or any
number different than 0) in order to disable the PV devices:

hw.xen.disable_pv_disks=1
hw.xen.disable_pv_nics=1

In /boot/loader.conf will disable both PV disks and nics.

Sponsored by: Citrix Systems R&D
Tested by: Karl Pielorz <kpielorz_lst@tdx.co.uk>
MFC after: 1 week

8 years agoMark bsd.info.mk as depreciated
bapt [Fri, 21 Aug 2015 15:30:50 +0000 (15:30 +0000)]
Mark bsd.info.mk as depreciated

8 years agovt_cpulogos: Resize all terms/windows when tearing down logos
cem [Fri, 21 Aug 2015 15:21:56 +0000 (15:21 +0000)]
vt_cpulogos: Resize all terms/windows when tearing down logos

PR: 202288 (partial)
Tested by: Jakob Alvermark
Reviewed by: ed
Approved by: markj (mentor)
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D3388

8 years agoDocument bsd.progs.mk, including its status as being strongly
imp [Fri, 21 Aug 2015 15:15:22 +0000 (15:15 +0000)]
Document bsd.progs.mk, including its status as being strongly
discouraged and that it will be going away as soon as is practicable.

8 years agoAutomatically disable x2APIC mode on SandyBridge Lenovo machines. I
kib [Fri, 21 Aug 2015 15:13:25 +0000 (15:13 +0000)]
Automatically disable x2APIC mode on SandyBridge Lenovo machines.  I
believe that the bug only affects mobile CPUs, at least I did not see
other reports, but it is impossible to detect it in madt_setup_local().

While there, reduce duplication in the information strings printed
when x2APIC is auto-disabled, and do not print the line when user
manually override the setting.

Tested and reviewed by:   royger (previous version)
Sponsored by: The FreeBSD Foundation

8 years agoFix err pointer not initialized to NULL resulting
bapt [Fri, 21 Aug 2015 14:28:14 +0000 (14:28 +0000)]
Fix err pointer not initialized to NULL resulting

Reported by: "O. Hartmann" <ohartman@zedat.fu-berlin.de>

8 years agoTurn off gcc's uninitialized warnings for this code. They
imp [Fri, 21 Aug 2015 14:15:54 +0000 (14:15 +0000)]
Turn off gcc's uninitialized warnings for this code. They
can be fixed, but really do appear to be false alarms.

8 years agoFix typo in regression test
bapt [Fri, 21 Aug 2015 11:25:42 +0000 (11:25 +0000)]
Fix typo in regression test

8 years agoFix /home symlink creation
bapt [Fri, 21 Aug 2015 09:28:20 +0000 (09:28 +0000)]
Fix /home symlink creation

Add regression test about it

8 years agotry to fix lor between z_teardown_lock and spa_namespace_lock
avg [Fri, 21 Aug 2015 08:17:44 +0000 (08:17 +0000)]
try to fix lor between z_teardown_lock and spa_namespace_lock

The lock order reversal and a resulting deadlock were introduced
in r285021 / D2865.  The problem is that zfs_register_callbacks() calls
dsl_prop_get_integer() that has to acquire spa_namespace_lock.
At the same time, spa_config_sync() is called with spa_namespace_lock
held and then it performs ZFS vnode operations that acquire
z_teardown_lock in the reader mode.

So, fix the problem by using dsl_prop_get_int_ds() instead of
dsl_prop_get_integer().  The former does not need to look up
the pool and the dataset by name.

Reported by: many
Reviewed by: delphij
Tested by: delphij, Jens Schweikhardt <schweikh@schweikhardt.net>
MFC after: 5 days
X-MFC with: r285021

8 years agofix standalone build of zfs module
avg [Fri, 21 Aug 2015 08:06:18 +0000 (08:06 +0000)]
fix standalone build of zfs module

Not sure if this is a proper fix, but it does the job.

8 years agofix a mismerge in r286539 (MFV 286538: 5562 ZFS sa_handle's violate...)
avg [Fri, 21 Aug 2015 08:04:56 +0000 (08:04 +0000)]
fix a mismerge in r286539 (MFV 286538: 5562 ZFS sa_handle's violate...)

PR: 202358
X-MFC with: r286539
X-MFC attn: mav

8 years agoFix useradd regression:
bapt [Fri, 21 Aug 2015 07:09:53 +0000 (07:09 +0000)]
Fix useradd regression:

Readd the function to create the parents home directory if it does not exists.
if it is only a directory at the top level of the hierarchy symlink it into /usr
as it used to be done before.

Reported by: kevlo, adrian

8 years agoDon't truncate cursor arithmetic to 16 bits.
ed [Fri, 21 Aug 2015 06:30:13 +0000 (06:30 +0000)]
Don't truncate cursor arithmetic to 16 bits.

When updating the row number when the cursor position escape sequence is
issued, we should make sure to store the intermediate result in a 32-bit
integer. If we fail to do this, the cursor may be set above the origin
region, which is bad.

This could cause libteken to crash when INVARIANTS is enabled, due to
the strict set of assertions that libteken has.

PR: 202540
Reported by: kcwu csie org
MFC after: 1 month

8 years agoEditing pass on procctl.2
bjk [Fri, 21 Aug 2015 02:42:14 +0000 (02:42 +0000)]
Editing pass on procctl.2

Spell "descendant" correctly.

Grammar fixes.

Use correct width argument to Bl.

Use Po and Pc to avoid leaving a dangling '(' on the end of a line.

8 years agoAdd initial boot support for e500mc and e5500.
jhibbits [Fri, 21 Aug 2015 02:41:35 +0000 (02:41 +0000)]
Add initial boot support for e500mc and e5500.

* Since r257190 the kernel must actually be loaded at a 64MB boundary, not 16MB.
* Don't program HID1 register on e500mc or e5500, they don't have this SPR.
* Set proper HID0 defaults for these new architectures.

There is still more work to be done for the various SoCs, and the PMAP code
still needs to be extended to 36-bit paddr, coming soon.

Obtained from: Semihalf
Sponsored by: Alex Perez/Inertial Computing

8 years agoSimplify the PCI bus scanning logic.
jhibbits [Fri, 21 Aug 2015 02:22:51 +0000 (02:22 +0000)]
Simplify the PCI bus scanning logic.

Rather than special casing on PCIC_BRIDGE || PCIC_PROCESSOR, allow all
HDRTYPE_BRIDGE types.

Obtained from: Semihalf
Sponsored by: Alex Perez/Intertial Computing

8 years agoIf process becomes reaper (procctl(PROC_REAP_ACQUIRE)) while already
kib [Thu, 20 Aug 2015 22:44:26 +0000 (22:44 +0000)]
If process becomes reaper (procctl(PROC_REAP_ACQUIRE)) while already
having some children, the children' reaper is not reset to the parent.
This allows for the situation where reaper has children but not
descendands and the too strict asserts in the reap_status() fire.

Remove the wrong asserts, add some clarification for the situation to
the procctl(2) REAP_STATUS.

Reported and tested by: feld
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoRemove reference to non-existent kern_openat(9).
bdrewery [Thu, 20 Aug 2015 22:14:43 +0000 (22:14 +0000)]
Remove reference to non-existent kern_openat(9).

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agosh: Avoid negative character values from $'\Uffffffff' etc.
jilles [Thu, 20 Aug 2015 22:05:55 +0000 (22:05 +0000)]
sh: Avoid negative character values from $'\Uffffffff' etc.

The negative value was not expected and generated the low 8 bits as a byte,
which may be an invalid character encoding.

The final shift in creating the negative value was undefined as well.

Make the temporary variable unsigned to fix this.

8 years agoAppease gcc-4.2
pfg [Thu, 20 Aug 2015 21:49:59 +0000 (21:49 +0000)]
Appease gcc-4.2

It needs to die, but it resists mipsteriously.

Submitted by: Oliver Pinter

8 years agosh: Add test for $'\u' without any digits.
jilles [Thu, 20 Aug 2015 21:31:36 +0000 (21:31 +0000)]
sh: Add test for $'\u' without any digits.

It is likely that $'\uXXXX' and $'\UXXXXXXXX' will allow fewer digits in
future. However, no digits at all should still be disallowed.

8 years agoPrevent ticks rollover from preventing vm_lowmem event
rstone [Thu, 20 Aug 2015 20:28:51 +0000 (20:28 +0000)]
Prevent ticks rollover from preventing vm_lowmem event

Currently vm_pageout_scan() uses a ticks-based scheme to rate-limit
the number of times that the vm_lowmem event will happen.  However
if no events happen for long enough for ticks to roll over, this
leaves us in a long window in which vm_lowmem events will not
happen.

Replace the use of ticks with time_t to prevent rollover from ever
being an issue.

Reviewed by: ian
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D3439

8 years agoRemove code left over from the armv4 days. On armv4, cache maintenance
ian [Thu, 20 Aug 2015 19:39:15 +0000 (19:39 +0000)]
Remove code left over from the armv4 days.  On armv4, cache maintenance
operations always had to be aligned and sized to cache lines.  On armv6
and later, cache maintenance operates on a cache line if any part of
the line is referenced in the operation, so we don't need extra code to
align the edges of the sync range.

8 years agoMinor comment and style fixes, no functional change.
ian [Thu, 20 Aug 2015 19:14:16 +0000 (19:14 +0000)]
Minor comment and style fixes, no functional change.

Submitted by: Svatopluk Kraus <onwahe@gmail.com>

8 years agoThe flags -mno-aes -mno-avx only exist for clang, not gcc, so
imp [Thu, 20 Aug 2015 18:31:05 +0000 (18:31 +0000)]
The flags -mno-aes -mno-avx only exist for clang, not gcc, so
add them only to the clang CFLAGS.

8 years agoAdd link for rw_unlock(9) to rwlock(9).
bdrewery [Thu, 20 Aug 2015 18:22:06 +0000 (18:22 +0000)]
Add link for rw_unlock(9) to rwlock(9).

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agoRevamp camcontrol(8) fwdownload support and add the opcodes subcommand.
ken [Thu, 20 Aug 2015 16:07:51 +0000 (16:07 +0000)]
Revamp camcontrol(8) fwdownload support and add the opcodes subcommand.

The significant changes and bugs fixed here are:

1. Fixed a bug in the progress display code:

   When the user's filename is too big, or his terminal width is too
   small, the progress code could wind up using a negative number for
   the length of the "stars" that it uses to indicate progress.

   This negative value was assigned to an unsigned variable, resulting
   in a very large positive value.

   The result is that we wound up writing garbage from memory to the
   user's terminal.

   With an 80 column terminal, a file name length of more than 35
   characters would generate this problem.

   To address this, we now set a minimum progress bar length, and
   truncate the user's file name as needed.

   This has been tested with large filenames and small terminals, and
   at least produces reasonable results.  If the terminal is too
   narrow, the progress display takes up an additional line with each
   update, but this is more user friendly than writing garbage to the
   tty.

2. SATA drives connected via a SATA controller didn't have SCSI Inquiry
   data populated in struct cam_device.  This meant that the code in
   fw_get_vendor() in fwdownload.c would try to match a zero-length
   vendor ID, and so return the first entry in the vendor table.  (Which
   used to be HITACHI.)  Fixed by grabbing identify data, passing the
   identify buffer into fw_get_vendor(), and matching against the model
   name.

3. SATA drives connected via a SAS controller do have Inquiry data
   populated.  The table included a couple of entries -- "ATA ST" and
   "ATA HDS", intended to handle Seagate and Hitachi SATA drives attached
   via a SAS controller.  SCSI to ATA translation layers use a vendor
   ID of "ATA" (which is standard), and then the model name from the ATA
   identify data as the SCSI product name when they are returning data on
   SATA disks.  The cam_strmatch code will match the first part of the
   string (because the length it is given is the length of the vendor,
   "ATA"), and return 0 (i.e. a match).  So all SATA drives attached to
   a SAS controller would be programmed using the Seagate method
   (WRITE BUFFER mode 7) of SCSI firmware downloading.

4. Issue #2 above covered up a bug in fw_download_img() -- if the
   maximum packet size in the vendor table was 0, it tried to default
   to a packet size of 32K.  But then it didn't actually succeed in
   doing that, because it set the packet size to the value that was
   in the vendor table (0).  Now that we actually have ATA attached
   drives fall use the VENDOR_ATA case, we need a reasonable default
   packet size.  So this is fixed to properly set the default packet size.

5. Add support for downloading firmware to IBM LTO drives, and add a
   firmware file validation method to make sure that the firmware
   file matches the drive type.  IBM tape drives include a Load ID and
   RU name in their vendor-specific VPD page 0x3.  Those should match
   the IDs in the header of the firmware file to insure that the
   proper firmware file is loaded.

6. This also adds a new -q option to the camcontrol fwdownload
   subcommand to suppress informational output.  When -q is used in
   combination with -y, the firmware upgrade will happen without
   prompting and without output except if an error condition occurs.

7. Re-add support for printing out SCSI inquiry information when
   asking the user to confirm that they want to download firmware, and
   add printing of ATA Identify data if it is a SATA disk.  This was
   removed in r237281 when support for flashing ATA disks was added.

8. Add a new camcontrol(8) "opcodes" subcommand, and use the
   underlying code to get recommended timeout values for drive
   firmware downloads.

   Many SCSI devices support the REPORT SUPPORTED OPERATION CODES
   command, and some support the optional timeout descriptor that
   specifies nominal and recommended timeouts for the commands
   supported by the device.

   The new camcontrol opcodes subcommand allows displaying all
   opcodes supported by a drive, information about which fields
   in a SCSI CDB are actually used by a given SCSI device, and the
   nominal and recommended timeout values for each command.

   Since firmware downloads can take a long time in some devices, and
   the time varies greatly between different types of devices, take
   advantage of the infrastructure used by the camcontrol opcodes
   subcommand to determine the best timeout to use for the WRITE
   BUFFER command in SCSI device firmware downloads.

   If the device recommends a timeout, it is likely to be more
   accurate than the default 50 second timeout used by the firmware
   download code.  If the user specifies a timeout, it will override
   the default or device recommended timeout.  If the device doesn't
   support timeout descriptors, we fall back to the default.

9. Instead of downloading firmware to SATA drives behind a SAS controller
   using WRITE BUFFER, use the SCSI ATA PASS-THROUGH command to compose
   an ATA DOWNLOAD MICROCODE command and it to the drive.  The previous
   version of this code attempted to send a SCSI WRITE BUFFER command to
   SATA drives behind a SAS controller.  Although that is part of the
   SAT-3 spec, it doesn't work with the parameters used with LSI
   controllers at least.

10.Add a new mechanism for making common ATA passthrough and
   ATA-behind-SCSI passthrough commands.

   The existing camcontrol(8) ATA command mechanism checks the device
   type on every command executed.  That works fine for individual
   commands, but is cumbersome for things like a firmware download
   that send a number of commands.

   The fwdownload code detects the device type up front, and then
   sends the appropriate commands.

11.In simulation mode (-s), if the user specifies the -v flag, print out
   the SCSI CDB or ATA registers that would be sent to the drive.  This will
   aid in debugging any firmware download issues.

sbin/camcontrol/fwdownload.c:
Add a device type to the fw_vendor structure, so that we can
specify different download methods for different devices from the
same vendor.  In this case, IBM hard drives (from when they
still made hard drives) and tape drives.

Add a tur_status field to the fw_vendor structure so that we can
specify whether the drive to be upgraded should be ready, not
ready, or whether it doesn't matter.  Add the corresponding
capability in fw_download_img().

Add comments describing each of the vendor table fields.

Add HGST and SmrtStor to the supported SCSI vendors list.

In fw_get_vendor(), look at ATA identify data if we have a SATA
device to try to identify what the drive vendor is.

Add IBM firmware file validation.  This gets VPD page 0x3, and
compares the Load ID and RU name in the page to the values
included in the header.  The validation code will refuse to load
a firmware file if the values don't match.  This does allow the
user to attempt a downgrade; whether or not it succeeds will
likely depend on the drive settings.

Add a -q option, and disable all informative output
(progress bars, etc.) when this is enabled.

Re-add the inquiry in the confirmation dialog so the user has
a better idea of which device he is talking to.  Add support for
displaying ATA identify data.

Don't automatically disable confirmation in simulation (-s) mode.
This allows the user to see the inquiry or identify data in the
dialog, and see exactly what they would see when the command
actually runs.  Also, in simulation mode, if the user specifies
the -v flag, print out the SCSI CDB or ATA registers that would
be sent to the drive.  This will aid in debugging any firmware
download issues.

Add a timeout field and timeout type to the firmware download
vendor table.  This allows specifying a default timeout and allows
specifying whether we should attempt to probe for a recommended
timeout from the drive.

Add a new fuction, fw_get_timeout(), that will determine
which timeout to use for the WRITE BUFFER command.  If the
user specifies a timeout, we always use that.  Otherwise,
we will use the drive recommended timeout, if available,
and fall back to the default when a drive recommended
timeout isn't available.

When we prompt the user, tell him what timeout we're going
to use, and the source of the timeout.

Revamp the way SATA devices are handled.

In fwdownload(), use the new get_device_type() function to
determine what kind of device we're talking to.

Allow firmware downloads to any SATA device, but restrict
SCSI downloads to known devices.  (The latter is not a
change in behavior.)

Break out the "ready" check from fw_download_img() into a
new subfunction, fw_check_device_ready().  This sends the
appropriate command to the device in question -- a TEST
UNIT READY or an IDENTIFY.  The IDENTIFY for SATA devices
  a SAT layer is done using the SCSI ATA PASS-THROUGH
command.

Use the new build_ata_cmd() function to build either a SCSI or
ATA I/O CCB to issue the DOWNLOAD MICROCODE command to SATA
devices.  build_ata_cmd() figures looks at the devtype argument
and fills in the correct CCB type and CDB or ATA registers.

Revamp the vendor table to remove the previous
vendor-specific ATA entries and use a generic ATA vendor
placeholder.  We currently use the same method for all ATA
drives, although we may have to add vendor-specific
behavior once we test this with more drives.

sbin/camcontrol/progress.c:
In progress_draw(), make barlength a signed value so that
we can easily detect a negative value.

If barlength (the length of the progress bar) would wind up
negative due to a small TTY width or a large filename,
set the bar length to the new minimum (10 stars) and
truncate the user's filename.  We will truncate it down to
0 characters if necessary.

Calculate a new prefix_len variable (user's filename length)
and use it as the precision when printing the filename.

sbin/camcontrol/camcontrol.c:
Implement a new camcontrol(8) subcommand, "opcodes".  The
opcodes subcommand allows displaying the entire list of
SCSI commands supported by a device, or details on an
individual command.  In either case, it can display
nominal and recommended timeout values.

Add the scsiopcodes() function, which calls the new
scsigetopcodes() function to fetch opcode data from a
drive.

Add two new functions, scsiprintoneopcode() and
scsiprintopcodes(), which print information about one
opcode or all opcodes, respectively.

Remove the get_disk_type() function.  It is no longer used.

Add a new function, dev_has_vpd_page(), that fetches the
supported INQUIRY VPD list from a device and tells the
caller whether the requested VPD page is available.

Add a new function, get_device_type(), that returns a more
precise device type than the old get_disk_type() function.
The get_disk_type() function only distinguished between
SCSI and ATA devices, and SATA devices behind a SCSI to ATA
translation layer were considered to be "SCSI".

get_device_type() offers a third type, CC_DT_ATA_BEHIND_SCSI.
We need to know this to know whether to attempt to send ATA
passthrough commands.  If the device has the ATA
Information VPD page (0x89), then it is an ATA device
behind a SCSI to ATA translation layer.

Remove the type argument from the fwdownload() subcommand.

Add a new function, build_ata_cmd(), that will take one set
of common arguments and build either a SCSI or ATA I/O CCB,
depending on the device type passed in.

sbin/camcontrol/camcontrol.h:
Add a prototype for scsigetopcodes().

Add a new enumeration, camcontrol_devtype.

Add prototypes for dev_has_vpd_page(), get_device_type()
and build_ata_cmd().

Remove the type argument from the fwdownload() subcommand.

sbin/camcontrol/camcontrol.8
Explain that the fwdownload subcommand will use the drive
recommended timeout if available, and that the user can
override the timeout.

Document the new opcodes subcommand.

Explain that we will attempt to download firmware to any
SATA device.

Document supported SCSI vendors, and models tested if known.

Explain the commands used to download firmware for the
three different drive and controller combinations.

Document that the -v flag in simulation mode for the fwdownload
subcommand will print out the SCSI CDBs or ATA registers that would
be used.

sys/cam/scsi/scsi_all.h:
Add new bit definitions for the one opcode descriptor for
the REPORT SUPPORTED OPCODES command.

Add a function prototype for scsi_report_supported_opcodes().

sys/cam/scsi/scsi_all.c:
Add a new CDB building function, scsi_report_supported_opcodes().

Sponsored by: Spectra Logic
MFC after: 1 week

8 years agoAdd ATF functional tests for fstyp(8). No ZFS or GELI tests yet.
asomers [Thu, 20 Aug 2015 15:37:47 +0000 (15:37 +0000)]
Add ATF functional tests for fstyp(8).  No ZFS or GELI tests yet.

Reviewed by: trasz, ngie
MFC after: 2 weeks
Sponsored by: SpectraLogic
Differential Revision: https://reviews.freebsd.org/D2801

8 years agoHandle the conditional decoding of execve() argument and environment
jhb [Thu, 20 Aug 2015 14:51:11 +0000 (14:51 +0000)]
Handle the conditional decoding of execve() argument and environment
arrays generically rather than duplicating a hack in all of the backends.
- Add two new system call argument types and use them instead of StringArray
  for the argument and environment arguments execve and linux_execve.
- Honor the -a/-e flags in the handling of these new types.
- Instead of printing "<missing argument>" when the decoding is disabled,
  print the raw pointer value.

8 years agoRework the argv and env string fetching for execve to be more robust.
jhb [Thu, 20 Aug 2015 14:33:30 +0000 (14:33 +0000)]
Rework the argv and env string fetching for execve to be more robust.
Before truss would fetch 100 string pointers and happily walk off the end
of the array if it never found a NULL.  This also means for a short argv
list it could fail entirely if the 100 string pointers spanned into an
unmapped page.

Instead, fetch page-aligned blocks of string pointers in a loop fetching
each string until a NULL is found.

While here, make use of the open memstream file descriptor instead of
allocating a temporary array.  This allows us to fetch each string once
instead of twice.

8 years agoTypo.
kib [Thu, 20 Aug 2015 13:37:08 +0000 (13:37 +0000)]
Typo.

8 years agoAdd the definitions of __infinity and __nan.
andrew [Thu, 20 Aug 2015 13:11:52 +0000 (13:11 +0000)]
Add the definitions of __infinity and __nan.

8 years agoAdd the kernel support for minidumps on arm64.
andrew [Thu, 20 Aug 2015 12:49:56 +0000 (12:49 +0000)]
Add the kernel support for minidumps on arm64.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3318

8 years agoRemove pmap_kenter from pmap.h, the function doesn't exist.
andrew [Thu, 20 Aug 2015 12:07:44 +0000 (12:07 +0000)]
Remove pmap_kenter from pmap.h, the function doesn't exist.

8 years agoAdd pmap_get_tables to get the page tables for a given virtual address. This
andrew [Thu, 20 Aug 2015 12:05:42 +0000 (12:05 +0000)]
Add pmap_get_tables to get the page tables for a given virtual address. This
will be used for minidump support.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years ago* Split allocation and table linking for lle's.
melifaro [Thu, 20 Aug 2015 12:05:17 +0000 (12:05 +0000)]
* Split allocation and table linking for lle's.
  Before that, the logic besides lle_create() was the following:
  return existing if found, create if not. This behaviour was error-prone
  since we had to deal with 'sudden' static<>dynamic lle changes.
  This commit fixes bunch of different issues like:
  - refcount leak when lle is converted to static.
    Simple check case:
    console 1:
    while true;
      do for i in `arp -an|awk '$4~/incomp/{print$2}'|tr -d '()'`;
        do arp -s $i 00:22:44:66:88:00 ; arp -d $i;
      done;
    done
   console 2:
    ping -f any-dead-host-in-L2
   console 3:
    # watch for memory consumption:
    vmstat -m | awk '$1~/lltable/{print$2}'
  - possible problems in arptimer() / nd6_timer() when dropping/reacquiring
   lock.
  New logic explicitly handles use-or-create cases in every lla_create
  user. Basically, most of the changes are purely mechanical. However,
  we explicitly avoid using existing lle's for interface/static LLE records.
* While here, call lle_event handlers on all real table lle change.
* Create lltable_free_entry() calling existing per-lltable
  lle_free_t callback for entry deletion

8 years agoAdd the arm64 minidump header. This was missed from r286953.
andrew [Thu, 20 Aug 2015 11:26:26 +0000 (11:26 +0000)]
Add the arm64 minidump header. This was missed from r286953.

8 years agoAdd support to libkvm for reading minidumps on arm64. The kernel side is
andrew [Thu, 20 Aug 2015 11:07:51 +0000 (11:07 +0000)]
Add support to libkvm for reading minidumps on arm64. The kernel side is
missing until it can be cleaned up.

Reviewed by: jhb
Approved by: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3319

8 years agoRestore part of r274628, reverted at r286776.
mav [Thu, 20 Aug 2015 07:41:33 +0000 (07:41 +0000)]
Restore part of r274628, reverted at r286776.

Submitted by: avg

8 years agoFurther conversions from ifp->if_softc -> ic_softc.
adrian [Thu, 20 Aug 2015 05:13:54 +0000 (05:13 +0000)]
Further conversions from ifp->if_softc -> ic_softc.

8 years agoRemove some if_softc references from urtwn(4).
adrian [Thu, 20 Aug 2015 03:57:41 +0000 (03:57 +0000)]
Remove some if_softc references from urtwn(4).

The only ones that are left are in if_start, if_stop and ioctl.

Tested:

* urtwn0: MAC/BB RTL8188CUS, RF 6052 1T1R, STA mode

8 years agogetrlimit.2: Document RSS, AS/VMEM limit behavior more clearly
cem [Thu, 20 Aug 2015 00:00:15 +0000 (00:00 +0000)]
getrlimit.2: Document RSS, AS/VMEM limit behavior more clearly

Alphabetize the RLIMIT_ list while here.

Reviewed by: jilles (previous version), wblock (previous version)
Approved by: markj (mentor)
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D3433

8 years agoAdd a new exit-timeout option to watchdogd.
ian [Wed, 19 Aug 2015 21:46:12 +0000 (21:46 +0000)]
Add a new exit-timeout option to watchdogd.

Watchdogd currently disables the watchdog when it exits, such as during
rc.shutdown processing.  That leaves the system vulnerable to getting hung
or deadlocked during the shutdown part of a reboot.  For embedded systems
it's especially important that the hardware watchdog always be active.  It
can also be useful for servers that are administered remotely.

The new -x <seconds> option tells watchdogd to program the watchdog with the
given timeout just before exiting.  The -x value can be longer or shorter
than the -t normal time value, to allow for various exceptional conditions
at shutdown such as allowing extra time for buffer flushing.

The exit value is also used internally in the "failsafe" handling (which
used to just disable the watchdog), on the theory that if you're using this
option, "safe" means having the watchdog always running, not disabled.

The default is still to disable the watchdog on exit if -x is not specified.

Differential Revision: https://reviews.freebsd.org/D2556 (timed out)

8 years agocompiler-rt: update __multc3 to upstream style and variable names
emaste [Wed, 19 Aug 2015 21:23:17 +0000 (21:23 +0000)]
compiler-rt: update __multc3 to upstream style and variable names

I introduced a local copy of __multc3 in r281221, which has now been
committed upstream to compiler-rt in revision 245296. Update our version
to match the changes made there.

Sponsored by: The FreeBSD Foundation

8 years agoCheck value return from lle_create() for NULL.
melifaro [Wed, 19 Aug 2015 21:08:42 +0000 (21:08 +0000)]
Check value return from lle_create() for NULL.
This bug sneaked unnoticed in r286722.

Reported by: adrian

8 years agoEnable the watchdog driver on imx6, now that it works.
ian [Wed, 19 Aug 2015 21:04:50 +0000 (21:04 +0000)]
Enable the watchdog driver on imx6, now that it works.

8 years agoMake the imx watchdog actually work, by setting WDOG_CR_WDE (enable bit).
ian [Wed, 19 Aug 2015 20:50:31 +0000 (20:50 +0000)]
Make the imx watchdog actually work, by setting WDOG_CR_WDE (enable bit).
Also, follow the rules from watchdog(9) about what values to return in
various situations (especially, don't touch *error when asked to set a
non-zero timeout that isn't achievable on the hardware).

8 years agoAdd compatible strings for all the hardware this driver works with.
ian [Wed, 19 Aug 2015 20:31:35 +0000 (20:31 +0000)]
Add compatible strings for all the hardware this driver works with.

Also, move the READ/WRITE bus space access macros from the header into the
source file, and rename them to RD2/WR2 to make it clear they're 16-bit
accessors.  (READ/WRITE just don't seem like good names to be in a public
header file.)

8 years agowordexp(): Improve some error codes.
jilles [Wed, 19 Aug 2015 20:31:03 +0000 (20:31 +0000)]
wordexp(): Improve some error codes.

Distinguish between WRDE_BADVAL and WRDE_SYNTAX based on when the error
occurred (parsing or execution), not based on whether WRDE_UNDEF was passed.

Also, return WRDE_NOSPACE for a few more unexpected results from sh.

8 years agoino_t is unsigned, so use uintmax_t instead of intmax_t when printing it.
jhb [Wed, 19 Aug 2015 20:10:58 +0000 (20:10 +0000)]
ino_t is unsigned, so use uintmax_t instead of intmax_t when printing it.

Submitted by: bde (sort of)

8 years agoAlways use %j with an intmax_t cast to print time_t values. time_t is
jhb [Wed, 19 Aug 2015 20:09:14 +0000 (20:09 +0000)]
Always use %j with an intmax_t cast to print time_t values.  time_t is
longer than long on 32-bit platforms with a 64-bit time_t.

Inspired by: mail from bde

8 years agoVarious style and whitespace fixes.
jhb [Wed, 19 Aug 2015 20:02:03 +0000 (20:02 +0000)]
Various style and whitespace fixes.

8 years agoUse nitems().
jhb [Wed, 19 Aug 2015 19:59:42 +0000 (19:59 +0000)]
Use nitems().

8 years agoUse bool rather than _Bool for C++ compatibility.
jasone [Wed, 19 Aug 2015 18:32:12 +0000 (18:32 +0000)]
Use bool rather than _Bool for C++ compatibility.

Submitted by: Nikolai Lifanov

8 years agoIssue warning and refuse to proceed further if the configured
delphij [Wed, 19 Aug 2015 18:24:39 +0000 (18:24 +0000)]
Issue warning and refuse to proceed further if the configured
repository signature_type is unsupported by bootstrap pkg(7).

Previously, when signature_type specified an unsupported method,
the bootstrap pkg(7) would proceed like when signature_type is
"none".  MITM attackers may be able to use this vulnerability and
bypass validation and install their own versions of pkg(8).

At this time, only fingerprint and none are supported by the
bootstrap pkg(7).

FreeBSD's official pkg(8) repository uses the fingerprint method
and is therefore unaffected.

Errata candidate.

Discussed with: bapt@
Submitted by: Fabian Keil
Obtained from: ElectroBSD

8 years agoRemove a broken link.
gjb [Wed, 19 Aug 2015 17:51:03 +0000 (17:51 +0000)]
Remove a broken link.
While here, prefer https where possible.

Sponsored by: The FreeBSD Foundation

8 years agocxgbe(4): Save the flags for the last adapter-wide synchronized
np [Wed, 19 Aug 2015 15:40:03 +0000 (15:40 +0000)]
cxgbe(4):  Save the flags for the last adapter-wide synchronized
operation that was initiated successfully.  (The caller and thread are
already recorded).

MFC after: 1 week

8 years agoAdd a kern.features.cloudabi64 entry when the module is loaded to helps the
bapt [Wed, 19 Aug 2015 15:18:32 +0000 (15:18 +0000)]
Add a kern.features.cloudabi64 entry when the module is loaded to helps the
userland to be able to test is cloudabi64 is supported or not

Reviewed by: ed
Differential Revision: https://reviews.freebsd.org/D3430

8 years agoRemove debug printf.
jhibbits [Wed, 19 Aug 2015 13:23:07 +0000 (13:23 +0000)]
Remove debug printf.

8 years agoIncrease MAXCPU in ARM64
zbb [Wed, 19 Aug 2015 11:59:41 +0000 (11:59 +0000)]
Increase MAXCPU in ARM64

Increase MAXCPU number to the maximum known value the existing
hardware can support.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3405

8 years agofget_unlocked() depends on the freed struct file f_count field being
kib [Wed, 19 Aug 2015 11:53:32 +0000 (11:53 +0000)]
fget_unlocked() depends on the freed struct file f_count field being
zero.  The file_zone if no-free, but r284861 added trashing of the
freed memory.  Most visible manifestation of the issue were 'memory
modified after free' panics for the file zone, triggered from
falloc_noinstall().

Add UMA_ZONE_ZINIT flag to turn off trashing.  Mjg noted that it makes
sense to not trash freed memory for any non-free zone, which will be
done later.

Reported and tested by: pho
Discussed with: mjg
Sponsored by: The FreeBSD Foundation

8 years agoRemove redundant mp_naps from ARM64 secondary CPU start-up code
zbb [Wed, 19 Aug 2015 11:45:45 +0000 (11:45 +0000)]
Remove redundant mp_naps from ARM64 secondary CPU start-up code

The global variable has been only used for CPU startup ordering
which is not needed anyway.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3296

8 years agoAdd SMP support to GICv3 and ITS drivers
zbb [Wed, 19 Aug 2015 10:36:36 +0000 (10:36 +0000)]
Add SMP support to GICv3 and ITS drivers

Introduce supprot for SMP to GICv3 and ITS drivers.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3299

8 years agoAllow building a kernel with baked in ig4, isl and cyapa drivers.
grembo [Wed, 19 Aug 2015 09:49:29 +0000 (09:49 +0000)]
Allow building a kernel with baked in ig4, isl and cyapa drivers.

Also addresses jhb's remarks on D2811 and D3068.

PR: 202059
Differential Revision: https://reviews.freebsd.org/D3351
Reviewed by: jhb
Approved by: jhb

8 years agoFix copy&paste.
jhibbits [Wed, 19 Aug 2015 06:08:11 +0000 (06:08 +0000)]
Fix copy&paste.

8 years agoSave the registers at the correct offsets.
jhibbits [Wed, 19 Aug 2015 06:07:32 +0000 (06:07 +0000)]
Save the registers at the correct offsets.

When merging the AIM and BookE trap.c files, the offsets for BookE's setfault
inadvertantly got munged.

8 years agoAdd required foo_if.h files to SRCS to fix build errors.
ian [Wed, 19 Aug 2015 02:37:30 +0000 (02:37 +0000)]
Add required foo_if.h files to SRCS to fix build errors.

Pointed out by:       gjb
Pointy hat to:       ian

8 years agoExpand the decoding of kevent structures.
jhb [Wed, 19 Aug 2015 01:44:56 +0000 (01:44 +0000)]
Expand the decoding of kevent structures.
- Print the ident value as decimal instead of hexadecimal for filter types
  that use "small" values such as file descriptors and PIDs.
- Decode NOTE_* flags in the fflags field of kevents for several system
  filter types.

8 years agoChange the argument formatting function to use a stdio FILE object opened
jhb [Wed, 19 Aug 2015 00:49:50 +0000 (00:49 +0000)]
Change the argument formatting function to use a stdio FILE object opened
with open_memstream() to build the string for each argument.  This allows
for more complicated argument building without resorting to intermediate
malloc's, etc.

Related, the strsig*() functions no longer return allocated strings but
use a static global buffer instead.

8 years agoFix minor malloc regressions.
jasone [Wed, 19 Aug 2015 00:06:46 +0000 (00:06 +0000)]
Fix minor malloc regressions.

- Use _Bool rather than bool to resolve missing type errors in malloc_np.h.
- Fix malloc manual page #include documentation.
- Add *allocm manual pages to obsolete files.

Submitted by: jbeich

8 years ago - ANSIfy
delphij [Tue, 18 Aug 2015 22:37:25 +0000 (22:37 +0000)]
 - ANSIfy
 - Remove the redundant _PATH_RSH definition (paths.h at r96194);
 - Use pid_t for PIDs
 - Note that we are at the same level of OpenBSD's counterpart of
   revision 1.7 (r94757).

No functional changes.

MFC after: 2 weeks

8 years agoFix the use of plural in two cases that I missed on r285784.
loos [Tue, 18 Aug 2015 21:37:14 +0000 (21:37 +0000)]
Fix the use of plural in two cases that I missed on r285784.

This should cause no functional change.

8 years agoAdd the GPIO driver for the ADI Engineering RCC-VE and RCC-DFF/DFFv2.
loos [Tue, 18 Aug 2015 21:05:56 +0000 (21:05 +0000)]
Add the GPIO driver for the ADI Engineering RCC-VE and RCC-DFF/DFFv2.

This driver allows read the software reset switch state and control the
status LEDs.

The GPIO pins have their direction (input/output) locked down to prevent
possible short circuits.

Note that most people get a reset button that is a hardware reset.  The
software reset button is available on boards from Netgate.

Sponsored by: Rubicon Communications (Netgate)

8 years agoDefine CPU_SPINWAIT as cpu_spinwait().
jasone [Tue, 18 Aug 2015 20:42:08 +0000 (20:42 +0000)]
Define CPU_SPINWAIT as cpu_spinwait().

Submitted by: cem

8 years agoUpdate sysbuild to new ports infrastructure.
phk [Tue, 18 Aug 2015 20:19:48 +0000 (20:19 +0000)]
Update sysbuild to new ports infrastructure.

8 years agowordexp(3): Update man page for no longer using the wordexp builtin.
jilles [Tue, 18 Aug 2015 20:13:36 +0000 (20:13 +0000)]
wordexp(3): Update man page for no longer using the wordexp builtin.

8 years agoFix multiple integer overflows in expat.
delphij [Tue, 18 Aug 2015 19:30:04 +0000 (19:30 +0000)]
Fix multiple integer overflows in expat.

Security: CVE-2015-1283
Security: FreeBSD-SA-15:20.expat

8 years agoSet curvnet context inside the RPC code in more places.
delphij [Tue, 18 Aug 2015 18:12:46 +0000 (18:12 +0000)]
Set curvnet context inside the RPC code in more places.

Reviewed by: melifaro
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D3398

8 years agoCorrect All Saints' day.
pfg [Tue, 18 Aug 2015 15:50:02 +0000 (15:50 +0000)]
Correct All Saints' day.

Thanks to: zec
X-MFC with: r286891

8 years agoServe /etc/eui64 via NIS.
asomers [Tue, 18 Aug 2015 15:33:23 +0000 (15:33 +0000)]
Serve /etc/eui64 via NIS.

The C library already knows how to lookup eui64 entries from NIS. For
example, fwcontrol(8) does it. But /var/yp/Makefile.dist doesn't build the
eui64 maps, and ypinit(8) doesn't push them to slaves. This change fixes
that.

Reviewed by: brooks, wblock
MFC after: 2 weeks
Sponsored by: SpectraLogic Corp
Differential Revision: https://reviews.freebsd.org/D3404

8 years agoCalendar: add a few more dates to the Christian calendar
pfg [Tue, 18 Aug 2015 15:11:41 +0000 (15:11 +0000)]
Calendar: add a few more dates to the Christian calendar

The many christian denominations have different dates for their
celebrations and controversies are likely to be always.

These are well established and happen to be holidays in many
Catholic countries.

MFC after: 1 month

8 years agoAdd ichwd TCO version 3 support (Bay Trail / Rangeley...)
fabient [Tue, 18 Aug 2015 14:54:29 +0000 (14:54 +0000)]
Add ichwd TCO version 3 support (Bay Trail / Rangeley...)

Reviewed by: jhb
Obtained from: Cas-well
Sponsored by: Stormshield

8 years agoUsing consistent coding style to deal with error inside the loop.
avatar [Tue, 18 Aug 2015 13:16:23 +0000 (13:16 +0000)]
Using consistent coding style to deal with error inside the loop.

MFC after: 1 week

8 years agoUsing the error return code documented in the comment.
avatar [Tue, 18 Aug 2015 13:16:06 +0000 (13:16 +0000)]
Using the error return code documented in the comment.

Though there is no direct midi_uninit() caller amongst existing drivers
at this moment, a quick experiment indicates that EBUSY gives users more
precise error message once drivers start to honour this result.  For example,
emu_midi_detach() should check the result of mpu401_uninit() and block
module unloading if there is any MIDI I/O in progress.

MFC after: 2 weeks

8 years agoFixing typo as well as improving readability of a few comments.
avatar [Tue, 18 Aug 2015 12:50:46 +0000 (12:50 +0000)]
Fixing typo as well as improving readability of a few comments.

MFC after: 3 days

8 years agoRIP Stefan Farfeleder (stefanf), committer since 2004.
brueffer [Tue, 18 Aug 2015 12:27:21 +0000 (12:27 +0000)]
RIP Stefan Farfeleder (stefanf), committer since 2004.

You will be missed!

8 years agoCorrect comment typo noted by erik
emaste [Tue, 18 Aug 2015 11:52:45 +0000 (11:52 +0000)]
Correct comment typo noted by erik

8 years agocallout_stop() should return 0 (fail) when the callout is currently
jch [Tue, 18 Aug 2015 10:15:09 +0000 (10:15 +0000)]
callout_stop() should return 0 (fail) when the callout is currently
being serviced and indeed unstoppable.

A scenario to reproduce this case is:

- the callout is being serviced and at same time,
- callout_reset() is called on this callout that sets
  the CALLOUT_PENDING flag and at same time,
- callout_stop() is called on this callout and returns 1 (success)
  even if the callout is indeed currently running and unstoppable.

This issue was caught up while making r284245 (D2763) workaround, and
was discussed at BSDCan 2015.  Once applied the r284245 workaround
is not needed anymore and will be reverted.

Differential Revision: https://reviews.freebsd.org/D3078
Reviewed by: jhb
Sponsored by: Verisign, Inc.

8 years agoRemove register dump from arm64 el0 unknown exception
emaste [Tue, 18 Aug 2015 10:07:03 +0000 (10:07 +0000)]
Remove register dump from arm64 el0 unknown exception

An exception with an unknown reasion is the expected result of the
attempted execution of an instruction bit pattern that has no allocated
instruction.

Sponsored by: The FreeBSD Foundation

8 years agoRe-add LG_SIZEOF_PTR definition for __aarch64__.
jasone [Tue, 18 Aug 2015 09:09:27 +0000 (09:09 +0000)]
Re-add LG_SIZEOF_PTR definition for __aarch64__.

This definition was erroneously removed during the 4.0.0 import.

8 years agoBump __FreeBSD_version for the jemalloc 4.0.0 import.
jasone [Tue, 18 Aug 2015 08:29:13 +0000 (08:29 +0000)]
Bump __FreeBSD_version for the jemalloc 4.0.0 import.

8 years agoMake clear that TIME_WAIT timeout expiration is managed solely by
jch [Tue, 18 Aug 2015 08:27:26 +0000 (08:27 +0000)]
Make clear that TIME_WAIT timeout expiration is managed solely by
tcp_tw_2msl_scan().

Sponsored by: Verisign, Inc.

8 years agoAdd missing sdallocx updates and remove *allocm manpage links.
jasone [Tue, 18 Aug 2015 08:18:28 +0000 (08:18 +0000)]
Add missing sdallocx updates and remove *allocm manpage links.

Submitted by: jbeich

8 years agoFix build failure due to missing CPU_SPINWAIT definition.
jasone [Tue, 18 Aug 2015 08:10:46 +0000 (08:10 +0000)]
Fix build failure due to missing CPU_SPINWAIT definition.

8 years agoAdd jemalloc support for 8 KiB, 16 KiB, and 64 KiB pages.
jasone [Tue, 18 Aug 2015 06:28:37 +0000 (06:28 +0000)]
Add jemalloc support for 8 KiB, 16 KiB, and 64 KiB pages.

8 years agoFix panic when handling non-inet arp message introduced in r286825.
melifaro [Tue, 18 Aug 2015 06:16:19 +0000 (06:16 +0000)]
Fix panic when handling non-inet arp message introduced in r286825.

Submitted by: delphij

8 years agoAdd 24 more page table pages we allocate on boot-up. 16MB slop
marcel [Tue, 18 Aug 2015 01:53:41 +0000 (01:53 +0000)]
Add 24 more page table pages we allocate on boot-up. 16MB slop
is a little tight in and by itself, but severily insufficient
when one needs to map a large frame buffer as part of console
initialization. 64MB slop should be enough for a while. As an
example: a 15" MacBook Pro with retina display needs ~28MB of
KVA for the frame buffer.

PR: 193745

8 years agoSupport frame buffers that are larger than the default screen
marcel [Tue, 18 Aug 2015 00:47:02 +0000 (00:47 +0000)]
Support frame buffers that are larger than the default screen
size as defined by VT_FB_DEFAULT_WIDTH and VT_FB_DEFAULT_HEIGHT
(at this time 2048x1200). The default is really a max. We cap
the height and width to those defaults and position the screen
in the center of the frame buffer.

Ideally we use a bigger font to utility the entire real estate
that is the frame buffer, but that's seen as an improvement over
making it work first.

PR: 193745