Commit Graph

207112 Commits

Author SHA1 Message Date
Ed Maste
7ebeabcf9b Revert accidental whitespace changes included with r292623 2015-12-22 20:40:34 +00:00
Konstantin Belousov
cccac8a1ef Make it possible for the cdevsw d_close() driver method to detect last
close and close due to revoke(2)-like operation.

A new FLASTCLOSE flag indicates that this is last close.  FREVOKE is
set for revokes, and FNONBLOCK is also set, same as is already done
for VOP_CLOSE() call from vgonel().

The flags reuse user open(2) flags which are never stored in f_flag,
to not consume bit space in the ABI visible way.  Assert this with the
static check.

Requested and reviewed by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-12-22 20:37:34 +00:00
Ed Maste
6ee0db8b76 Support a.out format in nlist only on i386
i386 is the only current FreeBSD architecture that ever used a.out
format.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D4687
2015-12-22 20:36:14 +00:00
John Baldwin
265e58989d Move the mkioctls script to libsysdecode and use it to generate a
sysdecode_ioctlname() function.  This function matches the behavior
of the truss variant in that it returns a pointer to a string description
for known ioctls.  The caller is responsible for displaying unknown
ioctl requests.  For kdump this meant moving the logic to handle unknown
ioctl requests out of the generated function and into an ioctlname()
function in kdump.c instead.

Differential Revision:	https://reviews.freebsd.org/D4610
2015-12-22 20:33:49 +00:00
Konstantin Belousov
b63d070ad1 Keep devfs mount locked for the whole duration of the devfs_setattr(),
and ensure that our dirent is instantiated.

Reported and tested by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-12-22 20:22:17 +00:00
Konstantin Belousov
d943fa35ad If we annoy user with the terminal output due to failed load of
interpreter, also show the actual error code instead of some
interpretation.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-12-22 20:12:52 +00:00
Enji Cooper
418629d81d Remove redundant ctx_switch_xsave declaration in sys/amd64/include/md_var.h
This variable was added to sys/x86/include/x86_var.h recently.

This unbreaks building kernel source that #includes both md_var.h and x86_var.h
with gcc 4.2.1 on amd64

Differential Revision: https://reviews.freebsd.org/D4686
Reviewed by: kib
X-MFC with: r291949
Sponsored by: EMC / Isilon Storage Division
2015-12-22 20:08:32 +00:00
Navdeep Parhar
c8b73c2cc7 Add comment to go with r291228.
Submitted by:	trasz@
2015-12-22 20:03:49 +00:00
Warner Losh
cf296cf3d7 Delete the DOS dir to mirror what we do with NANO_WORLDDIR.
Copy ubldr and ubldr.bin to the dos partition when we're making it.
Minor style fixes.
2015-12-22 19:40:34 +00:00
Ed Schouten
459d04a5ee Let tsearch()/tdelete() use an AVL tree.
The existing implementations of POSIX tsearch() and tdelete() don't
attempt to perform any balancing at all. Testing reveals that inserting
100k nodes into a tree sequentially takes approximately one minute on my
system.

Though most other BSDs also don't use any balanced tree internally, C
libraries like glibc and musl do provide better implementations. glibc
uses a red-black tree and musl uses an AVL tree.

Red-black trees have the advantage over AVL trees that they only require
O(1) rotations after insertion and deletion, but have the disadvantage
that the tree has a maximum depth of 2*log2(n) instead of 1.44*log2(n).
My take is that it's better to focus on having a lower maximum depth,
for the reason that in the case of tsearch() the invocation of the
comparator likely dominates the running time.

This change replaces the tsearch() and tdelete() functions by versions
that create an AVL tree. Compared to musl's implementation, this version
is different in two different ways:

- We don't keep track of heights; just balances. This is sufficient.
  This has the advantage that it reduces the number of nodes that are
  being accessed. Storing heights requires us to also access all of the
  siblings along the path.

- Don't use any recursion at all. We know that the tree cannot 2^64
  elements in size, so the height of the tree can never be larger than
  96. Use a 128-bit bitmask to keep track of the path that is computed.
  This allows us to iterate over the same path twice, meaning we can
  apply rotations from top to bottom.

