]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoMFH @r292599
Bjoern A. Zeeb [Tue, 22 Dec 2015 13:58:11 +0000 (13:58 +0000)]
MFH @r292599

This includes the pluggable TCP framework and other chnages to the
netstack to track for VNET stability.

Security: The FreeBSD Foundation

8 years agoFix a panic when launching VNETs after the commit of r292309.
Jonathan T. Looney [Tue, 22 Dec 2015 13:41:50 +0000 (13:41 +0000)]
Fix a panic when launching VNETs after the commit of r292309.

Differential Revision: https://reviews.freebsd.org/D4645
Reviewed by: rrs
Reported by: kp
Tested by: kp
Sponsored by: Juniper Networks

8 years agoWe don't need to use a temporary buffer, here.
Hajimu UMEMOTO [Tue, 22 Dec 2015 12:01:06 +0000 (12:01 +0000)]
We don't need to use a temporary buffer, here.

MFC after: 1 week

8 years agoMake CUSE usable with platforms where the size of "unsigned long" is
Hans Petter Selasky [Tue, 22 Dec 2015 09:55:44 +0000 (09:55 +0000)]
Make CUSE usable with platforms where the size of "unsigned long" is
different from the size of a pointer.

8 years agoMake CUSE usable with platforms where the size of "unsigned long" is
Hans Petter Selasky [Tue, 22 Dec 2015 09:41:33 +0000 (09:41 +0000)]
Make CUSE usable with platforms where the size of "unsigned long" is
different from the size of a pointer.

8 years agoGuard against the same process being both CUSE server and client at
Hans Petter Selasky [Tue, 22 Dec 2015 09:26:24 +0000 (09:26 +0000)]
Guard against the same process being both CUSE server and client at
the same time. This can easily lead to a deadlock when destroying the
character devices nodes.

8 years agoRemove the arm KERNPHYSADDR option as it is no longer used. The make
Andrew Turner [Tue, 22 Dec 2015 09:08:21 +0000 (09:08 +0000)]
Remove the arm KERNPHYSADDR option as it is no longer used. The make
option is still in existance as it is used to build the trampoline code.

8 years agoFor embedded platforms that require it, use mtools to copy the
Warner Losh [Tue, 22 Dec 2015 06:36:00 +0000 (06:36 +0000)]
For embedded platforms that require it, use mtools to copy the
appropriate u-boot port's files into the fat part.

8 years agoPrevent use-after-free with ctx->ns in set_nameservers(..), which could occur
Enji Cooper [Tue, 22 Dec 2015 05:57:23 +0000 (05:57 +0000)]
Prevent use-after-free with ctx->ns in set_nameservers(..), which could occur
if the memory wasn't allocated again later on

Reported by: Coverity
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoSet env vars from values on the efi loader command line.
Ian Lepore [Tue, 22 Dec 2015 03:07:38 +0000 (03:07 +0000)]
Set env vars from values on the efi loader command line.

Examine each cmdline arg and if it contains an '=' convert it to ascii and
pass it to putenv(). This allows var=value settings to come in on the
command line.

This will allow overriding dhcp server-provided data in loader(8), as
discussed in PR 202098

PR: 202098
Differential Revision: https://reviews.freebsd.org/D4561

8 years agoAllow dhcp/bootp server-provided values to be overriden from environment
Ian Lepore [Tue, 22 Dec 2015 03:02:52 +0000 (03:02 +0000)]
Allow dhcp/bootp server-provided values to be overriden from environment
variables in loader(8) and other libstand applications.

Sometimes a dhcp server provides incorrect information along with the IP
address. It would be useful to have a way to override this with
locally-supplied information, such as command line parameters passed from a
prior-stage bootloader. This change allows pre-existing env vars to take
precedence over values delivered by the dhcp or bootp server.

The bootp/dhcp code in libstand automatically creates environment variables
from the data provided by the server (dhcp.root-path, dhcp.domain-name,
etc). It also transcribes the values to some global variables such as
'rootpath' and 'hostname'.

This change does two things:

    When adding dhcp.* vars to the environment, don't replace existing
    vars/values.

    When setting the global vars rootpath and hostname, use the
    dhcp.root-path and dhcp.host-name env var values if they exist.

This allows the platform-specific part of loader(8) to obtain override
values in some platform-specific way and store them in the environment
before opening the network device. The set of values that can be overriden
is currently limited to just string options. The values that are delivered
as binary data are things that probably shouldn't be overridden (IP,
netmask, gateway, etc).

The original patch this evolved from was submitted by martymac@

PR: 202098
Differential Revision: https://reviews.freebsd.org/D4559

8 years agoDump out the output from flock_helper on failure so failures with the
Enji Cooper [Tue, 22 Dec 2015 02:10:31 +0000 (02:10 +0000)]
Dump out the output from flock_helper on failure so failures with the
test app can be debugged

MFC after: 1 week
Obtained from: Isilon OneFS (^/onefs/head@r511419)
Sponsored by: EMC / Isilon Storage Division

8 years agoUse stable output to a test file instead of depending on the OS name being
Enji Cooper [Tue, 22 Dec 2015 01:21:27 +0000 (01:21 +0000)]
Use stable output to a test file instead of depending on the OS name being
grep'able in /bin/sh

