dragonfly.git
9 years agolibc - bail out on invalid sem_open(3) flags
Nicolas Thery [Mon, 30 Jun 2014 18:57:27 +0000 (20:57 +0200)]
libc - bail out on invalid sem_open(3) flags

Preventing now callers from passing invalid flags prevents compatibility
issue should new flags be added to sem_open(3) in future standard
revisions.

Reviewed-by: joris@giovannangeli.fr
9 years agolibc - change SEM_VALUE_MAX
Nicolas Thery [Mon, 30 Jun 2014 18:57:03 +0000 (20:57 +0200)]
libc - change SEM_VALUE_MAX

sem_getvalue(3) requires a signed int count so change SEM_VALUE_MAX to INT_MAX.

Reviewed-by: joris@giovannangeli.fr
9 years agokernel/acpi: Stop installing default address space handlers explicitly.
Sascha Wildner [Tue, 1 Jul 2014 04:01:10 +0000 (06:01 +0200)]
kernel/acpi: Stop installing default address space handlers explicitly.

Since ACPICA 20040427 this is no longer necessary since it is part of
AcpiEnableSubsystem(). It is not supported and has led to problems.

See http://svnweb.freebsd.org/base?view=revision&revision=212993

9 years agokernel/acpica: Add tunables for editing the _OSI string list.
Sascha Wildner [Tue, 1 Jul 2014 03:09:17 +0000 (05:09 +0200)]
kernel/acpica: Add tunables for editing the _OSI string list.

ACPICA has a built-in list of supported _OSI strings. A query on any of
those strings returns TRUE. It is meant to help the ASL code determine
which OS it is dealing with. See AcpiDefaultSupportedInterfaces[] in
utosi.c for the full list.

This commit adds two tunables, hw.acpi.{install,remove}_interface,
for adding to and removing from that list. Their contents are comma
separated and leading white space is ignored.

Examples:

# Add "FreeBSD" to the list of supported _OSI strings,
# i.e. _OSI("FreeBSD") from ASL will return TRUE.
#
hw.acpi.install_interface="FreeBSD"

# Remove "Windows 2000" and "Windows 2001" from the list
# of supported _OSI strings, i.e. _OSI("Windows 2000") and
# _OSI("Windows 2001") from ASL will return FALSE.
#
hw.acpi.remove_interface="Windows 2000, Windows 2001"

Taken-from: FreeBSD

9 years agokernel - Move CPUMASK_LOCK out of the cpumask_t
Matthew Dillon [Mon, 30 Jun 2014 19:27:59 +0000 (12:27 -0700)]
kernel - Move CPUMASK_LOCK out of the cpumask_t

* Add cpulock_t (a 32-bit integer on all platforms) and implement
  CPULOCK_EXCL as well as space for a counter.

* Break-out CPUMASK_LOCK, add a new field to the pmap (pm_active_lock)
  and do the process vmm (p_vmm_cpulock) and implement the mmu interlock
  there.

  The VMM subsystem uses additional bits in cpulock_t as a mask counter
  for implementing its interlock.

  The PMAP subsystem just uses the CPULOCK_EXCL bit in pm_active_lock for
  its own interlock.

* Max cpus on 64-bit systems is now 64 instead of 63.

* cpumask_t is now just a pure cpu mask and no longer requires all-or-none
  atomic ops, just normal bit-for-bit atomic ops.  This will allow us to
  hopefully extend it past the 64-cpu limit soon.

9 years agobuild - Add additional CFLAGS
Matthew Dillon [Mon, 30 Jun 2014 19:20:41 +0000 (12:20 -0700)]
build - Add additional CFLAGS

* Add additional CFLAGS that are expected to be needed in later revs
  of the compiler.  These are not needed at the moment.

9 years agoSet CR4.OSFXSR before probing the mxcsr mask
Markus Pfeiffer [Mon, 30 Jun 2014 16:29:15 +0000 (17:29 +0100)]
Set CR4.OSFXSR before probing the mxcsr mask

This fixes Bug #2691

Reported-By: Antonio Huete Jiménez <tuxillo@quantumachine.net>
9 years agokernel - Fix nfs server-side shutdown race
Matthew Dillon [Sun, 29 Jun 2014 18:08:05 +0000 (11:08 -0700)]
kernel - Fix nfs server-side shutdown race

* Fix issues where slp->ns_so is being accessed during or after the socket
  has been zapped.  The zap code actually closes the fp and destroys the
  socket so this race results in a use-after-free and can cause a panic
  on the NFS server.

* Zapping now shuts the socket down but does not close/destroy it.  The
  socket will be destroyed when the last ref on slp (aka nfssvc_sock)
  is dropped.

* Re-check SLP_VALID in a few more places after potentially blocking.
  Other situations that might block are handled by the change in the
  zap code.

9 years agoFix buildworld.
Sascha Wildner [Sun, 29 Jun 2014 14:57:33 +0000 (16:57 +0200)]
Fix buildworld.

Due to adding a struct lock to struct pf_state in one of the recent
pf(4) commits, we have to define _KERNEL_STRUCTURES in everything
which includes pfvar.h.

