freebsd.git
8 years agoGet function prototypes for msg, shm, sem functions
rodrigc [Thu, 30 Jul 2015 18:59:01 +0000 (18:59 +0000)]
Get function prototypes for msg, shm, sem functions
from header files.

Differential Revision: D2669

8 years agoib mad: fix an incorrect use of list_for_each_entry
markj [Thu, 30 Jul 2015 18:28:37 +0000 (18:28 +0000)]
ib mad: fix an incorrect use of list_for_each_entry

In tf_dequeue(), if we reach the end of the list without finding a
non-cancelled element, "tmp" will be a pointer into the list head, so the
tmp->canceled check is bogus. Use a flag instead.

Submitted by: Tao Liu <Tao.Liu@isilon.com>
Reviewed by: hselasky
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D3244

8 years agoDo not pretend that vm_fault(9) supports unwiring the address. Rename
kib [Thu, 30 Jul 2015 18:28:34 +0000 (18:28 +0000)]
Do not pretend that vm_fault(9) supports unwiring the address.  Rename
the VM_FAULT_CHANGE_WIRING flag to VM_FAULT_WIRE.  Assert that the
flag is only passed when faulting on the wired map entry.  Remove the
vm_page_unwire() call, which should be never reachable.

Since VM_FAULT_WIRE flag implies wired map entry, the TRYPAGER() macro
is reduced to the testing of the fs.object having a default pager.
Inline the check.

Suggested and reviewed by: alc
Tested by: pho (previous version)
MFC after: 1 week

8 years agoMake some variables and functions static.
rodrigc [Thu, 30 Jul 2015 18:08:08 +0000 (18:08 +0000)]
Make some variables and functions static.

8 years agoUpdat the committers graph
allanjude [Thu, 30 Jul 2015 17:02:23 +0000 (17:02 +0000)]
Updat the committers graph

Approved by: marcel (mentor)
Differential Revision: https://reviews.freebsd.org/D3251

8 years agoAdd enough of pmap_page_set_memattr to run gstat. It still needs to split
andrew [Thu, 30 Jul 2015 16:17:44 +0000 (16:17 +0000)]
Add enough of pmap_page_set_memattr to run gstat. It still needs to split
the DMAP 1G pages so we set the attributes only on the specified page.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoImprove comments.
kib [Thu, 30 Jul 2015 15:47:53 +0000 (15:47 +0000)]
Improve comments.

Submitted by: bde
MFC after: 2 weeks

8 years agovfs: fill fallout from r286076
royger [Thu, 30 Jul 2015 15:43:26 +0000 (15:43 +0000)]
vfs: fill fallout from r286076

This right operator is >= not =>.

Reported by: cem

8 years agovfs: fix off-by-one error in vfs_buf_check_mapped
royger [Thu, 30 Jul 2015 15:28:06 +0000 (15:28 +0000)]
vfs: fix off-by-one error in vfs_buf_check_mapped

The check added in r285872 can trigger for valid buffers if the buffer space
used happens to be just after unmapped_buf in KVA space.

Discussed with: kib
Sponsored by: Citrix Systems R&D

8 years agoGCC: Add a new option "-fstack-protector-strong"
pfg [Thu, 30 Jul 2015 14:31:09 +0000 (14:31 +0000)]
GCC: Add a new option "-fstack-protector-strong"

This includes additional functions to be protected: those that
have local array definitions, or have references to local frame
addresses. This is a new option in GCC-4.9 that was relicensed
by Han Shen from Google under GPLv2 for OpenBSD.

Obtained from: OpenBSD (2014-01-14)
MFC after: 2 weeks

8 years agoAdd ARM64TODO markers to unimplemented functionality
emaste [Thu, 30 Jul 2015 14:20:36 +0000 (14:20 +0000)]
Add ARM64TODO markers to unimplemented functionality

Reviewed by: andrew
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2389

8 years agoEnable IRQ during syscalls on ARM64
zbb [Thu, 30 Jul 2015 13:59:38 +0000 (13:59 +0000)]
Enable IRQ during syscalls on ARM64

FreeBSD provides a feature called Adaptive Mutexes, which allows
a thread to spin for a while when the mutex is taken instead of
immediately going to sleep. This causes issues when called from
syscall handler if interrupts are masked. If every other core
also attempts to access the same mutex there is a chance that
all of them are spinning on the same lock at the same time.
If interrupts are disabled, no kernel preemtion can occur and
the system becomes unresponsive.

This patch enables interrupts when syscall is being executed
and masks them as soon as it is completed.

Reviewed by:   andrew
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3246

8 years agoRemove obsolete vendor code from Alpine platform support
zbb [Thu, 30 Jul 2015 13:45:34 +0000 (13:45 +0000)]
Remove obsolete vendor code from Alpine platform support

This is a clean-up patch from a serie delivering support for
Annapurna Labs Alpine PoC.
The HAL files have already been added to sys/contrib/alpine-hal
so there is no need for them in the platform directory.
This patch removes obsolete files.

Reviewed by:    andrew
Obtained from:  Semihalf
Sponsored by:   Annapurna Labs
Differential Revision: https://reviews.freebsd.org/D3248