This fixes the situation where the OS has been rebranded to something other
than `FreeBSD`

MFC after: 1 week
Obtained from: Isilon OneFS (^/onefs/head@r511419)
Reviewed by: cem, Daniel O'Connor <darius@dons.net.au>
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd libxo support to jls
Craig Rodrigues [Tue, 22 Dec 2015 00:58:35 +0000 (00:58 +0000)]
Add libxo support to jls

PR:                    200746
Submitted by:          Emmanuel Vadot <manu bidouilliste com>
Reviewed by:           allanjude
Relnotes:              yes
Differential Revision: https://reviews.freebsd.org/D4452

8 years agoFix the detection of IO/memory space changing across busses when the bus
Ian Lepore [Tue, 22 Dec 2015 00:53:19 +0000 (00:53 +0000)]
Fix the detection of IO/memory space changing across busses when the bus
is not pci (and thus where, ironically, the whole situation is meaningless).

This was not an error in the original code, it was introduced during my
refactoring to commonize the routine.  A small change a few lines above
drove the need to make this change, and the error didn't show up on the
platforms I initially tested with.

8 years agoDon't dump core files with lib/libc/ssp/ssp_test and lib/libc/gen/assert_test
Enji Cooper [Tue, 22 Dec 2015 00:43:22 +0000 (00:43 +0000)]
Don't dump core files with lib/libc/ssp/ssp_test and lib/libc/gen/assert_test

The default `sysctl kern.corefile` value is compatible with `kyua test` (FreeBSD
will dump to the current directory). If it's set to an absolute path however,
`kyua test` will not be able to clean up the corefiles after the fact

The corefiles have little value when testing the behavior of feature behavior,
so just disable corefile generation

MFC after: 1 week
Obtained from: Isilon OneFS (^/onefs/head@r511419)
Sponsored by: EMC / Isilon Storage Division

8 years agoInclude machine/_bus.h so that bus_space_[tag|handle]_t will be available.
Ian Lepore [Mon, 21 Dec 2015 23:47:49 +0000 (23:47 +0000)]
Include machine/_bus.h so that bus_space_[tag|handle]_t will be available.

It appears that all platforms except aarch64 are getting the file via
various header pollution, and ensuring _bus.h is included before any
openfirmware headers in every consumer of ofw/fdt stuff seems like more of
a career path than a task, so I'm taking this easy way out.

8 years agoboot1.efi: show EFI error number, not full status value
Ed Maste [Mon, 21 Dec 2015 22:42:03 +0000 (22:42 +0000)]
boot1.efi: show EFI error number, not full status value

EFI return values set the high bit to indicate an error. The log
messages changed here are printed only in the case of an error,
so including the error bit is redundant. Also switch to decimal to
match the error definitions (in sys/boot/efi/include/efierr.h).

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

8 years agortld: Use common NT_FREEBSD_* note types introduced in r291909
Ed Maste [Mon, 21 Dec 2015 22:40:29 +0000 (22:40 +0000)]
rtld: Use common NT_FREEBSD_* note types introduced in r291909

Sponsored by: The FreeBSD Foundation

8 years agoAdd i.MX 6 IPU driver and enable it in IMX6 config
Oleksandr Tymoshenko [Mon, 21 Dec 2015 22:25:35 +0000 (22:25 +0000)]
Add i.MX 6 IPU driver and enable it in IMX6 config

Current functionality is somewhat limited: driver assumes that there
is only one active IPU unit (IPU1) and that video output is DI0 and
video mode is 1024x768. For more advanced functionality driver requires
proper clock management which is work in progress. At the moment driver
assumes that pixel clock is configured by u-boot for 1026x768 mode.

Reviewed by: andrew, ian, mmel
Differential Revision: https://reviews.freebsd.org/D4168

8 years agoFix "mount -a" for NFS and ZFS filesystems with shared mountpoints
Alan Somers [Mon, 21 Dec 2015 22:19:22 +0000 (22:19 +0000)]
Fix "mount -a" for NFS and ZFS filesystems with shared mountpoints

sbin/mount.c
Check whether an fstab entry has the same fstype as a mounted
filesystem before declaring it to be mounted. This will allow NFS
filesystems that share a mountpoint with a local filesystem to be
automatically mounted at boot.

This is not such an unusual situation. For example, if somebody uses
the standard installer with a ZFS root, he'll get a /usr/home
filesystem, even though he may choose to mount /usr/home over NFS.

Reviewed by: trasz
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D4556

8 years ago- Add driver for i.MX 6 HDMI framer
Oleksandr Tymoshenko [Mon, 21 Dec 2015 21:40:15 +0000 (21:40 +0000)]
- Add driver for i.MX 6 HDMI framer
- Enable HDMI driver in IMX6 config

Reviewed by: andrew, ian, mmel
Differential Revision: https://reviews.freebsd.org/D4174

8 years agoIntegrate tools/regression/mac/mac_bsdextended and
Enji Cooper [Mon, 21 Dec 2015 21:24:03 +0000 (21:24 +0000)]
Integrate tools/regression/mac/mac_bsdextended and
tools/regression/mac/mac_portacl into the FreeBSD test suite as
tests/sys/mac/bsdextended and tests/sys/mac/portacl, respectively

MFC after: 1 month
Sponsored by: EMC / Isilon Storage Division

