]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoCheck uid/gid used when creating a user/group are not larger than UID_MAX/GID_MAX
Baptiste Daroussin [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
Baptiste Daroussin [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 Roberson [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.
Xin LI [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
Xin LI [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
David C Somayajulu [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:
Bryan Drewery [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:
Bryan Drewery [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:
Bryan Drewery [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
Renato Botelho [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/
Zbigniew Bodek [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.
Gleb Smirnoff [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
Zbigniew Bodek [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)
Ed Maste [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 Schouten [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
Baptiste Daroussin [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
Steven Hartland [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
Steven Hartland [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
Renato Botelho [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
Gleb Smirnoff [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.
Michael 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:
Hans Petter Selasky [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
Konstantin Belousov [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
Konstantin Belousov [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.
Konstantin Belousov [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 Schouten [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 Schouten [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 Moolenaar [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
Marcelo 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.
Michael 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
Xin LI [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 Strobl [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 Strobl [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 Strobl [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 Strobl [Mon, 27 Jul 2015 14:03:34 +0000 (14:03 +0000)]
- Nuke dupe $FreeBSD$.
- Fix whitespace.

MFC after: 3 days

8 years agoMake shutdown() return ENOTCONN as required by POSIX, part deux.
Ed Schouten [Mon, 27 Jul 2015 13:17:57 +0000 (13:17 +0000)]
Make shutdown() return ENOTCONN as required by POSIX, part deux.

Summary:
Back in 2005, maxim@ attempted to fix shutdown() to return ENOTCONN in case the socket was not connected (r150152). This had to be rolled back (r150155), as it broke some of the existing programs that depend on this behavior. I reapplied this change on my system and indeed, syslogd failed to start up. I fixed this back in February (279016) and MFC'ed it to the supported stable branches. Apart from that, things seem to work out all right.

Since at least Linux and Mac OS X do the right thing, I'd like to go ahead and give this another try. To keep old copies of syslogd working, only start returning ENOTCONN for recent binaries.

I took a look at the XNU sources and they seem to test against both SS_ISCONNECTED, SS_ISCONNECTING and SS_ISDISCONNECTING, instead of just SS_ISCONNECTED. That seams reasonable, so let's do the same.

Test Plan:
This issue was uncovered while writing tests for shutdown() in CloudABI:

https://github.com/NuxiNL/cloudlibc/blob/master/src/libc/sys/socket/shutdown_test.c#L26

Reviewers: glebius, rwatson, #manpages, gnn, #network

Reviewed By: gnn, #network

Subscribers: bms, mjg, imp

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

8 years ago- Probe UICLASS_CDC/UISUBCLASS_ABSTRACT_CONTROL_MODEL/0xff again. This
Marius Strobl [Mon, 27 Jul 2015 12:14:14 +0000 (12:14 +0000)]
- Probe UICLASS_CDC/UISUBCLASS_ABSTRACT_CONTROL_MODEL/0xff again. This
  variant of Microsoft RNDIS, i. e. their unofficial version of CDC ACM,
  has been disabled in r261544 for resolving a conflict with umodem(4).
  Eventually, in r275790 that problem was dealt with in the right way.
  However, r275790 failed to put probing of RNDIS devices in question
  back.
- Initialize the device prior to querying it, as required by the RNDIS
  specification. Otherwise already determining the MAC address may fail
  rightfully.
- On detach, halt the device again.
- Use UCDC_SEND_ENCAPSULATED_{COMMAND,RESPONSE}. While these macros are
  resolving to the same values as UR_{CLEAR_FEATURE,GET_STATUS}, the
  former set is way more appropriate in this context.
- Report unknown - rather: unimplemented - events unconditionally and
  not just in debug mode. This ensures that we'll get some hint of what
  is going wrong instead of the driver silently failing.
- Deal with the Microsoft ActiveSync requirement of using an input buffer
  the size of the expected reply or larger - except for variably sized
  replies - when querying a device.
- Fix some pointless NULL checks, style bugs etc.

This changes allow urndis(4) to communicate with a Microsoft-certified
USB RNDIS test token.

MFC after: 3 days
Sponsored by: genua mbh

8 years agoAdd a futex implementation for CloudABI.
Ed Schouten [Mon, 27 Jul 2015 10:07:29 +0000 (10:07 +0000)]
Add a futex implementation for CloudABI.

Summary:
CloudABI provides two different types of futex objects: read-write locks
and condition variables. There is no need to provide separate support
for once objects and thread joining, as these are efficiently simulated
by blocking on a read-write lock. Mutexes simply use read-write locks.

Condition variables always have a lock object associated to them. They
always know to which lock a thread needs to be migrated if woken up.
This allows us to implement requeueing. A broadcast on a condition
variable will never cause multiple threads to be woken up at once. They
will be woken up iteratively.

This implementation still has lots of room for improvement. Locking is
coarse and right now we use linked lists to store all of the locks and
condition variables, instead of using a hash table. The primary goal of
this implementation was to behave correctly. Performance will be
improved as we go.

Test Plan:
This futex implementation has been in use for the last couple of months
and seems to work pretty well. All of the cloudlibc and libc++ unit
tests seem to pass.

Reviewers: dchagin, kib, vangyzen

Subscribers: imp

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

8 years agoRegenerate system call table.
Ed Schouten [Mon, 27 Jul 2015 10:04:28 +0000 (10:04 +0000)]
Regenerate system call table.

8 years agoSync in latest upstream system call definitions.
Ed Schouten [Mon, 27 Jul 2015 10:04:06 +0000 (10:04 +0000)]
Sync in latest upstream system call definitions.

Futex object scopes have been renamed from using their own constants to
simply reusing the existing CLOUDABI_MAP_{PRIVATE,SHARED} flags, as they
are more accurate in this context.

8 years agoChange the dev argument from a full path to just the device
Marcel Moolenaar [Sun, 26 Jul 2015 21:37:31 +0000 (21:37 +0000)]
Change the dev argument from a full path to just the device
identification (e.g. isa:0x3f0 or pci0:2:1:0). In libbus,
the device is turned into a path name. For bus_space_map(),
the resource is now specified in a second argument.
Before:
bus.map('/dev/proto/pci0:2:1:0/pcicfg')
busdma.tag_create('/dev/proto/pci0:2:1:0/busdma', ...)
Now:
bus.map('pci0:2:1:0', 'pcicfg')
busdma.tag_create('pci0:2:1:0', ...)

8 years agoDocument r285557, bsdinstall aligns zfs partitions on 1Mb boundaries.
Glen Barber [Sun, 26 Jul 2015 19:47:08 +0000 (19:47 +0000)]
Document r285557, bsdinstall aligns zfs partitions on 1Mb boundaries.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r285642, ssh(1) hostname canonicalization before looking
Glen Barber [Sun, 26 Jul 2015 19:47:05 +0000 (19:47 +0000)]
Document r285642, ssh(1) hostname canonicalization before looking
for the host in known_hosts.
Add Dell, Inc. to sponsors.ent.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r285679, bsdinstall(8) updates to workaround various
Glen Barber [Sun, 26 Jul 2015 19:47:02 +0000 (19:47 +0000)]
Document r285679, bsdinstall(8) updates to workaround various
problematic BIOSes when booting from GPT, and partition scheme
selection in the UFS partition menu.

Sponsored by: The FreeBSD Foundation

8 years agoFurther refine the PAE_TABLES entry, based on feedback from
Glen Barber [Sun, 26 Jul 2015 17:57:35 +0000 (17:57 +0000)]
Further refine the PAE_TABLES entry, based on feedback from
alc.

Sponsored by: The FreeBSD Foundation

8 years agoRemove debugging output. We should have tracing instead.
Marcel Moolenaar [Sun, 26 Jul 2015 16:40:51 +0000 (16:40 +0000)]
Remove debugging output. We should have tracing instead.

8 years agoo make sure the boundary is a power of 2, when not zero.
Marcel Moolenaar [Sun, 26 Jul 2015 16:39:37 +0000 (16:39 +0000)]
o   make sure the boundary is a power of 2, when not zero.
o   don't convert 0 to ~0 just so that we can use MIN. ~0 is not a
    valid boundary. Introduce BNDRY_MIN that deals with 0 values
    that mean no boundary.

8 years agoPass unsigned long argument to ioctl().
Craig Rodrigues [Sun, 26 Jul 2015 14:46:42 +0000 (14:46 +0000)]
Pass unsigned long argument to ioctl().

Eliminates "ioctl sign-extension" warnings.

PR: 200896

8 years agoReplace GNU RCS ident with a BSD license ident
Baptiste Daroussin [Sun, 26 Jul 2015 11:21:36 +0000 (11:21 +0000)]
Replace GNU RCS ident with a BSD license ident

Rationale: ident(1) is useful out of RCS, lot of scripts are using ident(1) and
failing when base is built WITHOUT_RCS.

This version is:
- fully compatible with RCS 5.7 ident.
- fully compatible with RCS 5.9 ident.
- passes all ident test from GNU RCS 5.9 test suite

This version has support for: svn extension for the Keyword id (double colon and
# before last $)

Différences with GNU RCS ident:
- no long options as found in GNU RCS 5.9 (but not commented there).
- '-V' reports nothing but has been added for compatibility.

Differential Revision: https://reviews.freebsd.org/D3200
Reviewed by: pfg

8 years agoReport the scheme and provider names in warning message about unaligned
Andrey V. Elsukov [Sun, 26 Jul 2015 11:16:48 +0000 (11:16 +0000)]
Report the scheme and provider names in warning message about unaligned
partition.

PR: 201873
MFC after: 1 week

8 years agoBuild debug version of rmlock's methods only when LOCK_DEBUG > 0.
Andrey V. Elsukov [Sun, 26 Jul 2015 10:53:32 +0000 (10:53 +0000)]
Build debug version of rmlock's methods only when LOCK_DEBUG > 0.

Currently LOCK_DEBUG is always defined in sys/lock.h (0 or 1).
This means that debugging code always built. In addition the kernel
modules have always defined LOCK_DEBUG as 1. So, debugging rmlock code
is always used by kernel modules.

MFC after: 1 week

8 years agoImprove locking on Mac OS X. This does not change the functionality
Michael Tuexen [Sun, 26 Jul 2015 10:37:40 +0000 (10:37 +0000)]
Improve locking on Mac OS X. This does not change the functionality
on FreeBSD.

Reviewed by: rrs
MFC after: 1 week

8 years agoFix and improve a debug message. The SID was reported as an SSN.
Michael Tuexen [Sun, 26 Jul 2015 10:17:17 +0000 (10:17 +0000)]
Fix and improve a debug message. The SID was reported as an SSN.

MFC after: 1 week

8 years agoIn tmpfs_chtimes(), remove checks on the nanosecond level when
Christian Brueffer [Sun, 26 Jul 2015 08:33:46 +0000 (08:33 +0000)]
In tmpfs_chtimes(), remove checks on the nanosecond level when
determining whether a node changed.

Other filesystems, e.g., UFS, only check on seconds, when determining
whether something changed.

This also corrects the birthtime case, where we checked tv_nsec
twice, instead of tv_sec and tv_nsec (PR).

PR: 201284
Submitted by: David Binderman
Patch suggested by: kib
Reviewed by: kib
MFC after: 2 weeks
Committed from: Essen FreeBSD Hackathon

8 years agoBump GCC max-inline-insns-single in libiconv_modules and grep
Pedro F. Giffuni [Sun, 26 Jul 2015 00:11:04 +0000 (00:11 +0000)]
Bump GCC max-inline-insns-single in libiconv_modules and grep

This is required by our FORTIFY_SOURCE implementation as it
does more inlining. As a rule of thumb, FORTIFY_SOURCE doubles
the number  of inlines except that in grep inlining
blows up for some reason.

8 years agoisl(4), driver for Intersil I2C ISL29018 Digital Ambient Light Sensor
Michael Gmelin [Sat, 25 Jul 2015 20:17:19 +0000 (20:17 +0000)]
isl(4), driver for Intersil I2C ISL29018 Digital Ambient Light Sensor

Differential Revision: https://reviews.freebsd.org/D2811
Reviewed by: adrian, wblock
Approved by: adrian, wblock
Relnotes: yes

8 years agoUse consistent spacing.
Edward Tomasz Napierala [Sat, 25 Jul 2015 20:17:19 +0000 (20:17 +0000)]
Use consistent spacing.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoAdd md_root example to defaults/loader.conf.
Edward Tomasz Napierala [Sat, 25 Jul 2015 20:15:29 +0000 (20:15 +0000)]
Add md_root example to defaults/loader.conf.

Note that this doesn't quite work yet - the preloaded image
gets loaded twice for some reason.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoRemove unused txd_saved.
Sean Bruno [Sat, 25 Jul 2015 19:24:33 +0000 (19:24 +0000)]
Remove unused txd_saved.

Intialize txd_upper, txd_lower and txd_used at declaration.

Differential Revision: D3174
Reviewed by: erj hiren
MFC after: 2 weeks
Sponsored by: Limelight Networks

8 years agoRevert r173708's modifications to vm_object_page_remove().
Konstantin Belousov [Sat, 25 Jul 2015 18:29:06 +0000 (18:29 +0000)]
Revert r173708's modifications to vm_object_page_remove().

Assume that a vnode is mapped shared and mlocked(), and then the vnode
is truncated, or truncated and then again extended past the mapping
point EOF.  Truncation removes the pages past the truncation point,
and if pages are later created at this range, they are not properly
mapped into the mlocked region, and their wiring count is wrong.

The revert leaves the invalidated but wired pages on the object queue,
which means that the pages are found by vm_object_unwire() when the
mapped range is munlock()ed, and reused by the buffer cache when the
vnode is extended again.

The changes in r173708 were required since then vm_map_unwire() looked
at the page tables to find the page to unwire.  This is no longer
needed with the vm_object_unwire() introduction, which follows the
objects shadow chain.

Also eliminate OBJPR_NOTWIRED flag for vm_object_page_remove(), which
is now redundand, we do not remove wired pages.

Reported by: trasz, Dmitry Sivachenko <trtrmitya@gmail.com>
Suggested and reviewed by: alc
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoMove including netinet/icmp6.h around to avoid a problem when including
Michael Tuexen [Sat, 25 Jul 2015 18:26:09 +0000 (18:26 +0000)]
Move including netinet/icmp6.h around to avoid a problem when including
netinet/icmp6.h and net/netmap.h. Both use ni_flags...
This allows to build multistack with SCTP support.

MFC after: 1 week

8 years agocyapa(4), driver for the Cypress APA I2C trackpad
Michael Gmelin [Sat, 25 Jul 2015 18:14:35 +0000 (18:14 +0000)]
cyapa(4), driver for the Cypress APA I2C trackpad

Differential Revision: https://reviews.freebsd.org/D3068
Reviewed by: kib, wblock
Approved by: kib
Relnotes: yes

8 years agoUse double newlines consistently.
Edward Tomasz Napierala [Sat, 25 Jul 2015 16:20:04 +0000 (16:20 +0000)]
Use double newlines consistently.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoRemove stale comment.
Kristof Provost [Sat, 25 Jul 2015 16:14:55 +0000 (16:14 +0000)]
Remove stale comment.

The IPv6 pseudo header checksum was added by bz in r235961.

Sponsored by: Essen FreeBSD Hackathon

8 years agoUpdate Capsicum and Mandatory Access Control manual pages
Edward Tomasz Napierala [Sat, 25 Jul 2015 15:56:49 +0000 (15:56 +0000)]
Update Capsicum and Mandatory Access Control manual pages
to no longer claim they are experimental.

Reviewed by: rwatson@, wblock@
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2985

8 years agoWith the removal of b_saveaddr in the r285819, b_data must be reset to
Konstantin Belousov [Sat, 25 Jul 2015 15:00:14 +0000 (15:00 +0000)]
With the removal of b_saveaddr in the r285819, b_data must be reset to
b_kvabase when the buffer is reclaimed.  Otherwise, if b_data for the
mapped buffer was adjusted with the page-offset portion of b_offset,
nothing would re-adjust the b_data, which breaks buffer management
code which expects page-aligned b_data (see e.g. bpman_qenter(), which
skips partial pages).

Fix a minor issue with the GB_KVAALLOC requests, which could result in
returning the mapped buffer if the reused buffer is mapped and have
the right amount of KVA reserved.

Improve assertion in the vfs_buf_check_mapped() to catch unmapped
buffers which have their b_data incorrectly adjusted with offset.

Reported and tested by: pho (previous version)
Reviewed by: jeff (previous version)
Sponsored by: The FreeBSD Foundation

8 years agoPf can reassemble IPv6 fragments now.
Kristof Provost [Sat, 25 Jul 2015 14:06:32 +0000 (14:06 +0000)]
Pf can reassemble IPv6 fragments now.

Obtained from: bluhm (OpenBSD)
Sponsored by: Essen FreeBSD Hackathon

8 years agoDocument md_root in loader(8). The md(4) manual page mentions it,
Edward Tomasz Napierala [Sat, 25 Jul 2015 13:02:41 +0000 (13:02 +0000)]
Document md_root in loader(8). The md(4) manual page mentions it,
but it's hard to find and easy to miss.

Reviewed by: wblock@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3183

8 years agoFix transposed words in man page.
Dru Lavigne [Sat, 25 Jul 2015 11:10:49 +0000 (11:10 +0000)]
Fix transposed words in man page.

PR: 201752
Reviewed by: bcr
MFC after: 3 days
Sponsored by: Essen FreeBSD Hackathon

8 years agoFix color mapping for TDA19988. Values for VIP_CNTRL_1 and VIP_CNTRL_2
Oleksandr Tymoshenko [Sat, 25 Jul 2015 03:19:02 +0000 (03:19 +0000)]
Fix color mapping for TDA19988. Values for VIP_CNTRL_1 and VIP_CNTRL_2
registers were mixed up

8 years agoSynchronize PIN input/output modes with gnu/dts/include/dt-bindings/pinctrl/am33xx.h
Oleksandr Tymoshenko [Sat, 25 Jul 2015 03:03:32 +0000 (03:03 +0000)]
Synchronize PIN input/output modes with gnu/dts/include/dt-bindings/pinctrl/am33xx.h
gpio driver requires exact value to match SoC pin mode with GPIO pin direction

8 years agoIf there is panel info in DTB do not wait for HDMI event and setup
Oleksandr Tymoshenko [Sat, 25 Jul 2015 02:59:45 +0000 (02:59 +0000)]
If there is panel info in DTB do not wait for HDMI event and setup
framebuffer immediately

8 years agoOF_getencprop_alloc shouldn't be used to get string value. If string
Oleksandr Tymoshenko [Sat, 25 Jul 2015 00:58:50 +0000 (00:58 +0000)]
OF_getencprop_alloc shouldn't be used to get string value. If string
length + 1 is not divisible by 4 this function returns NULL property
value. Otherwise - string with each 4 letters inverted

8 years agoDocument the fact that system(3) can easily be misused due to shell meta
Xin LI [Sat, 25 Jul 2015 00:21:29 +0000 (00:21 +0000)]
Document the fact that system(3) can easily be misused due to shell meta
characters are honored.  While I'm there also mention posix_spawn in the
SEE ALSO section.

MFC after: 2 weeks

8 years agoFix a typo in comment.
Xin LI [Fri, 24 Jul 2015 22:13:39 +0000 (22:13 +0000)]
Fix a typo in comment.

Submitted by: Yanhui Shen via twitter
MFC after: 3 days

8 years agoAuto-generate hardware notes for pms(4).
Christian Brueffer [Fri, 24 Jul 2015 21:55:16 +0000 (21:55 +0000)]
Auto-generate hardware notes for pms(4).

MFC after: 1 week
Committed from: Essen FreeBSD Hackathon

8 years agoAdd a basic manpage for the pms driver.
Christian Brueffer [Fri, 24 Jul 2015 21:48:53 +0000 (21:48 +0000)]
Add a basic manpage for the pms driver.

MFC after: 1 week
Committed from: Essen FreeBSD Hackathon

8 years agoCast uid and gid to the correct type for display to solve segfault in ls(1) on 32bit...
Allan Jude [Fri, 24 Jul 2015 20:20:59 +0000 (20:20 +0000)]
Cast uid and gid to the correct type for display to solve segfault in ls(1) on 32bit arches

Correctly escape literal % for display

This fixes segfaults in 32bit arches caused by r285734

Reviewed by: ngie
Approved by: dim
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D3191

8 years agoAdd a comment discussing the appropriate use of the atomic_*() functions
Alan Cox [Fri, 24 Jul 2015 19:43:18 +0000 (19:43 +0000)]
Add a comment discussing the appropriate use of the atomic_*() functions
with acquire and release semantics versus the *mb() functions on amd64
processors.

Reviewed by: bde (an earlier version), kib
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd missing SIGUSR1 description.
Edward Tomasz Napierala [Fri, 24 Jul 2015 18:14:57 +0000 (18:14 +0000)]
Add missing SIGUSR1 description.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

8 years agoAdd missing capitalization.
Edward Tomasz Napierala [Fri, 24 Jul 2015 18:13:13 +0000 (18:13 +0000)]
Add missing capitalization.

8 years agoreadelf: avoid division by zero on section entry size
Ed Maste [Fri, 24 Jul 2015 18:00:53 +0000 (18:00 +0000)]
readelf: avoid division by zero on section entry size

ELF Tool Chain tickets #439, #444, #445, #467
Reported by: Alexander Cherepanov <cherepan@mccme.ru> (#467)
Reported by: antiAgainst (others)

Reviewed by: brooks
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2338

8 years agoar: add -U (unique) option to disable -D (deterministic) mode
Ed Maste [Fri, 24 Jul 2015 17:46:43 +0000 (17:46 +0000)]
ar: add -U (unique) option to disable -D (deterministic) mode

This is required in order for us to support deterministic mode by
default.  If multiple -D or -U options are specified on the command
line, the final one takes precedence.  GNU ar also uses -U for this.

An equivalent change will be applied to ELF Tool Chain's version of ar.

PR: 196929
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3175

8 years ago- Since r253161, uart_intr() abuses FILTER_SCHEDULE_THREAD for signaling
Marius Strobl [Fri, 24 Jul 2015 17:01:16 +0000 (17:01 +0000)]
- Since r253161, uart_intr() abuses FILTER_SCHEDULE_THREAD for signaling
  uart_bus_attach() during its test that 20 iterations weren't sufficient
  for clearing all pending interrupts, assuming this means that hardware
  is broken and doesn't deassert interrupts. However, under pressure, 20
  iterations also can be insufficient for clearing all pending interrupts,
  leading to a panic as intr_event_handle() tries to schedule an interrupt
  handler not registered. Solve this by introducing a flag that is set in
  test mode and otherwise restores pre-r253161 behavior of uart_intr(). The
  approach of additionally registering uart_intr() as handler as suggested
  in PR 194979 is not taken as that in turn would abuse special pccard and
  pccbb handling code of intr_event_handle(). [1]
- Const'ify uart_driver_name.
- Fix some minor style bugs.

PR: 194979 [1]
Reviewed by: marcel (earlier version)
MFC after: 3 days

8 years agotruss: follow pdfork()ed descendents with -f
Ed Maste [Fri, 24 Jul 2015 16:57:13 +0000 (16:57 +0000)]
truss: follow pdfork()ed descendents with -f

PR: 201276
Reported by: David Drysdale
Reviewed by: oshogbo
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2976

8 years agoAdd RISC-V ELF machine type definition
Ed Maste [Fri, 24 Jul 2015 16:52:21 +0000 (16:52 +0000)]
Add RISC-V ELF machine type definition

EM_RISCV is now officially registered as e_machine 243.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years ago- In mpt_send_handshake_cmd(), use bus_space_write_stream_4(9) for writing
Marius Strobl [Fri, 24 Jul 2015 16:00:35 +0000 (16:00 +0000)]
- In mpt_send_handshake_cmd(), use bus_space_write_stream_4(9) for writing
  raw data to the doorbell offset in order to clarify the intent and for
  avoiding unnecessarily converting the endianess back and forth.
  Unfortunately, the same can't be done in mpt_recv_handshake_reply() as
  16-bit data needs to be read using 32-bit bus accessors.
- In mpt_recv_handshake_reply(), get rid of a redundant variable.

MFC after: 1 fortnight

8 years agoo Revert the other functional half of r239864, i. e. the merge of r134227
Marius Strobl [Fri, 24 Jul 2015 15:13:21 +0000 (15:13 +0000)]
o Revert the other functional half of r239864, i. e. the merge of r134227
  from x86 to use smp_ipi_mtx spin lock not only for smp_rendezvous_cpus()
  but also for the MD cache invalidation, TLB demapping and remote register
  reading IPIs due to the following reasons:
  - The cross-IPI SMP deadlock x86 otherwise is subject to can't happen on
    sparc64. That's because on sparc64, spin locks don't disable interrupts
    completely but only raise the processor interrupt level to PIL_TICK. This
    means that IPIs still get delivered and direct dispatch IPIs such as the
    cache invalidation etc. IPIs in question are still executed.
  - In smp_rendezvous_cpus(), smp_ipi_mtx is held not only while sending an
    IPI_RENDEZVOUS, but until all CPUs have processed smp_rendezvous_action().
    Consequently, smp_ipi_mtx may be locked for an extended amount of time as
    queued IPIs (as opposed to the direct ones) such as IPI_RENDEZVOUS are
    scheduled via a soft interrupt. Moreover, given that this soft interrupt
    is only delivered at PIL_RENDEZVOUS, processing of smp_rendezvous_action()
    on a target may be interrupted by f. e. a tick interrupt at PIL_TICK, in
    turn leading to the target in question trying to send an IPI by itself
    while IPI_RENDEZVOUS isn't fully handled, yet, and, thus, resulting in a
    deadlock.
o As mentioned in the commit message of r245850, on least some sun4u platforms
  concurrent sending of IPIs by different CPUs is fatal. Therefore, hold the
  reintroduced MD ipi_mtx also while delivering cross-traps via MI helpers,
  i. e. ipi_{all_but_self,cpu,selected}().
o Akin to x86, let the last CPU to process cpu_mp_bootstrap() set smp_started
  instead of the BSP in cpu_mp_unleash(). This ensures that all APs actually
  are started, when smp_started is no longer 0.
o In all MD and MI IPI helpers, check for smp_started == 1 rather than for
  smp_cpus > 1 or nothing at all. This avoids races during boot causing IPIs
  trying to be delivered to APs that in fact aren't up and running, yet.
  While at it, move setting of the cpu_ipi_{selected,single}() pointers to
  the appropriate delivery functions from mp_init() to cpu_mp_start() where
  it's better suited and allows to get rid of the global isjbus variable.
o Given that now concurrent IPI delivery no longer is possible, also nuke
  the delays before completely disabling interrupts again in the CPU-specific
  cross-trap delivery functions, previously giving other CPUs a window for
  sending IPIs on their part. Actually, we now should be able to entirely get
  rid of completely disabling interrupts in these functions. Such a change
  needs more testing, though.
o In {s,}tick_get_timecount_mp(), make the {s,}tick variable static. While not
  necessary for correctness, this avoids page faults when accessing the stack
  of a foreign CPU as {s,}tick now is locked into the TLBs as part of static
  kernel data. Hence, {s,}tick_get_timecount_mp() always execute as fast as
  possible, avoiding jitter.

PR: 201245
MFC after: 3 days

8 years agoFix silly syntax error emacs chugged in for me.. gesh.
Randall Stewart [Fri, 24 Jul 2015 14:13:43 +0000 (14:13 +0000)]
Fix silly syntax error emacs chugged in for me.. gesh.

MFC after: 3 weeks

8 years agoFix an issue with MAC OS locking and also optimize the case
Randall Stewart [Fri, 24 Jul 2015 14:09:03 +0000 (14:09 +0000)]
Fix an issue with MAC OS locking and also optimize the case
where we are sending back a stream-reset and a sack timer is running, in
that case we should just send the SACK.

MFC after: 3 weeks

8 years agoinode should be different to actually mean mandocdb is in used
Baptiste Daroussin [Fri, 24 Jul 2015 09:20:02 +0000 (09:20 +0000)]
inode should be different to actually mean mandocdb is in used

Sponsored by: gandi.net

8 years agoFix man -k with mandocdb
Baptiste Daroussin [Fri, 24 Jul 2015 09:10:03 +0000 (09:10 +0000)]
Fix man -k with mandocdb

If apropos(1) and whatis(1) are not hardlinks to man(1) that means the system is
using mandocdb, then man -k should spawn apropos(1) and/or whatis(1) directly

Reported by: kevlo
Tested by: kevlo
Sponsored by: gandi.net

8 years agoImplement the basic system calls that operate on pathnames.
Ed Schouten [Fri, 24 Jul 2015 07:46:02 +0000 (07:46 +0000)]
Implement the basic system calls that operate on pathnames.

Summary:
Unlike FreeBSD, CloudABI does not use null terminated strings for its
pathnames. Introduce a function called copyin_path() that can be used by
all of the filesystem system calls that use pathnames. This change
already implements the system calls that don't depend on any additional
functionality (e.g., conversion of struct stat).

Also implement the socket system calls that operate on pathnames, namely
the ones used by the C library functions bindat() and connectat(). These
don't receive a 'struct sockaddr_un', but just the pathname, meaning
they could be implemented in such a way that they don't depend on the
size of sun_path. For now, just use the existing interfaces.

Add a missing #include to cloudabi_syscalldefs.h to get this code to
build, as one of its macros depends on UINT64_C().

Test Plan:
These implementations have already been tested in the CloudABI branch on
GitHub. They pass all of the tests.

Reviewers: kib, pjd

Subscribers: imp

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

9 years agoPanic when a device is trying to recursively acquire rather than hang
Warner Losh [Fri, 24 Jul 2015 04:56:46 +0000 (04:56 +0000)]
Panic when a device is trying to recursively acquire rather than hang
indefinitely. Improve error messages from other panics.

9 years agoCall ksem_get() with initialized 'rights'.
Sergey Kandaurov [Thu, 23 Jul 2015 23:18:03 +0000 (23:18 +0000)]
Call ksem_get() with initialized 'rights'.

ksem_get() consumes fget(), and it's mandatory there.

Reported by: truckman
Reviewed by: mjg

9 years agoRefactor unmapped buffer address handling.
Jeff Roberson [Thu, 23 Jul 2015 19:13:41 +0000 (19:13 +0000)]
Refactor unmapped buffer address handling.
 - Use pointer assignment rather than a combination of pointers and
   flags to switch buffers between unmapped and mapped.  This eliminates
   multiple flags and generally simplifies the logic.
 - Eliminate b_saveaddr since it is only used with pager bufs which have
   their b_data re-initialized on each allocation.
 - Gather up some convenience routines in the buffer cache for
   manipulating buf space and buf malloc space.
 - Add an inline, buf_mapped(), to standardize checks around unmapped
   buffers.

In collaboration with: mlaier
Reviewed by: kib
Tested by: pho (many small revisions ago)
Sponsored by: EMC / Isilon Storage Division

9 years agoRefine the PAE_TABLES entry based on feedback from kib
Glen Barber [Thu, 23 Jul 2015 18:11:52 +0000 (18:11 +0000)]
Refine the PAE_TABLES entry based on feedback from kib
and jhb.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

9 years agoDocument the fact that tunables can be set in device.hints.
Brooks Davis [Thu, 23 Jul 2015 17:27:10 +0000 (17:27 +0000)]
Document the fact that tunables can be set in device.hints.

Reviewed by: wblock
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D3153

9 years agonvme: ensure csts.rdy bit is cleared before returning from nvme_ctrlr_disable
Jim Harris [Thu, 23 Jul 2015 15:50:39 +0000 (15:50 +0000)]
nvme: ensure csts.rdy bit is cleared before returning from nvme_ctrlr_disable

PR: 200458
MFC after: 3 days
Sponsored by: Intel

9 years agonvme: properly handle case where pci_alloc_msix does not alloc all vectors
Jim Harris [Thu, 23 Jul 2015 15:35:08 +0000 (15:35 +0000)]
nvme: properly handle case where pci_alloc_msix does not alloc all vectors

Reported by: Sean Kelly <smkelly@smkelly.org>
MFC after: 3 days
Sponsored by: Intel