Commit Graph

224201 Commits

Author SHA1 Message Date
Ed Maste
22ef11ee47 Link EFI/uboot loaders with -znotext
By default LLD links with relocations disallowed against readonly
sections (e.g., .text), but the 32-bit ARM EFI & uboot boot bits require
such relocations. -znotext is either ignored as an unknown -z option
(in-tree lld 2.17.50) or is already the default (GNU ld or GNU gold from
ports) so we can just add it unconditionally to allow building with LLD.

This is similar to the change in r320179 for the kernel link.

Sponsored by:	The FreeBSD Foundation
2017-07-01 18:48:15 +00:00
Alan Cox
510cdf22a2 When "force" is specified to pmap_invalidate_cache_range(), the given
start address is not required to be page aligned.  However, the loop
within pmap_invalidate_cache_range() that performs the actual cache
line invalidations requires that the starting address be truncated to
a multiple of the cache line size.  This change corrects an error in
that truncation.

Submitted by:	Brett Gutstein <bgutstein@rice.edu>
Reviewed by:	kib
MFC after:	1 week
2017-07-01 16:42:09 +00:00
Jason A. Harmening
96a38fc002 Bump __FreeBSD_version due to r320528, cleanup and inlining of
bus_dmamap* functions.

Reported by:	David Wolfskill <david@catwhisker.org>
2017-07-01 15:58:57 +00:00
Jeremie Le Hen
cf3de64127 Disable RCMDS by default.
This was announced in this thread:
https://lists.freebsd.org/pipermail/freebsd-arch/2017-June/018239.html

Applying plan proposed by ngie@ in:
https://lists.freebsd.org/pipermail/freebsd-arch/2017-June/018249.html

The port has been submitted as net/bsdrcmds in r444814.

Approved by:	bapt, roberto, and others
2017-07-01 10:04:42 +00:00
Andrew Turner
567dec3d2b Remove all calls to cpu_dcache_wb_range from the arm64 pmap code. These
were unneeded as we tell the tlb the pagetables are in cached memory. This
gives us a small, but statistically significant improvement over just
removing the PTE_SYNC cases.

While here remove PTE_SYNC, it's now unneeded.

Sponsored by:	DARPA, AFRL
2017-07-01 09:38:52 +00:00
Jason A. Harmening
eb36b1d0bc Clean up MD pollution of bus_dma.h:
--Remove special-case handling of sparc64 bus_dmamap* functions.
  Replace with a more generic mechanism that allows MD busdma
  implementations to generate inline mapping functions by
  defining WANT_INLINE_DMAMAP in <machine/bus_dma.h>.  This
  is currently useful for sparc64, x86, and arm64, which all
  implement non-load dmamap operations as simple wrappers
  around map objects which may be bus- or device-specific.

--Remove NULL-checked bus_dmamap macros.  Implement the
  equivalent NULL checks in the inlined x86 implementation.
  For non-x86 platforms, these checks are a minor pessimization
  as those platforms do not currently allow NULL maps.  NULL
  maps were originally allowed on arm64, which appears to have
  been the motivation behind adding arm[64]-specific barriers
  to bus_dma.h, but that support was removed in r299463.

--Simplify the internal interface used by the bus_dmamap_load*
  variants and move it to bus_dma_internal.h

--Fix some drivers that directly include sys/bus_dma.h
  despite the recommendations of bus_dma(9)

Reviewed by:	kib (previous revision), marius
Differential Revision:	https://reviews.freebsd.org/D10729
2017-07-01 05:35:29 +00:00
Alan Cox
545414213d Change blst_leaf_alloc() to handle a cursor argument, and to improve
performance.

To find in the leaf bitmap all ranges of sufficient length, use a doubling
strategy with shift-and-and until each bit still set represents a bit
sequence of length 'count', or until the bitmask is zero.  In the latter
case, update the hint based on the first bit sequence length not found to
be available.  For example, seeking an interval of length 12, the set bits
of the bitmap would represent intervals of length 1, then 2, then 3, then
6, then 12.  If no bits are set at the point when each bit represents an
interval of length 6, then the hint can be updated to 5 and the search
terminated.

If long-enough intervals are found, discard those before the cursor.  If
any remain, use binary search to find the position of the first of them,
and allocate that interval.