9 years agoinpcb: Rework insertion of local group
Sepherosa Ziehau [Sun, 29 Jun 2014 12:33:38 +0000 (20:33 +0800)]
inpcb: Rework insertion of local group

Mainly to take possible malloc(9) blocking into consideration.  This
prepares tokenizing inpcb lists and tables for udp.

9 years agokernel - Fix pf-based NAT
Matthew Dillon [Sun, 29 Jun 2014 06:46:43 +0000 (23:46 -0700)]
kernel - Fix pf-based NAT

* NAT may not always be able to select a translated addr/port that is
  compatible with the source addr/port.  In this situation return packets
  from the translated target won't be able to find the state structure.

  This occurs if static-port is used or if the port range is insufficent
  for PF to be able to find a hash-compatible addr/port.

  This also occurs for UDP because the toeplitz hash does not appear to
  include a port (so there's nothing PF NAT can do to make it
  hash-compatible).

* In situations where PF believes a translation is not hash-compatible,
  the pf_state_key will be placed on a global RBTREE instead of the
  cpu-localized RBTREE.  This tree is checked and modified with a separate
  lock (shared when doing lookups, exclusive when doing adjustments).

  The nominal pf_find_state*() code will now check the global RBTREE if the
  state cannot be found in the localized tree.

* Modifications to the pf_state structure are now exclusively locked to
  handle the case where a state structure might be used by multiple cpu's
  at the same time.  This can only occur for translations such as NAT.

* The TCP code is not allowed to destroy state on connection reuse unless
  the state is cpu-local.  If it is not cpu-local the TCP code will mark
  the state for an immediate purge (within the next second).

* Add a TSO flag check to pf_route(), which is called via NAT.  Locally
  originated packets may have been built with TSO.  For PF NAT, we can
  only assume that the target interface will be compatible and allow the
  packet through (not try to fragment it, which won't work well anyway for
  TCP packets).

9 years agokernel/pf: Check size of long at compile time (fixes i386 build).
Sascha Wildner [Sat, 28 Jun 2014 20:10:48 +0000 (22:10 +0200)]
kernel/pf: Check size of long at compile time (fixes i386 build).

9 years agokernel - add toeplitz_piecemeal_addr/port()
Matthew Dillon [Sat, 28 Jun 2014 16:38:38 +0000 (09:38 -0700)]
kernel - add toeplitz_piecemeal_addr/port()

* Add two more inlines to help PF calculate matching cpus for NAT port
  scans.

9 years agoChmod 644 a few scripts in the tree.
Sascha Wildner [Sat, 28 Jun 2014 15:51:11 +0000 (17:51 +0200)]
Chmod 644 a few scripts in the tree.

As usual, 'make install' will take care about setting the wanted mode.

9 years agokernel/acpi: Solve ACPI_DEBUG_{CACHE,LOCKS,MEMMAP} building better.
Sascha Wildner [Sat, 28 Jun 2014 13:31:31 +0000 (15:31 +0200)]
kernel/acpi: Solve ACPI_DEBUG_{CACHE,LOCKS,MEMMAP} building better.

ACPICA 20140627 added a mechanism for having a platform dependent
header that is included _after_ ACPICA headers are included.

So we can now solve compilation with ACPI_DEBUG_{CACHE,LOCKS,MEMMAP}
by adding a new acdragonflyex.h header for the prototypes of the
debug flavors of AcpiOsReleaseObject(), AcpiOsAcquireLock(),
AcpiOsMapMemory() and AcpiOsUnmapMemory() instead of having to put
them into the vendor code (like I did in 3b92a84dc0def, which this
commit reverts).

9 years agokernel/acpi: Fix a kprintf for ACPI_DEBUG_MEMMAP.
Sascha Wildner [Sat, 28 Jun 2014 13:24:00 +0000 (15:24 +0200)]
kernel/acpi: Fix a kprintf for ACPI_DEBUG_MEMMAP.

9 years agovga_pci: Improve vga boot display detection.
Imre Vadasz [Fri, 27 Jun 2014 19:29:04 +0000 (21:29 +0200)]
vga_pci: Improve vga boot display detection.

* Check the "VGA Enable" bit on the parent bridge only if it is a
  PCI-to-PCI bridge.

* Always check the "I/O" and "Memory address space decoding" bits on the
  video card itself.

* Furthermore, vga_pci_attach() logs "Boot video device" if the card
  being attached is the Chosen One:
    vgapci0: <VGA-compatible display> [...]
    vgapci0: Boot video device

This is FreeBSD's r259579.

Tested-by: François Tigeot <ftigeot@wolfpond.org>
9 years agounlock_return.cocci: Add a check for ACPI_SERIAL_{BEGIN,END}.
Sascha Wildner [Sat, 28 Jun 2014 12:00:58 +0000 (14:00 +0200)]
unlock_return.cocci: Add a check for ACPI_SERIAL_{BEGIN,END}.

9 years agokernel/acpi_thinkpad: Unlock properly before returning.
Sascha Wildner [Sat, 28 Jun 2014 11:58:48 +0000 (13:58 +0200)]
kernel/acpi_thinkpad: Unlock properly before returning.

