Commit Graph

218372 Commits

Author SHA1 Message Date
Conrad Meyer
9716e7d4e4 dma-mbox-create: Restrict with Capsicum
The restriction here is pretty late and pretty minimal. We need a lot
of authority to open password databases, and don't do much after that
point.

Feedback from:	lifanov at mail.lifanov.com (earlier version), emaste (earlier version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D7988
2016-12-16 01:48:55 +00:00
Conrad Meyer
941e22d17d Capsicumify last(1)
Reviewed by:	ed (earlier version), emaste (earlier version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8001
2016-12-16 01:47:08 +00:00
Conrad Meyer
ec055aeff5 vfprintf(3): Add support for kernel %b format
This is a direct port of the kernel %b format.

I'm unclear on if (more) non-portable printf extensions will be a
problem. I think it's desirable to have userspace formats include all
kernel formats, but there may be competing goals I'm not aware of.

Reviewed by:	no one, unfortunately
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8426
2016-12-16 01:44:50 +00:00
Conrad Meyer
93326017f6 gelf_getphdr: Allow extended indices
Needed for 'readelf -l' of extended phnum files.  (Parity with GNU
binutils.)

Reviewed by:	no one, unfortunately
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8703
2016-12-16 01:42:51 +00:00
Conrad Meyer
1d1bfbbb38 libelf: Fix extended numbering detection
Extended numbering is used for any of these fields overflowing.

Reviewed by:	emaste@
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8701
2016-12-16 01:39:06 +00:00
Conrad Meyer
6a1c4d1efc capsicum_helpers: Add LOOKUP flag
Add a helper routine for opening a directory that is restricted to being
used for opening relative files as stdio streams.

I think this will really help basic adaptation of multi-file programs to
Capsicum. Rather than having each program initialize a rights object and
ioctl/fcntl arrays for their root fd for relative opens, consolidate in the
logical place.

Reviewed by:	oshogbo@
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8743
2016-12-16 01:37:44 +00:00
Pedro F. Giffuni
6e183b4b25 libbfd: make sure variables are initialized before using them.
Initialize l_sec_contents to make sure that free(l_sec_contents) is called
on valid pointers.

Obtained from:	OpenBSD (partial CVS rev 1.18)
MFC after:	5 days
2016-12-16 00:35:59 +00:00
Pedro F. Giffuni
d90714d2c5 libbfd: drop unnecessary variable increment.
Do not increment `s' before it is initialized. At the time
of the increment, `s' is otherwise unused anyway.

Obtained from:	OpenBSD (CVS rev 1.11)
2016-12-16 00:23:59 +00:00
Adrian Chadd
26eae5c681 [ar933x] don't waste memory/flash; drop the UMTX_CHAINS count down to 16. 2016-12-16 00:04:32 +00:00
Ed Maste
602f95d4c4 Add WITH_REPRODUCIBLE_BUILD src.conf(5) knob to disable kernel metadata
The kernel builds reproducibly, except for the time, date, user, and
hostname baked into the kernel (reported at startup and via the
kern.version sysctl for uname).  Add a build knob to disable the
inclusion of this metadata.

Reviewed by:	jhb
MFC after:	1 month
Relnotes:	Yes
Sponsored by:	Reproducible Builds World Summit 2, Berlin
Differential Revision:	https://reviews.freebsd.org/D8809
2016-12-15 21:26:58 +00:00
Andrew Turner
6eef858694 Add -fPIC to the ubldr build. Without this the self relocation code will
try to use an absolute address in a switch statement, jumping to an invalid
memory location.

Sponsored by:	ABT Systems Ltd
2016-12-15 17:36:54 +00:00
Emmanuel Vadot
74b66ae149 Fix building arm64 kernel after r310117
Pointy hat: me

MFC after:	3 days
2016-12-15 17:26:16 +00:00
Alan Somers
f698b621da Fix ls_tests:o_flag with ZFS TMPDIR
Unlike UFS or TMPFS, ZFS sets uarch automatically whenever a file is
updated. The test must explicitly clear uarch to be portable across
filesystems. Also, it doesn't need to run as root.

PR:		215179
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D8741
2016-12-15 16:13:52 +00:00
Emmanuel Vadot
15b2342cf3 Add information about interrupts in the Allwinner padconf files and
correct some pin numbering.

While here switch to my freebsd mail address in the copyright.

MFC after:	3 days
2016-12-15 15:52:13 +00:00
Ed Schouten
669a25b50d Document the existence of the {0, 6, ...} sysctl. 2016-12-15 15:45:11 +00:00
Ed Maste
e77cf5967a newvers.sh: correct typo in comment
Submitted by:	lidl
2016-12-15 15:14:02 +00:00
Andrew Turner
cf1db37a45 Directly include openfirm.h rather than through fdt_common.h as none of the
latter file is needed.

Sponsored by:	ABT Systems Ltd
2016-12-15 13:31:44 +00:00
Ed Maste
7e9de36c3a newvers.sh: add option to eliminate kernel build metadata
Build metadata (username, hostname, etc.) prevents the FreeBSD kernel
from building reproducibly. Add an option to disable inclusion of that
metadata but retain the release information and SVN/git VCS details.
See https://reproducible-builds.org/ for additional background.

Reviewed by:	bapt
Obtained from:	NetBSD
MFC after:	1 month
Sponsored by:	Reproducible Builds World Summit 2, Berlin
Differential Revision:	https://reviews.freebsd.org/D4347
2016-12-15 12:57:03 +00:00
Alexander Motin
c5f74c4873 Revert r310023 for now.
After another look my new variable mapping was not exactly right.
2016-12-15 08:03:16 +00:00
Sepherosa Ziehau
9622c93ae8 hyperv: Allow userland to ro-mmap reference TSC page
This paves way to implement VDSO for the enlightened time counter.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8768
2016-12-15 03:32:24 +00:00
Navdeep Parhar
1de8c69de7 cxgbe(4): Deal with compressed error vectors.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2016-12-15 02:05:29 +00:00
Konstantin Belousov
a1e9a3bba3 Provide introductory description of the default pager.
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-12-14 23:36:32 +00:00
Konstantin Belousov
a41ece0840 Remove locking around accounting initialization of the default object.
The object is not yet fully constructed and must not be available to
other threads.  This makes default_pager_alloc() almost identical to
swap_pager_alloc_init().

Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-12-14 23:34:25 +00:00
Jilles Tjoelker
b9a6fb9343 reaper: Make REAPER_KILL_SUBTREE actually work.
MFC after:	2 weeks
2016-12-14 22:49:20 +00:00
Brooks Davis
facc3cb0ff Use nmount(2) rather than the obsolete mount(2).
Reviewed by:	cem
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8513
2016-12-14 21:30:44 +00:00
Brooks Davis
b32720888a Add a free_iovec() function to reset iovec's.
The primary purpose is to call nmount() in a loop with new iovec's so
free_iovec takes arguments by reference and resets their values.

Reviewed by:	cem
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8513
2016-12-14 21:26:43 +00:00
Pedro F. Giffuni
f50fae318d ed(1): drop redundant parenthesis.
These were Left-over from the cleanup in r309936.
2016-12-14 21:14:43 +00:00
Brooks Davis
9dad1250d7 Mount filesystems without executable permissions since they should never
be used.

Reviewed by:	cem
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8513
2016-12-14 21:13:10 +00:00
Andriy Voskoboinyk
bdad1bcea4 ifconfig: do not truncate SSID in verbose mode.
Fix 32-character SSID abbreviation for 'ifconfig -v wlan0 scan' command.

PR:		215301
Submitted by:	<ms-freebsd-bugzilla@stoffnet.at>
MFC after:	4 days
2016-12-14 21:12:43 +00:00
Brooks Davis
176d3efd2b Put the undocumented df feature of mounting filesystems from device nodes
under an ifdef.  Leave enabled.

Reviewed by:	cem
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8513
2016-12-14 21:11:42 +00:00
Rene Ladan
e61e40a204 Add adamw, feld and rene to the portmgr organization 2016-12-14 20:53:46 +00:00
Dimitry Andric
085def3f0a In xbd_connect(), use correct scanf conversion specifiers for the
feature_barrier and feature_flush variables.  Otherwise, adjacent
variables on the stack, such as sector_size, may be overwritten, with
disastrous results.

Note that I did not see a good reason to revert the addition of zero
checks introduced in r310013.  Better safe than sorry.

PR:		215209
Tested by:	royger
MFC after:	3 days
2016-12-14 19:28:19 +00:00
Mark Johnston
90556839e9 Skip a ustack test that triggers an assertion on INVARIANTS kernels.
Reported by:	ngie
Sponsored by:	Dell EMC Isilon
X-MFC-With:	r309698
2016-12-14 19:01:43 +00:00
Mark Johnston
f85ea63d69 Don't run the MCA record refill task during boot.
The MCA taskqueue is not initialized until some time after CMCIs are
enabled on the BSP.

Reviewed by:	cem, jhb
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8783
2016-12-14 19:00:08 +00:00
Alan Cox
3d026d871f Tidy up. Mostly, remove or replace stale comments. Most of the comments
in this file actually described the operation of the swap pager, not the
default pager.  Given that this is the wrong place to discuss the
implementation of the swap pager, it shouldn't come as a surprise that as
the swap pager evolved these comments became increasingly stale.  In
addition, apply some style fixes, like modernizing a few remaining old-
style function definitions.

Reviewed by:	kib, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8781
2016-12-14 17:28:55 +00:00
Emmanuel Vadot
2b0f0faeb6 Add new compatible string "allwinner,sun7i-a20-mmc".
New upstream DTS is using this now for A20 SoC.

MFC after:	3 days
2016-12-14 15:00:24 +00:00
Hans Petter Selasky
d3e8d4784d Fix initialisation of mlx4_pci_table's .driver_data fields.
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D8791
Sponsored by:		Mellanox Technologies
Submitted by:		Dexuan Cui <decui@microsoft.com>
2016-12-14 14:13:44 +00:00
Ed Schouten
13a83707bc Revert accidental change made in r310056.
Because I had to cherry-pick some of my changes in r310051, I
accidentally made a typo when manually applying the rest in r310056.
2016-12-14 13:35:33 +00:00
Ed Schouten
977ffc4c2a Let all FEATURE()s use the same Prometheus metric.
Without this change, every individual FEATURE() declaration would have
an individual metric in Prometheus. Though this wouldn't be harmful, it
would look very cluttered.

By letting it use a single metric with the name of the feature attached
as a label, it also becomes easier to search, as you can apply regex
matching, etc.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D8775
2016-12-14 13:05:04 +00:00
Ed Schouten
ae15715360 Add a "device_index" label to all sysctls under dev.$driver.$index.
This way it becomes possible to graph a property for all instances of a
single driver. For example, graphing the number of packets across all
USB controllers, the amount of dropped packets on all NICs, etc.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D8775
2016-12-14 13:03:01 +00:00
Ed Schouten
3fd335bcc7 Attach a "thermal_zone" label to the ACPI thermal zone sysctls.
In order to make Prometheus do graphing/alerting on thermal sensors in a
generic fashion, we should attach the name of the thermal zone device as
a label. That way there is only a single metric for the temperature of a
thermal zone, with its name attached as a label.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D8775
2016-12-14 13:00:27 +00:00
Ed Schouten
fd0f59709d Add labels to sysctls related to clocks.
Sysctls like kern.eventtimer.et.*.quality currently embed the name of
the clock device. This is problematic for the Prometheus metrics
exporter for two reasons:

- Some of those clocks have dashes in their names, which Prometheus
  doesn't allow to be used in metric names.
- It doesn't allow for extracting the same property of all clocks on the
  system from within a single query.

Attach these nodes to have a label, so that the Prometheus metrics
exporter gives these metric a uniform name with the name of the clock
attached as a label.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D8775
2016-12-14 12:56:58 +00:00
Ed Schouten
4c484fd216 Add label annotations to CAM sysctls.
Under kern.cam we have certain sysctls that are per-device, such as the
ones under kern.cam.ada.[0-9]+.*. Add a "device_index" label annotation
to such sysctls, so that the Prometheus metrics exporter will give all
of those metrics the same name. The device number will be added to the
metric name as the "device_index" label.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D8775
2016-12-14 12:53:33 +00:00
Ed Schouten
1e1f3941e4 Add support for attaching aggregation labels to sysctl objects.
I'm currently working on writing a metrics exporter for the Prometheus
monitoring system to provide access to sysctl metrics. Prometheus and
sysctl have some structural differences:

- sysctl is a tree of string component names.
- Prometheus uses a flat namespace for its metrics, but allows you to
  attach labels with values to them, so that you can do aggregation.

An initial version of my exporter simply translated

    hw.acpi.thermal.tz1.temperature

to

    sysctl_hw_acpi_thermal_tz1_temperature_celcius

while we should ideally have

    sysctl_hw_acpi_thermal_temperature_celcius{thermal_zone="tz1"}

allowing you to graph all thermal zones on a system in one go.

The change presented in this commit adds support for accomplishing this,
by providing the ability to attach labels to nodes. In the example I
gave above, the label "thermal_zone" would be attached to "tz1". As this
is a feature that will only be used very rarely, I decided to not change
the KPI too aggressively.

Discussed on:	hackers@
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D8775
2016-12-14 12:47:34 +00:00
Konstantin Belousov
396a688bd9 Provide non-final but valid PCB pointer for thread0 for duration of
hammer_time().  This makes assembler exception handlers not fault
itself when setting PCB flags, and allow normal kernel trap handler to
get control.  The pointer is reset after FPU parameters are obtained.

Set thread0.td_critnest to 1 for duration of hammer_time() as well.
In particular, page faults at that early stage panic immediately
instead of trying to call not yet operational VM to resolve it.

As result, faults during second half of the hammer_time() execution
have a chance to be reported instead of silent machine reboot or hang.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-12-14 11:40:31 +00:00
Navdeep Parhar
ca276276f1 cxgbe(4): Fix the tid range shown for T6 cards in misc.tids.
MFC after:	3 days
2016-12-14 07:36:36 +00:00
Sepherosa Ziehau
de69dfbbbc hyperv: Implement "enlightened" time counter, which is rdtsc based.
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8763
2016-12-14 03:20:57 +00:00
Glen Barber
82fe834050 - Resize FreeBSD to the size of the OpenStack flavor (growfs).
- Speeds up the boot process by disabling sendmail.
- Allows an user to ssh as root with a public key.
- Make ssh(1) respond faster by disabling DNS lookups.
- Enable DHCP on the vtnet(4) interface.

Note: The CLOUDWARE list has not yet been changed to include the
OpenStack target by default yet.

Submitted by:	Diego Casati
PR:		215258
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2016-12-14 03:01:15 +00:00
John Baldwin
a24563566a Add 'const' to fn_name's return type to remove a cast. 2016-12-14 00:21:06 +00:00
John Baldwin
ecb65f66c6 Use casts to force an unsigned comparison in db_search_symbol().
On all of our platforms, db_expr_t is a signed integer while
db_addr_t is an unsigned integer value.  db_search_symbol used variables
of type db_expr_t to hold the current offset of the requested address from
the "best" symbol found so far.  This value was initialized to '~0'.
When a new symbol is found from a symbol table, the associated diff for the
new symbol is compared against the existing value as 'if (newdiff < diff)'
to determine if the new symbol had a smaller diff and was thus a closer
match.

On 64-bit MIPS, the '~0' was treated as a negative value (-1).  A lookup
that found a perfect match of an address against a symbol returned a diff
of 0.  However, in signed comparisons, 0 is not less than -1.  As a result,
DDB on 64-bit MIPS never resolved any addresses to symbols.  Workaround
this by using casts to force an unsigned comparison.

Probably the diff returned from db_search_symbol() and X_db_search_symbol()
should be changed to a db_addr_t instead of a db_expr_t as it is an
unsigned value (and is an offset of an address, so should fit in the same
size as an address).

Sponsored by:	DARPA / AFRL
2016-12-14 00:18:12 +00:00