bapt [Sun, 27 Oct 2013 20:52:09 +0000 (20:52 +0000)]
Improt pf.c 1.636 from OpenBSD
Original log:
Make sure pd2 has a pointer to the icmp header in the payload; fixes
panic seen with some some icmp types in icmp error message payloads.
bapt [Sun, 27 Oct 2013 20:44:42 +0000 (20:44 +0000)]
Import pf.c 1.635 and pf_lb.c 1.4 from OpenBSD
Stricter state checking for ICMP and ICMPv6 packets: include the ICMP type
in one port of the state key, using the type to determine which
side should be the id, and which should be the type. Also:
- Handle ICMP6 messages which are typically sent to multicast
addresses but recieve unicast replies, by doing fallthrough lookups
against the correct multicast address. - Clear up some mistaken
assumptions in the PF code:
- Not all ICMP packets have an icmp_id, so simulate
one based on other data if we can, otherwise set it to 0.
- Don't modify the icmp id field in NAT unless it's echo
- Use the full range of possible id's when NATing icmp6 echoy
Difference with OpenBSD version:
- C99ify the new code
- WITHOUT_INET6 safe
markj [Sun, 27 Oct 2013 20:39:10 +0000 (20:39 +0000)]
Clean up the debug printing in libproc a bit. In particular:
* Don't print any error messages to stderr unless DEBUG is defined.
* Add a DPRINTFX macro for use when errno isn't set.
* Print the error string from libelf when appropriate.
glebius [Sun, 27 Oct 2013 17:14:33 +0000 (17:14 +0000)]
Almost all if_clone consumers do not care about if_clone_event.
Do not force them to include sys/eventhandler.h. Those who
utilize EVENTHANDLER(9), will see the declaration.
ian [Sun, 27 Oct 2013 17:09:23 +0000 (17:09 +0000)]
Remove the last dregs of trapframe_t. It turns out only arm was using
this type, so remove it to make arm code more consistant with other
platforms. Thanks to bde@ for pointing out only arm used trapframe_t.
kib [Sun, 27 Oct 2013 16:31:12 +0000 (16:31 +0000)]
Several small fixes for the amd64 minidump code.
In report_progress(), use nitems(progress_track) instead of manually
hard-coding array size. Wrap long line.
In blk_write(), code verifies that ptr and pa cannot be non-zero
simultaneously. The later check for the page-alignment of the ptr
argument never triggers due to pa != 0 always implying ptr == NULL. I
believe that the intent was to ensure that physicall address passed is
page-aligned, since the address is (temporary) mapped for the duration
of the page write.
Clear the progress_track.visited fields when starting minidump. If
minidump is restarted or taken second time during the system lifetime,
progress is not printed otherwise, making operator suspectible to the
dump status.
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
kib [Sun, 27 Oct 2013 16:20:52 +0000 (16:20 +0000)]
When reentering kdb, typically due to a bug causing trap or assert in
the code executed in the context of debugger, do not be ashamed to
inform loudly about the re-entry. Also, print the backtrace before
obliterating current stack with longjmp, allowing the operator to see
a place which caused the bug.
The change should make it less mysterious debugging the ddb itself.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
markj [Sun, 27 Oct 2013 16:01:11 +0000 (16:01 +0000)]
Convert the lockstat(1) man page to mdoc and make sure that it gets
installed. Additionally, remove Solaris-specific sections and references,
and replace example outputs with output from lockstat on FreeBSD, since
lockstat's output contains stack traces.
This change also removes some examples that don't seem to work properly on
FreeBSD. The examples should be re-added when lockstat is fixed.
hselasky [Sun, 27 Oct 2013 10:09:53 +0000 (10:09 +0000)]
Fix a deadlock when trying to power off a USB device. The deadlock
happens because the code in question is trying to modify the parent
USB port registers outside the USB explore thread.
ian [Sun, 27 Oct 2013 03:13:26 +0000 (03:13 +0000)]
Retire arm_remap_nocache() and the data and constants associated with it.
The only remaining user was the code that allocates bounce pages for armv4
busdma. It's not clear why bounce pages would need uncached memory, but
if that ever changes, kmem_alloc_attr() would be the way to get it.
ian [Sun, 27 Oct 2013 01:34:10 +0000 (01:34 +0000)]
Remove #include <machine/frame.h> from all the arm code that doesn't
really need it. That would be almost everywhere it was included. Add
it in a couple files that really do need it and were previously getting
it by accident via another header.
ian [Sun, 27 Oct 2013 00:51:46 +0000 (00:51 +0000)]
Remove all #include <machine/pmap.h> from arm code. It's already
included by vm/pmap.h, which is a prerequisite for arm/machine/pmap.h
so there's no reason to ever include it directly.
ian [Sat, 26 Oct 2013 23:13:20 +0000 (23:13 +0000)]
Maximize available kva space by doing static device mapping from the top
of the address space downwards, and then returning the lowest mapped
device address from initarm_lastaddr(). This adds over 500MB of kva
space compared to the old way of hardcoding the end address as 0xE0000000.
Also, pre-map most of the SoC's common memory-mapped devices using 1MB
section mappings so that all device access uses just a few TLB entries.
Graphics devices aren't mapped this way yet, but probably should be.
To provide this new functionality without pasting identical code into
multiple imxNN_machdep.c files, rework the imx machdep code so that
things common to the whole family of SoCs are in a new imx_machdep.c file.
The rewritten imxNN_machdep.c files contain just things specific to an
individual SoC.
nwhitehorn [Sat, 26 Oct 2013 20:57:26 +0000 (20:57 +0000)]
Make devices with registers into the KVA region work reliably. Without this,
previous KVA allocations (which the PMAP lazily invalidates) in TLB0 could
shadow device maps in TLB1. Add a big block comment about some of the
caveats with this approach.
bdrewery [Sat, 26 Oct 2013 19:59:42 +0000 (19:59 +0000)]
Fix build with GCC.
BIO_new_mem_buf takes a void* buf, but internally it never modifies the
buf. It assigns the buffer to another pointer and then marks it as
read-only. So deconsting it should be safe here.
Also fix warning about 'buf' possibly being unused in parse_cert()
Approved by: bapt
MFC after: 2 days
X-MFC-With: r257147
nwhitehorn [Sat, 26 Oct 2013 19:50:40 +0000 (19:50 +0000)]
Handle (in a slightly ugly way) ePAPR-type loaders that just place a
device tree into r3. Rather than worrying about mapping that tree, reserving
its space in the global physical memory space, etc., just copy it to some
memory after the kernel.
glebius [Sat, 26 Oct 2013 18:59:58 +0000 (18:59 +0000)]
Start splitting pfvar.h into internal and external parts.
- Provide pf_altq.h that has only stuff needed for ALTQ.
- Start pf.h, that would have all constant values and
eventually non-kernel structures.
- Build ALTQ w/o pfvar.h, include if_var.h, that before
came via pollution.
- Build tcpdump w/o pfvar.h.
glebius [Sat, 26 Oct 2013 18:40:17 +0000 (18:40 +0000)]
The MII layer shouldn't care about administrative status of an
interface. Make MII drivers forget about 'struct ifnet'.
Later plan is to provide an administrative downcall from ifnet
layer into drivers, to inform them about administrative status
change. If someone thinks that processing MII events for an
administratively down interface is a big problem, then drivers
would turn MII processing off.
The following MII drivers do evil things, like strcmp() on
driver name, so they still need knowledge of ifnet and thus
include if_var.h. They all need to be fixed:
nwhitehorn [Sat, 26 Oct 2013 18:25:55 +0000 (18:25 +0000)]
Be a bit more flexible in how we find the console from the properties on
/chosen, following the list of allowed console properties in ePAPR. Also
do not require that stdin be defined and equal to stdout: stdin is
nonstandard (for ePAPR) and console in an unexpected place is after all
better than no console.
nwhitehorn [Sat, 26 Oct 2013 18:18:14 +0000 (18:18 +0000)]
Interrelated improvements to early boot mappings:
- Remove explicit requirement that the SOC registers be found except as an
optimization (although the MPC85XX LAW drivers still require they be found
externally, which should change).
- Remove magic CCSRBAR_VA value.
- Allow bus_machdep.c's early-boot code to handle non 1:1 mappings and
systems not in real-mode or global 1:1 maps in early boot.
- Allow pmap_mapdev() on Book-E to reissue previous addresses if the
area is already mapped. Additionally have it check all mappings, not
just the CCSR area.
This allows the console on e500 systems to actually work on systems where
the boot loader was not kind enough to set up a 1:1 mapping before starting
the kernel.
glebius [Sat, 26 Oct 2013 17:58:36 +0000 (17:58 +0000)]
The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare
to this event, adding if_var.h to files that do need it. Also, include
all includes that now are included due to implicit pollution via if_var.h
zbb [Sat, 26 Oct 2013 17:24:59 +0000 (17:24 +0000)]
Wait for DesignWare UART transfers completion before accessing line control
When using DW UART with BUSY detection it is necessary to wait
until all serial transfers are finished before manipulating the
line control. LCR will not be affected when UART is busy.
In addition, if Divisor Latch Access Bit is being set in order to
modify UART divisors:
1. We will get BUSY interrupt if interrupts are enabled.
2. Because LCR will not be affected the THR and (even worse) IER
contents will be corrupted. This will lead to console hang.
nwhitehorn [Sat, 26 Oct 2013 16:49:41 +0000 (16:49 +0000)]
Fix concurrency issues with TLB1 updates and make pmap_kextract() search
TLB1 mappings as well, which is required for the console to work after
r257111.
nwhitehorn [Sat, 26 Oct 2013 14:54:43 +0000 (14:54 +0000)]
The old trap.h (then trap_aim.h) actually had trap ID codes for Book-E CPUs.
Use it universally. Book-E traps may also need revisiting due to the
introduction of fixed-offset traps and the deprecation of IVORs in POWER
ISA 2.06, but that's very much an issue for another day.
nwhitehorn [Sat, 26 Oct 2013 14:52:55 +0000 (14:52 +0000)]
Add pmap_mapdev_attr() and pmap_kenter_attr() interfaces. pmap_set_memattr()
is slightly more complicated and is left unimplemented for now. Also
prevent pmap_mapdev() from mapping over the kernel and KVA regions if
devices happen to have high physical addresses.
markj [Sat, 26 Oct 2013 06:23:51 +0000 (06:23 +0000)]
Do some cleanup of the SDT code. In particular,
* Remove the unused sdt cdev.
* Don't bother keeping a list of probes in struct sdt_prov; it's not needed.
* Invoke sdt_load and sdt_unload from the module handler instead of
registering separate SYSINITs.
* Keep to within 80 columns.
* Check for errors from dtrace_unregister().
bdrewery [Sat, 26 Oct 2013 03:47:49 +0000 (03:47 +0000)]
Add support to check the signature of a local pkg.txz file being
added with "pkg add". If the pkg.conf is configured to check for
signature, then the pkg.txz.sig file will be expected and validated
per r257147
bdrewery [Sat, 26 Oct 2013 03:43:02 +0000 (03:43 +0000)]
Support checking signature for pkg bootstrap.
If the pkg.conf is configured with SIGNATURE_TYPE: FINGERPRINTS,
and FINGERPRINTS: /etc/keys/pkg then a pkg.sig file is fetched along
with pkg.txz. The signature contains the signature provided by the
signing server, and the public key. The .sig is the exact output
from the signing server in the following format:
SIGNATURE
<openssl signed>
CERT
<rsa public key>
END
The signature is verified with the following logic:
- If the .sig file is missing, it fails.
- If the .sig doesn't validate, it fails.
- If the public key in the .sig is not in the known trusted fingerprints,
it fails.
- If the public key is in the revoked key list, it fails.
Approved by: bapt
MFC after: 2 days
Discussed by: bapt with des, jonathan, gavin
markj [Sat, 26 Oct 2013 03:21:54 +0000 (03:21 +0000)]
Fix a couple of bugs in the fasttrap emulation of a "push %rbp" instruction:
the code was trying to save the stack pointer rather than the frame pointer,
and the arguments to copyout(9) were reversed, so nothing ended up being
saved on the stack. This would cause process crashes when the pid provider
was being used to instrument calls of a function starting with this
instruction.
adrian [Fri, 25 Oct 2013 19:46:52 +0000 (19:46 +0000)]
Begin fleshing out a knob to enable/disable bluetooth coexistence.
Some firmware versions seem to get very unhappy if they're sent btcoex
commands when they don't actually have bluetooth hardware in them.
So, disable sending them those commands.
Tested:
* 5100 (which has bluetooth, no problems)
* 4965 (which doesn't have bluetooth, but didn't seem to crash)
* 6200 (no bluetooth, seems to get unhappy being sent bluetooth commands.)
adrian [Fri, 25 Oct 2013 19:44:53 +0000 (19:44 +0000)]
Temporarily disable multi-rate retry (link quality) and eliminate rate
index lookups.
* My recent(ish) change to iwn(4) and the net80211 rate control API to
support 11n rates broke the link quality table use. So, until I or
someone else decides to fix it, let's just disable it for now.
* Teach iwn_tx_data_raw() to use the iwn_rate_to_plcp() function.
* Eliminate two uses of the net80211 rate index lookup functions - they
are only for legacy rates and they're not needed here.
This fixes some invalid looking rate control TX issues that showed up
on my 4965 but it doesn't fix the two TX hangs I've noticed. Those look
like DMA related issues.
ian [Fri, 25 Oct 2013 19:15:21 +0000 (19:15 +0000)]
Add a helper routine to search for a compat string in a table that
associates compat strings with arbitrary values that mean something to
the driver. This is handy for drivers that support several variations
of similar hardware and need to know which one matched.
nwhitehorn [Fri, 25 Oct 2013 13:29:07 +0000 (13:29 +0000)]
Use common OFW root code to set up fdtbus. This is an almost purely
negative diff that should improve reliability somewhat. There should be
no differences in behavior -- please report any that crop up. This has been
tested on ARM and PPC systems.
smh [Fri, 25 Oct 2013 09:09:00 +0000 (09:09 +0000)]
Add clang-CC and CC to list of hints allowing clang to identify its operating
mode as c++ instead of defaulting to c for the binary names CC and clang-CC.
This fixes builds that use cmake, which automatically sets CXX to
/usr/bin/CC by default.
PR: bin/182442
Reviewed by: dwhite, wca
MFC after: 2 days
rpaulo [Fri, 25 Oct 2013 05:33:04 +0000 (05:33 +0000)]
Add a tests(7) manual page.
This manual page intends to describe the structure and behavior of
the FreeBSD test suite installed in /usr/tests. The contents have
been inherited from the NetBSD manual page.
As a side effect, this also updates the hier(7) manual page to
mention /usr/tests and points at tests(7) for more details.
rpaulo [Fri, 25 Oct 2013 05:25:19 +0000 (05:25 +0000)]
Set up the /usr/tests hierarchy.
Populate /usr/tests with the only test programs that currently live
in the tree (those in lib/libcrypt/tests/) and add all the build
machinery to accompany this change.
In particular:
- Add a WITHOUT_TESTS variable that users can define to request that
no tests be put in /usr/tests.
- Add a top-level Kyuafile for /usr/tests and a way to create similar
Kyuafiles in top-level subdirectories.
- Add a BSD.tests.dist file to define the directory layout of
/usr/tests.
rpaulo [Fri, 25 Oct 2013 05:12:31 +0000 (05:12 +0000)]
Move the TESTSBASE definition to bsd.own.mk.
We need to be able to reference the value of TESTSBASE without requiring
the inclusion of bsd.test.mk (e.g. in etc/Makefile), so move its definition
to the more generic bsd.own.mk.
rpaulo [Fri, 25 Oct 2013 05:11:10 +0000 (05:11 +0000)]
Allow mixing bsd.files.mk with bsd.subdir.mk.
If a single Makefile wants to recurse into subdirectories and also
wants to install files, bsd.files.mk's targets would get ignored in
favor of those defined by bsd.subdir.mk because installfiles would
not get defined in bsd.files.mk.
Prevent this from happening by defining the targets in bsd.files.mk
with auxiliary names and listing them as dependencies of installfiles
instead.
This is required by bsd.test.mk, which needs to install a Kyuafile
in pretty much all cases but may also need to recurse into
subdirectories for build purposes.
adrian [Fri, 25 Oct 2013 04:06:54 +0000 (04:06 +0000)]
Add a configuration file and hints file for the Alfa Networks Hornet UB
board.
This is another AR9331 board similar to the Carambola2. It has different
ethernet and LED wiring though.
They make a variety of boards that mostly differ on the amount of RAM/flash
available. Alfa Networks graciously donated a handful of 64MB RAM/16MB flash
boards so I can finish off 802.11s support for the AR93xx chips and do up
a tech demonstration with it.
nwhitehorn [Fri, 25 Oct 2013 03:55:52 +0000 (03:55 +0000)]
Be a little more suspicious of thermal sensors, which can have single
crazy readings occasionally. One wild reading should not be enough to
trigger a shutdown, so instead wait for several concerning readings in
a row.
PR: powerpc/180593
Submitted by: Julio Merino
MFC after: 1 week
grehan [Fri, 25 Oct 2013 03:18:56 +0000 (03:18 +0000)]
Fix bug in the ioapic emulation for level-triggered interrupts,
where a pin assertion while a source was masked would result in
the interrupt being lost, with the symptom being a console hang.
The condition is now recorded, and the interrupt generated when
the source is unmasked.