9 years agoacpi: Sync aapits Makefile with 20140627 ACPICA test suite.
Sascha Wildner [Sat, 28 Jun 2014 11:43:04 +0000 (13:43 +0200)]
acpi: Sync aapits Makefile with 20140627 ACPICA test suite.

9 years agokernel: Sync ACPICA with Intel's version 20140627.
Sascha Wildner [Sat, 28 Jun 2014 11:14:15 +0000 (13:14 +0200)]
kernel: Sync ACPICA with Intel's version 20140627.

* Various bug fixes and enhancements (see changes.txt).

* Use new local printf() like functions for the utilities.

* Use new AcpiLogError for portability.

This that are also changed/new but it don't affect DragonFly so far:

* Support for ACPICA generation within the EFI environment.

* New OSL file I/O interface.

* New global AcpiGbl_VerifyTableChecksum.

For a more detailed list, please see sys/contrib/dev/acpica/changes.txt.

9 years agokernel - merge fixes from FreeBSD
Matthew Dillon [Sat, 28 Jun 2014 03:06:02 +0000 (20:06 -0700)]
kernel - merge fixes from FreeBSD

* Merge 8159278dbd8e019, fixes to pf_get_sport().  Primarily fixes the state
  key used to check whether a port is in-use or not.  NAT could previously
  choose a port that was already in-use.

* bzero() the state key to ensure that uninitialized fields are zero,
  otherwise the RB_FIND is likely to fail.

* Cleanup the case where there is no port range or the protocol is not
  supported.  In this situation, sport must be replicated on the host.

9 years agopfctl - Change default keep-policy to bring more in-line with other BSDs
Matthew Dillon [Sat, 28 Jun 2014 02:05:33 +0000 (19:05 -0700)]
pfctl - Change default keep-policy to bring more in-line with other BSDs

* Change the default keep-policy to the equivalent of:

  set keep-policy keep state (pickups, sloppy)

* This is being done because without keep state PF is simply going to be
  too inefficient for any reasonable set of rules, and we no longer want
  to make users set the keep-policy line when keep state is already the
  default in other BSD systems.

* Note that we also set pickups and sloppy by default.  This allows the
  router and/or PF to be restarted and allows packet routing to change
  mid-stream without causing all active TCP connections to drop.  This
  may not be the default in other BSD systems but it should be.  Being
  ultra strict here to improve security against ICMP-based attacks removes
  too much flexibility to be appropriate.  Proper TCP implementations
  already do sequence space checks for RST packets.

9 years agokernel - Fix pf-based NAT
Matthew Dillon [Sat, 28 Jun 2014 01:02:26 +0000 (18:02 -0700)]
kernel - Fix pf-based NAT

* Concurrency work on PF broke NAT.  Fix NAT for IPV4 TCP.

* This is not a complete fix, the NAT must be able to select from a range
  of local ports to replace sport to properly map the NAT onto the same
  cpu that the originating packet was forwarded to.

* Not fixed for UDP yet.

9 years agokernel - Force manual hash calculation for IP fragments
Matthew Dillon [Fri, 27 Jun 2014 17:24:24 +0000 (10:24 -0700)]
kernel - Force manual hash calculation for IP fragments

* Hardware toeplitz hashes do not always distinguish IP fragments from
  full IP packets.  An IP fragment will typically have the
  (src,dst,srcport,dstport) in the first fragment, but will only have
  (src,dst) in the remaining fragments.  The HW might not understand this
  and generate hashes which prevent the fragments from being directed to
  the same cpu.

* Force a manual recalculation of the hash (ignore the HW hash) for any
  IP fragment.  That is, any IP packet with the IP_MF bit set or with a
  non-zero offset (masked by IP_OFFMASK).

* Direct all IP fragments to a target cpu based on the hash.  We previously
  directed all IP fragments to cpu 0.

* NOTE: The IP fragment handling code in the kernel is still serialized with
a lock.  This will be addressed in a later commit.  However, fragments
which are piped into PF will now be properly distributed across
available cpus.

Submitted-by: sephe
9 years agodrm/i915: Reorder function definitions in i915_gem.c
François Tigeot [Fri, 27 Jun 2014 06:57:55 +0000 (08:57 +0200)]
drm/i915: Reorder function definitions in i915_gem.c

* Reducing differences with Linux 3.8.13

* No functional changes

9 years agobuildworld - Add sync/sleep safety before mkinitrd
Matthew Dillon [Fri, 27 Jun 2014 04:04:09 +0000 (21:04 -0700)]
buildworld - Add sync/sleep safety before mkinitrd

* Try to mitigate a bug in earlier versions of DragonFly that can be
  triggered by mkinitrd's use of the VN device by ensuring that the world
  is synced to disk before running mkinitrd.

9 years agopf - make the bulk of PF concurrent under normal operation
Matthew Dillon [Fri, 27 Jun 2014 03:40:32 +0000 (20:40 -0700)]
pf - make the bulk of PF concurrent under normal operation

* state and ip fragment tables are now per-cpu.

* packet paths acquire pf_token shared instead of exclusive.  Packet
  processing runs concurrently.