8 years agoAdd ELF Tool Chain's ar(1) and elfdump(1) to contrib
emaste [Thu, 30 Jul 2015 12:41:54 +0000 (12:41 +0000)]
Add ELF Tool Chain's ar(1) and elfdump(1) to contrib

ELF Tool Chain built on FreeBSD's ar and elfdump, but has a number of
improvements and enhancements. Bring them into contrib in order to start
integrating into our build.

8 years agoBuild if_stf(4) module only when both INET and INET6 support are enabled.
ae [Thu, 30 Jul 2015 10:26:43 +0000 (10:26 +0000)]
Build if_stf(4) module only when both INET and INET6 support are enabled.

8 years agoImprove strtounum
bapt [Thu, 30 Jul 2015 06:14:47 +0000 (06:14 +0000)]
Improve strtounum

Fix many style bugs
Better variable naming
Use C99 'restrict' were apropriate
Fix potential errno race

Submitted by: bde

8 years agoDisable blkif indirect segment I/Os in EC2 by default due to performance
cperciva [Thu, 30 Jul 2015 04:01:00 +0000 (04:01 +0000)]
Disable blkif indirect segment I/Os in EC2 by default due to performance
issues on some EC2 instance types.  Users may want to experiment with
removing this from loader.conf and measuring the performance impact on
the EC2 instances they are using.

8 years agoAdd support for Xen blkif indirect segment I/Os. This makes it possible for
cperciva [Thu, 30 Jul 2015 03:50:01 +0000 (03:50 +0000)]
Add support for Xen blkif indirect segment I/Os.  This makes it possible for
the blkfront driver to perform I/Os of up to 2 MB, subject to support from
the blkback to which it is connected and the initiation of such large I/Os
by the rest of the kernel.  In practice, the I/O size is increased from 40 kB
to 128 kB.

The changes to xen/interface/io/blkif.h consist merely of merging updates
from the upstream Xen repository.

In dev/xen/blkfront/block.h we add some convenience macros and structure
fields used for indirect-page I/Os: The device records its negotiated limit
on the number of indirect pages used, while each I/O command structure gains
permanently allocated page(s) for indirect page references and the Xen grant
references for those pages.

In dev/xen/blkfront/blkfront.c we now check in xbd_queue_cb whether a request
is small enough to handle without an indirection page, and either follow the
previous behaviour or use new code for issuing an indirect segment I/O.  In
xbd_connect we read the size of indirect segment I/Os supported by the backend
and select the maximum size we will use; then allocate the pages and Xen grant
references for each I/O command structure.  In xbd_free those grants and pages
are released.

A new loader tunable, hw.xbd.xbd_enable_indirect, can be set to 0 in order to
disable this functionality; it works by pretending that the backend does not
support this feature.  Some backends exhibit a loss of performance with large
I/Os, so users may wish to test with and without this functionality enabled.

Reviewed by: royger
MFC after: 3 days
Relnotes: yes

8 years agoFollow r256586 and rename the kernel version of the Free() macro to
loos [Thu, 30 Jul 2015 02:09:03 +0000 (02:09 +0000)]
Follow r256586 and rename the kernel version of the Free() macro to
R_Free().  This matches the other macros and reduces the chances to clash
with other headers.

This also fixes the build of radix.c outside of the kernel environment.

Reviewed by: glebius

8 years agoUse private cache line for the locked nop in *mb() on i386.
kib [Thu, 30 Jul 2015 00:13:20 +0000 (00:13 +0000)]
Use private cache line for the locked nop in *mb() on i386.

Suggested by: alc
Reviewed by: alc, bde
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoMFamd64 r285934: Remove store/load (= full) barrier from the i386
kib [Wed, 29 Jul 2015 23:59:17 +0000 (23:59 +0000)]
MFamd64 r285934: Remove store/load (= full) barrier from the i386
atomic_load_acq_*().

Noted by: alc (long time ago)
Reviewed by: alc, bde
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoconst'ify an arg that we don't update...
jmg [Wed, 29 Jul 2015 23:37:15 +0000 (23:37 +0000)]
const'ify an arg that we don't update...

8 years agoCleanup includes
bapt [Wed, 29 Jul 2015 23:26:18 +0000 (23:26 +0000)]
Cleanup includes

8 years agoThis patch fixes a problem where, if the NFSv4 server has a previous
rmacklem [Wed, 29 Jul 2015 23:06:30 +0000 (23:06 +0000)]
This patch fixes a problem where, if the NFSv4 server has a previous
unconfirmed clientid structure for the same client on the last hash list,
this old entry would not be removed/deleted. I do not think this bug would have
caused serious problems, since the new entry would have been before the old one
on the list. This old entry would have eventually been scavenged/removed.
Detected while reading the code looking for another bug.

MFC after: 3 days

8 years agoActually set the proper license
bapt [Wed, 29 Jul 2015 22:51:54 +0000 (22:51 +0000)]
Actually set the proper license

Reported by: trasz

8 years agoMK_ELFCOPY_AS_OBJCOPY should be a variable
emaste [Wed, 29 Jul 2015 21:41:15 +0000 (21:41 +0000)]
MK_ELFCOPY_AS_OBJCOPY should be a variable

