]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoFix duplicate TLB entries issue during section promotion/demotion.
Svatopluk Kraus [Fri, 22 Apr 2016 06:42:50 +0000 (06:42 +0000)]
Fix duplicate TLB entries issue during section promotion/demotion.
Such situation is defined as UNPREDICTABLE by arm arm manual.

This patch fixes all explicit TLB fetches which could cause this issue
and speculative TLB fetches for sections mapped in user address space.
Speculative TLB fetches for sections mapped in kernel address space are
not fixed yet as the break-before-make approach must be implemented for
kernel mappings too. This means that promoted/demoted section will be
unmapped for a while. Either kernel stack the promotion/demotion is
being done on or L1 page table(s) which must be modified may be mapped
by this section. Thus the fix will not be so simple like for userland
mappings.

The issue was detectable only on Cortex-A8 platforms and only very
rarely. It was reported few times. First, it was by Mikael Urankar
in June 2015. He helped to identify the mechanism of this issue, but
we were not sure how to fix it correctly until now.

PR: 208381
Reported by: Mikael Urankar (mikael.urankar at gmail.com)
Reviewed by: kib

8 years agoAdd KASSERT() and set error code in dead code case to help static code
Hans Petter Selasky [Fri, 22 Apr 2016 06:39:07 +0000 (06:39 +0000)]
Add KASSERT() and set error code in dead code case to help static code
analysis tools.

Suggested by: ngie@
Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoAdd missing set of the current VNET when inputting IP packets in IPoIB.
Hans Petter Selasky [Fri, 22 Apr 2016 06:33:06 +0000 (06:33 +0000)]
Add missing set of the current VNET when inputting IP packets in IPoIB.

This fixes a kernel panic when using IPoIB with VIMAGE and infiniband.

PR: 208957
Sponsored by: Mellanox Technologies
Tested by: Justin Clift <justin@postgresql.org>
MFC after: 1 week

8 years agoDon't use atomic operations for page table entries and handle access
Svatopluk Kraus [Fri, 22 Apr 2016 06:32:27 +0000 (06:32 +0000)]
Don't use atomic operations for page table entries and handle access
and R/W emulation aborts under pmap lock.

There were two reasons for using of atomic operations:
(1) the pmap code is based on i386 one where they are used,
(2) there was an idea that access and R/W emulation aborts should be
    handled as quick as possible, without pmap locking.

However, the atomic operations in i386 pmap code are used only because
page table entries may be modified by hardware. At the beginning, we
were not sure that it's the only reason. So even if arm hardware does
not modify them, we did not risk to not use them at that time. Further,
it turns out after some testing that using of pmap lock for access and
R/W emulation aborts does not bring any extra cost and there was no
measurable difference. Thus, we have decided finally to use pmap lock
for all operations on page table entries and so, there is no reason for
atomic operations on them. This makes the code cleaner and safer.

This decision introduce a question if it's safe to use pmap lock for
access and R/W emulation aborts. Anyhow, there may happen two cases in
general:
(A) Aborts while the pmap lock is locked already - this should not
happen as pmap lock is not recursive. However, under pmap lock only
internal kernel data should be accessed and such data should be mapped
with A bit set and NM bit cleared. If double abort happens, then
a mapping of data which has caused it must be fixed.
(B) Aborts while another lock(s) is/are locked - this already can
happen. There is no difference here if it's either access or R/W
emulation abort, or if it's some other abort.

Reviewed by: kib

8 years agoAdd four functions which check a virtual address for stage 1 privileged
Svatopluk Kraus [Fri, 22 Apr 2016 06:26:45 +0000 (06:26 +0000)]
Add four functions which check a virtual address for stage 1 privileged
(PL1) and unprivileged (PL0) read/write access. As cp15 virtual to
physical address translation operations are used, interrupts must be
disabled to get consistent result when they are called.

These functions should be used only in very specific occasions like
during abort handling or kernel debugging. One of them is going to be
used in pmap_fault(). However, complete function set is added. It cost
nothing, as they are inlined.

While here, fix comment of #endif.

Reviewed by: kib

8 years agoUse MIN()/MAX() macros from sys/param.h.
Marcelo Araujo [Fri, 22 Apr 2016 06:25:32 +0000 (06:25 +0000)]
Use MIN()/MAX() macros from sys/param.h.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D6054

8 years agoUse roundup2() macro from sys/param.h.
Marcelo Araujo [Fri, 22 Apr 2016 06:23:23 +0000 (06:23 +0000)]
Use roundup2() macro from sys/param.h.

MFC after: 2 weeks.

8 years agoDon't try to free `string` (stack allocated char[])
Enji Cooper [Fri, 22 Apr 2016 06:01:11 +0000 (06:01 +0000)]
Don't try to free `string` (stack allocated char[])