* Any dynamic rules updates will run synchronously for now.

* State expiration from the pfpurge thread runs synchronously for now.
  More work can be done here.

* ioctl (and also pfsync) paths acquire pf_token exclusively.  That is,
  primarily pfctl commands.  This includes rules updates and state scans.
  More work can be done here.

9 years agopfctl - Fix pf_print_state
Matthew Dillon [Fri, 27 Jun 2014 02:19:30 +0000 (19:19 -0700)]
pfctl - Fix pf_print_state

* Fix a bug where the 'minutes' field in the expiration was not being
  calculated properly.

* Reformat the verbose output so it does not overflow 80 columns, and
  move the rule # printing up a little so it is not confusedly associated
  with the next entry.

9 years agonewsyslog(8): Remove a NULL-check-after-use and instead assert != NULL.
Sascha Wildner [Thu, 26 Jun 2014 20:21:56 +0000 (22:21 +0200)]
newsyslog(8): Remove a NULL-check-after-use and instead assert != NULL.

Taken-from: FreeBSD

9 years agoroute(8): Fix a sizeof bug.
Sascha Wildner [Thu, 26 Jun 2014 17:55:29 +0000 (19:55 +0200)]
route(8): Fix a sizeof bug.

9 years agoAlways check the limits of array index variables before using them.
Sascha Wildner [Thu, 26 Jun 2014 17:24:43 +0000 (19:24 +0200)]
Always check the limits of array index variables before using them.

9 years agonetmap: port if_transmit() to ifq_dispatch()
Franco Fichtner [Thu, 26 Jun 2014 17:10:27 +0000 (19:10 +0200)]
netmap: port if_transmit() to ifq_dispatch()

Suggested by: sephe

9 years agoinet: Handle IP fragments in netisr0
Sepherosa Ziehau [Thu, 26 Jun 2014 12:13:41 +0000 (20:13 +0800)]
inet: Handle IP fragments in netisr0

For packet whose hash is provided by hardware, the processing netisr
may not be netisr0.  Add a IP fragments check at the beginning of
ip_input(): if the current processing netisr is not netisr0 and the
packet is an IP fragment, then redispatch it to netisr0.

Discussed-with: dillon@

9 years agoNote need for most recent 3.6 possible before updating.
Justin C. Sherrill [Thu, 26 Jun 2014 03:47:00 +0000 (23:47 -0400)]
Note need for most recent 3.6 possible before updating.

9 years agoperror.1: Document which locale related env variables affect perror(1).
Sascha Wildner [Wed, 25 Jun 2014 19:29:09 +0000 (21:29 +0200)]
perror.1: Document which locale related env variables affect perror(1).

9 years agokernel/pci: Fix wrong checks for U4B presence.
Sascha Wildner [Wed, 25 Jun 2014 13:07:49 +0000 (15:07 +0200)]
kernel/pci: Fix wrong checks for U4B presence.

I messed this up when switching us to the new USB stack.

Thanks to Markus Pfeiffer for tracking down my mistake.

Reported-by: peeter
Dragonfly-bug: <http://bugs.dragonflybsd.org/issues/2686>

9 years agokernel/mrsas: Fix memset() size.
Sascha Wildner [Wed, 25 Jun 2014 11:59:34 +0000 (13:59 +0200)]
kernel/mrsas: Fix memset() size.

9 years agoinpcb: Reorganize localgroup manages functions.
Sepherosa Ziehau [Sun, 22 Jun 2014 12:00:41 +0000 (20:00 +0800)]
inpcb: Reorganize localgroup manages functions.

This is in preparation for conditionally tokenize inpcb lists/tables.

9 years agoboot - Return proper sense from probe_keyboard()
Matthew Dillon [Tue, 24 Jun 2014 22:33:56 +0000 (15:33 -0700)]
boot - Return proper sense from probe_keyboard()

* The sense was reversed.  Return the proper sense.

Taken-From: FreeBSD

9 years agoboot - consistently reload v86.ctl/v86.addr (non-bug)
Matthew Dillon [Tue, 24 Jun 2014 22:32:09 +0000 (15:32 -0700)]
boot - consistently reload v86.ctl/v86.addr (non-bug)

* This is not a bug.  Be more consistent when loading the v86 structure,
  do not try to optimize out fields that are already loaded in distinct
  code sections.

9 years agoboot - Timeout seta20 for normal boots as well as for cd boots.
Matthew Dillon [Tue, 24 Jun 2014 22:29:47 +0000 (15:29 -0700)]
boot - Timeout seta20 for normal boots as well as for cd boots.

* Bring code from cdboot into boot1.S

* Also use a more correct segment:offset when trying to reboot.

Reported-by: karu.pruun (karu.pruun@gmail.com),
     Roman Neuhauser (neuhauser@sigpipe.cz)

9 years agoboot - Fix BIOS lockup due to H2 probe on small medias
Matthew Dillon [Tue, 24 Jun 2014 22:10:31 +0000 (15:10 -0700)]
boot - Fix BIOS lockup due to H2 probe on small medias