PR: 201978
Submitted by: O. Hartmann
Differential Revision: https://reviews.freebsd.org/D2887

8 years agonvme: do not notify a consumer about failures that occur during initialization
jimharris [Wed, 29 Jul 2015 21:29:50 +0000 (21:29 +0000)]
nvme: do not notify a consumer about failures that occur during initialization

MFC after: 3 days
Sponsored by: Intel

8 years agoClarify historical practice of not removing old entries. Add entry for
imp [Wed, 29 Jul 2015 21:15:50 +0000 (21:15 +0000)]
Clarify historical practice of not removing old entries. Add entry for
stable/10 branch that was forgotten when it was created. Update end
date to be correct.

8 years agoAdd support for BCM5466 PHY
sbruno [Wed, 29 Jul 2015 20:50:48 +0000 (20:50 +0000)]
Add support for BCM5466 PHY

Differential Revision: D3232
Submitted by: kevin.bowling@kev009.com

8 years agoRemove dead functions pmap_pvdump and pads.
sbruno [Wed, 29 Jul 2015 20:47:27 +0000 (20:47 +0000)]
Remove dead functions pmap_pvdump and pads.

Differential Revision: D3206
Submitted by: kevin.bowling@kev009.com
Reviewed by: alc

8 years agoAvoid double reference decrement when firewalls force relooping of packets
eri [Wed, 29 Jul 2015 20:10:36 +0000 (20:10 +0000)]
Avoid double reference decrement when firewalls force relooping of packets

When firewalls force a reloop of packets and the caller supplied a route the reference to the route might be reduced twice creating issues.
This is especially the scenario when a packet is looped because of operation in the firewall but the new route lookup gives a down route.

Differential Revision: https://reviews.freebsd.org/D3037
Reviewed by: gnn
Approved by: gnn(mentor)

8 years agoRemove mention of non-existent gconv tool
emaste [Wed, 29 Jul 2015 20:02:20 +0000 (20:02 +0000)]
Remove mention of non-existent gconv tool

I believe this is a typo of gcov, but gcov is not controlled by
WITHOUT_BINUTILS anyhow.

Sponsored by: The FreeBSD Foundation

8 years agoUse default CLANG build options for ARM
emaste [Wed, 29 Jul 2015 19:06:53 +0000 (19:06 +0000)]
Use default CLANG build options for ARM

We previously disabled CLANG_FULL on (little-endian) ARM because the
build failed.  This is no longer the case and as of Clang 3.5 we cannot
build any part of the in-tree Clang with in-tree GCC, so it's no longer
necessary to disable CLANG_FULL.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2525

8 years agoRegenerate src.conf(5) after r286016 and r286030
emaste [Wed, 29 Jul 2015 18:55:51 +0000 (18:55 +0000)]
Regenerate src.conf(5) after r286016 and r286030

8 years agoAllow ELF Tool Chain elfcopy to be installed as objcopy
emaste [Wed, 29 Jul 2015 18:45:38 +0000 (18:45 +0000)]
Allow ELF Tool Chain elfcopy to be installed as objcopy

ELF Tool Chain elfcopy is nearly a drop-in replacement for GNU objcopy,
but does not currently support PE output which is needed for building
x86 UEFI bits.

Add a src.conf knob to allow installing it as objcopy and set it by
default for aarch64 only, where we don't have a native binutils.

Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2887

8 years agoUpdate OLD_FILES for tools provided by ELF Tool Chain or Binutils
emaste [Wed, 29 Jul 2015 18:33:11 +0000 (18:33 +0000)]
Update OLD_FILES for tools provided by ELF Tool Chain or Binutils

Sponsored by: The FreeBSD Foundation

8 years agoip_output normalization and fixes
eri [Wed, 29 Jul 2015 18:04:01 +0000 (18:04 +0000)]
ip_output normalization and fixes

ip_output has a big chunk of code used to handle special cases with pfil consumers which also forces a reloop on it.
Gather all this code together to make it readable and properly handle the reloop cases.

Some of the issues identified:

M_IP_NEXTHOP is not handled properly in existing code.
route reference leaking is possible with in FIB number change
route flags checking is not consistent in the function

Differential Revision: https://reviews.freebsd.org/D3022
Reviewed by: gnn
Approved by: gnn(mentor)
MFC after: 4 weeks

8 years agoRevert r265338, r271089 and r271123 as those changes do not handle
pkelsey [Wed, 29 Jul 2015 17:59:13 +0000 (17:59 +0000)]
Revert r265338, r271089 and r271123 as those changes do not handle
non-inline urgent data and introduce an mbuf exhaustion attack vector
similar to FreeBSD-SA-15:15.tcp, but not requiring VNETs.

Address the issue described in FreeBSD-SA-15:15.tcp.

Reviewed by: glebius
Approved by: so
Approved by: jmallett (mentor)
Security: FreeBSD-SA-15:15.tcp
Sponsored by: Norse Corp, Inc.

8 years agoar: Fix deterministic mode default with options other than -q or -r
emaste [Wed, 29 Jul 2015 17:34:26 +0000 (17:34 +0000)]
ar: Fix deterministic mode default with options other than -q or -r