8 years agoMake the mac_portacl testcases work / more robust
Enji Cooper [Mon, 21 Dec 2015 21:15:23 +0000 (21:15 +0000)]
Make the mac_portacl testcases work / more robust

- A trap(1) call has been added to the test scripts to better
  ensure that the tests do a better job at trying to restore the
  test host state at the end of the tests (if the test was
  interrupted before it would leave the system in an odd state,
  potentially making the test results for subsequent runs
  non-deterministic).
- Add root user checks
- Fix nc(1) usage:
  -- -o is deprecated
  -- Using `-w 10` will make the call timeout after 10 seconds so it
     doesn't block indefinitely
- Use local variables
- Be more terse in the error messages
- Parameterize out "127.0.0.1"

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoRevert this change. It broke the trampoline build. Until I'm sure
Warner Losh [Mon, 21 Dec 2015 20:36:01 +0000 (20:36 +0000)]
Revert this change. It broke the trampoline build. Until I'm sure
nothing else is broken, I'm reverting.

8 years agoAdd CCM functions to enable HDMI framer and IPU units (video controller)
Oleksandr Tymoshenko [Mon, 21 Dec 2015 20:17:24 +0000 (20:17 +0000)]
Add CCM functions to enable HDMI framer and IPU units (video controller)

Reviewed by: andrew, ian
Differential Revision: https://reviews.freebsd.org/D4168

8 years agoAdd port for IRC over TLS/SSL, as noted in RFC 7194.
Jeremie Le Hen [Mon, 21 Dec 2015 20:14:40 +0000 (20:14 +0000)]
Add port for IRC over TLS/SSL, as noted in RFC 7194.

PR: 192505
Submitted by: loic.blot@unix-experience.fr
MFC after: 3 days

8 years agoloader.efi: strip trailing whitespace
Ed Maste [Mon, 21 Dec 2015 19:56:11 +0000 (19:56 +0000)]
loader.efi: strip trailing whitespace

Sponsored by: The FreeBSD Foundation

8 years agoAs previously noted in r290409, purge old entries from MAINTAINERS.
John Baldwin [Mon, 21 Dec 2015 19:15:06 +0000 (19:15 +0000)]
As previously noted in r290409, purge old entries from MAINTAINERS.

8 years agoStop processing of a SACK when the association has been aborted.
Michael Tuexen [Mon, 21 Dec 2015 18:52:02 +0000 (18:52 +0000)]
Stop processing of a SACK when the association has been aborted.

MFC after: 3 days

8 years agoConfigure the Atmel eval boards to boot the same way. This gives
Warner Losh [Mon, 21 Dec 2015 18:27:51 +0000 (18:27 +0000)]
Configure the Atmel eval boards to boot the same way. This gives
them the same layout as other embedded systems.

8 years agoAdd a mips implementation of OF_decode_addr().
Ian Lepore [Mon, 21 Dec 2015 18:19:14 +0000 (18:19 +0000)]
Add a mips implementation of OF_decode_addr().

8 years agoImplement OF_decode_addr() for arm. Move most of powerpc's implementation
Ian Lepore [Mon, 21 Dec 2015 18:07:32 +0000 (18:07 +0000)]
Implement OF_decode_addr() for arm.  Move most of powerpc's implementation
into a new function that other platforms can share.

This creates a new ofw_reg_to_paddr() function (in a new ofw_subr.c file)
that contains most of the existing ppc implementation, mostly unchanged.
The ppc code now calls the new MI code from the MD code, then creates a
ppc-specific bus_space mapping from the results. The new arm implementation
does the same in an arm-specific way.

This also moves the declaration of OF_decode_addr() from ofw_machdep.h to
openfirm.h, except on sparc64 which uses a different function signature.

This will help all FDT platforms to set up early console access using
OF_decode_addr().

8 years agoUse _map_v4v6_address().
Hajimu UMEMOTO [Mon, 21 Dec 2015 17:54:23 +0000 (17:54 +0000)]
Use _map_v4v6_address().

MFC after: 1 week

8 years agoMake the building of libsmb and mount_smbfs unconditional, now that r292552
Ian Lepore [Mon, 21 Dec 2015 17:41:08 +0000 (17:41 +0000)]
Make the building of libsmb and mount_smbfs unconditional, now that r292552
has eliminated alignment and endian problems that were making it fail on
some platforms.

PR:        180438
PR:        189415

8 years agoAvoid unaligned memory accesses when encoding netbios names in libsmb.
Ian Lepore [Mon, 21 Dec 2015 17:17:00 +0000 (17:17 +0000)]
Avoid unaligned memory accesses when encoding netbios names in libsmb.

The current code for encoding a netbios name converts each byte to a 16-bit
value and stores the result by casting a char* to u_short*, resulting in
alignment faults on strict-alignment platforms.

This change reimplements the encoding routine using only byte accesses to
memory. There is no particular reason to work with 16-bit values just
because the encoding process creates two bytes of output for every byte of
input. Working a byte at at time also avoids endian problems for big-endian
platforms.

PR: 180438
PR: 189415
Differential Revision: https://reviews.freebsd.org/D4622

8 years agoSimplify _map_v4v6_address().
Hajimu UMEMOTO [Mon, 21 Dec 2015 16:55:36 +0000 (16:55 +0000)]
Simplify _map_v4v6_address().

