MFC 233601:
  Permit tcpdrop in VNET jails.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250744 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r249558, r250145:

r249558:

Add a new set of notes to a process core dump to store procstat data.

The notes format is a header of sizeof(int), which stores the size of
the corresponding data structure to provide some versioning, and data
in the format as it is returned by a related sysctl call.

The userland tools (procstat(1)) will be taught to extract this data,
providing additional info for postmortem analysis.

PR:		kern/173723
Suggested by:	jhb
Discussed with:	jhb, kib
Reviewed by:	jhb (initial version), kib

r250145:

Introduce a constant, ELF_NOTE_ROUNDSIZE, which evidently declares our
intention to use 4-byte padding for elf notes.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250752 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merge r244633, r250246.

Use unified IP_FW_ARG_TABLEARG() macro for most tablearg checks.
Log real value instead of IP_FW_TABLEARG (65535) in ipfw_log().

Use unified method for accessing / updating cached rule pointers.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250760 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r243711.

Use common macros for working with rule/dynamic counters.
This is done as preparation to introduce per-cpu ipfw counters.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250761 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248552, r248971

Add ipfw support for setting/matching DiffServ codepoints (DSCP).

Setting DSCP support is done via O_SETDSCP which works for both
IPv4 and IPv6 packets. Fast checksum recalculation (RFC 1624) is done for IPv4.
Dscp can be specified by name (AFXY, CSX, BE, EF), by value
(0..63) or via tablearg.

Matching DSCP is done via another opcode (O_DSCP) which accepts several
classes at once (af11,af22,be). Classes are stored in bitmask (2 u32 words).

Many people made their variants of this patch, the ones I'm aware of are
(in alphabetic order):

Dmitrii Tejblum
Marcelo Araujo
Roman Bogorodskiy (novel)
Sergey Matveichuk (sem)
Sergey Ryabin

PR:		kern/102471, kern/121122

Fix ipfw rule validation partially broken by r248552.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250762 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r249625:
Introduce kern.timecounter.smp_tsc_adjust tunable (disabled by default) and
respective functionality, allowing to synchronize TSC on APs to match BSP's
during boot.  It may be unsafe in general case due to theoretical chance of
later drift if CPUs are using different clock rate or source, but it allows
to use TSC in some cases when difference caused by some initialization bug,
while TSCs are known to increment synchronously.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250772 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r250423:

Retire write-only PCB_GS32BIT pcb flag on amd64.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250785 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Direct commit to update ports INDEX location.

PR:		bin/164561
Approved by:	bapt


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250787 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r250290:
Only check fan type once. Not only is continuously rechecking pointless, a
single random failure can reprogram what control mechanism we try to use.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250798 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFH r242738:

  Clarify that the ' flag is an apostrophe.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250799 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
grep: change some int types.

Change several int variables to size_t, ssize_t, or ptrdiff_t.
This should fix the bug described in CVE-2012-5667 when an input
line is so long that its length cannot be stored in an int
variable.

This is based on NetBSD's revision which says:

This change to NetBSD's version of GNU grep 2.5.1 (licenced under
GPLv2) was made without direct reference to any code licenced
under GPLv3.

Obtained from:	NetBSD
MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250821 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revert r250821 - This was not meant to be a direct commit.
(wrong tree)

Pointy hat:	me


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250822 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248566:
Add new USB ID.

PR:		usb/177173


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250842 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248499:
Add new USB ID.

PR:		usb/177105


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250845 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248458:
Add new USB ID.

PR:	usb/177013


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250847 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r249666, r249667, r249670, r249672, r249674, r249676, r249677, r249679,
    r249681, r249684, r249688, r249711, r249731, r250146

r249666, r249682:

Make libprocstat(3) extract procstat notes from a process core file.

PR:		kern/173723
Suggested by:	jhb
Glanced by:	kib

r249667:

Add procstat_getvmmap function to get VM layout of a process.

r249670:

Add procstat_getgroups function to retrieve process groups.

r249672:

Add procstat_getumask function to retrieve a process umask.

r249674:

Add procstat_getrlimit function to retrieve a process resource limits info.

r249676:

Add procstat_getpathname function to retrieve a process executable.

r249677:

Add procstat_getosrel function to retrieve a process osrel info.

r249679:

Extend libprocstat with functions to retrieve process command line
arguments and environment variables.