Fix minor style with warnx call while in the neighborhood

MFC after: 1 week
CID: 1009683
Reported by: Coverity, gcc 5.x
Sponsored by: EMC / Isilon Storage Division

8 years agoDon't use `entry` after free in the "already in lists" case
Enji Cooper [Fri, 22 Apr 2016 05:52:40 +0000 (05:52 +0000)]
Don't use `entry` after free in the "already in lists" case

Return with 0 as it isn't an error.

MFC after: 1 week
CID: 1006085
Reported by: Coverity
Obtained from: Isilon OneFS (part of r493633)
Submitted by: Thor Steingrimsson <thor.steingrimsson@isilon.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoSimplify always evaluated branch (`e != NULL`)
Enji Cooper [Fri, 22 Apr 2016 05:24:15 +0000 (05:24 +0000)]
Simplify always evaluated branch (`e != NULL`)

- xalloc(..) ensures that e will be non-null via malloc + err.
- `e` is already dereferenced above, so logically it's impossible
  to hit the lower test without crashing if it was indeed NULL.

MFC after: 3 days
CID: 1007408
Reported by: Coverity
Sponsored by: EMC / Isilon Storage Division

8 years agohyperv/et: Make Hyper-V event timer a device.
Sepherosa Ziehau [Fri, 22 Apr 2016 05:15:59 +0000 (05:15 +0000)]
hyperv/et: Make Hyper-V event timer a device.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5957

8 years agoDon't leak `string` in parse_define(..) when a macro has been found
Enji Cooper [Fri, 22 Apr 2016 05:14:12 +0000 (05:14 +0000)]
Don't leak `string` in parse_define(..) when a macro has been found
and the parser token != TOK_ASSIGN

MFC after: 1 week
CID: 10071871007188
Reported by: Coverity
Obtained from: Isilon OneFS (part of r445479)
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoUse macro MAX() from sys/param.h.
Marcelo Araujo [Fri, 22 Apr 2016 05:07:59 +0000 (05:07 +0000)]
Use macro MAX() from sys/param.h.

MFC after: 2 weeks.

8 years agohyperv: Update copyright to 2016 for the files Microsoft changed in 2016
Sepherosa Ziehau [Fri, 22 Apr 2016 05:01:43 +0000 (05:01 +0000)]
hyperv: Update copyright to 2016 for the files Microsoft changed in 2016

Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6039

8 years agoUse macro MAX() from sys/param.h.
Marcelo Araujo [Fri, 22 Apr 2016 03:55:33 +0000 (03:55 +0000)]
Use macro MAX() from sys/param.h.

MFC after: 2 weeks.

8 years agoUse MIN() macro from sys/param.h.
Marcelo Araujo [Fri, 22 Apr 2016 03:46:57 +0000 (03:46 +0000)]
Use MIN() macro from sys/param.h.

MFC after: 2 weeks.

8 years agoUse macro MAX() from sys/param.h.
Marcelo Araujo [Fri, 22 Apr 2016 03:43:06 +0000 (03:43 +0000)]
Use macro MAX() from sys/param.h.

MFC after: 2 weeks.

8 years agoUse macro MAX() from sys/param.h.
Marcelo Araujo [Fri, 22 Apr 2016 03:37:27 +0000 (03:37 +0000)]
Use macro MAX() from sys/param.h.

MFC after: 2 weeks.

8 years agoUse macro MAX() from sys/param.h.
Marcelo Araujo [Fri, 22 Apr 2016 03:32:14 +0000 (03:32 +0000)]
Use macro MAX() from sys/param.h.

MFC after: 2 weeks.

8 years agokernel: use our nitems() macro when it is available through param.h.
Pedro F. Giffuni [Thu, 21 Apr 2016 21:30:51 +0000 (21:30 +0000)]
kernel: use our nitems() macro when it is available through param.h.

No functional change, only trivial cases are done in this sweep,

Discussed in: freebsd-current

8 years agoDRY on buffer sizes. Update to r298420.
Alan Somers [Thu, 21 Apr 2016 21:13:41 +0000 (21:13 +0000)]
DRY on buffer sizes.  Update to r298420.

sys/geom/geom_disk.c:
In disk_attr_changed, don't repeat a buffer size.

Reported by: ngie, hselasky
MFC after: 4 weeks
X-MFC-With: 298420
Sponsored by: Spectra Logic Corp

8 years agoPull r266775 from upstream clang trunk (by Douglas Katzman):
Dimitry Andric [Thu, 21 Apr 2016 20:38:10 +0000 (20:38 +0000)]
Pull r266775 from upstream clang trunk (by Douglas Katzman):

  Pass dwarf-version to cc1as.

  Fix PR26999 - crashing in cc1as with any '*bsd' target.