Suggested by: hrs
MFC after: 1 week

8 years agomakefs: use ENTRY macro for diff reduction with NetBSD
Ed Maste [Mon, 21 Dec 2015 16:12:41 +0000 (16:12 +0000)]
makefs: use ENTRY macro for diff reduction with NetBSD

Sponsored by: The FreeBSD Foundation

8 years ago- Convert testcase to TAP format
Enji Cooper [Mon, 21 Dec 2015 12:43:04 +0000 (12:43 +0000)]
- Convert testcase to TAP format
- Use nitems(x) instead of handrolled sizeof(x) / sizeof(*x) macro
- Do not mark count != 0 case with bsde_get_rule_count as a failure; this
  generates false positives on systems with ugidfw rules set on it

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoRedo the TAP integration so it works with Kyua
Enji Cooper [Mon, 21 Dec 2015 12:39:16 +0000 (12:39 +0000)]
Redo the TAP integration so it works with Kyua

Kyua needs numbers in the TAP results :/, but prove doesn't

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoImplement drain_workqueue() function.
Hans Petter Selasky [Mon, 21 Dec 2015 12:20:02 +0000 (12:20 +0000)]
Implement drain_workqueue() function.

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoIn the zero delay case in queue_delayed_work() use the return value
Hans Petter Selasky [Mon, 21 Dec 2015 12:13:03 +0000 (12:13 +0000)]
In the zero delay case in queue_delayed_work() use the return value
from taskqueue_enqueue() instead of reading "ta_pending" unlocked and
also ensure the callout is stopped before proceeding.

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoMinor workqueue cleanup:
Hans Petter Selasky [Mon, 21 Dec 2015 11:58:59 +0000 (11:58 +0000)]
Minor workqueue cleanup:
- Make some functions global instead of inline to ease debugging.
- Fix some minor style issues.

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoRecheck curthread->td_su after the VFS_SYNC() call, and re-sync if the
Konstantin Belousov [Mon, 21 Dec 2015 11:50:32 +0000 (11:50 +0000)]
Recheck curthread->td_su after the VFS_SYNC() call, and re-sync if the
ast was rescheduled during VFS_SYNC().  It is possible that enough
parallel writes or slow/hung volume result in VFS_SYNC() deferring to
the ast flushing of workqueue.

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

8 years agoIf we end up following a CNAME chain that does not find
Hajimu UMEMOTO [Mon, 21 Dec 2015 11:24:14 +0000 (11:24 +0000)]
If we end up following a CNAME chain that does not find
any data return that instead of internal error.

PR: 156684
Obtained from: NetBSD
MFC after: 1 week

8 years agoImplement sleepable RCU mechanism using shared exclusive locks.
Hans Petter Selasky [Mon, 21 Dec 2015 11:03:12 +0000 (11:03 +0000)]
Implement sleepable RCU mechanism using shared exclusive locks.

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoImplement ACCESS_ONCE(), WRITE_ONCE() and READ_ONCE().
Hans Petter Selasky [Mon, 21 Dec 2015 10:56:38 +0000 (10:56 +0000)]
Implement ACCESS_ONCE(), WRITE_ONCE() and READ_ONCE().

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoFix 'make depend'
Ulrich Spörlein [Mon, 21 Dec 2015 09:38:45 +0000 (09:38 +0000)]
Fix 'make depend'

8 years agoSkip the testcases if mac_bsdextended(4) isn't detected on the
Enji Cooper [Mon, 21 Dec 2015 08:58:14 +0000 (08:58 +0000)]
Skip the testcases if mac_bsdextended(4) isn't detected on the
system

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoMark `subject matching jailid` testcase as an unexpected failure with
Enji Cooper [Mon, 21 Dec 2015 08:53:26 +0000 (08:53 +0000)]
Mark `subject matching jailid` testcase as an unexpected failure with
TODO to ensure that the testcase isn't marked as a failure

PR: 205481
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoMake test_matches.sh into a series of TAP testcases
Enji Cooper [Mon, 21 Dec 2015 08:14:45 +0000 (08:14 +0000)]
Make test_matches.sh into a series of TAP testcases

Use temporary filesystems / memory disks instead of a hardcoded path
which doesn't exist on test systems

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years ago- Use 1 for an exit code instead of -1 with err, errx, and exit
Enji Cooper [Mon, 21 Dec 2015 07:04:01 +0000 (07:04 +0000)]
- Use 1 for an exit code instead of -1 with err, errx, and exit
- Add unistd.h for getuid(3)
- Sort #includes

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoThere's no such program as [-n :(. Add the missing space. Also,
Warner Losh [Mon, 21 Dec 2015 05:08:20 +0000 (05:08 +0000)]
There's no such program as [-n :(. Add the missing space. Also,
work when the object directory doesn't exist yet. realpath hates
us, so use the backup of the realpath arg when that happens.

8 years agox86: Add CPUID_STDEXT_* macros for CPU feature bits
Conrad Meyer [Mon, 21 Dec 2015 04:42:58 +0000 (04:42 +0000)]
x86: Add CPUID_STDEXT_* macros for CPU feature bits

A follow-up to r292478 and r292488.

Sponsored by: EMC / Isilon Storage Division