Suggested by:	stas
Reviewed by:	jhb and stas (initial version)

r249681:

Add procstat_getauxv function to retrieve a process auxiliary vector.

r249684:

Add procstat_getkstack function to dump kernel stacks of a process.

r249688:

Bump date.

r249711 (joel):

mdoc: end function context properly.

r249731:

Embed revision id in the library.

r250146:

KVM method support for procstat_getgroups, procstat_getumask,
procstat_getrlimit, and procstat_getosrel.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250870 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r249668, r249669, r249671, r249673, r249675, r249678, r249680, r249683,
    r249685, r249686:

r249668:

Use procstat_getprocs(3) for retrieving thread information instead of
direct sysctl calls.

r249669:

Use more generic procstat_getvmmap(3) for retrieving VM layout of a process.

r249671:

Use procstat_getgroups(3) for retrieving groups information instead of
direct sysctl.

r249673:

Use procstat_getumask(3) for retrieving umaks information instead of
direct sysctl.

r249675:

Use procstat_getrlimit(3) for retrieving rlimit information instead of
direct sysctl calls.

r249678:

Use libprocstat(3) when retrieving binary information for a process.

r249680:

Use libprocstat(3) to retrieve process command line arguments and
environment variables.

r249683:

Use libprocstat(3) to retrieve ELF auxiliary vector.

r249685:

Use procstat_getkstack(3) for retrieving process kernel stacks
instead of direct sysctl calls.

r249686:

Make use of newly added libprocstat(3) ability to extract procstat
info from a process core file.

So now one can run procstat(1) on a process core e.g. to get a list of
files opened by a process when it crashed:

root@lisa:/ # procstat -f /root/vi.core
  PID COMM               FD T V FLAGS     REF  OFFSET PRO NAME
  658 vi               text v r r--------   -       - -   /usr/bin/vi
  658 vi               ctty v c rw-------   -       - -   /dev/pts/0
  658 vi                cwd v d r--------   -       - -   /root
  658 vi               root v d r--------   -       - -   /
  658 vi                  0 v c rw-------  11    3208 -   /dev/pts/0
  658 vi                  1 v c rw-------  11    3208 -   /dev/pts/0
  658 vi                  2 v c rw-------  11    3208 -   /dev/pts/0
  658 vi                  3 v r r----n-l-   1       0 -   /tmp/vi.0AYKz3Lps7
  658 vi                  4 v r rw-------   1       0 -   /var/tmp/vi.recover/vi.GaGYsz
  658 vi                  5 v r rw-------   1       0 -   -

PR:		kern/173723
Suggested by:	jhb


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250871 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r249687, r249704, r250511:

r249687, r249704:

Sync gcore(1) with the recent changes in kernel code aimed at adding
procstat notes to a process core file.

Suggested by:	jhb

r250511 (antoine):

Add some missing DPADD.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250872 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r250374:

According to the documentation, on Linux, cancel_delayed_work() does not
do drain (flush_workqueue() in Linux terms) but instead returns true if
the work was removed before it is run, or false otherwise.

Simulate this by removing the taskqueue_drain() and return the value
derived from taskqueue_cancel()'s return value.

This would solve a witness warning caused by calling taskqueue_drain()
with a non-sleepable lock held, like:

taskqueue_drain with the following non-sleepable locks held:
exclusive rw lle (lle) r = 0 (0xfffffe001450b410) locked @
/usr/src/sys/netinet/in.c:1484
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffff848d4f7690
kdb_backtrace() at kdb_backtrace+0x39/frame 0xffffff848d4f7740
witness_warn() at witness_warn+0x4a8/frame 0xffffff848d4f7800
taskqueue_drain() at taskqueue_drain+0x3a/frame 0xffffff848d4f7840
set_timeout() at set_timeout+0x4a/frame 0xffffff848d4f7860
netevent_callback() at netevent_callback+0x16/frame 0xffffff848d4f7870
arpintr() at arpintr+0x9b5/frame 0xffffff848d4f7930

This do not affect kernel without OFED compiled in.

Reported by:	Garrett Cooper <yaneurabeya gmail com>


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250893 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFH revisions 242743 to 243202:

Make parameters to -c and -k options optional.  If no parameters are
supplied, print information for all keywords.

Improve output of -c option, in particular in conjunction with -k
option.

Complete man page.

Add comment on standards conformity.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250905 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f