Reported by: jhibbits
Reviewed by: jhibbits
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3237

8 years agoMake pipes in CloudABI work.
ed [Wed, 29 Jul 2015 17:18:27 +0000 (17:18 +0000)]
Make pipes in CloudABI work.

Summary:
Pipes in CloudABI are unidirectional. The reason for this is that
CloudABI attempts to provide a uniform runtime environment across
different flavours of UNIX.

Instead of implementing a custom pipe that is unidirectional, we can
simply reuse Capsicum permission bits to support this. This is nice,
because CloudABI already attempts to restrict permission bits to
correspond with the operations that apply to a certain file descriptor.

Replace kern_pipe() and kern_pipe2() by a single kern_pipe() that takes
a pair of filecaps. These filecaps are passed to the newly introduced
falloc_caps() function that creates the descriptors with rights in
place.

Test Plan:
CloudABI pipes seem to be created with proper rights in place:

https://github.com/NuxiNL/cloudlibc/blob/master/src/libc/unistd/pipe_test.c#L44

Reviewers: jilles, mjg

Reviewed By: mjg

Subscribers: imp

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

8 years agoIntroduce falloc_caps() to create descriptors with capabilties in place.
ed [Wed, 29 Jul 2015 17:16:53 +0000 (17:16 +0000)]
Introduce falloc_caps() to create descriptors with capabilties in place.

falloc_noinstall() followed by finstall() allows you to create and
install file descriptors with custom capabilities. Add falloc_caps()
that can do both of these actions in one go.

This will be used by CloudABI to create pipes with custom capabilities.

Reviewed by: mjg

8 years agoRemove the AUTHORS section until it's clear who exactly wrote the driver.
brueffer [Wed, 29 Jul 2015 16:37:36 +0000 (16:37 +0000)]
Remove the AUTHORS section until it's clear who exactly wrote the driver.

8 years agoInclude c++filt and readelf in WITHOUT_ELFTOOLCHAIN_TOOLS
emaste [Wed, 29 Jul 2015 15:42:22 +0000 (15:42 +0000)]
Include c++filt and readelf in WITHOUT_ELFTOOLCHAIN_TOOLS

8 years agoMake Broadcom XLR use shared ds1374 RTC driver.
sbruno [Wed, 29 Jul 2015 15:32:59 +0000 (15:32 +0000)]
Make Broadcom XLR use shared ds1374 RTC driver.

Remove its identical and redundant ds1374u version.

Differential Revision: D3225
Submitted by: kevin.bowling@kev009.com

8 years agoEliminate the use of m_copydata() in gif_encapcheck().
ae [Wed, 29 Jul 2015 14:07:43 +0000 (14:07 +0000)]
Eliminate the use of m_copydata() in gif_encapcheck().

ip_encap already has inspected mbuf's data, at least an IP header.
And it is safe to use mtod() and do direct access to needed fields.
Add M_ASSERTPKTHDR() to gif_encapcheck(), since the code expects that
mbuf has a packet header.
Move the code from gif_validate[46] into in[6]_gif_encapcheck(), also
remove "martian filters" checks. According to RFC 4213 it is enough to
verify that the source address is the address of the encapsulator, as
configured on the decapsulator.

Reviewed by: melifaro
Obtained from: Yandex LLC
Sponsored by: Yandex LLC

8 years agoFixed shutdown(2) unix(4) tests for SOCK_SEQPACKET after r285910 (by ed).
pluknet [Wed, 29 Jul 2015 13:49:34 +0000 (13:49 +0000)]
Fixed shutdown(2) unix(4) tests for SOCK_SEQPACKET after r285910 (by ed).

8 years agoar: enable deterministic mode by default
emaste [Wed, 29 Jul 2015 13:36:17 +0000 (13:36 +0000)]
ar: enable deterministic mode by default

Ar cannot handle UIDs with more than 6 digits, and storing the mtime,
uid, gid and mode provides little to negative value anyhow for ar's
uses. Turn on deterministic (-D) mode by default; it can be disabled by
the user with -U.

PR: 196929
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3190

8 years agoSplit up Capsicum to CloudABI rights conversion into two separate routines.
ed [Wed, 29 Jul 2015 12:42:45 +0000 (12:42 +0000)]
Split up Capsicum to CloudABI rights conversion into two separate routines.

CloudABI's openat() ensures that files are opened with the smallest set
of relevant rights. For example, when opening a FIFO, unrelated rights
like CAP_RECV are automatically removed. To remove unrelated rights, we
can just reuse the code for this that was already present in the rights
conversion function.

8 years agoAdd quirk for ThunderX ITS device table size
zbb [Wed, 29 Jul 2015 11:22:19 +0000 (11:22 +0000)]
Add quirk for ThunderX ITS device table size

Limit the number of supported device IDs to 0x100000
in order to decrease the size of the ITS device table so
that it matches with the HW capabilities.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3131

8 years agoReduce overhead of ipfw's me6 opcode.
ae [Wed, 29 Jul 2015 10:53:42 +0000 (10:53 +0000)]
Reduce overhead of ipfw's me6 opcode.