8 years agoAdd strlcat() and strlcpy() to libstand32. This should have been part of
Ian Lepore [Mon, 21 Dec 2015 02:02:43 +0000 (02:02 +0000)]
Add strlcat() and strlcpy() to libstand32.  This should have been part of
r292234, but I forgot there was a libstand32.

Submitted by: martymac
Pointy hat: ian

8 years ago[mips] print out l2 cache configuration if it exists.
Adrian Chadd [Mon, 21 Dec 2015 01:48:16 +0000 (01:48 +0000)]
[mips] print out l2 cache configuration if it exists.

The Ingenic JZ7480 SoC that is on the Imagination Technologies CI20 board
has an L2 cache:

Cache info:
  picache_stride    = 4096
  picache_loopcount = 8
  pdcache_stride    = 4096
  pdcache_loopcount = 8
cpu0: Ingenic Xburst processor v79.2
  MMU: Standard TLB, 32 entries
  L1 i-cache: 8 ways of 128 sets, 32 bytes per line
  L1 d-cache: 8 ways of 128 sets, 32 bytes per line
  L2 cache: 8 ways of 256 sets, 128 bytes per line, 256 KiB total size
  Config1=0xbe67338b<WatchRegs,EJTAG,FPU>
  Config2=0x80000267
  Config3=0x20

8 years agoReplace some references to KERNPHYSADDR with the equivelent value passed in
Ian Lepore [Mon, 21 Dec 2015 01:14:54 +0000 (01:14 +0000)]
Replace some references to KERNPHYSADDR with the equivelent value passed in
from the bootloader.

8 years agoChange KERNVIRTADDR to 0xc0000000 since the low-order bits no longer need to
Ian Lepore [Sun, 20 Dec 2015 23:38:14 +0000 (23:38 +0000)]
Change KERNVIRTADDR to 0xc0000000 since the low-order bits no longer need to
match the physical load address.  Remove the *PHYSADDR symbols which are no
longer necessary.

Also remove a bunch of comments, most of which which have been wrong for
quite some time now, and the rest of which are mooted by these changes.  All
that's left in this file is assigning a single symbol to its cannonical
value, not much to comment on anymore.

8 years agoAllow armv4/5 kernels to be loaded on any 2MB boundary, like armv6/7.
Ian Lepore [Sun, 20 Dec 2015 23:31:11 +0000 (23:31 +0000)]
Allow armv4/5 kernels to be loaded on any 2MB boundary, like armv6/7.

This eliminates the reliance on PHYSADDR and KERNPHYSADDR compile-time
symbols (except when the rom-copy code is enabled) by using the current
PC and the assumption that the entry-point routine is in the first 1MB
section of the text segment.

Other cleanups done:

 - Reduce the initarm() stack size back to 2K.  It got increased to
   4 * 2K when this file was supporting multicore armv6, but that
   support is now in locore-v6.S.

 - When building the temporary startup page tables, map the entire
   4GB address space as VA=PA before mapping the kernel at its loaded
   location.  This allows access to boot parameters stored somewhere
   in ram by the bootloader, regardless of where that may be.

 - When building the page table entry for supporting EARLY_PRINTF, map
   the section as uncached unbuffered, since it is presumably device
   registers.

Note that this restores the ability to use loader(8)/ubldr on armv4/5
kernels.  That was broken in r283035, the point at which ubldr started
loading an arm kernel at any 2MB boundary.

Also note that after this, there is no reason to set KERNVIRTADDR to
anything other than 0xc0000000, and no need for PHYSADDR or KERNPHYSADDR
symbols at all.

8 years agoMerge from contrib/openbsm to bring the kernel audit bits up to date with OpenBSM...
Christian Brueffer [Sun, 20 Dec 2015 23:22:04 +0000 (23:22 +0000)]
Merge from contrib/openbsm to bring the kernel audit bits up to date with OpenBSM 1.2 alpha 4:

- remove $P4$
- fix a comment

8 years agolibc: Use namespace.h in a few more files.
Jilles Tjoelker [Sun, 20 Dec 2015 23:05:20 +0000 (23:05 +0000)]
libc: Use namespace.h in a few more files.

libc now no longer calls fstat(), socketpair() and wait(), only the
underscore-prefixed versions (_waitpid() instead of wait()).

8 years agoTidy up mips ofw_machdep.h. Don't include openfirm.h because openfirm.h
Ian Lepore [Sun, 20 Dec 2015 19:09:12 +0000 (19:09 +0000)]
Tidy up mips ofw_machdep.h.  Don't include openfirm.h because openfirm.h
is what includes machine/ofw_machdep.h.  Don't declare OF_decode_addr();
it isn't implemented yet on mips and the declaration for it is about to
be commonized into openfirm.h.

8 years agoDon't assume checksums will be calculated later when fastfoward is
Cy Schubert [Sun, 20 Dec 2015 18:02:13 +0000 (18:02 +0000)]
Don't assume checksums will be calculated later when fastfoward is
enabled (by default in r290383).

PR: 72210
MFC after: 1 week

8 years agosh/mknodes: Close files and check for errors when writing.
Jilles Tjoelker [Sun, 20 Dec 2015 16:40:36 +0000 (16:40 +0000)]
sh/mknodes: Close files and check for errors when writing.

This is a build tool only and does not affect run time.