* Some BIOSes (found w/Intel atom D525 w/Foxconn mobo, AMIBIOS) will
  implode when asked to read a disk address beyond the EOM.  The HAMMER2
  probe tries to read a volume header at the 0, 2G, 4G, and 6G marks.
  This appears to blow up the BIOS when booting from USB media.

* To work around the problem, for now we do not proceed to test all four
  volume header offsets if the first one (at offset 0) does not have a
  HAMMER2 signature.

* Thanks to tm512 (Kyle Davis) for spending ~4+ hours helping us find
  the problem.

Reported-by: tm512 (Kyle Davis)
9 years agodrm/i915: fix notify_ring()
Johannes Hofmann [Mon, 23 Jun 2014 20:53:02 +0000 (22:53 +0200)]
drm/i915: fix notify_ring()

9 years agoauthor style fixes in manual pages
Franco Fichtner [Sat, 21 Jun 2014 14:16:50 +0000 (16:16 +0200)]
author style fixes in manual pages

9 years agodrm/i915: Sync intel_pm.c with Linux 3.8.13
François Tigeot [Sat, 21 Jun 2014 09:00:30 +0000 (11:00 +0200)]
drm/i915: Sync intel_pm.c with Linux 3.8.13

* Add a workaround for a hardware issue making the GPU get stuck at
  some particular frequency

* Add initialization code to enable Haswell power wells

* Little fixes and adjustements for various GPUs up to Haswell

9 years agokernel/vinum: Use %jx in a number of places instead of %llx.
Sascha Wildner [Fri, 20 Jun 2014 09:30:57 +0000 (11:30 +0200)]
kernel/vinum: Use %jx in a number of places instead of %llx.

9 years agokernel: Correct function names in comments.
Sascha Wildner [Fri, 20 Jun 2014 06:12:19 +0000 (08:12 +0200)]
kernel: Correct function names in comments.

9 years agofile: libmagic knows about libz now so drop the dependency
Franco Fichtner [Thu, 19 Jun 2014 12:28:14 +0000 (14:28 +0200)]
file: libmagic knows about libz now so drop the dependency

9 years agolibmagic: fix file identification
Franco Fichtner [Thu, 19 Jun 2014 12:10:26 +0000 (14:10 +0200)]
libmagic: fix file identification

Removes local modifications from contrib code and
fixes at least the following identification issue.

Before:

    # file /usr/src/bin/test/test.c
    /usr/src/bin/test/test.c: ASCII text

After:

    # file /usr/src/bin/test/test.c
    /usr/src/bin/test/test.c: C source, ASCII text

9 years agojscan(8): Remove dupdata() (no longer used since 36d6bdee113b682f2).
Sascha Wildner [Thu, 19 Jun 2014 09:28:23 +0000 (11:28 +0200)]
jscan(8): Remove dupdata() (no longer used since 36d6bdee113b682f2).

9 years agokernel - Fix rare ucred race
Matthew Dillon [Wed, 18 Jun 2014 18:47:45 +0000 (11:47 -0700)]
kernel - Fix rare ucred race

* In a threaded program if one thread is modifying the ucred, e.g.
  changing the uid or gid or something like that, and another thread
  enters a system call at the same time, the second thread can wind
  up trying to hold a stale ucred kfree()'d by the first thread.

* Very rare race on top of a ~2-instruction window.

* Fix the problem by obtaining proc->p_spin when updating the per-thread
  ucred cache (td->td_ucred) from p->p_ucred, as well as when replacing
  p_ucred.

  These fixes do NOT impose any critical-path overhead.  For the case where
  a thread already has the current p_ucred cached on entry to a system call,
  absolutely nothing needs to be done.

Reported-by: joris (Joris Giovannangeli)
9 years agosocket: so_pru_abort_oncpu -> so_pru_abort_direct
Sepherosa Ziehau [Wed, 18 Jun 2014 14:19:53 +0000 (22:19 +0800)]
socket: so_pru_abort_oncpu -> so_pru_abort_direct

No functional change.  It is consistent w/ other so_pru functions name.

9 years agosocket: {soabort,so_pru_abort}a -> {soabort,so_pru_abort}_async
Sepherosa Ziehau [Wed, 18 Jun 2014 14:12:50 +0000 (22:12 +0800)]
socket: {soabort,so_pru_abort}a -> {soabort,so_pru_abort}_async

No functional change.  They are consistent w/ other so and so_pru
function names.

9 years agouipc: Fix comment
Sepherosa Ziehau [Wed, 18 Jun 2014 13:46:51 +0000 (21:46 +0800)]
uipc: Fix comment

9 years agouipc: Nuke unnecessary void cast
Sepherosa Ziehau [Wed, 18 Jun 2014 13:32:00 +0000 (21:32 +0800)]
uipc: Nuke unnecessary void cast

9 years agotcp: White space cleanup; no functional changes.
Sepherosa Ziehau [Wed, 18 Jun 2014 13:20:25 +0000 (21:20 +0800)]
tcp: White space cleanup; no functional changes.

9 years agoip/demux: Remove no longer applied comment
Sepherosa Ziehau [Wed, 18 Jun 2014 13:19:41 +0000 (21:19 +0800)]
ip/demux: Remove no longer applied comment