This should fix possible crashes when using -g in combination with
-save-temps.

8 years agoRevert r298147 (temporary workaround for LLVM PR 26999) in preparation
Dimitry Andric [Thu, 21 Apr 2016 20:37:53 +0000 (20:37 +0000)]
Revert r298147 (temporary workaround for LLVM PR 26999) in preparation
for committing the final upstream fix.

8 years agourtwn: optimize rate lookup in the urtwn_ra_init()
Andriy Voskoboinyk [Thu, 21 Apr 2016 20:34:38 +0000 (20:34 +0000)]
urtwn: optimize rate lookup in the urtwn_ra_init()

Replace loop with switch statement (rate2ridx())
(should be noop).

Tested with RTL8188EU / RTL8188CUS, STA mode.

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D4848 (rebased)

8 years agoYet more redundant parenthesis from r298431.
Pedro F. Giffuni [Thu, 21 Apr 2016 20:30:38 +0000 (20:30 +0000)]
Yet more redundant parenthesis from r298431.

Mea culpa.

8 years agoCompletely disable fmaxmin_test (follow up to r297952)
Enji Cooper [Thu, 21 Apr 2016 19:59:55 +0000 (19:59 +0000)]
Completely disable fmaxmin_test (follow up to r297952)

COMPILER_TYPE/COMPILER_VERSION doesn't get passed down properly at
buildworld/installworld with older build hosts

MFC after: never
PR: 208703, 208963
Reported by: Jenkins
Sponsored by: EMC / Isilon Storage Division

8 years agosys: use our roundup2/rounddown2() macros when param.h is available.
Pedro F. Giffuni [Thu, 21 Apr 2016 19:57:40 +0000 (19:57 +0000)]
sys: use our roundup2/rounddown2() macros when param.h is available.

rounddown2 tends to produce longer lines than the original code
and when the code has a high indentation level it was not really
advantageous to do the replacement.

This tries to strike a balance between readability using the macros
and flexibility of having the expressions, so not everything is
converted.

8 years agoRedundant parenthesis from r298431.
Pedro F. Giffuni [Thu, 21 Apr 2016 19:48:28 +0000 (19:48 +0000)]
Redundant parenthesis from r298431.

8 years agosys: use our nitems() macro when param.h is available.
Pedro F. Giffuni [Thu, 21 Apr 2016 19:40:10 +0000 (19:40 +0000)]
sys: use our nitems() macro when param.h is available.

This should cover all the remaining cases in the kernel.

Discussed in: freebsd-current

8 years agoUse proper type of tag in bcm2835_mbox_fb_init
Oleksandr Tymoshenko [Thu, 21 Apr 2016 18:58:06 +0000 (18:58 +0000)]
Use proper type of tag in bcm2835_mbox_fb_init

bcm2835_mbox_fb_init sets configuration so SET_VIRTUAL_OFFSET should be used
instead of GET_VIRTUAL_OFFSET

Submitted by: Sylvain Garrigues <sylvain@sylvaingarrigues.com>

8 years agoAdjust the fdc worker thread startup to work when APs are started earlier.
John Baldwin [Thu, 21 Apr 2016 18:37:36 +0000 (18:37 +0000)]
Adjust the fdc worker thread startup to work when APs are started earlier.

- Enable the commented out locking in fd_probe().  The worker thread
  should not be running yet (even after these changes), but better to be
  safe than sorry.
- Defer starting the worker thread until after the child drives have been
  probed.  The worker thread startup is moved into a fdc_start_worker()
  thread that the various front ends call at the end of attach.  As a
  side effect this fixes a few edge cases that weren't shutting down the
  worker thread if attach encountered a late failure.
- When executing the initial reset requested by attach in the worker
  thread, use DELAY() instead of a tsleep() if cold is set.

Tested by: Howard Su <howard0su@gmail.com>
Sponsored by: Netflix

8 years agoQueue the CPU-probing task after all acpi_cpu devices are attached.
John Baldwin [Thu, 21 Apr 2016 18:27:05 +0000 (18:27 +0000)]
Queue the CPU-probing task after all acpi_cpu devices are attached.

Eventually with earlier AP startup this code will change to call the
startup function synchronously instead of queueing the task.  Moving
the time we queue the task should be a no-op since taskqueue threads
don't start executing tasks until much later, but this reduces the diff
with the earlier AP startup patches.

Sponsored by: Netflix

8 years agoAdd new USB quirk.
Hans Petter Selasky [Thu, 21 Apr 2016 17:45:37 +0000 (17:45 +0000)]
Add new USB quirk.

Submitted by: Naram Qashat <cyberbotx@cyberbotx.com>
PR: 208642
MFC after: 1 week