PR: 204951
MFC after: 1 week

8 years agolibthr: Don't use both __sys_open() and __sys_openat().
Jilles Tjoelker [Sun, 20 Dec 2015 16:33:56 +0000 (16:33 +0000)]
libthr: Don't use both __sys_open() and __sys_openat().

8 years agoloader.efi: refresh size in GetMemoryMap retry loop
Ed Maste [Sun, 20 Dec 2015 16:07:09 +0000 (16:07 +0000)]
loader.efi: refresh size in GetMemoryMap retry loop

If ExitBootServices fails due to a changed efi_mapkey then GetMemoryMap
must be called again. In this case it is also possible for the memory
map to grow, so repeat the initial GetMemoryMap call to fetch the new
size.

Also roll bi_add_efi_data_and_exit into bi_load_efi_data as there's no
need for it to be a separate function.

PR: 202455
Reported by: Berislav Purgar <bpurgar@gmail.com>
Tested by: Berislav Purgar <bpurgar@gmail.com>
Reviewed by: kib
MFC after: 1 week
MFC with: r292338
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D4621

8 years agoaddrinfo.ai_family is an address family, not a protocol family.
Hajimu UMEMOTO [Sun, 20 Dec 2015 15:18:50 +0000 (15:18 +0000)]
addrinfo.ai_family is an address family, not a protocol family.

PR: 162434
MFC after: 1 week

8 years agoclock_gettime(2),gettimeofday(2): Remove [EFAULT] error.
Jilles Tjoelker [Sun, 20 Dec 2015 15:11:11 +0000 (15:11 +0000)]
clock_gettime(2),gettimeofday(2): Remove [EFAULT] error.

Depending on system configuration and parameters, clock_gettime() and
gettimeofday() may not be system calls. If so, passing an invalid pointer
will cause a signal and not an [EFAULT] error.

From a standards perspective, this is OK since passing an invalid pointer is
undefined behaviour.

MFC after: 1 week

8 years agoRestore a day of the week in date(1) output for Japanese locales.
Hajimu UMEMOTO [Sun, 20 Dec 2015 14:59:30 +0000 (14:59 +0000)]
Restore a day of the week in date(1) output for Japanese locales.
It was lost by recent locale change.

8 years agoFix lockf(3) cancellation behaviour.
Konstantin Belousov [Sun, 20 Dec 2015 11:55:39 +0000 (11:55 +0000)]
Fix lockf(3) cancellation behaviour.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoClean up Kyuafile.tmp, not Kyuafile.auto.tmp
Enji Cooper [Sun, 20 Dec 2015 06:29:03 +0000 (06:29 +0000)]
Clean up Kyuafile.tmp, not Kyuafile.auto.tmp

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Reviewed by: emaste, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoDocument LOCALBASE in the bsd.test.mk section
Enji Cooper [Sun, 20 Dec 2015 06:27:36 +0000 (06:27 +0000)]
Document LOCALBASE in the bsd.test.mk section

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Reviewed by: emaste, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years ago- Use LOCALBASE instead of KYUA_PREFIX for the --prefix to kyua(1)
Enji Cooper [Sun, 20 Dec 2015 06:26:15 +0000 (06:26 +0000)]
- Use LOCALBASE instead of KYUA_PREFIX for the --prefix to kyua(1)
- Use LOCALBASE instead of hardcoding /usr/local for perl

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Reviewed by: emaste, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoDeal with another hardcoded reference to Kyuafile in the KYUAFILE == auto
Enji Cooper [Sun, 20 Dec 2015 06:01:53 +0000 (06:01 +0000)]
Deal with another hardcoded reference to Kyuafile in the KYUAFILE == auto
case

Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Reviewed by: emaste, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoAlways expose LOCALBASE, not just when CROSS_TOOLCHAIN is defined
Enji Cooper [Sun, 20 Dec 2015 05:52:03 +0000 (05:52 +0000)]
Always expose LOCALBASE, not just when CROSS_TOOLCHAIN is defined

Instead of using which(1) to look for doxygen, look for it in <LOCALBASE>/bin .
$PATH gets mangled by make buildenv, etc so it's better to just be explicit
about the path if someone uses that for instance.

Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Reviewed by: emaste, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoFix typo in r292500 by adding missing conditional statement
Enji Cooper [Sun, 20 Dec 2015 05:41:12 +0000 (05:41 +0000)]
Fix typo in r292500 by adding missing conditional statement

MFC after: 1 week
X-MFC with: r292500
Pointyhat to: ngie
Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Sponsored by: EMC / Isilon Storage Division

8 years agoSimplify Kyuafile generation logic with KYUAFILE == auto and
Enji Cooper [Sun, 20 Dec 2015 05:38:06 +0000 (05:38 +0000)]
Simplify Kyuafile generation logic with KYUAFILE == auto and
related complexity with variables

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Reviewed by: emaste, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoBump __FreeBSD_version for r292469.
Mark Johnston [Sun, 20 Dec 2015 05:21:59 +0000 (05:21 +0000)]
Bump __FreeBSD_version for r292469.

8 years agoIntegrate the remaining tools/regression/lib/msun testcases into the
Enji Cooper [Sun, 20 Dec 2015 05:06:44 +0000 (05:06 +0000)]
Integrate the remaining tools/regression/lib/msun testcases into the
FreeBSD test suite under lib/msun/tests

