mm [Mon, 20 Mar 2017 13:02:27 +0000 (13:02 +0000)]
MFV r315633, 315635:
Sync libarchive with vendor
Vendor changes/bugfixes (FreeBSD-related):
PR 867 (bsdcpio): show numeric uid/gid when names are not found
PR 870 (seekable zip): accept files with valid ZIP64 EOCD headers
PR 880 (pax): Fix handling of "size" pax header keyword
PR 887 (crypto): Discard 3072 bytes instead of 1024 of first keystream
OSS-Fuzz issue 806 (mtree): rework mtree_atol10 integer parser
Break ACL read/write code into platform-specific source files
Unbreak static dependency on libbz2
MFC after: 1 week
mm [Mon, 20 Mar 2017 11:12:31 +0000 (11:12 +0000)]
Update vendor/libarchive to git
5881c9021a85668bd945593f5ba43a0d22c53d71
Vendor changes (FreeBSD-related):
Break ACL read/write code into platform-specific source files
Vendor bugfixes (FreeBSD-related):
PR 867 (bsdcpio): show numeric uid/gid when names are not found
PR 870 (seekable zip): accept files with valid ZIP64 EOCD headers
PR 880 (pax): Fix handling of "size" pax header keyword
PR 887 (crypto): Discard 3072 bytes instead of 1024 of first keystream
OSS-Fuzz issue 806 (mtree): rework mtree_atol10 integer parser
Unbreak static dependency on libbz2
avos [Mon, 20 Mar 2017 08:10:35 +0000 (08:10 +0000)]
rtwn: fix node id assignment.
Do not assign new id if node is reused.
Tested with RTL8821AU, HOSTAP mode + RTL8188EU, STA mode
(with inactivity timeout == 90)
ngie [Mon, 20 Mar 2017 06:12:55 +0000 (06:12 +0000)]
syslogd: try to print out a more helpful message in socksetup(..) if/when
getaddrinfo fails
If the asprintf call fails, fall back to the old code (as a last ditch effort
to provide the end-user with helpful output).
Sponsored by: Dell EMC Isilon
alc [Mon, 20 Mar 2017 05:15:55 +0000 (05:15 +0000)]
Use IDX_TO_OFF(), not ptoa(), when converting the difference between two
vm_pindex_t's into a vm_ooffset_t.
The length given to shm_dotruncate() must never be negative. Assert this.
Tidy up a comment.
Reviewed by: kib
MFC after: 1 week
ngie [Mon, 20 Mar 2017 05:12:27 +0000 (05:12 +0000)]
syslogd: fix dprintf in socksetup(..)
- Make the explanation more complete
- Correct a minor grammar nit with verb tense.
- Don't emit the message if `pe->pe_name` is NULL (it doesn't
have much value).
MFC after: 1 week
Sponsored by: Dell EMC Isilon
delphij [Mon, 20 Mar 2017 04:41:36 +0000 (04:41 +0000)]
Pet manlint.
MFC after: 2 weeks
ngie [Mon, 20 Mar 2017 04:25:40 +0000 (04:25 +0000)]
syslogd: don't leak `f` on failure in cfline(..)
Free `f` if an unknown priority or facility is parsed with the function.
MFC after: 1 week
Reported by: Coverity
CID: 1368068
Sponsored by: Dell EMC Isilon
ngie [Mon, 20 Mar 2017 03:52:06 +0000 (03:52 +0000)]
Remove all expected failures from lib/libc/locale/io_test for FreeBSD
This is no longer required as of r315616, as the test is no longer
built/installed.
This is being done to diff reduce with NetBSD.
Sponsored by: Dell EMC Isilon
ngie [Mon, 20 Mar 2017 03:50:22 +0000 (03:50 +0000)]
Don't build/install lib/libc/io_test anymore
The failing test requires the zh_TW.Big5 locale, which is no longer
installed as of r315568.
Add a note/pointer just in case someone considers re-adding it.
Reported by: Jenkins
Sponsored by: Dell EMC Isilon
delphij [Mon, 20 Mar 2017 03:47:15 +0000 (03:47 +0000)]
Make space style consistent with earlier entries.
X-MFC with: r315526
ngie [Mon, 20 Mar 2017 03:42:14 +0000 (03:42 +0000)]
Fix date added in r315570 so it's sorted properly
Sponsored by: Dell EMC Isilon
ngie [Mon, 20 Mar 2017 02:47:28 +0000 (02:47 +0000)]
kvm_close(3): return `error` instead of blindly returning `0`
`error` is the accumulated error from previous close(2) calls.
This bug has been present since the libcall's import from 4.4BSD
Lite (r1573).
MFC after: 1 week
Noticed by: vangyzen (D10022)
Relnotes: yes
Sponsored by: Dell EMC Isilon
ngie [Mon, 20 Mar 2017 01:19:04 +0000 (01:19 +0000)]
kvm_open2(3): remove '*' when describing addr argument for `resolver`
As noted by vangyzen, with a similar issue in D10022, the pointer portion of
the .Fa macro call is unnecessary, so remove the '*'.
MFC after: 1 week
Sponsored by: Dell EMC Isilon
marius [Sun, 19 Mar 2017 23:27:17 +0000 (23:27 +0000)]
o Add support for eMMC DDR bus speed mode at 52 MHz to sdhci(4) and
mmc(4). For the most part, this consists of support for:
- Switching the signal voltage (VCCQ) to 1.8 V or (if supported
by the host controller) to 1.2 V,
- setting the UHS mode as appropriate in the SDHCI_HOST_CONTROL2
register,
- setting the power class in the eMMC device according to the
core supply voltage (VCC),
- using different bits for enabling a bus width of 4 and 8 bits
in the the eMMC device at DDR or higher timings respectively,
- arbitrating timings faster than high speed if there actually
are additional devices on the same MMC bus.
Given that support for DDR52 is not denoted by SDHCI capability
registers, availability of that timing is indicated by a new
quirk SDHCI_QUIRK_MMC_DDR52 and only enabled for Intel SDHCI
controllers so far. Generally, what it takes for a sdhci(4)
front-end to enable support for DDR52 is to hook up the bridge
method mmcbr_switch_vccq (which especially for 1.2 V signaling
support is chip/board specific) and the sdhci_set_uhs_timing
sdhci(4) method.
As a side-effect, this change also fixes communication with
some eMMC devices at SDR high speed mode with 52 MHz due to
the signaling voltage and UHS bits in the SDHCI controller no
longer being left in an inappropriate state.
Compared to 52 MHz at SDR high speed which typically yields
~45 MB/s with the eMMC chips tested, throughput goes up to
~80 MB/s at DDR52.
Additionally, this change already adds infrastructure and quite
some code for modes up to HS400ES and SDR104 respectively (I did
not want to add to much stuff at a time, though). Essentially,
what is still missing in order to be able to activate support
for these latter is is support for and handling of (re-)tuning.
o In sdhci(4), add two tunables hw.sdhci.quirk_clear as well as
hw.sdhci.quirk_set, which (when hooked up in the front-end)
allow to set/clear sdhci(4) quirks for debugging and testing
purposes. However, especially for SDHCI controllers on the
PCI bus which have no specific support code so far and, thus,
are picked up as generic SDHCI controllers, hw.sdhci.quirk_set
allows for setting the necessary quirks (if required).
o In mmc(4), check and handle the return values of some more
function calls instead of assuming that everything went right.
In case failures actually are not problematic, indicate that
by casting the return value to void.
Reviewed by: jmcneill
alc [Sun, 19 Mar 2017 23:06:11 +0000 (23:06 +0000)]
Style fixes. In particular, the variable "bogus" is used like a Boolean.
Define it as such.
Reviewed by: kib
MFC after: 1 week
avos [Sun, 19 Mar 2017 23:05:03 +0000 (23:05 +0000)]
net80211: reschedule tasks properly after r315594.
ngie [Sun, 19 Mar 2017 23:04:58 +0000 (23:04 +0000)]
Remove a commented out line before kvm_getprocs(3)
The commented out return value for kvm_getprocs(3) was misleading -- the
uncommented line is correct.
No content change
MFC after: 1 week
Sponsored by: Dell EMC Isilon
avos [Sun, 19 Mar 2017 22:18:44 +0000 (22:18 +0000)]
net80211: do not cancel callout when FF queue is empty.
This should reduce overhead for aggregates (since every second frame
clears the queue and reschedules the task there is no need to cancel
the callout here; let it just run once at the end - even if queue is
empty).
Reported by: adrian
ian [Sun, 19 Mar 2017 21:53:12 +0000 (21:53 +0000)]
Replace the hard-coded way-too-small minimum event timer period with a value
calculated at runtime based on how long it takes to set up an event in
hardware. This fixes the intermittant 1-minute hang at boot on imx5
systems, and also the occasional oversleeping while running. It doesn't
affect imx6 systems, which use different hardware for eventtimers.
It turns out that it usually takes about 30 timer ticks to set up the timer
compare register, and the old hard-coded minimum period was 10 ticks. On
the rare occasions when a timeout event that short was set up, we'd miss
the event and have to wait about 64 seconds for counter rollover before
the compare interrupt would fire.
Instead of just hardcoding a new bigger value, the code now measures the
time it takes to do the register read/write sequence to set up the compare
register, scales it up by 1.5x to be safe, and calculates the minimum event
period from the result. In the real world, the minimum period works out to
about 750 nanoseconds on imx5 hardware.
ngie [Sun, 19 Mar 2017 21:49:15 +0000 (21:49 +0000)]
diff(1): add --strip-trailing-cr to last example in the SYNOPSIS
This syncs the last example in the SYNOPSIS with the other examples.
Reviewed by: bapt
Sponsored by: Dell EMC Isilon
Differential Revision: D10017
ian [Sun, 19 Mar 2017 21:28:37 +0000 (21:28 +0000)]
Eliminate unnecessary read/modify/write sequences during eventtimer setup.
It turns out to be surprisingly expensive to access the gpt hardware (on the
order of 150ns per read/write). To cut down on the overhead of setting up
each eventtimer event, eliminate read-modify-write sequences to manage the
compare interrupt enable, by keeping a shadow copy of the hardware register
and only writing to the hardware when the enable bits really change.
kib [Sun, 19 Mar 2017 21:25:27 +0000 (21:25 +0000)]
Update the list of cpudev ioctls which require write access.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
mav [Sun, 19 Mar 2017 21:25:13 +0000 (21:25 +0000)]
Remove some useless code.
MFC after: 2 weeks
kib [Sun, 19 Mar 2017 21:24:07 +0000 (21:24 +0000)]
Style.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
jilles [Sun, 19 Mar 2017 21:18:53 +0000 (21:18 +0000)]
sh: Fix build with -DDEBUG=2.
With the new expansion code (word splitting during instead of after other
expansion processing), tracing the result of command substitution is no
longer possible, so stop trying.
avos [Sun, 19 Mar 2017 20:51:28 +0000 (20:51 +0000)]
rtwn: drop unneeded (after r315583) code.
Tested with RTL8188EU, HOSTAP mode + RTL8821AU, STA mode
(fast-frames / A-MSDU).
avos [Sun, 19 Mar 2017 20:05:21 +0000 (20:05 +0000)]
net80211: add a timer to flush fast-frames queues.
This should allow to drop 'ieee80211_ff_[age/flush]' calls from drivers
(an additional call can be made from ieee80211_tx_complete()
for non-default ieee80211_ffagemax values to prevent stalls -
but it will require an additional counter for transmitted frames).
Tested with RTL8821AU, STA mode (A-MSDU part only).
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D9984
alc [Sun, 19 Mar 2017 19:52:47 +0000 (19:52 +0000)]
Two changes to vm_fault_populate():
Simplify the logic for clipping the range returned by the pager to fit
within the map entry.
Use atop() rather than OFF_TO_IDX() on addresses.
Reviewed by: kib
MFC after: 1 week
mav [Sun, 19 Mar 2017 19:11:40 +0000 (19:11 +0000)]
Add initial support for multiple MSI-X vectors.
For 24xx and above use 2 vectors (default and response queue).
For 26xx and above use 3 vectors (default, response and ATIO queues).
Due to global lock interrupt hardlers never run simultaneously now, but
at least this allows to save one regitster read per interrupt.
MFC after: 2 weeks
ian [Sun, 19 Mar 2017 19:10:23 +0000 (19:10 +0000)]
Add a module to build imx5 dtb files.
ian [Sun, 19 Mar 2017 18:50:03 +0000 (18:50 +0000)]
Delete our local imx53-qsb.dts file; the code now runs fine using the
standard vendor-supplied file in sys/gnu/dts/arm.
ian [Sun, 19 Mar 2017 18:38:08 +0000 (18:38 +0000)]
Add INTRNG option to EFIKA_MX config, it is an imx5-based platform.
ian [Sun, 19 Mar 2017 18:35:20 +0000 (18:35 +0000)]
Remove kernel config for DIGI-CCWMX53 devel board. It was just standard
IMX53 with static dtb added, and now that imx53 can use vendor-supplied dts
files and ubldr, there is no need for a static-dtb variant.
ian [Sun, 19 Mar 2017 18:30:38 +0000 (18:30 +0000)]
Convert the imx5 interrupt controller driver to INTRNG.
ian [Sun, 19 Mar 2017 18:28:38 +0000 (18:28 +0000)]
Add dtb/imx5 module build to the imx53 kernel config.
ian [Sun, 19 Mar 2017 18:26:52 +0000 (18:26 +0000)]
Remove kernel config for IMX53-QSB (quickstart board). It was just
standard IMX53 with static dtb added, and now that imx53 can use vendor-
supplied dts files and ubldr, there is no need for a static-dtb variant.
bapt [Sun, 19 Mar 2017 18:21:35 +0000 (18:21 +0000)]
Canada adheres to ISO 8601, let's make the locale reflecting that fact
PR: 200079
MFC after: 1 week
Submitted by: Dan McGregor <dan.mcgregor@usask.ca>
Reported by: A.J. Kehoe IV (Nanoman) <freebsd-bugs@nanoman.ca>
Differential Revision: https://reviews.freebsd.org/D9925
bapt [Sun, 19 Mar 2017 18:03:52 +0000 (18:03 +0000)]
Remove empty Big5 directory from share/nls
bapt [Sun, 19 Mar 2017 17:54:12 +0000 (17:54 +0000)]
Finish removal of Big5
bapt [Sun, 19 Mar 2017 17:52:46 +0000 (17:52 +0000)]
Remove zh_TW.Big5 locale
After discussion with many Taiwanese, in IT or not. Big5 is not used anymore.
It is not able to represent lots of the characters used in the language.
bapt [Sun, 19 Mar 2017 17:48:41 +0000 (17:48 +0000)]
Prepare the removal of the zh_TW.Big5 encoding
bapt [Sun, 19 Mar 2017 17:46:08 +0000 (17:46 +0000)]
Garbage collect a map file that is not used anymore to generate locales
bapt [Sun, 19 Mar 2017 17:19:59 +0000 (17:19 +0000)]
Temporary readd GNU diff
etcupdate requires --change-group-format it is not easy to implement
in bsd diff so for now readd GNU diff
trasz [Sun, 19 Mar 2017 16:17:42 +0000 (16:17 +0000)]
Improve formatting.
MFC after: 2 weeks
trasz [Sun, 19 Mar 2017 15:53:17 +0000 (15:53 +0000)]
Bring back the "i". The point is to make it easy to find via "apropos
iscsi", along with all the other relevant components.
MFC after: 2 weeks
trasz [Sun, 19 Mar 2017 15:49:51 +0000 (15:49 +0000)]
Document how to use reroot with NFS.
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
kib [Sun, 19 Mar 2017 14:42:16 +0000 (14:42 +0000)]
Fix off-by-one in the vm_fault_populate() code.
When re-calculating the last inclusive page index after the pager
call, -1 was erronously ommitted. If the pager extended the run
(unlikely), the result would be insertion of the valid page mapping
outside the current map entry range.
Found by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
mav [Sun, 19 Mar 2017 13:46:11 +0000 (13:46 +0000)]
Remove hackish code delaying ATIOs to unknown virtual port.
Since we support RQSTYPE_RPT_ID_ACQ, that functionality is only useful
in loop mode, which probably doesn't worth having this hack in 2017.
MFC after: 2 weeks
mav [Sun, 19 Mar 2017 10:28:04 +0000 (10:28 +0000)]
Move <= 23xx PDB workaround to generic code.
It is chip-specific and has nothing to do with platform.
MFC after: 2 weeks
mav [Sun, 19 Mar 2017 09:36:43 +0000 (09:36 +0000)]
Remove some dead stuff.
MFC after: 2 weeks
mav [Sun, 19 Mar 2017 09:30:03 +0000 (09:30 +0000)]
Move 24xx RQSTYPE_NOTIFY handling to generic code.
This code has nothing to do with specific platform.
MFC after: 2 weeks
adrian [Sun, 19 Mar 2017 05:00:14 +0000 (05:00 +0000)]
[ath] prepare for "correct" group (bcast/mcast) address frame handling and software/hardware queue TID mapping.
When I initially did this 11n TX work in days of yonder, my 802.11 standards
clue was ... not as finely tuned. One of the things in 802.11-2012 (which
I guess technically was after I did this work, but I'm sure it was like this
in the previous rev?) is that among other traffic classes, three things are
important:
* group addressed frames should be default non-QoS, even if they're QoS frames, and
* group addressed frames should have a seqno out of a different space than the
per-TID QoS one; and because of this
* group addressed frames, being non-QoS, should never be in the Block-ACK window
for TX.
Now, net80211 and now this code cheats by using the non-QOS TID, but ideally
we'd introduce a separate seqno space just for multicast/group traffic for
TX and RX comparison.
Later extensions (eg reliable multicast / multimedia) express what one should do
when doing multicast traffic in a TID. Now, technically we /could/ do group traffic
as QoS traffic and throw it into a per-TID seqno space, but this definitely
introduces ordering issues when you take into account things like CABQ behaviour.
(Ie, if some traffic in the TID goes into the CABQ and some doesn't, because
it's doing a split of multicast and non-multicast traffic, then you have
seqno ordering issues.)
So, until someone implements 802.11vv reliable multicast / multimedia extensions,
group traffic is non-QoS.
Next, software/hardware queue TID mapping. In the past I believed the WME tagging
of frames because well, net80211 had a habit of tagging things like management
traffic with it. But, then we also map QoS traffic categories to TIDs as well.
So, we should obey the TID! But! then it put some management traffic into higher
WME categories too, as those frames don't have QoS TIDs. But! It'd do things like
put things like QoS action frames into higher WME categories, when they should
be kept in-order with the rest of the traffic for that TID. So! Given all of this,
the ath(4) driver does overrides to not trust the WME category.
I .. am undoing some of this. Now, the TID has a 1:1 mapping to the hardware
queue. The TID is the primary source of truth now for all QoS traffic.
The WME is only used for non-QoS traffic. This now means that any TID traffic
queued should be consistently queued regardless of WME, so things like the
"TX finished, do more TX" that is occuring right now for transmit handling
should be "better".
The consistent {TID, WME} -> hardware queue mapping is important for
transmit completion. It's used to schedule more traffic for that
particular TID, because that {many TID}:{1 TXQ} mapping in ath_tx_tid_sched()
is used for driving completion. Ie, when the hardware queue completes,
it'll walk that list of scheduled TIDs attached to that TXQ.
The eventual aim is to get ready for some other features around putting
some data into other hardware queues (eg for better PS-POLL support,
uAPSD, support, correct-er TDMA support, etc) which requires that
I tidy all of this up in preparation for then introducing further
TID scheduling that isn't linked to a hardware TXQ (likely a per-WME, per-TID
driver queue, and a per-node driver queue) to enable that.
Tested:
* AR9380, STA mode
* AR9380, AR9580, AP mode
ian [Sun, 19 Mar 2017 04:03:39 +0000 (04:03 +0000)]
Remove unreferenced global function imx_gpt_get_timerfreq() and do some
cleanups enabled by that:
- The only thing left in imx_gptvar.h was the softc, which IMO never
should have been in there at all. Move it into the driver, and
delete the header file.
- Remove several unneeded #includes from the driver.
- Change imx_gpt_softc from global to static (it's used by DELAY()), and
don't redundantly static-initialize it to NULL.
kp [Sun, 19 Mar 2017 03:06:09 +0000 (03:06 +0000)]
pf: Fix rule evaluation after inet6 route-to
In pf_route6() we re-run the ruleset with PF_FWD if the packet goes out
of a different interface. pf_test6() needs to know that the packet was
forwarded (in case it needs to refragment so it knows whether to call
ip6_output() or ip6_forward()).
This lead pf_test6() to try to evaluate rules against the PF_FWD
direction, which isn't supported, so it needs to treat PF_FWD as PF_OUT.
Once fwdir is set correctly the correct output/forward function will be
called.
PR: 217883
Submitted by: Kajetan Staszkiewicz
MFC after: 1 week
Sponsored by: InnoGames GmbH
bjk [Sun, 19 Mar 2017 01:24:18 +0000 (01:24 +0000)]
Tidy up mdoc formatting for "etc.)" at end of line
man(1) has some logic to use two spaces after a full stop, which is
useful for spotting sentence breaks in monospace fonts. However,
this logic is very simple, treating almost all '.' characters as
end-of-sentence markers, unless followed by certain other
characters. For example, '.,' is not end-of-sentence, and neither
is ".) ", but ".)" at the end of a line triggers the sentence-end
detection.
Apply a zero-width space to a few instances of this in share/man,
and also supply a missing full stop for an instance that occurred at
the end of a sentence.
Leave untouched several instances that are at the end of a sentence
or list element.
Reported by: 0mp (ieee80211.9)
vangyzen [Sun, 19 Mar 2017 00:54:24 +0000 (00:54 +0000)]
Regenerate syscall files for r315526
Sponsored by: Dell EMC
vangyzen [Sun, 19 Mar 2017 00:51:12 +0000 (00:51 +0000)]
Add clock_nanosleep()
Add a clock_nanosleep() syscall, as specified by POSIX.
Make nanosleep() a wrapper around it.
Attach the clock_nanosleep test from NetBSD. Adjust it for the
FreeBSD behavior of updating rmtp only when interrupted by a signal.
I believe this to be POSIX-compliant, since POSIX mentions the rmtp
parameter only in the paragraph about EINTR. This is also what
Linux does. (NetBSD updates rmtp unconditionally.)
Copy the whole nanosleep.2 man page from NetBSD because it is complete
and closely resembles the POSIX description. Edit, polish, and reword it
a bit, being sure to keep any relevant text from the FreeBSD page.
Reviewed by: kib, ngie, jilles
MFC after: 3 weeks
Relnotes: yes
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10020
jhb [Sun, 19 Mar 2017 00:36:29 +0000 (00:36 +0000)]
Improve decoding of last arguments to ioctl() and sendto().
Decode the last argument to ioctl() as a pointer rather than an int.
Eventually this could use 'int' for the _IOWINT() case and pointers for
all others.
The last argument to sendto() is a socklen_t value, not a pointer.
jhb [Sun, 19 Mar 2017 00:31:21 +0000 (00:31 +0000)]
Decode arguments to madvise().
jhb [Sun, 19 Mar 2017 00:27:07 +0000 (00:27 +0000)]
Add a Sizet type for 'size_t' values and use it instead of Int.
Various size_t arguments were previously decoded as Int values instead
which would have truncated values above 2^31 on 64-bit systems.
emaste [Sun, 19 Mar 2017 00:22:13 +0000 (00:22 +0000)]
use INT3 instead of NOP for x86 binary padding
We should never end up executing the inter-function padding, so we
are better off faulting than silently carrying on to whatever function
happens to be next.
Note that LLD will soon do this by default (although it currently pads
with zeros).
Reviewed by: dim, kib
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10047
alc [Sat, 18 Mar 2017 23:37:00 +0000 (23:37 +0000)]
Avoid unnecessary calls to vm_map_protect() in elf_load_section().
Typically, when elf_load_section() unconditionally passed VM_PROT_ALL to
elf_map_insert(), it was needlessly enabling execute access on the
mapping, and it would later have to call vm_map_protect() to correct the
mapping's access rights. Now, instead, elf_load_section() always passes
its parameter "prot" to elf_map_insert(). So, elf_load_section() must
only call vm_map_protect() if it needs to remove the write access that
was temporarily granted to perform a copyout().
Reviewed by: kib
MFC after: 1 week
truckman [Sat, 18 Mar 2017 23:00:13 +0000 (23:00 +0000)]
Change several constants used by the PIE algorithm from unsigned to signed.
- PIE_MAX_PROB is compared to variable of int64_t and the type promotion
rules can cause the value of that variable to be treated as unsigned.
If the value is actually negative, then the result of the comparsion
is incorrect, causing the algorithm to perform poorly in some
situations. Changing the constant to be signed cause the comparision
to work correctly.
- PIE_SCALE is also compared to signed values. Fortunately they are
also compared to zero and negative values are discarded so this is
more of a cosmetic fix.
- PIE_DQ_THRESHOLD is only compared to unsigned values, but it is small
enough that the automatic promotion to unsigned is harmless.
Submitted by: Rasool Al-Saadi <ralsaadi@swin.edu.au>
MFC after: 1 week
jilles [Sat, 18 Mar 2017 20:41:07 +0000 (20:41 +0000)]
sh: Remove unused function declaration for arith_lex_reset().
Reported by: Robert Elz
vangyzen [Sat, 18 Mar 2017 20:16:23 +0000 (20:16 +0000)]
nanosleep: plug a kernel memory disclosure
nanosleep() updates rmtp on EINVAL. In that case, kern_nanosleep()
has not updated rmt, so sys_nanosleep() updates the user-space rmtp
by copying garbage from its stack frame. This is not only a kernel
memory disclosure, it's also not POSIX-compliant. Fix it to update
rmtp only on EINTR.
Reviewed by: jilles (via D10020), dchagin
MFC after: 3 days
Security: possibly
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10044
jhb [Sat, 18 Mar 2017 19:59:21 +0000 (19:59 +0000)]
Decode arguments passed to kldsym() and kldunloadf().
This does not currently decode the kld_sym_lookup structure passed to
kldsym().
ian [Sat, 18 Mar 2017 19:54:58 +0000 (19:54 +0000)]
Remove hardcoded bootverbose=1; imx53 systems boot using loader(8) and
users can set verbose if they want to.
mav [Sat, 18 Mar 2017 19:27:16 +0000 (19:27 +0000)]
Reorganize RQSTYPE_NOTIFY handling for chips <= 23xx.
There were two copies of the code: one in generic code was half-broken, and
another in platform code was never called. Leave only one in generic code
and working.
MFC after: 2 weeks
dchagin [Sat, 18 Mar 2017 18:38:12 +0000 (18:38 +0000)]
Glibc get_nprocs() and get_nprocs_conf() uses the sysfs cpu infrastructure
to get number of processors. Implement /sys/devices/system/cpu/.
MFC after: 1 month
dchagin [Sat, 18 Mar 2017 18:34:29 +0000 (18:34 +0000)]
Implement getrandom() syscall.
Note. GRND_RANDOM option is not supported for now.
MFC after: 1 month
jhb [Sat, 18 Mar 2017 18:31:45 +0000 (18:31 +0000)]
Decode arguments passed to getfsstat().
Note that this does not yet decode the statfs structures returned by
getfsstat().
dchagin [Sat, 18 Mar 2017 18:31:04 +0000 (18:31 +0000)]
As noted by Roel Bouwman Linux allows a large buffer size than the
struct ucred size. Fix this.
PR: 102956
Reported by: Roel Bouwman <roel at qsp nl>
MFC after: 1 week
jhb [Sat, 18 Mar 2017 18:26:56 +0000 (18:26 +0000)]
Decode flock() operation.
dchagin [Sat, 18 Mar 2017 18:23:30 +0000 (18:23 +0000)]
To reduce code duplication move socket defines to the MI path.
MFC after: 1 week
jhb [Sat, 18 Mar 2017 18:21:41 +0000 (18:21 +0000)]
Decode file flags passed to *chflags*().
While here, decode arguments passed to fchflags() and chflagsat().
dchagin [Sat, 18 Mar 2017 18:19:31 +0000 (18:19 +0000)]
Remove superflous break statment.
MFC after: 1 week
dchagin [Sat, 18 Mar 2017 18:14:17 +0000 (18:14 +0000)]
Check for negative nanoseconds.
Linux do that in timespec_valid().
Reported by: vangyzen@
MFC after: 1 week
jhb [Sat, 18 Mar 2017 18:12:09 +0000 (18:12 +0000)]
Decode arguments passed to posix_fadvise().
jhb [Sat, 18 Mar 2017 18:10:02 +0000 (18:10 +0000)]
Decode the arguments passed to cap_fcntls_get() and cap_fcntls_limit().
ian [Sat, 18 Mar 2017 17:50:49 +0000 (17:50 +0000)]
Make the imx5 clocks driver work with vendor-supplied dts (which does not
supply the addresses for the DPLL register blocks) by hard-coding the
addresses in the driver source code. Yes, this is just as bad an idea as
it sounds, but we have no choice.
In the early days of using fdt data, when we were making up our own data
for each board, we defined 4 sets of memory mapped registers in the data.
The vendor-supplied data only provides the address of the CCM register
block, but not the 3 DPLL blocks. The linux driver has the DPLL physical
addresses (which differ by SOC type) hard-coded in the driver, and we
have no choice but to do the same thing if we want to run with the vendor-
supplied fdt data.
So now we use bus_space_map() to make the DPLL blocks accessible, choosing
the set of fixed addresses to map based on the soc id.
mav [Sat, 18 Mar 2017 17:01:11 +0000 (17:01 +0000)]
Move RQSTYPE_ABTS_RCVD parsing into generic code.
MFC after: 2 weeks
mav [Sat, 18 Mar 2017 16:09:36 +0000 (16:09 +0000)]
Extend nt_lun to full 8 byte.
MFC after: 2 weeks
jilles [Sat, 18 Mar 2017 16:09:30 +0000 (16:09 +0000)]
sh: Remove unused return value of subevalvar_misc().
mav [Sat, 18 Mar 2017 15:42:22 +0000 (15:42 +0000)]
Remove dead remnants of SPI target.
MFC after: 2 weeks
badger [Sat, 18 Mar 2017 15:25:51 +0000 (15:25 +0000)]
ptrace_test: eliminate assumption about thread scheduling
A couple of the ptrace tests make assumptions about which thread in a
multithreaded process will run after a halt. This makes the tests less
portable across branches, and susceptible to future breakage. Instead,
twiddle thread scheduling and priorities to match the tests'
expectation.
X-MFC with: r313992
Sponsored by: Dell EMC
mav [Sat, 18 Mar 2017 13:42:08 +0000 (13:42 +0000)]
Use isp_target_put_entry() in places where it can be.
This unifies the code and removes some duplication.
MFC after: 2 weeks
bde [Sat, 18 Mar 2017 11:13:54 +0000 (11:13 +0000)]
Fix bright colors for syscons, and make them work for the first time
for vt. Restore syscons' rendering of background (bg) brightness as
foreground (fg) blinking and vice versa, and add rendering of blinking
as background brightness to vt.
Bright/saturated is conflated with light/white in the implementation
and in this description.
Bright colors were broken in all cases, but appeared to work in the
only case shown by "vidcontrol show". A boldness hack was applied
only in 1 layering-violation place (for some syscons sequences) where
it made some cases seem to work but was undone by clearing bold using
ANSI sequences, and more seriously was not undone when setting
ANSI/xterm dark colors so left them bright. Move this hack to drivers.
The boldness hack is only for fg brightness. Restore/add a similar hack
for bg brightness rendered as fg blinking and vice versa. This works
even better for vt, since vt changes the default text mode to give the
more useful bg brightness instead of fg blinking.
The brightness bit in colors was unnecessarily removed by the boldness
hack. In other cases, it was lost later by teken_256to8(). Use
teken_256to16() to not lose it. teken_256to8() was intended to be
used for bg colors to allow finer or bg-specific control for the more
difficult reduction to 8; however, since 16 bg colors actually work
on VGA except in syscons text mode and the conversion isn't subtle
enough to significantly in that mode, teken_256to8() is not used now.
There are still bugs, especially in vidcontrol, if bright/blinking
background colors are set.
Restore XOR logic for bold/bright fg in syscons (don't change OR
logic for vt). Remove broken ifdef on FG_UNDERLINE and its wrong
or missing bit and restore the correct hard-coded bit. FG_UNDERLINE
is only for mono mode which is not really supported.
Restore XOR logic for blinking/bright bg in syscons (in vt, add
OR logic and render as bright bg). Remove related broken ifdef
on BG_BLINKING and its missing bit and restore the correct
hard-coded bit. The same bit means blinking or bright bg depending
on the mode, and we want to ignore the difference everywhere.
Simplify conversions of attributes in syscons. Don't pretend to
support bold fonts. Don't support unusual encodings of brightness.
It is as good as possible to map 16 VGA colors to 16 xterm-16
colors. E.g., VGA brown -> xterm-16 Olive will be converted back
to VGA brown, so we don't need to convert to xterm-256 Brown. Teken
cons25 compatibility code already does the same, and duplicates some
small tables. This is mostly for the sc -> te direction. The other
direction uses teken_256to16() which is too generic.
mav [Sat, 18 Mar 2017 10:34:29 +0000 (10:34 +0000)]
Do some notify acks cleanup.
ISPASYNC_TARGET_NOTIFY_ACK makes no sense without argument.
MFC after: 2 weeks
bde [Sat, 18 Mar 2017 07:01:18 +0000 (07:01 +0000)]
Fix right shifts on arches with db_expr_t larger than u_int (LP64 arches
in practice).
db_expr_t is a signed type, but right shifts are fudged to evaluate
them in an unsigned type, and the unsigned type was broken by hard-
coding it as 'unsigned', so casting to it lost the top bits on arches
with db_expr_t larger than u_int.
The unsigned type with the same size as db_expr_t is not declared;
assume that db_addr_t gives it. Fixing this properly is less important
than using the correct type for db_expr_t (originally always long for
C90, but always intmax_t since C99).
kp [Sat, 18 Mar 2017 01:37:20 +0000 (01:37 +0000)]
pf: Fix memory leak on vnet shutdown or unload
Rules are unlinked in shutdown_pf(), so we must call
pf_unload_vnet_purge(), which frees unlinked rules, after that, not
before.
Reviewed by: eri, bz
Differential Revision: https://reviews.freebsd.org/D10040
emaste [Sat, 18 Mar 2017 00:53:24 +0000 (00:53 +0000)]
libc: add reference to two-way algorithm and bad shift table in memmem/strstr
Requested by: ed
emaste [Sat, 18 Mar 2017 00:51:39 +0000 (00:51 +0000)]
libc: Use musl's O(n) memmem and strstr
It is O(n) in the length of the haystack (big) string, and has special
cases for short needle (little) strings, of one to four bytes, to avoid
excessive overhead.
There are a small set of nearly trivial cases where the startup overhead
of the musl implementation makes it slightly slower -- for example, a 31
byte needle that matches the beginning of the haystack. It's faster for
non-trivial cases, and significantly so for inputs that trigger worst-
case behaviour of the previous implementation. As an example, in my
tests a 16K needle that matches the end of a 64K haystack is nearly
2000x faster with this implementation.
Reviewed by: bapt (earlier), ed (earlier)
Obtained from: musl (snapshot at commit
c718f9fc)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2601
marius [Fri, 17 Mar 2017 22:57:37 +0000 (22:57 +0000)]
Again, fixes regarding style(4), to comments, includes and unused
parameters.
landonf [Fri, 17 Mar 2017 22:02:02 +0000 (22:02 +0000)]
Add MIPS boot support for the BCM4706/Northstar ChipCommon core.
This adds support for matching against a core lookup table when performing
early boot core lookup, and includes the BCM4706/Northstar-specific
ChipCommon core ID in the set of supported ChipCommon cores.
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D10033
jhibbits [Fri, 17 Mar 2017 21:40:14 +0000 (21:40 +0000)]
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
bdrewery [Fri, 17 Mar 2017 18:08:36 +0000 (18:08 +0000)]
META_MODE: Fix not using .depend files when no OBJDIR is present.
By default bmake does not allow meta mode to work unless an OBJDIR is
present. It allows this if curdirok= is set with a value not starting
with [0NnFf], but usually it is "yes".
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
bdrewery [Fri, 17 Mar 2017 18:08:33 +0000 (18:08 +0000)]
kmod: Fix building assym.o not building missing dependencies.
For instance, in the dtrace/dtrace module, building dtrace_asm.o wants
to build genassym.o first, but it doesn't build the missing ilinks
and if_*.h headers which are part of the OBJS_DEPEND_GUESS list
of dependencies to build if a .depend file is missing.
MFC after: 1 week
Sponsored by: Dell EMC Isilon
bdrewery [Fri, 17 Mar 2017 18:08:00 +0000 (18:08 +0000)]
kmod: Fix depending on ILINKS for tracked DEPENDOBJS.
The objects that may be in the dependency graph may not match
${OBJS}. Ensure the ilink link is added as a dependency for
all of them when a .depend file is missing for that objfile.
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
asomers [Fri, 17 Mar 2017 16:50:37 +0000 (16:50 +0000)]
Constrain IPv6 routes to single FIBs when net.add_addr_allfibs=0
sys/netinet6/icmp6.c
Use the interface's FIB for source address selection in ICMPv6 error
responses.
sys/netinet6/in6.c
In in6_newaddrmsg, announce arrival of local addresses on the
interface's FIB only. In in6_lltable_rtcheck, use a per-fib ND6
cache instead of a single cache.
sys/netinet6/in6_src.c
In in6_selectsrc, use the caller's fib instead of the default fib.
In in6_selectsrc_socket, remove a superfluous check.
sys/netinet6/nd6.c
In nd6_lle_event, use the interface's fib for routing socket
messages. In nd6_is_new_addr_neighbor, check all FIBs when trying
to determine whether an address is a neighbor. Also, simplify the
code for point to point interfaces.
sys/netinet6/nd6.h
sys/netinet6/nd6.c
sys/netinet6/nd6_rtr.c
Make defrouter_select fib-aware, and make all of its callers pass in
the interface fib.
sys/netinet6/nd6_nbr.c
When inputting a Neighbor Solicitation packet, consider the
interface fib instead of the default fib for DAD. Output NS and
Neighbor Advertisement packets on the correct fib.
sys/netinet6/nd6_rtr.c
Allow installing the same host route on different interfaces in
different FIBs. If rt_add_addr_allfibs=0, only install or delete
the prefix route on the interface fib.
tests/sys/netinet/fibs_test.sh
Clear some expected failures, but add a skip for the newly revealed
BUG217871.
PR: 196361
Submitted by: Erick Turnquist <jhujhiti@adjectivism.org>
Reported by: Jason Healy <jhealy@logn.net>
Reviewed by: asomers
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9451