8 years agoFix unset variables from r298417.
Bryan Drewery [Thu, 21 Apr 2016 16:50:45 +0000 (16:50 +0000)]
Fix unset variables from r298417.

Pointyhat to: bdrewery
Sponsored by: EMC / Isilon Storage Division

8 years agoReplace the A20 kernel config with a generic ALLWINNER kernel config that
Jared McNeill [Thu, 21 Apr 2016 16:49:04 +0000 (16:49 +0000)]
Replace the A20 kernel config with a generic ALLWINNER kernel config that
supports A20, A31, and A31S. Adds support for the BananaPi M2 (A31S) board.

Submitted by: Emmanuel Vadot <manu@bidouilliste.com>
Reviewed by: jmcneill
Differential Revision: https://reviews.freebsd.org/D5580

8 years agoAdd more missing .PHONY
Bryan Drewery [Thu, 21 Apr 2016 16:43:36 +0000 (16:43 +0000)]
Add more missing .PHONY

Sponsored by: EMC / Isilon Storage Division

8 years agoNotify userspace listeners when geom disk attributes have changed
Alan Somers [Thu, 21 Apr 2016 16:43:15 +0000 (16:43 +0000)]
Notify userspace listeners when geom disk attributes have changed

sys/geom/geom_disk.c:
disk_attr_changed(): Generate a devctl event of type GEOM:<attr> for
every call.

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

8 years agoFix for using IPv6 addresses with RDMA:
Hans Petter Selasky [Thu, 21 Apr 2016 16:33:42 +0000 (16:33 +0000)]
Fix for using IPv6 addresses with RDMA:

IPv6 addresses has a scope ID which sometimes is stored in the
"sin6_scope_id" field of "struct sockaddr_in6" and sometimes as part
of the IPv6 address itself depending on the context. If the scope ID
is not in the expected location, the IPv6 address lookups in the
so-called GID table will fail. Some code factoring has been made to
achieve a clean exit of the "addr_resolve" function via a common
"done" label.

Sponsored by: Mellanox Technologies
Submitted by: Shani Michaeli <shanim@mellanox.com>
MFC after: 1 week

8 years agoAdd more guards to disable GELIBOOT by defining LOADER_NO_GELI_SUPPORT
Allan Jude [Thu, 21 Apr 2016 16:32:48 +0000 (16:32 +0000)]
Add more guards to disable GELIBOOT by defining LOADER_NO_GELI_SUPPORT

Reviewed by: cem
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D6049

8 years agoRemove redundant logic from the pkg-base merge.
Bryan Drewery [Thu, 21 Apr 2016 16:30:28 +0000 (16:30 +0000)]
Remove redundant logic from the pkg-base merge.

These will be set from the logic right above it.

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

8 years agoFix 'make -n' for new packaging targets.
Bryan Drewery [Thu, 21 Apr 2016 16:30:25 +0000 (16:30 +0000)]
Fix 'make -n' for new packaging targets.

Sponsored by: EMC / Isilon Storage Division

8 years agoAdd more missing .PHONY.
Bryan Drewery [Thu, 21 Apr 2016 16:30:16 +0000 (16:30 +0000)]
Add more missing .PHONY.

This also protects them from trying to create .meta files
with WITH_META_MODE.

Reported by: Nikolai Lifanov <lifanov@mail.lifanov.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoGet rid of rctl_lock; use racct_lock where appropriate. The fast paths
Edward Tomasz Napierala [Thu, 21 Apr 2016 16:22:52 +0000 (16:22 +0000)]
Get rid of rctl_lock; use racct_lock where appropriate. The fast paths
already required both of them, so having a separate rctl_lock didn't
buy us anything.

Reviewed by: mjg@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5914

8 years agoFollow-up r298219: Don't error with 'make all install'.
Bryan Drewery [Thu, 21 Apr 2016 16:12:55 +0000 (16:12 +0000)]
Follow-up r298219: Don't error with 'make all install'.

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

8 years agoFix for resolving mac address when the destination address is a gateway.
Hans Petter Selasky [Thu, 21 Apr 2016 16:04:58 +0000 (16:04 +0000)]
Fix for resolving mac address when the destination address is a gateway.
Remove some dead code while at it.

Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoRemove slightly used const values that can be replaced with nitems().
Pedro F. Giffuni [Thu, 21 Apr 2016 15:38:28 +0000 (15:38 +0000)]
Remove slightly used const values that can be replaced with nitems().

Suggested by: jhb

8 years agosiba(4): remove slightly used 'bound' variable.
Pedro F. Giffuni [Thu, 21 Apr 2016 15:24:21 +0000 (15:24 +0000)]
siba(4): remove slightly used 'bound' variable.

It can be replaced with nitems(). While here simplify the function

Suggested by: jhb