Skip checks for IPv6 multicast addresses.
Use in6_localip() for global unicast.
And for IPv6 link-local addresses do search in the IPv6 addresses list.
Since LLA are stored in the kernel internal form, use
IN6_ARE_MASKED_ADDR_EQUAL() macro with lla_mask for addresses comparison.
lla_mask has zero bits in the second word, where we keep sin6_scope_id.

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

8 years agoMove bufshutdown() out of the #ifdef INVARIANTS block.
kib [Wed, 29 Jul 2015 09:57:34 +0000 (09:57 +0000)]
Move bufshutdown() out of the #ifdef INVARIANTS block.

8 years agoConvert in_ifaddr_lock and in6_ifaddr_lock to rmlock.
ae [Wed, 29 Jul 2015 08:12:05 +0000 (08:12 +0000)]
Convert in_ifaddr_lock and in6_ifaddr_lock to rmlock.

Both are used to protect access to IP addresses lists and they can be
acquired for reading several times per packet. To reduce lock contention
it is better to use rmlock here.

Reviewed by: gnn (previous version)
Obtained from: Yandex LLC
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D3149

8 years agoRFC4868 section 2.3 requires that the output be half... This fixes
jmg [Wed, 29 Jul 2015 07:15:16 +0000 (07:15 +0000)]
RFC4868 section 2.3 requires that the output be half...  This fixes
problems that was introduced in r285336...  I have verified that
HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD
6.1.5 vm...

Reviewed by: gnn

8 years agopf: Always initialise pf_fragment.fr_flags
kp [Wed, 29 Jul 2015 06:35:36 +0000 (06:35 +0000)]
pf: Always initialise pf_fragment.fr_flags

When we allocate the struct pf_fragment in pf_fillup_fragment() we forgot to
initialise the fr_flags field. As a result we sometimes mistakenly thought the
fragment to not be a buffered fragment. This resulted in panics because we'd end
up freeing the pf_fragment but not removing it from V_pf_fragqueue (believing it
to be part of V_pf_cachequeue).
The next time we iterated V_pf_fragqueue we'd use a freed object and panic.

While here also fix a pf_fragment use after free in pf_normalize_ip().
pf_reassemble() frees the pf_fragment, so we can't use it any more.

PR: 201879, 201932
MFC after: 5 days

8 years agoImplement CloudABI's readdir().
ed [Wed, 29 Jul 2015 06:31:44 +0000 (06:31 +0000)]
Implement CloudABI's readdir().

Summary:
CloudABI's readdir() system call could be thought of as a mixture
between FreeBSD's getdents(2) and pread(). Instead of using the file
descriptor offset, userspace provides a 64-bit cloudabi_dircookie_t
continue reading at a given point. CLOUDABI_DIRCOOKIE_START, having
value 0, can be used to return entries at the start of the directory.

The file descriptor offset is not used to store the cookie for the
reason that in a file descriptor centric environment, it would make
sense to allow concurrent use of a single file descriptor.

The remaining space returned by the system call should be filled with a
partially truncated copy of the next entry. The advantage of doing this
is that it gracefully deals with long filenames. If the C library
provides a buffer that is too small to hold a single entry, it can still
extract the directory entry header, meaning that it can retry the read
with a larger buffer or skip it using the cookie.

Test Plan:
This implementation passes the cloudlibc unit tests at:

https://github.com/NuxiNL/cloudlibc/tree/master/src/libc/dirent

Reviewers: marcel, kib

Reviewed By: kib

Subscribers: imp

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

8 years agoActually add the new code
bapt [Wed, 29 Jul 2015 06:23:06 +0000 (06:23 +0000)]
Actually add the new code

8 years agoCreate a strtounum function using the same API as strtonum
bapt [Wed, 29 Jul 2015 06:22:41 +0000 (06:22 +0000)]
Create a strtounum function using the same API as strtonum

This function returns uintmax_t
Use this function to convert to gid_t/uid_t

8 years ago - Remove some dead code copied from ffs.
jeff [Wed, 29 Jul 2015 03:06:08 +0000 (03:06 +0000)]
 - Remove some dead code copied from ffs.

8 years agoTeach sysctl about the new optional suffix after IK to specify
imp [Wed, 29 Jul 2015 02:34:25 +0000 (02:34 +0000)]
Teach sysctl about the new optional suffix after IK to specify
precision. Update input as well. Add IK to the manual (it was missing
completely).

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

8 years ago - Make 'struct buf *buf' private to vfs_bio.c. Having a global variable
jeff [Wed, 29 Jul 2015 02:26:57 +0000 (02:26 +0000)]
 - Make 'struct buf *buf' private to vfs_bio.c.  Having a global variable
   'buf' is inconvenient and has lead me to some irritating to discover
   bugs over the years.  It also makes it more challenging to refactor
   the buf allocation system.
 - Move swbuf and declare it as an extern in vfs_bio.c.  This is still
   not perfect but better than it was before.
 - Eliminate the unused ffs function that relied on knowledge of the buf
   array.
 - Move the shutdown code that iterates over the buf array into vfs_bio.c.

Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division