9 years agoudp: Fix "unconnect" and cleanup connect
Sepherosa Ziehau [Wed, 18 Jun 2014 13:18:45 +0000 (21:18 +0800)]
udp: Fix "unconnect" and cleanup connect

Put udp inpcb into wildcard hash in pru_disconnect method.  This restores
the old behaviour of traditional BSD "unconnect".

Clean up pru_connect after fixing the "unconnect" support; in preparation
for distributing udp inpcb across netisrs.

9 years agosystat/ip,tcp: Initialize curstate to avoid overflow/underflow
Sepherosa Ziehau [Wed, 18 Jun 2014 13:18:02 +0000 (21:18 +0800)]
systat/ip,tcp: Initialize curstate to avoid overflow/underflow

9 years agonet: Add initport protosw method to init socket's default protocol port
Sepherosa Ziehau [Wed, 18 Jun 2014 13:16:58 +0000 (21:16 +0800)]
net: Add initport protosw method to init socket's default protocol port

Currently only tcp implements this method to distribute pru_attach and
pru_connect workload.

Nuke no longer necessary protosw flag PR_RAND_INITPORT and sysctl
kern.ipc.rand_initport.

9 years agotcp: Avoid unnecessary calling of in_pcbladdr() in tcp_connect()
Sepherosa Ziehau [Wed, 18 Jun 2014 13:15:52 +0000 (21:15 +0800)]
tcp: Avoid unnecessary calling of in_pcbladdr() in tcp_connect()

If in_pcbladdr() was called and inp_laddr was saved, there would be
no need to call in_pcbladdr() again, after the inp was forwarded to
its owner netisr.

9 years agolibmagic: link against libz
Franco Fichtner [Mon, 16 Jun 2014 13:16:08 +0000 (15:16 +0200)]
libmagic: link against libz

Linking a program against the library without explicitly
stating `-lz' produced this output:

    /usr/lib/libmagic.so: undefined reference to `inflate'
    /usr/lib/libmagic.so: undefined reference to `inflateInit2_'
    /usr/lib/libmagic.so: undefined reference to `inflateEnd'

9 years agoinpcb: Remove inp_cpcbinfo, which serves no purpose now
Sepherosa Ziehau [Mon, 16 Jun 2014 13:08:46 +0000 (21:08 +0800)]
inpcb: Remove inp_cpcbinfo, which serves no purpose now

It is always same as inp_pcbinfo.

9 years agoinpcb: Cache align inpcbinfo
Sepherosa Ziehau [Mon, 16 Jun 2014 13:08:02 +0000 (21:08 +0800)]
inpcb: Cache align inpcbinfo

9 years agoinet: in_pcbsetlport_remote -> in_pcbbind_remote
Sepherosa Ziehau [Mon, 16 Jun 2014 13:07:01 +0000 (21:07 +0800)]
inet: in_pcbsetlport_remote -> in_pcbbind_remote

This function may change inp_laddr, so 'bind' is is better than
'setlport'.

9 years agonet: Remove unnecessary sosetport() in various pru_attachs
Sepherosa Ziehau [Mon, 16 Jun 2014 13:06:16 +0000 (21:06 +0800)]
net: Remove unnecessary sosetport() in various pru_attachs

The so_port is set before the pru_attach is called; there is no need
to do it again.

9 years agoudp: No data will be carried along w/ connect
Sepherosa Ziehau [Mon, 16 Jun 2014 13:05:38 +0000 (21:05 +0800)]
udp: No data will be carried along w/ connect

Pull the assertion into earlier place.

9 years agoctags(1): Fix use after free().
Sascha Wildner [Sun, 15 Jun 2014 18:13:17 +0000 (20:13 +0200)]
ctags(1): Fix use after free().

9 years agonetstat(8): Remove upHex(), which is unused since we dropped NS.
Sascha Wildner [Sun, 15 Jun 2014 18:02:00 +0000 (20:02 +0200)]
netstat(8): Remove upHex(), which is unused since we dropped NS.

9 years agoUpdate the pciconf(8) database.
Sascha Wildner [Sun, 15 Jun 2014 11:46:20 +0000 (13:46 +0200)]
Update the pciconf(8) database.

June 14, 2014 snapshot from http://pciids.sourceforge.net/

9 years agoRemove some unneeded continue statements.
Sascha Wildner [Sun, 15 Jun 2014 01:10:42 +0000 (03:10 +0200)]
Remove some unneeded continue statements.

9 years agoSync zoneinfo database with tzdata2014e from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Sat, 14 Jun 2014 21:35:53 +0000 (23:35 +0200)]
Sync zoneinfo database with tzdata2014e from ftp://ftp.iana.org/tz/releases

* africa: Egypt's 2014 Ramadan-based transitions are June 26 and July 31
    at 24:00. (Thanks to Imed Chihi.) Similarly, Morocco's are June 28
    at 03:00 and August 2 at 02:00.  (Thanks to Milamber Space Network.)

* europe: The abbreviation "MSM" (Moscow Midsummer Time) is now used
    instead of "MSD" for Moscow's double daylight time in summer 1921.
    Also, a typo "VLASST" has been repaired to be "VLAST" for
    Vladivostok summer time in 1991.  (Thanks to Hank W. for reporting
    the problems.)