Submitted by:	Doug Moore <dougm@rice.edu>
Reviewed by:	kib, markj
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D11426
2017-07-01 05:27:40 +00:00
Warner Losh
4d81e14528 Fix sign of resid and add a mostly useless cast to cope with signed vs
unsigned check warnings from traditional unix code construsts bogusly
flagged as potentially unsafe.
2017-07-01 02:19:48 +00:00
Phil Shafer
20a21f671f Fix functional_test.sh to use --libxo options instead of the deprecated
LIBXO_OPTIONS environment variable.

Submitted by:	phil
2017-06-30 23:53:40 +00:00
Ryan Libby
98018db419 netfront.c: avoid gcc variably-modified warning
gcc produces a "variably modified X at file scope" warning for
structures that use these size definitions.  I think the definitions are
actually fine but can be rephrased with the __CONST_RING_SIZE macro more
cleanly anyway.

Reviewed by:	markj, royger
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential revision:	https://reviews.freebsd.org/D11417
2017-06-30 22:14:22 +00:00
Ryan Libby
5a62cbcaad mpt.h: macro parenthesization
Build with gcc -Wint-in-bool-context revealed a macro parenthesization
error (invoking mpt_lprt with a ternary expression for level).

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential revision:	https://reviews.freebsd.org/D11412
2017-06-30 22:06:24 +00:00
Ryan Libby
fb0e3235ea g_virstor.h: macro parenthesization
Build with gcc -Wint-in-bool-context revealed a macro parenthesization
error (invoking LOG_MSG with a ternary expression for lvl).

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential revision:	https://reviews.freebsd.org/D11411
2017-06-30 22:01:18 +00:00
Konstantin Belousov
b73ac66839 In the stdio cleanup push and pop wrappers, always call libc stubs for
__pthread_cleanup_push/pop_imp instead of symbols also exported from
libthr.

This prevents calls into libthr if libthr is not yet initialized.  The
situation occurs e.g. when an LD_PRELOADed object is not linked
against libthr, but the main binary is.

Reported and tested by:	jbeich
PR:	 220381
Discussed with:	vangyzen
Sponsored by:	The FreeBSD Foundation
MFC after:	13 days
2017-06-30 20:27:51 +00:00
Konstantin Belousov
14d1c3b581 Fix typo in the r320472 change to fgetws(). Return proper value.
Reported by:	Oleg Ginzburg <olevole@olevole.ru>
Reviewed by:	vangyzen
Sponsored by:	The FreeBSD Foundation
MFC after:	13 days
2017-06-30 20:23:46 +00:00
Kyle Evans
9722f604fc Add myself to commiters-src.dot, emaste@ as mentor; sort his mentees while here
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D11429
2017-06-30 20:01:31 +00:00
Jason Evans
1a78ec8941 Default the abort_conf malloc option to false.
This avoids troublesome backward compatibility issues.
2017-06-30 17:45:51 +00:00
Ed Maste
d786d51091 bsd.linker.mk: add band-aid for linker invocation failure
In some cases bsd.linker.mk reports an error like:

  make[4]: ".../share/mk/bsd.linker.mk" line 56:
  Unknown linker from LD=ld -m elf32ppc_fbsd:"

For now change this to a .warning, and then assume GNU ld 2.17.50.
At present the linker type detection is used only for enabling build-id,
and we can carry on without it when type detection fails.

Also, show errors from ${LD} --version to aid in failure diagnosis.
Successful invocations of ${LD} --version produce no output on stderr
so this will not create any spam in non-failing builds.

Tested by:	swills
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11424
2017-06-30 16:34:17 +00:00
Konstantin Belousov
157d5e6df3 Correct fences for sys/refcount.h.
The acq barrier in refcount_acquire() has no use, constructor must
ensure that the changes are visible before publication by other means.
Last release must sync/with the constructor and all updaters.

This is based on the refcount/shared_ptr analysis I heard at the Hans
Boehm and Herb Sutter talks about C++ atomics.

Reviewed by:	alc, jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D11270
2017-06-30 16:16:21 +00:00
Konstantin Belousov
cfb2d93ba6 Amend the layout of kevent32 on powerpc where uint64_t has 8-byte
alignment.

Reported,tested and assertion updates by:	andreast
Sponsored by:	The FreeBSD Foundation
2017-06-30 16:12:57 +00:00
Konstantin Belousov
9fb8c888f1 Define ino64_trunc_error under same conditions as the code which uses
the variable.

Noted by:	bde
Sponsored by:	The FreeBSD Foundation
2017-06-30 16:10:21 +00:00
Alan Cox
8056df6e25 Clear the MAP_WIREFUTURE flag on the vm map in exec_new_vmspace() when it
recycles the current vm space.  Otherwise, an mlockall(MCL_FUTURE) could
still be in effect on the process after an execve(2), which violates the
specification for mlockall(2).