8 years agoCompilers will complain the usage of obsolescent variable declarations.
araujo [Wed, 29 Jul 2015 02:21:35 +0000 (02:21 +0000)]
Compilers will complain the usage of obsolescent variable declarations.
Also it will fix the build problem with sparc64.

Submitted by: ed@

8 years agounlink(2): Note the possibility for ENOSPC to be returned on ZFS.
bdrewery [Tue, 28 Jul 2015 22:48:58 +0000 (22:48 +0000)]
unlink(2): Note the possibility for ENOSPC to be returned on ZFS.

PR: 154930

8 years agoReject usermod and userdel if the user concerned is not on the user database
bapt [Tue, 28 Jul 2015 21:49:38 +0000 (21:49 +0000)]
Reject usermod and userdel if the user concerned is not on the user database
supposed to be manipulated

This prevent pw usermod creating a new local user when requesting to usermod on
a username is defined in LDAP.

This issue only happens when modifying the local user database (not inpacting
commands when -V or -R are used).

PR: 187653
Submitted by: tmwalaszek@gmail.com

8 years agodrm/i915: Sort functions in i915_gem.c to match Linux 3.8's ordering
dumbbell [Tue, 28 Jul 2015 21:47:37 +0000 (21:47 +0000)]
drm/i915: Sort functions in i915_gem.c to match Linux 3.8's ordering

While here, reduce the style diff with Linux.

There is no functional change. The goal is to ease the future update to
Linux 3.8's i915 driver.

MFC after: 2 months

8 years agoFix rescue build after r284356 with STRIP= by using proper STRIPBIN per build(7).
bdrewery [Tue, 28 Jul 2015 21:39:58 +0000 (21:39 +0000)]
Fix rescue build after r284356 with STRIP= by using proper STRIPBIN per build(7).

This was causing the following error:

  rescue
  sh: rescue: not found
  *** [rescue] Error code 127

  make[1]: stopped in /usr/obj/usr/src/rescue/rescue

Sponsored by: EMC / Isilon Storage Division

8 years agoCheck uid/gid used when creating a user/group are not larger than UID_MAX/GID_MAX
bapt [Tue, 28 Jul 2015 21:10:58 +0000 (21:10 +0000)]
Check uid/gid used when creating a user/group are not larger than UID_MAX/GID_MAX

PR: 173977
Reported by: nvass@gmx.com

8 years agoFix wrong warning printed after changing or updating NIS users
bapt [Tue, 28 Jul 2015 20:52:10 +0000 (20:52 +0000)]
Fix wrong warning printed after changing or updating NIS users

PR: 37672
Submitted by: chris+freebsd@chrullrich.de

8 years ago - Eliminate the EMPTYKVA queue. It served as a cache of KVA allocations
jeff [Tue, 28 Jul 2015 20:24:09 +0000 (20:24 +0000)]
 - Eliminate the EMPTYKVA queue.  It served as a cache of KVA allocations
   attached to bufs to avoid the overhead of the vm.  This purposes is now
   better served by vmem.  Freeing the kva immediately when a buf is
   destroyed leads to lower fragmentation and a much simpler scan algorithm.

Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division

8 years agoFix multiple OpenSSH vulnerabilities.
delphij [Tue, 28 Jul 2015 19:58:38 +0000 (19:58 +0000)]
Fix multiple OpenSSH vulnerabilities.

Security: CVE-2014-2653
Security: CVE-2015-5600
Security: FreeBSD-SA-15:16.openssh

8 years agoFix shell injection vulnerability in patch(1) and drop SCCS
delphij [Tue, 28 Jul 2015 19:58:36 +0000 (19:58 +0000)]
Fix shell injection vulnerability in patch(1) and drop SCCS
support by replacing system() with execve().

Future revisions may remove the functionality completely.

Obtained from: Bitrig
Security: CVE-2015-1416

8 years ago- Avoid lock contention in the if_transmit callback by using trylock and
davidcs [Tue, 28 Jul 2015 19:15:44 +0000 (19:15 +0000)]
- Avoid lock contention in the if_transmit callback by using trylock and
 enqueueing the frames when it fails. This way there is some latency
 removed from the transmitting path.
- If IFF_DRV_OACTIVE is set (and also if IFF_DRV_RUNNING is not) just
 enqueue the desired frames and return successful transmit. This way we
 avoid to return errors on transmit side and resulting in
 possible out-of-order frames. Please note that IFF_DRV_OACTIVE is set
 everytime we get the threshold ring hit, so this can be happening quite
 often.

Submitted by: Attilio.Rao@isilon.com
MFC after:5 days

8 years agoMFV r285970:
bdrewery [Tue, 28 Jul 2015 18:41:28 +0000 (18:41 +0000)]
MFV r285970:

  Apply upstream changeset bf4f6ec64e:

  Fix issue 356: properly skip a sparse file entry in a tar file.

PR: 201506
MFC after: 3 days
Relnotes: yes

8 years agoApply upstream changeset bf4f6ec64e:
bdrewery [Tue, 28 Jul 2015 17:48:34 +0000 (17:48 +0000)]
Apply upstream changeset bf4f6ec64e:

Fix issue 356: properly skip a sparse file entry in a tar file.