MFC after: 3 weeks
X-MFC with: r292328
Sponsored by: EMC / Isilon Storage Division

8 years agoSkip the testcases on i386 (all the assertions fail) [*]
Enji Cooper [Sun, 20 Dec 2015 04:52:53 +0000 (04:52 +0000)]
Skip the testcases on i386 (all the assertions fail) [*]

Also, don't compile the ldexpl(3) testcases on platforms that don't support
the libcall (technically only x86 right now). This makes this test buildable on
arm*/mips*/powerpc*

PR: 205449 [*]
MFC after: 1 week
Tested on: stable/10 (amd64/i386), head (amd64/i386)
Sponsored by: EMC / Isilon Storage Division

8 years agoInitialize j so it doesn't print out a garbage index
Enji Cooper [Sun, 20 Dec 2015 04:42:55 +0000 (04:42 +0000)]
Initialize j so it doesn't print out a garbage index

Use it consistently instead of i in the first loop

MFC after: 3 days
X-MFC with: 292492
Sponsored by: EMC / Isilon Storage Division

8 years agoSkip infinities testcases that fail assertions on amd64 only on CURRENT
Enji Cooper [Sun, 20 Dec 2015 04:41:17 +0000 (04:41 +0000)]
Skip infinities testcases that fail assertions on amd64 only on CURRENT

PR: 205448
MFC after: never
Sponsored by: EMC / Isilon Storage Division

8 years agoDon't run test-fma on i386
Enji Cooper [Sun, 20 Dec 2015 04:32:30 +0000 (04:32 +0000)]
Don't run test-fma on i386

It completely fails all assertions on i386 on both stable/9 and stable/10

PR: 205448
MFC after: 1 week
X-MFC to: stable/10
Sponsored by: EMC / Isilon Storage Division

8 years ago- Use nitems instead of handrolling the macro
Enji Cooper [Sun, 20 Dec 2015 04:28:37 +0000 (04:28 +0000)]
- Use nitems instead of handrolling the macro
- Use a separate variable for tracking the testcase count instead
  of hardcoding the offset for the testcases

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

8 years agoDisable test-ctrig.t testcases which fail assertions on i386 [*]
Enji Cooper [Sun, 20 Dec 2015 04:17:54 +0000 (04:17 +0000)]
Disable test-ctrig.t testcases which fail assertions on i386 [*]

Also, don't compile the exp2l(3) testcases on platforms that don't support the
libcall (technically only x86 right now). This makes this test buildable on
arm*/mips*/powerpc*

Tested on: stable/10 (amd64/i386), head (amd64/i386)
PR: 205446 [*]
MFC after: 1 week
X-MFC to: stable/10
Sponsored by: EMC / Isilon Storage Division

8 years agoDisable test-ctrig.t testcases which fail assertions on i386
Enji Cooper [Sun, 20 Dec 2015 04:06:30 +0000 (04:06 +0000)]
Disable test-ctrig.t testcases which fail assertions on i386

Tested on: stable/10 (amd64/i386), head (amd64/i386)
PR: 205446
MFC after: 1 week
X-MFC to: stable/10
Sponsored by: EMC / Isilon Storage Division

8 years agox86: Detect feature flags "AVX512DQ", "AVX512IFMA", "AVX512BW", "AVX512VBMI"
Conrad Meyer [Sun, 20 Dec 2015 03:34:30 +0000 (03:34 +0000)]
x86: Detect feature flags "AVX512DQ", "AVX512IFMA", "AVX512BW", "AVX512VBMI"

Documented in Intel Architecture Set Extensions Programming Reference
(319433-023).

Sponsored by: EMC / Isilon Storage Division

8 years agoUpdate the test list after r292328
Enji Cooper [Sun, 20 Dec 2015 03:06:29 +0000 (03:06 +0000)]
Update the test list after r292328

Add test-invtrig to the list of tests

Sponsored by: EMC / Isilon Storage Division

8 years agoAdd missing smbios.h #include to mute a -Wimplicit-function-declaration warning
Enji Cooper [Sun, 20 Dec 2015 02:46:51 +0000 (02:46 +0000)]
Add missing smbios.h #include to mute a -Wimplicit-function-declaration warning
after r279222

Reported by: Jenkins
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd missing return statement to atf/printf_test to make the example
Enji Cooper [Sun, 20 Dec 2015 02:36:30 +0000 (02:36 +0000)]
Add missing return statement to atf/printf_test to make the example
complete and correct, and mute a compiler warning from clang

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

8 years agoAdd a safety net to reclaim mbufs when one of the mbuf zones become
Jonathan T. Looney [Sun, 20 Dec 2015 02:05:33 +0000 (02:05 +0000)]
Add a safety net to reclaim mbufs when one of the mbuf zones become
exhausted.

It is possible for a bug in the code (or, theoretically, even unusual
network conditions) to exhaust all possible mbufs or mbuf clusters.
When this occurs, things can grind to a halt fairly quickly. However,
we currently do not call mb_reclaim() unless the entire system is
experiencing a low-memory condition.

While it is best to try to prevent exhaustion of one of the mbuf zones,
it would also be useful to have a mechanism to attempt to recover from
these situations by freeing "expendable" mbufs.