It's pointless for vm_map_stack() to check the MEMLOCK limit.  It will
never be asked to wire the stack.  Moreover, it doesn't even implement
wiring of the stack.

Reviewed by:	kib, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D11421
2017-06-30 15:49:36 +00:00
Andrew Turner
2da3e34e0a Remove a blank line accidentally added in r320403. 2017-06-30 14:45:43 +00:00
Alexander Motin
e8583acf9a Allow status aggregation for ramdisk reads. 2017-06-30 07:48:08 +00:00
Xin LI
94c5b2d124 Revert r300385 and r300624 which was false positive
reported by cppcheck.

dup_ncp() tries to allocate a buffer of MAXNETCONFIGLINE
as tmp, which is then assigned to p->nc_netid via strcpy,
so the free(p->nc_netid) would have correctly released
the memory in case nc_lookups() fails, therefore, the
allerged leak never existed.

MFC after:	3 days
2017-06-30 07:04:10 +00:00
Alexander Motin
86ce2be65a Unify INOT/ATIO setup. 2017-06-30 06:34:49 +00:00
Alexander Motin
6ddb89725b Polish target_id/target_lun setting for ATIOs/INOTs.
For ATIOs it is pointless to report isp_loopid to CAM, since in other
places it operates with port database record IDs, not with loop IDs.

For INOTs target_id/target_lun seems were never set, so wildcard INOTs
probably were not working correctly when LUN IDs were important.
2017-06-30 06:10:18 +00:00
Enji Cooper
4fb696d630 atf-sh(3): document atf_init_test_cases(3) fully
The function was missing from the NAME/SYNOPSIS sections. Add a manpage link
to complete the documentation reference.

MFC after:	1 month
2017-06-30 05:49:12 +00:00
Sepherosa Ziehau
b90e33a435 hyperv/input: Remove unnecessary inclusion.
The unbreaks gcc compilation.

Submitted by:	Ryan Libby
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11415
2017-06-30 03:01:22 +00:00
Justin Hibbits
d7fd731d06 Use the more common Book-E idiom for disabling interrupts.
Book-E has the wrteei/wrtee instructions for writing the PSL_EE bit, ignoring
all others.  Use this instead of the AIM-typical mtmsr.

MFC with:	r320392
2017-06-30 02:11:32 +00:00
Glen Barber
b4f3658513 Correct the branch naming convention in param.h.
While here, consistently use upper-case 'X' to represent the
version number.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-06-30 00:20:48 +00:00
Warner Losh
440f35093c Improve wdc error log pulling.
After review by the WDC engineers, improve how we pull down the
so-called 'e6' logs. The 'c6' logs are obsolete and support for them
has been removed because FreeBSD needed to pull them in chunks, which
is incompatible with the 0xc6 opcode implementation. Rather than leave
the code in place that produces bad log pulls, remove it.
2017-06-29 23:15:28 +00:00
Andrew Turner
edca29bf48 As with arm64 mark the EFI PE header as allocated on arm. This is needed
for lld to link laoder.efi and boot1.efi.

Reported by:	emaste
2017-06-29 22:09:32 +00:00
John Baldwin
51645e836d Store a 32-bit PT_LWPINFO struct for 32-bit process core dumps.
Process core notes for a 32-bit process running on a 64-bit host need to
use 32-bit structures so that the note layout matches the layout of notes
of a core dump of a 32-bit process under a 32-bit kernel.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D11407
2017-06-29 21:31:13 +00:00
Navdeep Parhar
98c9236978 Adjust sowakeup post-r319685 so that it continues to make upcalls but
still avoids calling soconnected during sodisconnected.

Discussed with:	glebius@
Sponsored by:	Chelsio Communications
2017-06-29 19:43:27 +00:00
Andrey V. Elsukov
785c0d4d97 Fix IPv6 extension header parsing. The length field doesn't include the
first 8 octets.

Obtained from:	Yandex LLC
MFC after:	3 days
2017-06-29 19:06:43 +00:00
Baptiste Daroussin
d25c1ff64f Add libxo(3) support to sesutil(8)
This is useful to simplify parsing "sesutil map"