Inserting 100k nodes into a tree now only takes 0.015 seconds. Insertion
seems to be twice as fast as glibc, whereas deletion has about the same
performance. Unlike glibc, it uses a fixed amount of memory.

I also experimented with both recursive and iterative bottom-up
implementations of the same algorithm. This iterative top-down version
performs similar to the recursive bottom-up version in terms of speed
and code size.

For some reason, the iterative bottom-up algorithm was actually 30%
faster for deletion, but has a quadratic memory complexity to keep track
of all the parent pointers.

Reviewed by:	jilles
Obtained from:	https://github.com/NuxiNL/cloudlibc
Differential Revision:	https://reviews.freebsd.org/D4412
2015-12-22 18:12:11 +00:00
Craig Rodrigues
26b18977b3 Refer to creating Phabricator Herald notifications
This will allow maintainers to be notified of
any reviews or commits affecting parts of the
tree which they maintain.

Reviewed by:           jhb, emaste, allanjude
Differential Revision: https://reviews.freebsd.org/D4623
2015-12-22 17:46:14 +00:00
Andrew Turner
b1eb23b26b Don't adjust the program counter to an invalid address after reaching a
breakpoint. The value doesn't need to be adjusted as it is already
correctly returned from the kernel.

This allows lldb to set breakpoints, and stop on them, however more work
is needed, for example single stepping fails to stop.

Discussed with:	emaste
2015-12-22 17:18:40 +00:00
Alexander Motin
b7200a19e6 Fix speed setting by NVRAM for 24xx and above chips. 2015-12-22 17:01:30 +00:00
Adrian Chadd
7b61491a8d [mips] Add TLB pagemask probing code, and print out the allowable page sizes.
This is from Stacey's work on larger kernel stack sizes for MIPS.  Thanks!

Submitted by:	sson
2015-12-22 15:59:41 +00:00
Pedro F. Giffuni
587d674e16 Undo change from r292607 that was not meant to be there
Pointyhat: me
2015-12-22 15:42:53 +00:00
Pedro F. Giffuni
d985028157 cron: Check the return value of pipe(2)
Fix inspired by:	OpenBSD (rev 1.56)
CID:	1009830
2015-12-22 15:32:45 +00:00
Pedro F. Giffuni
7044922b39 crontab: properly free an entry
This should close memory leak.

Obtained from:	OpenBSD (rev. 1.62)
CID:		271773
2015-12-22 15:30:26 +00:00
Pedro F. Giffuni
c28c984689 crontab: replace malloc + bzero with calloc
Obtained from:	OpenBSD (Rev 1.20)
2015-12-22 15:20:08 +00:00
Bjoern A. Zeeb
f501e6f136 If vnets are torn down while ifconfig runs an ioctl to say, destroy an
epair(4), we may hit if_detach_internal() without holding a lock and by
the time we aquire it the interface might be gone.
We should not panic() in this case as it is our fault for not holding
the lock all the way. It is not ideal to return silently without error
to user space, but other callers will all ignore the return values so
do not change the entire KPI for little benefit for now.
The ifp will be dealt with one way or another still.

Sponsored by:		The FreeBSD Foundation
MFC after:		2 weeks
Reviewed by:		gnn
Differential Revision:	https://reviews.freebsd.org/D4529
2015-12-22 15:03:45 +00:00
Bjoern A. Zeeb
616bc4f476 If bootverbose is enabled every vnet startup and virtual interface
creation will print extra lines on the console. We are generally not
interested in this (repeated) information for each VNET. Thus only
print it for the default VNET. Virtual interfaces on the base system
will remain printing information, but e.g. each loopback in each vnet
will no longer cause a "bpf attached" line.

Sponsored by:		The FreeBSD Foundation
MFC after:		2 weeks
Reviewed by:		gnn
Differential Revision:	https://reviews.freebsd.org/D4531
2015-12-22 15:00:04 +00:00
Bjoern A. Zeeb
76d68eccbd Simplify bringup order by removing a SYSINIT making it a static list
initialization.

Mfp4 @180384,180385:

  There is no need for a dedicated SYSINIT here.  The
  list can be initialized statically.

  Sponsored by:		CK Software GmbH