8 years agoApply upstream changeset fa9e61:
bdrewery [Tue, 28 Jul 2015 17:20:35 +0000 (17:20 +0000)]
Apply upstream changeset fa9e61:

Fix --one-file-system to include the directory encountered rather than
excluding it.

8 years agoSimplify logic added in r285945 as suggested by glebius
garga [Tue, 28 Jul 2015 14:59:29 +0000 (14:59 +0000)]
Simplify logic added in r285945 as suggested by glebius

Approved by: glebius
MFC after: 3 days
Sponsored by: Netgate

8 years agoImport Annapurna Labs Alpine HAL to sys/contrib/
zbb [Tue, 28 Jul 2015 14:20:33 +0000 (14:20 +0000)]
Import Annapurna Labs Alpine HAL to sys/contrib/

Import from vendor-sys/alpine-hal/2.7
SVN rev.: 285432
HAL version: 2.7

Obtained from:  Semihalf
Sponsored by:   Annapurna Labs

8 years agoFix the r272906 description.
glebius [Tue, 28 Jul 2015 13:48:19 +0000 (13:48 +0000)]
Fix the r272906 description.

8 years agoLimit ofw_cpu_early_foreach() to CPUs only
zbb [Tue, 28 Jul 2015 13:16:08 +0000 (13:16 +0000)]
Limit ofw_cpu_early_foreach() to CPUs only

On some platforms, the /cpus node contains cpu-to-cluster
map which deffinitely is not a CPU node. Its presence was
causing incrementing of "id" variable and reporting more
CPUs available than it should.
To make "id" valid, increment it only when an entry really
is a CPU device.

Reviewed by:   andrew
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3216

8 years agoRemove claim that the OS is Darwin from lldb(1)
emaste [Tue, 28 Jul 2015 13:09:16 +0000 (13:09 +0000)]
Remove claim that the OS is Darwin from lldb(1)

Reported by: bapt

8 years agoImplement file attribute modification system calls for CloudABI.
ed [Tue, 28 Jul 2015 12:57:19 +0000 (12:57 +0000)]
Implement file attribute modification system calls for CloudABI.

CloudABI uses a system call interface to modify file attributes that is
more similar to KPI's/FUSE, namely where a stat structure is passed back
to the kernel, together with a bitmask of attributes that should be
changed. This would allow us to update any set of attributes atomically.

That said, I'd rather not go as far as to actually implement it that
way, as it would require us to duplicate more code than strictly needed.
Let's just stick to the combinations that are actually used by
cloudlibc.

Obtained from: https://github.com/NuxiNL/freebsd

8 years agowhen -n is passed to any pw subcommand it is always expected to be considered as
bapt [Tue, 28 Jul 2015 12:20:57 +0000 (12:20 +0000)]
when -n is passed to any pw subcommand it is always expected to be considered as
a name so do not try to convert it to an id if it is a numeric value

PR: 31933
Reported by: ted@impulse.net
Sponsored by: gandi.net

8 years agoCorrect typo in UPDATING message
smh [Tue, 28 Jul 2015 11:21:33 +0000 (11:21 +0000)]
Correct typo in UPDATING message

MFC after: 3 days
Sponsored by: Multiplay

8 years agoAdd warning about low KSTACK_PAGES for ZFS use
smh [Tue, 28 Jul 2015 11:19:38 +0000 (11:19 +0000)]
Add warning about low KSTACK_PAGES for ZFS use

As ZFS requires a more kernel stack pages than is the default on some
architectures e.g. i386, warn if KSTACK_PAGES is less than
ZFS_MIN_KSTACK_PAGES (which is 4 at the time of writing).

MFC after: 3 days
Sponsored by: Multiplay

8 years agoRespect pf rule log option before log dropped packets with IP options or
garga [Tue, 28 Jul 2015 10:31:34 +0000 (10:31 +0000)]
Respect pf rule log option before log dropped packets with IP options or
dangerous v6 headers

Reviewed by: gnn, eri
Approved by: gnn
Obtained from: pfSense
MFC after: 3 days
Sponsored by: Netgate
Differential Revision: https://reviews.freebsd.org/D3222

8 years agoFix a typo in r280169. Of course we are interested in deleting nsn only
glebius [Tue, 28 Jul 2015 09:36:26 +0000 (09:36 +0000)]
Fix a typo in r280169. Of course we are interested in deleting nsn only
if we have just created it and we were the last reference.

Submitted by: dhartmei

8 years agoFix a typo reported by Erik Cederstrand.
tuexen [Tue, 28 Jul 2015 08:50:13 +0000 (08:50 +0000)]
Fix a typo reported by Erik Cederstrand.

MFC after:  1 week

8 years agoOptimise the DWC OTG host mode driver's receive path:
hselasky [Tue, 28 Jul 2015 07:30:07 +0000 (07:30 +0000)]
Optimise the DWC OTG host mode driver's receive path:

Remove NAKing limit and pause IN and OUT transactions for 125us in
case of NAK response for BULK and CONTROL endpoints. This gets the
receive latency down and improves USB network throughput at the cost
of some CPU usage.

MFC after: 1 month