8 years agoPrevent underflows in tp->snd_wnd if the remote side ACKs more than
Jonathan T. Looney [Thu, 21 Apr 2016 15:06:53 +0000 (15:06 +0000)]
Prevent underflows in tp->snd_wnd if the remote side ACKs more than
tp->snd_wnd. This can happen, for example, when the remote side responds to
a window probe by ACKing the one byte it contains.

Differential Revision: https://reviews.freebsd.org/D5625
Reviewed by: hiren
Obtained from: Juniper Networks (earlier version)
MFC after: 2 weeks
Sponsored by: Juniper Networks

8 years agoDocument r296417, clang, llvm, etc. updated to upstream 3.8.0
Steven Kreuzer [Thu, 21 Apr 2016 14:20:45 +0000 (14:20 +0000)]
Document r296417, clang, llvm, etc. updated to upstream 3.8.0

Approved by: gjb@
Differential Revision: D6037

8 years agoMake the GIC SGI global variables static, they are only ever used within
Andrew Turner [Thu, 21 Apr 2016 14:04:56 +0000 (14:04 +0000)]
Make the GIC SGI global variables static, they are only ever used within
within this file.

Approved by: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoAdjust BOOTSTRAPPING test after MFC of kbdcontrol's -P option
Ed Maste [Thu, 21 Apr 2016 13:14:55 +0000 (13:14 +0000)]
Adjust BOOTSTRAPPING test after MFC of kbdcontrol's -P option

8 years agoelftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree
Ed Maste [Thu, 21 Apr 2016 12:58:29 +0000 (12:58 +0000)]
elftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree

It's provided by sys.mk so there's no need to derive it from ${.CURDIR}.

Suggested by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5998

8 years agoProperly setup arguments for if_resolvemulti() callback.
Hans Petter Selasky [Thu, 21 Apr 2016 11:32:22 +0000 (11:32 +0000)]
Properly setup arguments for if_resolvemulti() callback.

Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoRemove stale function declaration
Andrey V. Elsukov [Thu, 21 Apr 2016 11:02:06 +0000 (11:02 +0000)]
Remove stale function declaration

8 years agoConstify mbuf pointer for IPSEC functions where mbuf isn't modified.
Andrey V. Elsukov [Thu, 21 Apr 2016 10:58:07 +0000 (10:58 +0000)]
Constify mbuf pointer for IPSEC functions where mbuf isn't modified.

8 years agoRework Mediatek/Ralink configuration files
Stanislav Galabov [Thu, 21 Apr 2016 07:40:03 +0000 (07:40 +0000)]
Rework Mediatek/Ralink configuration files

Only compile what each SoC needs and get rid of MEDIATEK generic config.

Approved by: adrian (mentor)
Sponsored by: Smartcom - Bulgaria AD
Differential Revision: https://reviews.freebsd.org/D5996

8 years agoRestore the original ascii.c from prior to r290494
Baptiste Daroussin [Thu, 21 Apr 2016 07:36:11 +0000 (07:36 +0000)]
Restore the original ascii.c from prior to r290494

It was doing the right thing, there was no need to "fail" to reinvent it from
none.c

Pointy hat: bapt
Submitted by: ache

8 years agoRestore histrory messed up in r290620
Baptiste Daroussin [Thu, 21 Apr 2016 06:27:06 +0000 (06:27 +0000)]
Restore histrory messed up in r290620

ascii.c was removed during r290494 but this introduced an issue with ASCII that
has been fixed in r290618 and lead to a rewrite of ascii.c based on none.c.

ascii.c was wrongly reintroduced in r290620 without proper svn operation which
lost the history.

Reported by: ache, danfe

8 years agoUse MIN()/MAX() macros from sys/param.h.
Marcelo Araujo [Thu, 21 Apr 2016 06:24:13 +0000 (06:24 +0000)]
Use MIN()/MAX() macros from sys/param.h.

MFC after: 2 weeks.

8 years agoUse MAX() from sys/param.h.
Marcelo Araujo [Thu, 21 Apr 2016 06:21:33 +0000 (06:21 +0000)]
Use MAX() from sys/param.h.

MFC after: 2 weeks.

8 years agonet80211: refresh comments for ieee80211_scan_next() and
Andriy Voskoboinyk [Thu, 21 Apr 2016 06:19:33 +0000 (06:19 +0000)]
net80211: refresh comments for ieee80211_scan_next() and
ieee80211_scan_done().

Refresh comments that reference scan_next() method
(does not exist since r191746) + fix spelling of 'current'.

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

8 years agoFix a missing blank space.
Marcelo Araujo [Thu, 21 Apr 2016 06:14:30 +0000 (06:14 +0000)]
Fix a missing blank space.