This patch makes two changes:

a) The patch adds a generic API to the UMA zone allocator to set a
function that should be called when an allocation fails because the
zone limit has been reached. Because of the way this function can be
called, it really should do minimal work.

b) The patch uses this API to try to free mbufs when an allocation
fails from one of the mbuf zones because the zone limit has been
reached. The function schedules a callout to run mb_reclaim().

Differential Revision: https://reviews.freebsd.org/D3864
Reviewed by: gnn
Comments by: rrs, glebius
MFC after: 2 weeks
Sponsored by: Juniper Networks

8 years agoAdd dev.fb.X.resync sysctl to resync ARM framebuffer with VideoCore
Oleksandr Tymoshenko [Sun, 20 Dec 2015 00:58:22 +0000 (00:58 +0000)]
Add dev.fb.X.resync sysctl to resync ARM framebuffer with VideoCore

Some applications (e.g. Kodi) use tvservice APIs to manage HDMI
modes, power state, EDID etc. directly through VideoCore. After
these manipulations VideoCore may loose its state and needs to be
resynced with ARM. Under Linux this problem is worked around using
fbset utility that recreates framebuffer. Since there is no fbset
utility in FreeBSD we provide sysctl for userland apps to get system
back into normal mode.

8 years agoFix whitespace issues in BSD.usr.dist introduced in r291455
Enji Cooper [Sat, 19 Dec 2015 23:02:18 +0000 (23:02 +0000)]
Fix whitespace issues in BSD.usr.dist introduced in r291455

Sponsored by: EMC / Isilon Storage Division

8 years agox86: Detect feature flags "CLWB" and "PCOMMIT"
Conrad Meyer [Sat, 19 Dec 2015 20:47:15 +0000 (20:47 +0000)]
x86: Detect feature flags "CLWB" and "PCOMMIT"

"The availability of CLWB instruction is indicated by the presence of
the CPUID feature flag CLWB (bit 24 of the EBX register)."

CLWB is similar to CLFLUSHOPT, except that it is not required to discard
cacheline contents.

"On processors that supports PCOMMIT, PCOMMIT is enumerated through
CPUID (CPUID.7.0.EBX[22]) only when the feature is enabled by BIOS."

PCOMMIT is used to cause store-to-memory operations to become persistent
(protected from power failure).

Sponsored by: EMC / Isilon Storage Division

8 years agoMove some MIPS specific flags to be more congruent with other
Warner Losh [Sat, 19 Dec 2015 19:20:48 +0000 (19:20 +0000)]
Move some MIPS specific flags to be more congruent with other
architectures.

8 years agoCreate libstand version of uuid_from_string and uuid_to_string. The
Warner Losh [Sat, 19 Dec 2015 19:13:38 +0000 (19:13 +0000)]
Create libstand version of uuid_from_string and uuid_to_string.  The
normal libc versions of these functions use asprintf and sscanf, both
of which aren't available in the libstand world.  It's easier to
rewrite these than to try to claw those functions into libstand.
Also include uuid_create_nil, since it's safe to include. These were
written from scratch, except for bits of comments that I got from the
libc version, which are acknowledged in the source.

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

8 years agoSave the physical address passed into the kernel of the UEFI system
Warner Losh [Sat, 19 Dec 2015 19:01:43 +0000 (19:01 +0000)]
Save the physical address passed into the kernel of the UEFI system
table.

8 years agoPass the UEFI system table into the kernel from the boot loader via
Warner Losh [Sat, 19 Dec 2015 19:01:42 +0000 (19:01 +0000)]
Pass the UEFI system table into the kernel from the boot loader via
the FW_HANDLE metadata item. The kernel can get the rest of what it
needs from this.

8 years agoIntroduce a new mechanism for relocating virtual pages to a new physical
Alan Cox [Sat, 19 Dec 2015 18:42:50 +0000 (18:42 +0000)]
Introduce a new mechanism for relocating virtual pages to a new physical
address and use this mechanism when:

1. kmem_alloc_{attr,contig}() can't find suitable free pages in the physical
   memory allocator's free page lists.  This replaces the long-standing
   approach of scanning the inactive and inactive queues, converting clean
   pages into PG_CACHED pages and laundering dirty pages.  In contrast, the
   new mechanism does not use PG_CACHED pages nor does it trigger a large
   number of I/O operations.

2. on 32-bit MIPS processors, uma_small_alloc() and the pmap can't find
   free pages in the physical memory allocator's free page lists that are
   covered by the direct map.  Tested by: adrian

3. ttm_bo_global_init() and ttm_vm_page_alloc_dma32() can't find suitable
   free pages in the physical memory allocator's free page lists.

In the coming months, I expect that this new mechanism will be applied in
other places.  For example, balloon drivers should use relocation to
minimize fragmentation of the guest physical address space.

Make vm_phys_alloc_contig() a little smarter (and more efficient in some
cases).  Specifically, use vm_phys_segs[] earlier to avoid scanning free
page lists that can't possibly contain suitable pages.

Reviewed by: kib, markj
Glanced at: jhb
Discussed with: jeff
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D4444

8 years agoFix indentation to make the script more readable
Baptiste Daroussin [Sat, 19 Dec 2015 13:19:39 +0000 (13:19 +0000)]
Fix indentation to make the script more readable