8 years agoRemove full barrier from the amd64 atomic_load_acq_*(). Strong
kib [Tue, 28 Jul 2015 07:04:51 +0000 (07:04 +0000)]
Remove full barrier from the amd64 atomic_load_acq_*().  Strong
ordering semantic of x86 CPUs makes only the compiler barrier
neccessary to give the acquire behaviour.

Existing implementation ensured sequentially consistent semantic for
load_acq, making much stronger guarantee than required by standard's
definition of the load acquire.  Consumers which depend on the barrier
are believed to be identified and already fixed to use proper
operations.

Noted by: alc (long time ago)
Reviewed by: alc, bde
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoRemove useless acquire semantic from the atomic_add operation before
kib [Tue, 28 Jul 2015 06:58:10 +0000 (06:58 +0000)]
Remove useless acquire semantic from the atomic_add operation before
sosend().  The only release on the xp_snt_cnt is done after sosend(),
with an intent to synchronize with load_acq in svc_vc_ack().

Reviewed by: alc
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoAdd bit names for the IA32_MISC_ENABLE msr.
kib [Tue, 28 Jul 2015 06:55:08 +0000 (06:55 +0000)]
Add bit names for the IA32_MISC_ENABLE msr.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoImplement directory and FIFO creation.
ed [Tue, 28 Jul 2015 06:50:47 +0000 (06:50 +0000)]
Implement directory and FIFO creation.

The file_create() system call can be used to create files of a given
type. Right now it can only be used to create directories and FIFOs. As
CloudABI does not expose filesystem permissions, this system call lacks
a mode argument. Simply use 0777 or 0666 depending on the file type.

8 years agoMake fstat() and friends work.
ed [Tue, 28 Jul 2015 06:36:49 +0000 (06:36 +0000)]
Make fstat() and friends work.

Summary:
CloudABI provides access to two different stat structures:

- fdstat, containing file descriptor level status: oflags, file
  descriptor type and Capsicum rights, used by cap_rights_get(),
  fcntl(F_GETFL), getsockopt(SO_TYPE).
- filestat, containing your regular file status: timestamps, inode
  number, used by fstat().

Unlike FreeBSD's stat::st_mode, CloudABI file descriptor types don't
have overloaded meanings (e.g., returning S_ISCHR() for kqueues). Add a
utility function to extract the type of a file descriptor accurately.

CloudABI does not work with O_ACCMODEs. File descriptors have two sets
of Capsicum-style rights: rights that apply to the file descriptor
itself ('base') and rights that apply to any new file descriptors
yielded through openat() ('inheriting'). Though not perfect, we can
pretty safely decompose Capsicum rights to such a pair. This is done in
convert_capabilities().

Test Plan: Tests for these system calls are fairly extensive in cloudlibc.

Reviewers: jonathan, mjg, #manpages

Reviewed By: mjg

Subscribers: imp

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

8 years agoCheck the sync operation.
marcel [Tue, 28 Jul 2015 04:54:05 +0000 (04:54 +0000)]
Check the sync operation.

8 years agoStaticfy and constify some variables and clean up the code a bit to make it
araujo [Tue, 28 Jul 2015 02:32:40 +0000 (02:32 +0000)]
Staticfy and constify some variables and clean up the code a bit to make it
more readable. No functional change.

Differential Revision: D3166
Reviewed by: kib
Sponsored by: gandi.net

8 years agoProvide consistent error causes whenever an ABORT chunk is sent.
tuexen [Mon, 27 Jul 2015 22:35:54 +0000 (22:35 +0000)]
Provide consistent error causes whenever an ABORT chunk is sent.

MFC after: 1 week

8 years agoRewrite scan procedure with a FSM. This improves code readability by
delphij [Mon, 27 Jul 2015 19:21:23 +0000 (19:21 +0000)]
Rewrite scan procedure with a FSM.  This improves code readability by
making clear transits between different states, and avoids bug with
handling repeated $'s.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D3221

8 years ago- Move the remainder of host controller capability registers reading from
marius [Mon, 27 Jul 2015 15:26:50 +0000 (15:26 +0000)]
- Move the remainder of host controller capability registers reading from
  xhci_start_controller() to xhci_init(). These values don't change at run-
  time so there's no point of acquiring them on every USB_HW_POWER_RESUME
  instead of only once during initialization. In r276717, reading the first
  couple of registers in question already had been moved as a prerequisite
  for the changes in that revision.
- Identify ASMedia ASM1042A controllers.
- Use NULL instead of 0 for pointers.

MFC after: 3 days

8 years ago- Fix compilation after r285909 with USB_DEBUG defined.
marius [Mon, 27 Jul 2015 14:43:14 +0000 (14:43 +0000)]
- Fix compilation after r285909 with USB_DEBUG defined.
- Regenerate usb.conf.

8 years ago- Use __FBSDID().
marius [Mon, 27 Jul 2015 14:34:32 +0000 (14:34 +0000)]
- Use __FBSDID().
- Const'ify cons_to_vga_colors.
- Fix line wrapping.

MFC after: 3 days

8 years ago- Nuke dupe $FreeBSD$.
marius [Mon, 27 Jul 2015 14:03:34 +0000 (14:03 +0000)]
- Nuke dupe $FreeBSD$.
- Fix whitespace.

MFC after: 3 days