8 years agoSimplify the get_type() function.
Marcelo Araujo [Thu, 21 Apr 2016 06:11:24 +0000 (06:11 +0000)]
Simplify the get_type() function.

Submitted by: bde
Discussed with: bde, jhb and pfg
MFC after: 2 weeks.

8 years agonet80211: enable promiscuous mode state change for non-monitor/ahdemo modes
Andriy Voskoboinyk [Thu, 21 Apr 2016 05:47:47 +0000 (05:47 +0000)]
net80211: enable promiscuous mode state change for non-monitor/ahdemo modes

- Allow to enable/disable promiscuous mode when:
  * interface is not a member of bridge, or;
  * request was issued by user (ifconfig wlan0 promisc), or;
  * interface is in MONITOR or AHDEMO mode.
- Drop local workarounds in mwl(4) and malo(4).

Tested with:
- Intel 3945BG, STA mode;
- RTL8188CUS, MONITOR mode;

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D5472

8 years agoBring a little more compability with GNU units 2.12
Eitan Adler [Thu, 21 Apr 2016 05:24:47 +0000 (05:24 +0000)]
Bring a little more compability with GNU units 2.12
- notionally support a 'history file' flag. This doesn't do much now,
  but is there to prevent scripts written against GNU units from
  breaking
- correctly gracefully quit rather than exit (this will make it easier
  to support a history file in the future)
- remove the "t" flag from fopen which was there to support windows. We
  have not supported windows since at the latest, the introduction of
  capsicum.

8 years agoRemove project.name which is a product of a bygone era.
Eitan Adler [Thu, 21 Apr 2016 04:33:07 +0000 (04:33 +0000)]
Remove project.name which is a product of a bygone era.

8 years agoAdd the address at which the routine returned.
George V. Neville-Neil [Thu, 21 Apr 2016 03:17:53 +0000 (03:17 +0000)]
Add the address at which the routine returned.

MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)

8 years agodhclient: Log a warning instead of bailing upon "illegal" options
Sepherosa Ziehau [Wed, 20 Apr 2016 23:56:25 +0000 (23:56 +0000)]
dhclient: Log a warning instead of bailing upon "illegal" options

In Azure, the DHCP servers add private option (id 0xf5), which contains
binary form of an IPv4 address. Once this option is converted to string
form, it could contain '$', e.g.

IPv4 address: 100.72.36.54
binary form: 0x64 0x48 0x24 0x36
string form: "dH$6"

dhclient bails upon "illegal" options like the above example, thus the
VM bring-up will fail.

Also as a side note, this "illegal" option detection was added in
OpenBSD ~11years ago:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c?rev=1.50&content-type=text/x-cvsweb-markup

And it was removed along with the removal of script support in OpenBSD
~3years ago:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c?rev=1.159&content-type=text/x-cvsweb-markup

Reported by: Hongxiong Xian <v-hoxian microsoft com>
Reviewed by: jhb, Dexuan Cui <decui microsoft com>
Tested by: Hongxiong Xian <v-hoxian microsoft com>
Analyzed by: Dong Liu <doliu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5853

8 years agoRevert r298357
Wojciech Macek [Wed, 20 Apr 2016 22:41:19 +0000 (22:41 +0000)]
Revert r298357

Revert workaround fixed by r298361

8 years agoForce framebuffer virtual viewport to be the same as physical
Oleksandr Tymoshenko [Wed, 20 Apr 2016 22:38:00 +0000 (22:38 +0000)]
Force framebuffer virtual viewport to be the same as physical

VideoCore reports garbage in viewport geometry fields unless
viewport was set previously by earlier stage boot loader. So
when booting FreeBSD kernel directly from VideoCore's start.elf
framebuffer intialization fails due to invalid vxres, vyres
values. Make sure we request viewport to be equal to physical
resolution

Submitted by: Sylvain Garrigues <sylvain@sylvaingarrigues.com>

8 years agoPlug memory leak
Baptiste Daroussin [Wed, 20 Apr 2016 21:37:32 +0000 (21:37 +0000)]
Plug memory leak

Reported by: coverity
CID: 13316641331665

8 years agoPlug various resources leak
Baptiste Daroussin [Wed, 20 Apr 2016 21:32:34 +0000 (21:32 +0000)]
Plug various resources leak
While here fix a test logic

Reported by: coverity
CID: 1332096133209713320981332099133210013321011332102
MFC after: 1 week

8 years agoPrefer sizeof(*pointer) over sizeof(type). No funtional change.
Jung-uk Kim [Wed, 20 Apr 2016 21:30:56 +0000 (21:30 +0000)]
Prefer sizeof(*pointer) over sizeof(type).  No funtional change.

8 years agoThere is no need to use array any more. No functional change.
Jung-uk Kim [Wed, 20 Apr 2016 21:26:59 +0000 (21:26 +0000)]
There is no need to use array any more.  No functional change.