Sponsored by:		The FreeBSD Foundation
MFC after:		2 weeks
Reviewed by:		gnn
Differential Revision:	https://reviews.freebsd.org/D4528
2015-12-22 14:57:04 +00:00
Bjoern A. Zeeb
0a03cf8ca6 Since r256624 we've been leaking routing table allocations
on vnet enabled jail shutdown. Call the provided cleanup
routines for IP versions 4 and 6 to plug these leaks.

Sponsored by:		The FreeBSD Foundation
MFC atfer:		2 weeks
Reviewed by:		gnn
Differential Revision:	https://reviews.freebsd.org/D4530
2015-12-22 14:53:19 +00:00
Jonathan T. Looney
c54a41def7 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
2015-12-22 13:41:50 +00:00
Hajimu UMEMOTO
eedae89765 We don't need to use a temporary buffer, here.
MFC after:	1 week
2015-12-22 12:01:06 +00:00
Hans Petter Selasky
beebd9aac8 Make CUSE usable with platforms where the size of "unsigned long" is
different from the size of a pointer.
2015-12-22 09:55:44 +00:00
Hans Petter Selasky
9fb69c9d9d Make CUSE usable with platforms where the size of "unsigned long" is
different from the size of a pointer.
2015-12-22 09:41:33 +00:00
Hans Petter Selasky
ac60e80129 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.
2015-12-22 09:26:24 +00:00
Andrew Turner
7c570e8bb1 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.
2015-12-22 09:08:21 +00:00
Warner Losh
730acac20c For embedded platforms that require it, use mtools to copy the
appropriate u-boot port's files into the fat part.
2015-12-22 06:36:00 +00:00
Enji Cooper
e830a247a1 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
2015-12-22 05:57:23 +00:00
Ian Lepore
21fddb1173 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
2015-12-22 03:07:38 +00:00
Ian Lepore
703db8ccae 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
2015-12-22 03:02:52 +00:00
Enji Cooper
8b302ecdb9 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
2015-12-22 02:10:31 +00:00
Enji Cooper
1115e598dd 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
2015-12-22 01:21:27 +00:00
Craig Rodrigues
cbbaf9b2b1 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
2015-12-22 00:58:35 +00:00
Ian Lepore
67bcc941d0 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.
2015-12-22 00:53:19 +00:00
Enji Cooper
8eb42fb2a8 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
2015-12-22 00:43:22 +00:00
Ian Lepore
5ce7e615fb 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.
2015-12-21 23:47:49 +00:00
Ed Maste
d3525a9e36 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
2015-12-21 22:42:03 +00:00
Ed Maste
66963b3cef rtld: Use common NT_FREEBSD_* note types introduced in r291909
Sponsored by:	The FreeBSD Foundation
2015-12-21 22:40:29 +00:00
Oleksandr Tymoshenko
dfbf5e4bbf 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
2015-12-21 22:25:35 +00:00
Alan Somers
b5bbeb2117 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
2015-12-21 22:19:22 +00:00
Oleksandr Tymoshenko
a0becfc978 - 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
2015-12-21 21:40:15 +00:00
Enji Cooper
870c2f7af9 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
2015-12-21 21:24:03 +00:00
Enji Cooper
1dc3084804 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
2015-12-21 21:15:23 +00:00
Warner Losh
23df2d677f Revert this change. It broke the trampoline build. Until I'm sure
nothing else is broken, I'm reverting.
2015-12-21 20:36:01 +00:00
Oleksandr Tymoshenko
c0f3a6c2bb Add CCM functions to enable HDMI framer and IPU units (video controller)
Reviewed by:	andrew, ian
Differential Revision:	https://reviews.freebsd.org/D4168
2015-12-21 20:17:24 +00:00
Jeremie Le Hen
3c62527d03 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
2015-12-21 20:14:40 +00:00
Ed Maste
2dfc9e2cd4 loader.efi: strip trailing whitespace
Sponsored by:	The FreeBSD Foundation
2015-12-21 19:56:11 +00:00
John Baldwin
16d63436e3 As previously noted in r290409, purge old entries from MAINTAINERS. 2015-12-21 19:15:06 +00:00