* Some minor adjustments/rearrangement.

9 years agokernel: Add the mrsas(4) RAID driver for LSI Thunderbolt and newer series.
Sascha Wildner [Sat, 14 Jun 2014 11:35:11 +0000 (13:35 +0200)]
kernel: Add the mrsas(4) RAID driver for LSI Thunderbolt and newer series.

Specifically, it adds support for Thunderbolt (6 Gb/s), Invader (12 Gb/s)
and Fury (12 Gb/s) series.

Note that Thunderbolt controllers are supported by mfi(4) too. When both
drivers are loaded, the default is to attach via mfi(4). This can be
changed by either not loading or compiling in the mfi(4) driver at all
or by setting hw.mfi.mrsas_enable=1 in /boot/loader.conf. It might be
that we change this default to giving precedence to mrsas(4) before the
next release, but for now, until it gets some more testing, we take
FreeBSD's default (giving mfi(4) precedence).

That said, the driver works without any issues here with an
Intel RS25DB080 card (which is really an LSI MegaRAID SAS 9265).

mrsas(4) should (at least) support the following adapters:

Thunderbolt:

LSI MegaRAID SAS 9265
LSI MegaRAID SAS 9266
LSI MegaRAID SAS 9267
LSI MegaRAID SAS 9270
LSI MegaRAID SAS 9271
LSI MegaRAID SAS 9272
LSI MegaRAID SAS 9285
LSI MegaRAID SAS 9286
DELL PERC H810
DELL PERC H710/P

Invader/Fury:

LSI MegaRAID SAS 9380
LSI MegaRAID SAS 9361
LSI MegaRAID SAS 9341
DELL PERC H830
DELL PERC H730/P
DELL PERC H330

Taken-from: FreeBSD

9 years agodrm/i915: Sync drm_irq.c with Linux 3.8.13
François Tigeot [Sat, 14 Jun 2014 10:19:13 +0000 (12:19 +0200)]
drm/i915: Sync drm_irq.c with Linux 3.8.13

Most significant change: an interrupt handler called when parity errors
are detected in the GPU L3 cache of Ivy Bridge+ CPUs.

9 years agodrm: Add linux/io.h
François Tigeot [Sat, 14 Jun 2014 10:06:33 +0000 (12:06 +0200)]
drm: Add linux/io.h

9 years agodrm/i915: Update ivybridge_init_clock_gating()
François Tigeot [Sat, 14 Jun 2014 07:40:02 +0000 (09:40 +0200)]
drm/i915: Update ivybridge_init_clock_gating()

* Synchronize it with Linux 3.8.13

* This commit fixes a flickering issue with some laptop screens

Reported-by: luxh
9 years agokernel/sound: Take the correct variable for a tunable.
Sascha Wildner [Fri, 13 Jun 2014 19:26:26 +0000 (21:26 +0200)]
kernel/sound: Take the correct variable for a tunable.

9 years agoinet: Migrate to CPU0 to perform in_pcblist_global() for rawip and divert
Sepherosa Ziehau [Fri, 13 Jun 2014 14:19:38 +0000 (22:19 +0800)]
inet: Migrate to CPU0 to perform in_pcblist_global() for rawip and divert

It is safe to access their pcb list on CPU0, but not on other CPUs.

9 years agofetch(1): Fix library order (helps static building).
Sascha Wildner [Fri, 13 Jun 2014 09:37:57 +0000 (11:37 +0200)]
fetch(1): Fix library order (helps static building).

9 years agodrill(1): Fix library order (helps static building).
Sascha Wildner [Fri, 13 Jun 2014 09:37:08 +0000 (11:37 +0200)]
drill(1): Fix library order (helps static building).

9 years agosftp(1): Link libtermcap instead of libcurses.
Sascha Wildner [Fri, 13 Jun 2014 09:34:28 +0000 (11:34 +0200)]
sftp(1): Link libtermcap instead of libcurses.

9 years agokernel: Add a few more missing crit_exit()s.
Sascha Wildner [Fri, 13 Jun 2014 09:15:00 +0000 (11:15 +0200)]
kernel: Add a few more missing crit_exit()s.

9 years agokernel - Update existing csprng
Matthew Dillon [Fri, 13 Jun 2014 04:47:45 +0000 (21:47 -0700)]
kernel - Update existing csprng

* Bring the current csprng up-to-date as per the author.  However, note
  that we will likely be making additional commits to add other csprng
  algorithms to the system.

  - Change stateIndex to a static instead of starting at 0 each time
    to improve security.

  - Move the L_SCHEDULE(keyLen) to the end.

  - Warm-up the IBAA in the entropy interrupt.  Author suggested warming
    it up before each read_random() but that creates a non-deterministic
    performance problem.

* Change read_random_unlimited() from L15_Byte() to IBAA_Byte().
  read_random() already uses IBAA_Byte().  That is, go with the
  heavier-weight csprng for everything (sysctl, /dev/urandom, /dev/random).
  Before only /dev/random was using the heavier-weight csprng.