8 years agoPlug memory leaks
Baptiste Daroussin [Wed, 20 Apr 2016 21:23:42 +0000 (21:23 +0000)]
Plug memory leaks

Reported by: Coverity
CID= 13385351338536133854213385691338570

8 years agoRemove query flag from acpi_EvaluateOSC(). This function does not support
Jung-uk Kim [Wed, 20 Apr 2016 21:21:47 +0000 (21:21 +0000)]
Remove query flag from acpi_EvaluateOSC().  This function does not support
return buffer (yet).

8 years agonet80211: hide subtype mask & shift in function call.
Andriy Voskoboinyk [Wed, 20 Apr 2016 21:15:55 +0000 (21:15 +0000)]
net80211: hide subtype mask & shift in function call.

Hide subtype mask/shift (which is used for index calculation
in ieee80211_mgt_subtype_name[] array) in function call.

Tested with RTL8188CUS, STA mode.

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D5369

8 years agoRemove unused SMB_DIALECT_MAX macro.
Pedro F. Giffuni [Wed, 20 Apr 2016 21:13:24 +0000 (21:13 +0000)]
Remove unused SMB_DIALECT_MAX macro.

Found by: jhb

8 years agoPlug leaks
Baptiste Daroussin [Wed, 20 Apr 2016 21:11:49 +0000 (21:11 +0000)]
Plug leaks

Reported by: Coverity
CID: 1340155 and 1340156
MFC after: 1 week

8 years agoAdd more fields from struct ifnet needed during debugging a kernel panic.
Bjoern A. Zeeb [Wed, 20 Apr 2016 21:04:39 +0000 (21:04 +0000)]
Add more fields from struct ifnet needed during debugging a kernel panic.
Move if_fib into the right place.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

8 years agoInvoke _OSC on Host-PCI bridges.
John Baldwin [Wed, 20 Apr 2016 20:58:30 +0000 (20:58 +0000)]
Invoke _OSC on Host-PCI bridges.

Tell the firmware that we support PCI-express config space access
and MSI.

Reviewed by: jkim
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6023

8 years agoFix bad checking of the return of realloc(3)
Baptiste Daroussin [Wed, 20 Apr 2016 20:56:06 +0000 (20:56 +0000)]
Fix bad checking of the return of realloc(3)

Reported by: Coverity
CID: 1007335
MFC after: 3 days

8 years agoAdd a wrapper for evaluating _OSC methods.
John Baldwin [Wed, 20 Apr 2016 20:55:58 +0000 (20:55 +0000)]
Add a wrapper for evaluating _OSC methods.

This wrapper does not translate errors in the first word to ACPI
error status returns.  Use this wrapper in the acpi_cpu(4) driver in
place of the existing _OSC code.  While here, fix a bug where the wrong
count of words was passed when invoking _OSC.

Reviewed by: jkim
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6022

8 years agoFix typo: actually test the return of strchr(3)
Baptiste Daroussin [Wed, 20 Apr 2016 20:54:47 +0000 (20:54 +0000)]
Fix typo: actually test the return of strchr(3)

Reported by: Coverity
CID: 1007335
MFC after: 3 days

8 years agoFix coverity issue with contrib/netbsd-tests/lib/libc/ssp/h_read.c
Enji Cooper [Wed, 20 Apr 2016 20:48:54 +0000 (20:48 +0000)]
Fix coverity issue with contrib/netbsd-tests/lib/libc/ssp/h_read.c

Ensure opening /dev/zero succeeds. Abort the test if it doesn't.

Also, use _PATH_DEVZERO instead of hardcoding "/dev/zero"

MFC after: 2 weeks
CID: 1251410
Reported by: Coverity
Sponsored by: EMC / Isilon Storage Division"

8 years agoCheck the returned value of memchr(3) before using it
Baptiste Daroussin [Wed, 20 Apr 2016 20:44:30 +0000 (20:44 +0000)]
Check the returned value of memchr(3) before using it

Reported by: Coverity
CID: 1338530

8 years agoFix coverity issues with contrib/netbsd-tests/lib/libc/sys/t_connect.c
Enji Cooper [Wed, 20 Apr 2016 20:43:05 +0000 (20:43 +0000)]
Fix coverity issues with contrib/netbsd-tests/lib/libc/sys/t_connect.c

- Ensure socket(2) calls succeed
- Don't leak slist allocated by earlier socket(2) call

MFC after: 2 weeks
CID: 976773, 1251405
Reported by: Coverity
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove unused e500_event_codes_size.
Pedro F. Giffuni [Wed, 20 Apr 2016 20:37:58 +0000 (20:37 +0000)]
Remove unused e500_event_codes_size.