Submitted by:	nikita.kozlov@blade-group.com
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	blade
2017-06-29 18:52:36 +00:00
Steve Wills
d8061eff49 Add hardening menu item for security.bsd.see_jail_proc
Approved by:		allanjude
Differential Revision:	https://reviews.freebsd.org/D11283
2017-06-29 16:39:55 +00:00
Konstantin Belousov
fda0a14f47 Make stdio deferred cancel-safe.
If used with fopen(3)/fdopen(3)-ed FILEs, stdio accurately uses
non-cancellable internal versions of the functions, i.e. it seems to
be fine with regard to cancellation.  But if the funopen(3) and
f{r,w}open(3) functions were used to open the FILE, and corresponding
user functions create cancellation points (they typically have no
other choice), then stdio code at least leaks FILE' lock.

The change installs cleanup handler which unlocks FILE.  Some minimal
restructuring of the code was required to make it use common return
place to satisfy hand-rolled pthread_cleanup_pop() requirements.

Noted by:	eugen
Reviewed by:	eugen, vangyzen
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D11246
2017-06-29 14:44:17 +00:00
Konstantin Belousov
d137278838 Do not cast struct kevent_args or struct freebsd11_kevent_args to
struct g_kevent_args.

On some architectures, e.g. PowerPC, there is additional padding in uap.

Reported and tested by:	andreast
Sponsored by:	The FreeBSD Foundation
2017-06-29 14:40:33 +00:00
Andrew Turner
3ab06e30cb Start to remove _libc_arm_fpu_present checks. We don't support the VFP on
ARMv4 or ARMv5, and only support it when it's present on ARMv6 and later.
As such always store the VFP register in setjmp and restore them in
longjmp when building for armv6.

Reviewed by:	mmel
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11393
2017-06-29 14:00:05 +00:00
Xin LI
80bfc295ef Don't bother to set target for SEEK_END.
While there also collapase SEEK_END into default case in lseek.

MFC after:	2 weeks
2017-06-29 06:28:54 +00:00
Toomas Soome
ee059e6369 loader: chain load relocate data declaration is bad
The implementation is using fixed size array allocated in asm module,
need to use proper array declaration for C source.

CID:		1376405
Reported by:	Coverity, cem
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D11321
2017-06-29 04:33:55 +00:00
Adrian Chadd
86a656deb0 [ath_hal] if building with ALQ, ensure we actually depend upon ALQ. 2017-06-29 03:59:02 +00:00
Adrian Chadd
b6c4248397 [mips] [ar71xx] Since the wlan/ath drivers use ALQ, ensure we build the module
here otherwise we can't load said module.
2017-06-29 03:58:01 +00:00
Adrian Chadd
05e89dd3a1 [mips] make this compile again after all of the config changes. 2017-06-29 03:57:22 +00:00
Ian Lepore
75ac55b81f Add iic_recover_bus.c. Should have been part of r320461. 2017-06-29 02:19:30 +00:00
Ian Lepore
8928c2e4f5 Add bus recovery handling to the imx5/imx6 i2c driver. 2017-06-29 01:59:39 +00:00
Ian Lepore
930b312319 Add iic_recover_bus(), a helper function that can be used by any i2c driver
which is able to manipulate the clock and data lines directly.

When an i2c bus is hung by a slave device stuck in the middle of a
transaction that didn't complete properly, this function manipulates the
clock and data lines in a sequence known to reliably reset slave devices.
The most common cause of a hung i2c bus is a system reboot in the middle of
an i2c transfer (so it doesnt' happen often, but now there is a way other
than power cycling to recover from it).
2017-06-29 01:50:58 +00:00
Ian Lepore
f03b277259 If an i2c transfer ends due to error, issue a stop on the bus even if the
nostop option is set, if a start was issued.

The nostop option doesn't mean "never issue a stop" it means "only issue
a stop after the last in a series of transfers".  If the transfer ends
due to error, then that was the last transfer in the series, and a stop
is required.

Before this change, any error during a transfer when nostop is set would
effectively hang the bus, because sc->started would never get cleared,
and that caused all future calls to iicbus_start() to return an error
because it looked like the bus was already active.  (Unrelated errors in
handling the nostop option, to be addressed separately, could lead to
this bus hang condition even on busses that don't set the nostop option.)
2017-06-29 00:29:15 +00:00
Rick Macklem
ad6eb97601 Fix an NFSv3 client case that probably never happens.
If an NFSv3 server were to reply with weak cache consistency attributes,
but not post operation attributes, the client would use garbage attributes
from memory. This was spotted during work on the code for the NFSv4.1 client.
I have never seen evidence that this happens and it wouldn't make sense
for an NFSv3 server to do this, so this patch is basically "theoretical",
but does fix the problem if a server were to do the above.

PR:		219552
MFC after:	2 weeks
2017-06-28 21:37:08 +00:00