9 years agousb - Fix mouse stall issue in X
Matthew Dillon [Fri, 13 Jun 2014 02:35:16 +0000 (19:35 -0700)]
usb - Fix mouse stall issue in X

* Some code I had added to fix abort/reissue issues in ums could lose
  track of whether the read was operational or not if the FIFO became
  full.

* Correct the lost state.

* Should hopefully fix mouse-stall issues related to temporary X stalls
  while moving the mouse that could result in the FIFO temporarily becoming
  full.

9 years agokernel/npx: Enable printing of npx mask on bootverbose on i386
Markus Pfeiffer [Thu, 12 Jun 2014 21:39:04 +0000 (22:39 +0100)]
kernel/npx: Enable printing of npx mask on bootverbose on i386

9 years agokernel/vkernel: port mxcsr mask probing to i386.
Markus Pfeiffer [Thu, 12 Jun 2014 19:33:05 +0000 (20:33 +0100)]
kernel/vkernel: port mxcsr mask probing to i386.

9 years agokernel: GC never true CPU_DISABLE_SSE checks from x86_64/vkernel64.
Sascha Wildner [Thu, 12 Jun 2014 21:45:27 +0000 (23:45 +0200)]
kernel: GC never true CPU_DISABLE_SSE checks from x86_64/vkernel64.

It is only an option in i386.

No functional changes.

Reported-by: profmakx
9 years agovkernel64: support mxcsr mask on vkernel64 too
Markus Pfeiffer [Thu, 12 Jun 2014 19:14:05 +0000 (20:14 +0100)]
vkernel64: support mxcsr mask on vkernel64 too

9 years agovkernel64: fix compilation after npx mask work
Markus Pfeiffer [Thu, 12 Jun 2014 18:24:45 +0000 (19:24 +0100)]
vkernel64: fix compilation after npx mask work

9 years agokernel/acpi: Tabify
Sascha Wildner [Thu, 12 Jun 2014 17:06:52 +0000 (19:06 +0200)]
kernel/acpi: Tabify

9 years agotcp: Number of netisrs for tcp is ncpus2
Sepherosa Ziehau [Thu, 12 Jun 2014 13:06:48 +0000 (21:06 +0800)]
tcp: Number of netisrs for tcp is ncpus2

While I'm here, simplify tcp_pcblist() cpu migration logic.

9 years agoudp: Cleanup ctlinput related code
Sepherosa Ziehau [Thu, 12 Jun 2014 13:06:12 +0000 (21:06 +0800)]
udp: Cleanup ctlinput related code

In preparation for udp inpcb distribution.

9 years agoudp: Reduce rcvbuf token cover range
Sepherosa Ziehau [Thu, 12 Jun 2014 13:04:39 +0000 (21:04 +0800)]
udp: Reduce rcvbuf token cover range

9 years agoudp: Don't ref/free socket to call in_pcbdisconnect()
Sepherosa Ziehau [Wed, 11 Jun 2014 13:12:05 +0000 (21:12 +0800)]
udp: Don't ref/free socket to call in_pcbdisconnect()

in_pcbdisconnect() no longer calls in_pcbdetach() now.

9 years agosendmail - Apply CVE-2014-3956
Matthew Dillon [Thu, 12 Jun 2014 03:44:57 +0000 (20:44 -0700)]
sendmail - Apply CVE-2014-3956

* Apply CVE-2014-3956, close high numbered file descriptors that were not
  intended to be passed on.

9 years agokernel/npx: Add detection code for default MXCSR mask
Markus Pfeiffer [Wed, 11 Jun 2014 22:09:20 +0000 (23:09 +0100)]
kernel/npx: Add detection code for default MXCSR mask

As per Intel/AMD manuals the default MXCSR mask can be probed
by executing fxstor (if supported) and reading the mask from the
stored state. This patch adds detection of the mask when it is
supported. Otherwise a default mask of 0xFFBF is used as before.

9 years agokernel/ath: Remove wlan_serialize_enter/exit() in ath_led_blink()
Johannes Hofmann [Mon, 9 Jun 2014 20:42:53 +0000 (22:42 +0200)]
kernel/ath: Remove wlan_serialize_enter/exit() in ath_led_blink()

9 years agoRevert "mountd: Stop refusing requests from "unprivileged ports""
François Tigeot [Wed, 11 Jun 2014 14:52:51 +0000 (16:52 +0200)]
Revert "mountd: Stop refusing requests from "unprivileged ports""

This reverts commit ce14e737211ad2bf1592b922fb90392abe96d94f.

Due to popular request.

9 years agomountd: Stop refusing requests from "unprivileged ports"
François Tigeot [Wed, 11 Jun 2014 13:37:36 +0000 (15:37 +0200)]
mountd: Stop refusing requests from "unprivileged ports"

* Security by "privileged ports" is a joke. We don't live in the 1980s
  anymore and everybody can be root on her/his own machine.

* Some mount requests made by super-users on client DragonFly machines
  were done on "unprivileged ports" anyway, possibly due to ephemeral
  port exhaustion.

* Disabling this mechanism by default thus makes DragonFly NFS servers
  more reliable.