Found by: jhb

8 years agonet80211: provide descriptions for reason codes
Andriy Voskoboinyk [Wed, 20 Apr 2016 20:30:18 +0000 (20:30 +0000)]
net80211: provide descriptions for reason codes

Add text description for deauth/disassoc/etc reason codes
in addition to 'reason: <number>' string.

Reviewed by: adrian
Obtained from: IEEE Std 802.11-2012, 8.4.1.7 "Reason Code field"
Differential Revision: https://reviews.freebsd.org/D5367

8 years agoAdd missing function prototypes in KGDB
Wojciech Macek [Wed, 20 Apr 2016 20:22:48 +0000 (20:22 +0000)]
Add missing function prototypes in KGDB

This fixes the build broken by r298358

8 years agoUpdate comment added in r298357
Ed Maste [Wed, 20 Apr 2016 19:21:26 +0000 (19:21 +0000)]
Update comment added in r298357

The additional regex replacements are actully required due to an
elfcopy bug which is now fixed (by r298361), not a Clang/GCC issue.

Sponsored by: The FreeBSD Foundation

8 years agoelfcopy: map all !alnum characters to '_' in binary input symbol names
Ed Maste [Wed, 20 Apr 2016 19:13:00 +0000 (19:13 +0000)]
elfcopy: map all !alnum characters to '_' in binary input symbol names

This matches bfd and gold.

Obtained from: ELF Tool Chain r3445
Sponsored by: The FreeBSD Foundation

8 years agonet80211 (trivial, noop): remove duplicate check from hostap_recv_mgmt()
Andriy Voskoboinyk [Wed, 20 Apr 2016 18:48:39 +0000 (18:48 +0000)]
net80211 (trivial, noop): remove duplicate check from hostap_recv_mgmt()

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

8 years agonet80211: replace internal LE_READ_*/LE_WRITE_* macro with system
Andriy Voskoboinyk [Wed, 20 Apr 2016 18:29:30 +0000 (18:29 +0000)]
net80211: replace internal LE_READ_*/LE_WRITE_* macro with system
le*dec / le*enc functions.

Replace net80211 specific macros with system-wide bytestream
encoding/decoding functions:
- LE_READ_2 ->  le16dec
- LE_READ_4 ->  le32dec
- LE_WRITE_2 -> le16enc
- LE_WRITE_4 -> le32enc

+ drop ieee80211_input.h include, where it was included for these
operations only.

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D6030

8 years agoFix KGDB backtrace on ARM
Wojciech Macek [Wed, 20 Apr 2016 17:58:13 +0000 (17:58 +0000)]
Fix KGDB backtrace on ARM

Modify trapframe decoding to properly analyze trapframe.

Provide method for fixup_pc. It happens, that in some kernel
functions, the GDB stack frame decoder cannot determine both
func name and frame size. This is because these functions
either contain invalid instruction, or their format does
not match standard schema. Detect that scenarios and move
PC accordingly to jump into known function schema, which
GDB is able to parse.

Obtained from:         Semihalf
Sponsored by:          Juniper Networks
Reviewed by:           kib, zbb
Differential Revision: https://reviews.freebsd.org/D5976

8 years agoFix MFS symbol redefinition with clang 3.8.0
Wojciech Macek [Wed, 20 Apr 2016 17:54:53 +0000 (17:54 +0000)]
Fix MFS symbol redefinition with clang 3.8.0

Newest CLANG objcpy uses different name parsing.
Modify regexp to match (i.e. avoid substitution
of "/" or "-" with "_").

Obtained from:         Semihalf
Sponsored by:          Juniper Networks
Reviewed by:           hselasky, zbb
Differential Revision: https://reviews.freebsd.org/D5873

8 years agoArm and arm64 both have fueword() implemented for some time. Correct
Konstantin Belousov [Wed, 20 Apr 2016 17:28:21 +0000 (17:28 +0000)]
Arm and arm64 both have fueword() implemented for some time.  Correct
the comment.

Sponsored by: The FreeBSD Foundation

8 years agoDon't use SYSDIR to avoid conflicts with existing usage.
Peter Grehan [Wed, 20 Apr 2016 17:05:32 +0000 (17:05 +0000)]
Don't use SYSDIR to avoid conflicts with existing usage.
Also, use SRCTOP to locate the top of the source tree
instead of a relative path.

PR: 208856

8 years agoIndentation issues.
Pedro F. Giffuni [Wed, 20 Apr 2016 16:19:44 +0000 (16:19 +0000)]
Indentation issues.

Contract some lines leftover from r298310.

Mea culpa.

8 years agoMinor indentation issue.
Pedro F. Giffuni [Wed, 20 Apr 2016 16:03:53 +0000 (16:03 +0000)]
Minor indentation issue.