Commit Graph

8415 Commits

Author SHA1 Message Date
Dimitry Andric
1bf8c89f28 Pull in r353299 from upstream lld trunk (by George Rimar):
Recommit r353293 "[LLD][ELF] - Set DF_STATIC_TLS flag for i386 target."

  With the following changes:
  1) Compilation fix:
  std::atomic<bool> HasStaticTlsModel = false; ->
  std::atomic<bool> HasStaticTlsModel{false};

  2) Adjusted the comment in code.

  Initial commit message:

  DF_STATIC_TLS flag indicates that the shared object or executable
  contains code using a static thread-local storage scheme.

  Patch checks if IE/LE relocations were used to check if the code uses
  a static model. If so it sets the DF_STATIC_TLS flag.

  Differential revision: https://reviews.llvm.org/D57749

Pull in r353378 from upstream lld trunk (by George Rimar):

  [LLD][ELF] - Set DF_STATIC_TLS flag for X64 target

  This is the same as D57749, but for x64 target.

  "ELF Handling For Thread-Local Storage" p41 says
  (https://www.akkadia.org/drepper/tls.pdf):
  R_X86_64_GOTTPOFF relocation is used for IE TLS models.
  Hence if linker sees this relocation we should add DF_STATIC_TLS flag.

  Differential revision: https://reviews.llvm.org/D57821

This adds support to lld for the DF_STATIC_TLS flag in shared objects,
which signals to the dynamic linker that the shared object requires
static thread local storage.

See also:	https://reviews.freebsd.org/D19072
MFC after:	1 week
2019-02-21 18:41:41 +00:00
Dimitry Andric
18ff5bdb9c Pull in r354515 from upstream libc++ trunk:
Fix the build with gcc when `-Wredundant-decls` is passed

  Summary:

  gcc warns that `__throw_runtime_error` is declared both in
  `<__locale>` and `<stdexcept>`, if `-Wredundant-decls` is passed on
  the command line; this is the case with FreeBSD when ${WARNS} == 6.

  Since `<__locale>` gets its first declaration via a transitive
  include of `<stdexcept>`, and the second declaration is after the
  first invocation of `__throw_runtime_error`, delete that second
  declaration.

  Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>

  Reviewers: kristina, MaskRay, EricWF, ldionne, ngie

  Reviewed By: EricWF

  Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, libcxx-commits

  Tags: #libc

  Differential Revision: https://reviews.llvm.org/D58425

Submitted by:	ngie
MFC after:	3 days
2019-02-20 21:06:11 +00:00
Enji Cooper
7ea28b21e4 Don't hardcode the source filename
In order to compile these tests with different CXXFLAGS, I needed to copy them
to different filenames to trick the compiler. Unfortunately, this triggers a
failure with one of the tests as it hardcodes the path to the test, instead of
relying on the compiler to fill in the path via `__FILE__`.

Using `__FILE__` is standard and works. Rely on it instead of a hardcoded path.
2019-02-20 07:21:22 +00:00
Enji Cooper
0cd3ea4138 Add .Lb references for gmock/gtest
These will be used in src.conf(5) changes--coming up next.
2019-02-19 22:35:14 +00:00
Enji Cooper
30e009fc3a MFhead@r344270 2019-02-19 03:46:32 +00:00
Dimitry Andric
993b827f31 Pull in r345199 from upstream libc++ trunk (by Petr Hosek):
Revert "Teach __libcpp_is_floating_point that __fp16 and _Float16 are
  floating-point types."

  This reverts commits r333103 and r333108. _Float16 and __fp16 are C11
  extensions and compilers other than Clang don't define these for C++.

  Differential Revision: https://reviews.llvm.org/D53670

This prevents "_Float16 is not supported on this target" errors in
libc++'s type_traits header, in some cases.

Reported by:	Charlie Li
MFC after:	3 days
2019-02-18 18:34:13 +00:00
Dimitry Andric
c981cbbd13 Merge ^/head r343956 through r344177. 2019-02-15 21:50:45 +00:00
Dimitry Andric
640dd76f2c Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r354130, resolve conflicts, and bump version numbers.
2019-02-15 21:44:42 +00:00
Dimitry Andric
381ab04f4f Pull in r353907 from upstream llvm trunk (by Reid Kleckner):
[MC] Make symbol version errors non-fatal

  We stil don't have a source location, which is pretty lame, but at
  least we won't tell the user to file a clang bug report anymore.

  Fixes PR40712

This will make errors for symbols with @@ versions that are not defined
non-fatal.  For example:

  void f(void)
  {
    __asm__(".symver foo,bar@@baz");
  }

will now result in:

  error: versioned symbol bar@@baz must be defined

instead of clang crashing with a diagnostic report.

PR:		234671
Upstream PR:	https://bugs.llvm.org/show_bug.cgi?id=40712
MFC after:	3 days
2019-02-13 20:13:40 +00:00
Martin Matuska
2a021abd9e MFV r344088 (libarchive):
archive_read_disk_posix.c: initialize delayed_errno

MFC after:	2 weeks
2019-02-13 07:37:33 +00:00
Enji Cooper
b89a7cc2ed Copy googletest 1.8.1 from ^/vendor/google/googletest/1.8.1 to .../contrib/googletest 2019-02-13 02:46:46 +00:00
Martin Matuska
a39fc08da2 MFV r344063:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1085: Fix a null pointer dereference bug in zip writer
  PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2
            decopmpression
  PR #1116: Add support for 64-bit ar format
  PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2]
  PR #1125: RAR5 reader - fix an invalid read and a memory leak
  PR #1131: POSIX reader - do not fail when tree_current_lstat() fails
            due to ENOENT [3]
  PR #1134: Delete unnecessary null pointer checks before calls of free()
  OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy.
  OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader

PR:		233006 [3]
Security:	CVE-2019-1000019 [1], CVE-2019-1000020 [2]
MFC after:	2 weeks
2019-02-12 23:24:45 +00:00
Martin Matuska
fbb1b16ad8 Update vendor/libarchive/dist to git 31c0a517c91f44eeee717a04db8b075cadda83d8
Relevant vendor changes:
  PR #1085: Fix a null pointer dereference bug in zip writer
  PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2
            decopmpression
  PR #1116: Add support for 64-bit ar format
  PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2]
  PR #1125: RAR5 reader - fix an invalid read and a memory leak
  PR #1131: POSIX reader - do not fail when tree_current_lstat() fails
            due to ENOENT [3]
  PR #1134: Delete unnecessary null pointer checks before calls of free()
  OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy.
  OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader

PR:		233006 [3]
Security:	CVE-2019-1000019 [1], CVE-2019-1000020 [2]
2019-02-12 22:29:41 +00:00
Dimitry Andric
54553daf6d Pull in r339734 from upstream llvm trunk (by Eli Friedman):
[ARM] Make PerformSHLSimplify add nodes to the DAG worklist correctly.

  Intentionally excluding nodes from the DAGCombine worklist is likely
  to lead to weird optimizations and infinite loops, so it's generally
  a bad idea.

  To avoid the infinite loops, fix DAGCombine to use the
  isDesirableToCommuteWithShift target hook before performing the
  transforms in question, and implement the target hook in the ARM
  backend disable the transforms in question.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=38530 . (I don't have a
  reduced testcase for that bug. But we should have sufficient test
  coverage for PerformSHLSimplify given that we're not playing weird
  tricks with the worklist. I can try to bugpoint it if necessary,
  though.)

  Differential Revision: https://reviews.llvm.org/D50667

This should fix a possible hang when compiling sys/dev/nxge/if_nxge.c
(which exists now only in the stable/11 branch) for arm.
2019-02-12 18:32:14 +00:00
Dimitry Andric
9e43c218d5 Merge ^/head r343807 through r343955. 2019-02-10 12:49:34 +00:00
Dimitry Andric
c232a6c2f7 Pull in r352607 from upstream llvm trunk (by Craig Topper):
[X86] Add FPSW as a Def on some FP instructions that were missing it.

Pull in r352608 from upstream llvm trunk (by Craig Topper):

  [X86] Remove a couple places where we unnecessarily pass 0 to the
  EmitPriority of some FP instruction aliases. NFC

  As far as I can tell we already won't emit these aliases due to an
  operand count check in the tablegen code. Removing these because I
  couldn't make sense of the inconsistency between fadd and fmul from
  reading the code.

  I checked the AsmMatcher and AsmWriter files before and after this
  change and there were no differences.

Pull in r353015 from upstream llvm trunk (by Craig Topper):

  [X86] Print %st(0) as %st when its implicit to the instruction.
  Continue printing it as %st(0) when its encoded in the instruction.

  This is a step back from the change I made in r352985. This appears
  to be more consistent with gcc and objdump behavior.

Pull in r353061 from upstream llvm trunk (by Craig Topper):

  [X86] Print all register forms of x87 fadd/fsub/fdiv/fmul as having
  two arguments where on is %st.

  All of these instructions consume one encoded register and the other
  register is %st. They either write the result to %st or the encoded
  register. Previously we printed both arguments when the encoded
  register was written. And we printed one argument when the result was
  written to %st. For the stack popping forms the encoded register is
  always the destination and we didn't print both operands. This was
  inconsistent with gcc and objdump and just makes the output assembly
  code harder to read.

  This patch changes things to always print both operands making us
  consistent with gcc and objdump. The parser should still be able to
  handle the single register forms just as it did before. This also
  matches the GNU assembler behavior.

Pull in r353141 from upstream llvm trunk (by Craig Topper):

  [X86] Connect the default fpsr and dirflag clobbers in inline
  assembly to the registers we have defined for them.

  Summary:
  We don't currently map these constraints to physical register numbers
  so they don't make it to the MachineIR representation of inline
  assembly.

  This could have problems for proper dependency tracking in the
  machine schedulers though I don't have a test case that shows that.

  Reviewers: rnk

  Reviewed By: rnk

  Subscribers: eraman, llvm-commits

  Tags: #llvm

  Differential Revision: https://reviews.llvm.org/D57641

Pull in r353489 from upstream llvm trunk (by Craig Topper):

  [X86] Add FPCW as a register and start using it as an implicit use on
  floating point instructions.

  Summary:
  FPCW contains the rounding mode control which we manipulate to
  implement fp to integer conversion by changing the roudning mode,
  storing the value to the stack, and then changing the rounding mode
  back. Because we didn't model FPCW and its dependency chain, other
  instructions could be scheduled into the middle of the sequence.

  This patch introduces the register and adds it as an implciit def of
  FLDCW and implicit use of the FP binary arithmetic instructions and
  store instructions. There are more instructions that need to be
  updated, but this is a good start. I believe this fixes at least the
  reduced test case from PR40529.

  Reviewers: RKSimon, spatel, rnk, efriedma, andrew.w.kaylor

  Subscribers: dim, llvm-commits

  Tags: #llvm

  Differential Revision: https://reviews.llvm.org/D57735

These should fix a problem in clang 7.0 where it would sometimes emit
long double floating point instructions in a slightly wrong order,
leading to failures in our libm tests.  In particular, the cbrt_test
test case 'cbrtl_powl' and the trig_test test case 'reduction'.

Reported by:	lwhsu
PR:		234040
Upstream PR:	https://bugs.llvm.org/show_bug.cgi?id=40206
2019-02-10 12:45:33 +00:00
Dimitry Andric
bc8fc00705 Amend r343442, by only expecting the lib.msun.cbrt_test.cbrtl_powl and
trig_test.reduction test cases to fail, if the fixes from r343916 have
not yet been applied to the base compiler.

Reported by:    lwhsu
PR:		234040
Upstream PR:	https://bugs.llvm.org/show_bug.cgi?id=40206
MFC after:	1 week
2019-02-08 18:31:54 +00:00
Dimitry Andric
94ba333f9c Pull in r352607 from upstream llvm trunk (by Craig Topper):
[X86] Add FPSW as a Def on some FP instructions that were missing it.

Pull in r353141 from upstream llvm trunk (by Craig Topper):

  [X86] Connect the default fpsr and dirflag clobbers in inline
  assembly to the registers we have defined for them.

  Summary:
  We don't currently map these constraints to physical register numbers
  so they don't make it to the MachineIR representation of inline
  assembly.

  This could have problems for proper dependency tracking in the
  machine schedulers though I don't have a test case that shows that.

  Reviewers: rnk

  Reviewed By: rnk

  Subscribers: eraman, llvm-commits

  Tags: #llvm

  Differential Revision: https://reviews.llvm.org/D57641

Pull in r353489 from upstream llvm trunk (by Craig Topper):

  [X86] Add FPCW as a register and start using it as an implicit use on
  floating point instructions.

  Summary:
  FPCW contains the rounding mode control which we manipulate to
  implement fp to integer conversion by changing the roudning mode,
  storing the value to the stack, and then changing the rounding mode
  back. Because we didn't model FPCW and its dependency chain, other
  instructions could be scheduled into the middle of the sequence.

  This patch introduces the register and adds it as an implciit def of
  FLDCW and implicit use of the FP binary arithmetic instructions and
  store instructions. There are more instructions that need to be
  updated, but this is a good start. I believe this fixes at least the
  reduced test case from PR40529.

  Reviewers: RKSimon, spatel, rnk, efriedma, andrew.w.kaylor

  Subscribers: dim, llvm-commits

  Tags: #llvm

  Differential Revision: https://reviews.llvm.org/D57735

These should fix a problem in clang 7.0 where it would sometimes emit
long double floating point instructions in a slightly wrong order,
leading to failures in our libm tests.  In particular, the cbrt_test
test case 'cbrtl_powl' and the trig_test test case 'reduction'.

Also bump __FreeBSD_cc_version, to be able to detect this in our test
suite.

Reported by:    lwhsu
PR:		234040
Upstream PR:	https://bugs.llvm.org/show_bug.cgi?id=40206
MFC after:	1 week
2019-02-08 18:24:53 +00:00
Dag-Erling Smørgrav
9c9d011eed Vendor import of Unbound 1.9.0. 2019-02-06 12:31:02 +00:00
Dimitry Andric
c8630eab15 Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r353167, resolve conflicts, and bump version numbers.
2019-02-05 19:48:24 +00:00
Dimitry Andric
c2c227a536 Merge ^/head r343571 through r343711. 2019-02-03 11:41:43 +00:00
Cy Schubert
e9a5006bff Kernel module shim sources have no business being in the userland
build directory, especially those for other operating systems.
The kernel module shims for other operating systems are hereby removed.
The kernel module shim for FreeBSD, mlfk_ipl.c, is already in
sys/contrib/ipfilter/netinet. The one here is never used and should
not be in the userland build directory either.

mlfk_rule.c isn't used either however we will keep it in case someone
wishes to use this shim to load rules via a kernel module, handy for
embedded. In that case it should be copied to
sys/contrib/ipfilter/netinet and a Makefile created to employ it.
(Probably a useful documentation project when time permits.)

MFC after:	1 month
2019-02-03 05:26:07 +00:00
Cy Schubert
e559413d6f Remove a redundant ip_compat.h, originally merged from upstream.
MFC after:	1 month
2019-02-03 05:26:01 +00:00
Cy Schubert
0fcd8cab4e ipfilter #ifdef cleanup.
Remove #ifdefs for ancient and irrelevant operating systems from
ipfilter.

When ipfilter was written the UNIX and UNIX-like systems in use
were diverse and plentiful. IRIX, Tru64 (OSF/1) don't exist any
more. OpenBSD removed ipfilter shortly after the first time the
ipfilter license terms changed in the early 2000's. ipfilter on AIX,
HP/UX, and Linux never really caught on. Removal of code for operating
systems that ipfilter will never run on again will simplify the code
making it easier to fix bugs, complete partially implemented features,
and extend ipfilter.

Unsupported previous version FreeBSD code and some older NetBSD code
has also been removed.

What remains is supported FreeBSD, NetBSD, and illumos. FreeBSD and
NetBSD have collaborated exchanging patches, while illumos has expressed
willingness to have their ipfilter updated to 5.1.2, provided their
zone-specific updates to their ipfilter are merged (which are of interest
to FreeBSD to allow control of ipfilters in jails from the global zone).

Reviewed by:	glebius@
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D19006
2019-02-03 05:25:49 +00:00
Ed Maste
3f0e38d70c readelf: decode FreeBSD note types
Decode NT_FREEBSD_ABI_TAG, NT_FREEBSD_ARCH_TAG, and NT_FREEBSD_FEATURE_CTL.

Reviewed by:	brooks, kib (earlier)
MFC after:	2 weeks
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19054
2019-02-01 22:24:14 +00:00
Ed Maste
6b2779a022 readelf: use table-based DT_FLAGS and DT_FLAGS_1 decoding
Fewer lines of code and more maintainable.

Reviewed by:	brooks, kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19053
2019-02-01 20:28:15 +00:00
Ed Maste
675f752cc5 readelf: dump elf note data
Output format is compatible with GNU readelf's handling of unknown note
types (modulo a GNU char signedness bug); future changes will add type-
specific decoding.

Reviewed by:	kib
MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2019-01-31 17:04:55 +00:00
Ed Maste
fb4e718261 readelf: fix i386 build
Use %jx and (uintmax_t) cast.

PR:		232983
MFC with:	r343592
Sponsored by:	The FreeBSD Foundation
2019-01-30 21:46:12 +00:00
Ed Maste
87a8583b24 readelf: decode flag bits in DT_FLAGS/DT_FLAGS_1
Decode d_val when the tag is DT_FLAGS or DT_FLAGS_1 based on the
information at:

https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-42444.html

PR:		232983
Submitted by:	Bora Ozarslan borako.ozarslan@gmail.com
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18784
2019-01-30 20:44:51 +00:00
Dimitry Andric
7e565c552a Merge ^/head r343320 through r343570. 2019-01-30 07:10:33 +00:00
Dimitry Andric
d75fca0d08 Pull in r352407 from upstream lld trunk (by Rui Ueyama):
Refactoring. NFC.

Pull in r352435 from upstream lld trunk (by Rui Ueyama):

  Attempt to fix build failure with GCC 5.4.

Pull in r352482 from upstream lld trunk (by George Rimar):

  [ELF] - Remove dead `readBfdName` declaration. NFC.

  `readBfdName` was removed recently.

Pull in r352606 from upstream lld trunk (by me):

  Recognize FreeBSD specific BFD names in OUTPUT_FORMAT

  Summary:
  After rLLD344952 ("Add OUTPUT_FORMAT linker script directive
  support"), using BFD names such as `elf64-x86-64-freebsd` the
  `OUTPUT_FORMAT` linker script command does not work anymore,
  resulting in errors like:

  ```
  ld: error: /home/dim/src/clang800-import/stand/efi/loader/arch/amd64/ldscript.amd64:2: unknown output format name: elf64-x86-64-freebsd
  >>> OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd")
  >>>               ^
  ```

  To fix this, recognize a `-freebsd` suffix in BFD names, and also set
  `Configuration::OSABI` to `ELFOSABI_FREEBSD` for those cases.

  Add and/or update several test cases to check for the correct results
  of these new `OUTPUT_FORMAT` arguments.

  Reviewers: ruiu, atanasyan, grimar, hokein, emaste, espindola

  Reviewed By: ruiu

  Subscribers: nemanjai, javed.absar, arichardson, krytarowski, kristof.beyls, kbarton, llvm-commits

  Differential Revision: https://reviews.llvm.org/D57283
2019-01-30 07:09:01 +00:00
Cy Schubert
60f4a175c5 Fix a typo.
MFC after:	3 days
2019-01-27 02:31:42 +00:00
Li-Wen Hsu
24df7b15fa Temporarily mark lib.msun.{cbrt_test.cbrtl_powl,trig_test.reduction}
expected failure after clang700-import merge

PR:		234040
Reviewed by:	ngie, markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18938
2019-01-25 18:48:20 +00:00
Ed Maste
ade4db4d04 clang: default to DWARF 4 as of FreeBSD 13
FreeBSD previously defaulted to DWARF 2 because several tools (gdb,
ctfconvert, etc.) did not support later versions.  These have either
been fixed or are deprecated.

Note that gdb 6 still exists but has been moved out of $PATH into
/usr/libexec and is intended only for use by crashinfo(8).  The kernel
build sets the DWARF version explicitly via -gdwarf2, so this should
have no effect there.

PR:		234887 [exp-run]
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17930
2019-01-25 14:46:13 +00:00
Dimitry Andric
bcba4b6d83 Reduce diff against upstream. 2019-01-22 20:34:42 +00:00
Dimitry Andric
7570aff4a0 Merge lldb release_80 branch r351543, and resolve conflicts. 2019-01-22 20:16:41 +00:00
Dimitry Andric
1064158e9b Merge lld release_80 branch r351543, and resolve conflicts. 2019-01-22 20:15:58 +00:00
Dimitry Andric
73471dd8c0 Merge clang release_80 branch r351543, and resolve conflicts. 2019-01-22 20:15:01 +00:00
Dimitry Andric
6f6198e75d Merge llvm release_80 branch r351543, and resolve conflicts. 2019-01-22 20:13:43 +00:00
Dimitry Andric
9c710df928 Merge compiler-rt trunk r351319, and resolve conflicts. 2019-01-22 19:20:24 +00:00
Dimitry Andric
0c824832d6 Merge libc++ trunk r351319, and resolve conflicts. 2019-01-22 19:02:28 +00:00
Dimitry Andric
053d6b6842 Remove customizations in #includes of Options.inc, and adjust lld
Makefile to generate the file in the right place.
2019-01-22 18:04:40 +00:00
Dimitry Andric
a903123562 Add #ifdef LLDB_ENABLE_ALL guards to prevent accessing the PDB AST
parser, which we have disabled in our lldb.
2019-01-22 18:02:40 +00:00
Dimitry Andric
4c14ae3e1e Fix ifunc code from r338251 for lld 8.0. 2019-01-21 20:22:11 +00:00
Dimitry Andric
763d4102c9 Merge lldb trunk r351319, resolve conflicts, and update FREEBSD-Xlist. 2019-01-20 15:00:15 +00:00
Dimitry Andric
0e23b2ff8c Merge lld trunk r351319, resolve conflicts, and update FREEBSD-Xlist. 2019-01-20 14:42:59 +00:00
Dimitry Andric
d5ea6fa648 Merge clang trunk r351319, resolve conflicts, and update FREEBSD-Xlist. 2019-01-20 14:02:54 +00:00
Dimitry Andric
d9484dd61c Merge llvm trunk r351319, resolve conflicts, and update FREEBSD-Xlist. 2019-01-20 11:41:25 +00:00
Kirk McKusick
adb8eabc2e Truely fix #if defined broken in -r343111
Pointy-hat-to: mckusick
2019-01-17 16:26:59 +00:00
Kirk McKusick
cc50e5a1b8 Proper definition of elast3.
Reported by: Oliver Pinter <oliver.pinter@hardenedbsd.org>
2019-01-17 15:42:10 +00:00
Kirk McKusick
cbb97f8d1e Fix #if defined broken in -r343111
Pointy-hat-to: mckusick
2019-01-17 15:35:04 +00:00
Kirk McKusick
88640c0e8b Create new EINTEGRITY error with message "Integrity check failed".
An integrity check such as a check-hash or a cross-correlation failed.
The integrity error falls between EINVAL that identifies errors in
parameters to a system call and EIO that identifies errors with the
underlying storage media. EINTEGRITY is typically raised by intermediate
kernel layers such as a filesystem or an in-kernel GEOM subsystem when
they detect inconsistencies. Uses include allowing the mount(8) command
to return a different exit value to automate the running of fsck(8)
during a system boot.

These changes make no use of the new error, they just add it. Later
commits will be made for the use of the new error number and it will
be added to additional manual pages as appropriate.

Reviewed by:    gnn, dim, brueffer, imp
Discussed with: kib, cem, emaste, ed, jilles
Differential Revision: https://reviews.freebsd.org/D18765
2019-01-17 06:35:45 +00:00
Cy Schubert
e719f737b7 Remove redundant ipfilter version of pcap-bpf.h. As of r214535 it was
no longer needed.

MFC after:	1 week
2019-01-16 20:46:39 +00:00
Konstantin Belousov
ea7e7006db Implement shmat(2) flag SHM_REMAP.
Based on the description in Linux man page.

Reviewed by:	markj, ngie (previous version)
Sponsored by:	Mellanox Technologies
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18837
2019-01-16 05:15:57 +00:00
Konstantin Belousov
b87850b96e Trim spaces at the end of lines.
Reviewed by:	markj, ngie
Sponsored by:	Mellanox Technologies
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18837
2019-01-16 05:09:29 +00:00
Cy Schubert
636a29ff4f Remove an IRIX-only source file.
MFC after:	1 week
2019-01-16 02:05:42 +00:00
Ed Maste
ae500c1ff8 Update to ELF Tool Chain r3668
Highlights:
- Make sure that only TLS sections are sorted into TLS segment.
- Fixed multiple errors in "Section to Segment mapping".
- Man page updates
- ar improvements
- elfcopy: avoid filter_reloc uninitialized variable for rela
- elfcopy: avoid stripping relocations from static binaries
- readelf: avoid printing directory in front of absolute path
- readelf: add NT_FREEBSD_FEATURE_CTL FreeBSD note type
- test improvements

NOTES:

Some of these changes originated in FreeBSD and simply reduce diffs
between contrib and vendor.

ELF Tool Chain ar is not (currently) used in FreeBSD, and there are
improvements in both FreeBSD and ELF Tool Chain ar that are not in
the other.

Sponsored by:	The FreeBSD Foundation
2019-01-10 14:35:23 +00:00
Gleb Smirnoff
3231251399 Timer interval is correctly counted in ticks (1/100 s) in
mibif_reset_hc_timer().  Multiplication by 10 is erroneous
and is probably a blind copy and paste from next function.

PR:		132993
Submitted by:	Vitezslav Novy <vnovy vnovy.net>
2019-01-09 05:53:59 +00:00
Pawel Jakub Dawidek
6d4db58393 In r316006 the getstrfromtype_locked() function was modified to return
an empty string, instead of NULL, if an entry is missing in the audit_control
file. Because of that change the getachost() function started to return
success even if the host name was not defined in the audit_control.
This in turn led to auditd_hostlen always being set (for an empty host it was
set to 0). If auditd_hostlen was not equal to -1 we were trying to append
the host name to trail file name. All this led to situation where when host
name is not defined in audit_control, auditd will create trail files with
a leading '.', which breaks auditdistd as it doesn't work with longer audit
trail file names.

Fix this by appending host name to the trail file name only if the host name
is not empty.
2019-01-09 01:16:35 +00:00
Konstantin Belousov
866fe991ac Clamp tuklib_physmem() return value to SIZE_T_MAX.
On 32bit platforms it is possible to have (much) more physical RAM
than is mappable into single address space.  In this case liblzma
scales the value into a request to mmap more address space than it is
theoretically possible.

Reported and tested by:	pho
Reviewed by:	delphij
Discussed with:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-01-06 23:59:04 +00:00
Cy Schubert
480717af29 Remove ipsd (IP Scan Detetor). It is unused and to my knowledge has
never been used on any platform that ipfilter has been on. However
it looks like it could be a useful utility, therefore there are plans
to make it a port one day. It lacks a man page as well.

MFC after:	1 month
2019-01-06 21:24:44 +00:00
Philip Paeps
d595db7390 Import tzdata 2018i
Changes: https://github.com/eggert/tz/blob/2018i/NEWS

MFC after:	2 days
2018-12-31 07:57:37 +00:00
Philip Paeps
2c5e84cc26 Import tzdata 2018h
Changes: https://github.com/eggert/tz/blob/2018h/NEWS

MFC after:	3 days
2018-12-30 08:22:35 +00:00
Cy Schubert
da7e48c690 TCP_PAWS_IDLE is does not exist in NetBSD and illumos. In FreeBSD
TCP_PAWS_IDLE is defined in netinet/tcp_seq.h, however this header
isn't included explicitly or implicitly at this point therefore
as far ipfilter is concerned TCP_PAWS_IDLE is not defined. Remove
the #ifdef and include netinet/tcp.h unconditionally.

MFC after:	1 week
2018-12-30 04:25:48 +00:00
Dimitry Andric
a9419c7133 Pull in r342863 from upstream llvm trunk (by Hans Wennborg):
Remove debug printf leftover from r342397

PR:		234480
MFC after:	6 weeks
X-MFC-With:	r341825
2018-12-29 15:21:51 +00:00
Dimitry Andric
434fe561e1 Pull in r342397 from upstream llvm trunk (by Amara Emerson):
Revert "Revert r342183 "[DAGCombine] Fix crash when store merging
  created an extract_subvector with invalid index.""

  Fixed the assertion failure.

  Differential Revision: https://reviews.llvm.org/D51831

This fixes 'Assertion failed: ((VT.getVectorNumElements() +
N2C->getZExtValue() <= N1.getValueType().getVectorNumElements()) &&
"Extract subvector overflow!"), function getNode' when building the
multimedia/aom port (with AVX2 enabled).

Reported by:	jbeich
PR:		234480
MFC after:	6 weeks
X-MFC-With:	r341825
2018-12-29 15:13:49 +00:00
Simon J. Gerraty
dfd669ab38 Merge bmake-20181221 2018-12-23 01:05:52 +00:00
Cy Schubert
076b94438c MFV r342175:
Update sqlite3-3.23.1 --> sqlite3-3.26.0 (3260000)

MFC after:	3 days
Security:	https://blade.tencent.com/magellan/index_en.html
		No known CVE was apparently registered.
2018-12-18 01:12:30 +00:00
Dimitry Andric
176fdeee33 Update clang, llvm, lld, lldb, compiler-rt and libc++ version number to
7.0.1 release r349250.  There were no functional changes since the 7.0.1
rc3 import.

PR:		230240, 230355
Relnotes:	yes
MFC after:	2 months
X-MFC-With:	r341825
2018-12-15 14:08:41 +00:00
Martin Matuska
98bf66e624 MFV r341771,342040,342041:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1102: RAR5 reader - fix big-endian problems
  PR #1105: Fix various crash, memory corruption and infinite loop conditions
  PR #1107: RAR5 reader: removed an unused function: bf_is_last_block

MFC after:	1 week
2018-12-13 11:18:45 +00:00
Hans Petter Selasky
46caeeca78 Don't register IOCTLs with capsicum when there is no valid file descriptor.
This fixes tcpdump when using mlx5_X devices.

Differential Revision:	https://reviews.freebsd.org/D18499
Reviewed by:		kib@, slavash@, oshogbo@
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2018-12-12 09:51:10 +00:00
Dimitry Andric
67350cb56a Merge ^/head r340918 through r341763. 2018-12-09 11:39:45 +00:00
Dimitry Andric
0b9890fcbf Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r348686 (effectively 7.0.1 rc3), resolve conflicts, and bump version
numbers.

PR:		230240, 230355
2018-12-09 11:36:04 +00:00
Cy Schubert
85732ac8bc MFV r341618:
Update wpa 2.6 --> 2.7.
2018-12-09 06:45:49 +00:00
Pawel Jakub Dawidek
4926792bc9 Consider the following situation:
The sender has .not_terminated file. It gets disconnected. The last trail
file is then terminated without adding new data (this can happen for example
when auditd is being stopped on the sender). After reconnect the .not_terminated
was not renamed on the receiver as it should.

We were already handling similar situation where the sender crashed and the
.not_terminated trail file was renamed to .crash_recovery. Extend this case to
handle the situation above.
2018-12-07 03:13:36 +00:00
Simon J. Gerraty
2eae894ca7 Update bmake to version 20180919
Cleanup of stats cache
and new :q modifier.
2018-12-06 20:56:19 +00:00
Cy Schubert
efc4145a6e Remove an ugly Ultrix hack. Ultrix has been AWOL since the last ice
age, more to come.

MFC after:	1 week
2018-12-06 20:15:54 +00:00
Slava Shwartsman
318bd2348c opensm: Use precision specifier for scanf
If user input a string larger than the length of buffer, the stack
memory will be corrupted.

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies
2018-12-05 13:28:46 +00:00
Slava Shwartsman
a6578a04e4 libibverbs: Fix memory leak in ibv_read_sysfs_file().
Testing packetdrill using valgrind resulted in finding a memory leak in
ibv_read_sysfs_file(). The attached patch fixes it.

Submitted by:	tuexen@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies
2018-12-05 13:28:17 +00:00
Cy Schubert
b1ece51fb8 As part of the general cleanup of the ipfilter code, special cases
are committed separately to document fixing them separately from
the general cleanup. In this case we don't want to hide the utter
brokenness of what is being fixed.

Clean up a discombobulated block of #if's, with one block unreachable.
ip_fil.c is used in ipftest which is used to dry-run test ipfilter
rules in userspace without loading them in the kernel. The call to
(*ifp->if_output) matches that in the FreeBSD kernel.

Further testing and work will be required to make ipftest fully
functional.

MFC after:	1 week
2018-12-04 06:11:04 +00:00
Yuri Pankov
f2dfec1ffb vi: fix UTF-8 detection.
PR:		202290
Submitted by:	lampa@fit.vutbr.cz
Reviewed by:	bapt
Approved by:	kib (mentor, implicit)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D17950
2018-11-26 15:33:55 +00:00
Martin Matuska
7d69e4cde7 MFV r340938:
Sync libarchive with vendor.

Relevant vendor changes:
  Issue #1096: Support extracting ACLs with in-entry comments (GNU tar)
  PR #1023: Support extracting extattrs as non-root on non-user-writeable
            files

MFC after:	1 week
2018-11-26 11:04:35 +00:00
Dimitry Andric
3d5db45595 Merge ^/head r340427 through r340868. 2018-11-24 14:46:06 +00:00
Martin Matuska
276f481d65 MFV r340865:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1080: Spelling fixes
  PR #1084: RAR5 reader bugfixes
  PR #1091: fix use-after-free in delayed newc link processing
  PR #1092: Fix a few obvious resource leaks and strcpy() misuses

MFC after:	1 week
2018-11-24 01:25:45 +00:00
Mateusz Guzik
248b5d08b3 strings: unbreak the build after r340746
Discussed with:	oshogbo
Sponsored by:	The FreeBSD Foundation
2018-11-21 22:37:49 +00:00
Mariusz Zaborski
4f486ad6f6 strings: fix style nits
Reviewed by:	cem, emaste, Joseph Koshy <jkoshy@users.sourceforge.net>
Differential Revision:	https://reviews.freebsd.org/D18036
2018-11-21 21:48:02 +00:00
Maxim Sobolev
65caaa0ed6 Fix CU: output of the --debug-dump=decodedline, the problem there
is that both file name and current directory is recorded, however
file name sometimes already contains absolute path. In which case
prefixing it with directory name results in an invalid pathname.

Only append directory name if the file name does not start with '/'.
This seems to DTRT.

Approved by:	emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D18290
2018-11-21 21:46:06 +00:00
Yuri Pankov
adeebb8308 Make mbstowcs_basic test pass, now that we have more ctype definitions.
Reported by:	jenkins
Approved by:	kib (mentor, implicit)
2018-11-17 12:59:59 +00:00
Mateusz Piotrowski
830809aea1 smbutil(1): Improve mdoc formatting.
Also, make the path to the example configuration file absolute.

Reviewed by:	bcr
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17985
2018-11-14 15:15:07 +00:00
Edward Tomasz Napierala
d5aef6d6ca Pick 57553c3b1a5592dc4c03f3c6831d9b794e523865 from upstream:
Avoid touching all pages in extent_recycle for debug build.

    We may have a large number of pages with *zero set (since they are populated on
    demand).  Only check the first page to avoid paging in all of them.

This makes it easy to compare performance with and without 'retain:true'.

Discussed with:	jasone
Obtained from:	Qi Wang <interwq at gwu dot edu>
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-11-14 13:06:48 +00:00
Ed Maste
7ee126159f Revert r340385, strings capability mode
This needs to be reworked for bootstrapping.
2018-11-13 01:30:31 +00:00
Ed Maste
672b07ce30 strings: enter capability mode when operating on stdin
Reviewed by:	oshogbo
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2018-11-12 20:38:43 +00:00
Dimitry Andric
9b5cb2f639 Merge ^/head r340235 through r340367. 2018-11-12 16:41:41 +00:00
Mariusz Zaborski
752d135e0d libcasper: ange the name of limits in cap_dns so the intentions are obvious.
Reported by:	pjd
MFC after:	3 weeks
2018-11-12 15:52:45 +00:00
Ed Maste
c59e510923 nvi: remove superfluous space before ^\
This fixes alignment in vi's 'viusage' command and has been fixed
upstream and in OpenBSD.

Submitted by:	Raf Czlonka (github:rjc)
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd/pull/122
2018-11-09 17:39:57 +00:00
Yuri Pankov
9eb7d595e1 Reset persistent mbstates when rune locale encoding changes.
This was shown to be a problem by side effect of now-enabled test case,
which was going through C, en_US.UTF-8, ja_JP.SJIS, and ja_JP.eucJP,
and failing eventually as data in mbrtowc's mbstate, that was
perfectly correct for en_US.UTF-8 was treated as incorrect for
ja_JP.SJIS, failing the entire test case.

This makes the persistent mbstates to be per ctype-component,
and not per-locale so we could easily reset the mbstates when
only LC_CTYPE is changed.

Reviewed by:	bapt, pfg
Approved by:	kib (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17796
2018-11-09 03:32:53 +00:00
Dimitry Andric
c06e7b66a1 Merge ^/head r340126 through r340212. 2018-11-07 18:52:28 +00:00
Edward Tomasz Napierala
086165ecb5 Pick 50b473c8839f5408df179bdf6f2b3fd2cf5c3b2f from upstream:
Set commit properly for FreeBSD w/ overcommit.

    When overcommit is enabled, commit needs to be set when doing mmap().  The
    regression was introduced in f80c97e.

This fixes 'retain:true'.

Discussed with:	jasone
Obtained from:	Qi Wang <interwq at gwu dot edu>
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-11-06 12:05:46 +00:00
Mariusz Zaborski
9b5dd8ff8b Un-break build libexpact.
The writeRandomBytes_arc4random is not used if the arc4random_buf
is available. This caused compiler to throw warnings which are treated as
an error in libexpact.

Approved by:	vangyzen
2018-11-04 18:24:11 +00:00
Eric van Gyzen
0a48773f8c Update expat to 2.2.6
Update contrib/expat by merging from the vendor branch.

Update expat_config.h manually, using
    make -C /usr/ports/textproc/expat2 configure
as a baseline.

MFC after:	1 month
Relnotes:	yes
Security:	yes; see contrib/expat/Changes since 2.2.0
Sponsored by:	Dell EMC Isilon
2018-11-04 16:08:59 +00:00
Dimitry Andric
2a22df74e9 Merge ^/head r339813 through r340125. 2018-11-04 15:49:06 +00:00
Dimitry Andric
689486003b Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r346007 (effectively 7.0.1 rc2), resolve conflicts, and bump version
numbers.

PR:		230240, 230355
2018-11-04 15:46:30 +00:00
Yuri Pankov
32a8ec8bdd strptime: make %k and %l specifiers match their description in
strftime(3), and allow them to process space-padded input.

PR:		230720
Submitted by:	rlittle@inetco.com (original version)
Approved by:	kib (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17761
2018-11-03 23:37:13 +00:00
Devin Teske
e0ff4751f0 Update awk(1) manual to state an exception to egrep(1)-like RE syntax
Reviewed by:	imp, jmg
MFC after:	3 days
Sponsored by:	Smule, Inc.
Differential Revision:	https://reviews.freebsd.org/D17739
2018-11-02 23:03:40 +00:00
Ed Maste
e74f411d47 Define NT_FREEBSD_FEATURE_CTL ELF note type
This ELF note will be used to allow binaries to opt out of, or in to,
upcoming vulnerability mitigation and other features.

Committing the definition and readelf change separately to allow
independent MFC.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2018-11-02 19:02:03 +00:00
Ed Maste
e37480d938 readelf: decode R_MIPS_HIGHER and R_MIPS_HIGHEST relocation types
Sponsored by:	The FreeBSD Foundation
2018-11-02 18:40:01 +00:00
Dag-Erling Smørgrav
209fcf8ed9 Merge upstream r4932: turn so-reuseport option off by default.
MFC after:	3 days
2018-11-01 23:42:35 +00:00
Mateusz Piotrowski
8df507900a smbutil(1): Reference nsmb.conf(5) and mount_smbfs(8)
Reviewed by:	bcr
Approved by:    krion (mentor, implicit), mat (mentor, implicit)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D17809
2018-11-01 22:54:52 +00:00
Mateusz Piotrowski
62d7aab953 mount_smbfs(8): Mention /etc/nsmb.conf, smbutil(1) and nsmb.conf(5)
Reviewed by:	bcr
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D17808
2018-11-01 22:50:50 +00:00
Mateusz Piotrowski
d5e3b0b563 mount_smbfs(8): Add the STANDARDS and HISTORY sections
- Document that mount_smbfs(8) only supports SMB1 and that SMB2 and SMB3
  are not supported at the moment. Suggest users to browse ports for
  software compatible with newer versions of the protocol.
- Copy supported servers list from README.
- Add a SEE ALSO section and reference the chapter about Samba in the
  FreeBSD Handbook.
- Add a HISTORY section.
- Style changes:
  - Use Dq instead of Em in the EXAMPLES section.
  - Mark command modifiers with Cm.

Reviewed by:	bcr
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
MFC after:	1 week
Sponsored by:   Bally Wulff Games & Entertainment GmbH
Differential Revision:	https://reviews.freebsd.org/D17798
2018-11-01 11:37:19 +00:00
Edward Tomasz Napierala
9436aa0e66 Remove no longer relevant comment, as suggested by imp@.
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-10-30 15:44:16 +00:00
Edward Tomasz Napierala
02ba1d993f Remove useless call to access(2) from tzcode. Quoting OpenBSD:
> Remove doaccess variable and access(2) call since this interfers with
> applications like zdump(8) because pledge(2) doesn't allow access(2) to
> /usr/share/zoneinfo.
>
> millert@ better described why this call can go away:
>
> "This looks like an attempt to do access checks based on the real uid instead
> of the effective uid.  Basically for setuid programs we don't want to allow a
> user to set TZ to a path they should not be able to otherwise access.
>
> However, we already have a check for issetugid() above so I think the doaccess
> bits can just be removed and we can rely on open()."
>
> After discussion with tb@, deraadt@ and millert@, this was also OK'ed by them

Reviewed by:	imp
Obtained from:	OpenBSD
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D17701
2018-10-30 15:43:06 +00:00
Yuri Pankov
281c29899f Connect libc/tests/time to the build, adding test cases for strptime()
issues fixed recently, and disabling the failing ones (mostly due to TZ
parsing differences with NetBSD).

Reviewed by:	ngie
Approved by:	kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D17546
2018-10-30 02:37:23 +00:00
Navdeep Parhar
7815283df2 rping(1): Make sure the socket address defaults to something reasonable
when running as the server.

Submitted by:	Krishnamraju Eraparaju @ Chelsio
Reviewed by:	hselasky@, np@
MFC after:	1 month
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D17707
2018-10-29 21:46:05 +00:00
Philip Paeps
b999412482 Import tzdata 2018g
Changes: https://github.com/eggert/tz/blob/2018g/NEWS

MFC after:	3 days
2018-10-28 23:54:05 +00:00
Dimitry Andric
fda9adafa3 Merge ^/head r339670 through r339812. 2018-10-27 14:44:39 +00:00
Martin Matuska
b160a8765d MFV r339792:
Sync libarchive with vendor.

Relevant vendor changes:
  RAR5 reader: more maybe-uninitialized size_t fixes for riscv64
               FreeBSD build

MFC after:	1 month
2018-10-26 21:17:50 +00:00
Martin Matuska
343d766b69 MFV r339750:
Sync libarchive with vendor.

Relevant vendor changes:
  RAR5 reader: FreeBSD build platform fixes for powerpc(64), mips(64),
               sparc64 and riscv64

MFC after:	1 month
2018-10-25 23:13:19 +00:00
Martin Matuska
b1c91e4b6c MFV r339640,339641,339644:
Sync libarchive with vendor

Relevant vendor changes:
  PR #1013: Add missing h_base offset when performing absolute seeks in
            xar decompression
  PR #1061: Add support for extraction of RAR v5 archives
  PR #1066: Fix out of bounds read on empty string filename for gnutar, pax
            and v7tar
  PR #1067: Fix temporary file path buffer overflow in tests
  IS #1068: Correctly process and verify integer arguments passed to
            bsdcpio and bsdtar
  PR #1070: Don't default XAR entry atime/mtime to the current time

MFC after:	1 month
2018-10-25 21:44:17 +00:00
Dimitry Andric
3e0f7fbee0 Add interpose flag, introduced in head r342239, to the list of checked
flag names.
2018-10-25 20:44:14 +00:00
Dimitry Andric
c6879c6c14 Merge ^/head r339015 through r339669. 2018-10-23 21:09:37 +00:00
Dimitry Andric
950f620367 Pull in r345002 from upstream lld trunk:
Don't mess up RelIplt symbols during relocatable processing

  Summary:
  During upgrading of the FreeBSD source tree with lld 7.0.0, I noticed
  that it started complaining about crt1.o having an "index past the
  end of the symbol table".

  Such a symbol table looks approximately like this, viewed with
  readelf -s (note the Ndx field being messed up):

  Symbol table '.symtab' contains 4 entries:
     Num:    Value  Size Type    Bind   Vis      Ndx Name
       0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
       1: 00000000     0 SECTION LOCAL  DEFAULT    1
       2: 00000000     0 NOTYPE  WEAK   HIDDEN  RSV[0xffff] __rel_iplt_end
       3: 00000000     0 NOTYPE  WEAK   HIDDEN  RSV[0xffff] __rel_iplt_start

  At first, it seemed that recent ifunc relocation work had caused this:
  <https://reviews.freebsd.org/rS339351>, but it turned out that it was
  due to incorrect processing of the object files by lld, when using -r
  (a.k.a. --relocatable).

  Bisecting showed that rL324421 ("Convert a use of Config->Static") was
  the commit where this new behavior began.  Simply reverting it solved
  the issue, and the __rel_iplt symbols had an index of UND again.

  Looking at Rafael's commit message, I think he simply missed the
  possibility of --relocatable being in effect, so I have added an
  additional check for it.

  I also added a simple regression test case.

  Reviewers: grimar, ruiu, emaste, espindola

  Reviewed By: ruiu

  Subscribers: arichardson, krytarowski, llvm-commits

  Differential Revision: https://reviews.llvm.org/D53515

This fixes a problem in lld where it places incorrect indexes for ifunc
related symbols in crt1.o and friends, making it impossible to link most
normal programs with it.
2018-10-23 20:56:59 +00:00
Edward Tomasz Napierala
0c885e274a Pick f80c97e477d1b3fe7778c65d9439d673738b4131 from upstream:
Rework the way jemalloc uses mmap(2) on FreeBSD.

    This makes it directly use MAP_EXCL and MAP_ALIGNED() instead
    of weird workarounds involving mapping at random places and then
    unmapping parts of them.

Discussed with:	jasone
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-10-23 14:11:35 +00:00
Edward Tomasz Napierala
bff19560ee Pick 676cdd66792ccb629a978837ea2a066d5db342cc from upstream:
Disable runtime detection of lazy purging support on FreeBSD.

    The check doesn't seem to serve any purpose here, and this shaves
    off three syscalls on binary startup.

Discussed by:	jasone
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-10-23 13:54:54 +00:00
Kristof Provost
a00d561893 tcpdump: Log uid on pflog interfaces
If pf logs the user id ('pass out log (user)') have tcpdump also print
this.

Example output:
 00:00:00.000000 rule 0/0(match) [uid 1001]: pass out on vtnet0: (tos 0x0, ttl 64, id 57539, offset 0, flags [none], proto UDP (17), length 55)
    172.16.2.2.18337 > 172.16.2.1.53: [bad udp cksum 0x5c58 -> 0x16e4!] 40222+ A? google.be. (27)

PR:		122773
Differential Revision:	https://reviews.freebsd.org/D17625
2018-10-21 21:17:42 +00:00
Philip Paeps
89abb9f8c2 Import tzdata 2018f
Changes: https://github.com/eggert/tz/blob/2018f/NEWS

MFC after:	3 days
2018-10-20 22:32:10 +00:00
Baptiste Daroussin
f4f33ea0c7 Update libdialog to 1.3-20180621 2018-10-20 20:49:46 +00:00
Ed Maste
447a8c25fe libelf: also test for 64-bit ELF in _libelf_is_mips64el
Although _libelf_is_mips64el is only called in contexts where we've
already checked that e_class is ELFCLASS64 but this may change in the
future.  Add a safety belt so that we don't access an invalid e_ehdr64
union member if it does.

Reported by:	jkoshy (in review D17380)
2018-10-20 18:47:45 +00:00
Ed Maste
aee4c74cdd objcopy: restore behaviour required by GCC's build
In r339350 filter_reloc() was removed, to fix the case of stripping
statically linked binaries with relocations (which may come from ifunc
use, for example).  As a side effect this changed the behaviour when
stripping object files - the output was broken both before and after
r339350, in different ways.  Unfortunately GCC's build process relies
on the previous behaviour, so:

- Revert r339350, restoring filter_reloc().
- Fix an unitialized variable use (commited as r3638 in ELF Tool Chain).
- Change filter_reloc() to omit relocations referencing removed
  symbols, while retaining relocations with no symbol reference.
- Retain the entire relocation section if it references the dynamic
  symbol table (fix from kaiw in D17596).

PR:		232176
Reported by:	antoine
Reviewed by:	kaiw
MFC with:	r339350
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17596
2018-10-20 17:27:53 +00:00
Glen Barber
b958317950 - Update head to 13.0-CURRENT.
- Bump MACHINE_TRIPLE, TARGET_TRIPLE, FBSD_MAJOR, FBSD_CC_VER,
  FREEBSD_CC_VERSION, OS_VERSION.
- Update comment in UPDATING regarding debugging options.
- Remove debug.witness.trace=0 from installation media.
- Bump __FreeBSD_version.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-10-19 00:37:47 +00:00
Yuri Pankov
a10034cb47 apropos/whatis: use output of manpath(1) to set defpaths if -M is not
specified.  This fixes searching the paths specified in
/usr/local/etc/man.d/*.conf, as currently apropos/whatis from mandoc
suite aren't aware about them.

PR:		227922
Reviewed by:	bapt
Approved by:	re (gjb), kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D17454
2018-10-16 17:17:11 +00:00
Ed Maste
c9504239e8 elfcopy: delete filter_reloc, it is broken and unnecessary
elfcopy contained logic to filter individual relocations in STRIP_ALL
mode.  However, this is not valid; relocations emitted by the linker are
required, unless they apply to an entire section being removed (which is
handled by other logic in elfcopy).

Note that filter_reloc was also buggy: for RELA relocation sections it
operated on uninitialized rel.r_info resulting in invalid operation.

The logic most likely needs to be inverted: instead of removing
relocations because their associated symbols are being removed, we must
keep symbols referenced by relocations.  That said, in practice we do
not encounter this code path today: objects being stripped are either
dynamically linked binaries which retain .dynsym, or static binaries
with no relocations.

Just remove filter_reloc.  This fixes certain cases including statically
linked binaries containing ifuncs.  Stripping binaries with relocations
referencing removed symbols was already broken, and after this change
may still be broken in a different way.

PR:		232176
Reviewed by:	kaiw, kib, markj
Approved by:	re (rgrimes)
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17519
2018-10-13 21:26:07 +00:00
Ed Maste
b371a9f082 lld: set sh_link and sh_info for .rela.plt sections
ELF spec says that for SHT_REL and SHT_RELA sh_link should reference the
associated string table and sh_info should reference the "section to
which the relocation applies."  ELF Tool Chain's elfcopy / strip use
this (in part) to control whether or not the relocation entry is copied
to the output.

LLVM PR 37538 https://bugs.llvm.org/show_bug.cgi?id=37538

Approved by:	re (kib)
Obtained from:	llvm r344226 (backported for 6.0)
2018-10-11 13:19:17 +00:00
Dag-Erling Smørgrav
43f8d28c37 Regenerate: remove GOST, enable DANE-TA now that we have OpenSSL 1.1.1.
Approved by:	re (gjb)
2018-10-11 08:14:31 +00:00
Dag-Erling Smørgrav
b319ead8be Try harder to sanitize the environment before running configure.
Remove a workaround for older Unbound versions that used sbrk.

Approved by:	re (gjb)
2018-10-10 22:29:06 +00:00
Dag-Erling Smørgrav
a755b6f6ca Upgrade to 1.8.1.
Approved by:	re (kib)
2018-10-10 08:53:47 +00:00
Dag-Erling Smørgrav
4c75e3aa0f Upgrade Unbound to 1.8.0. More to follow.
Approved by:	re (kib)
2018-10-10 07:55:06 +00:00
Dag-Erling Smørgrav
0a0da7ddd5 Vendor import of Unbound 1.8.1. 2018-10-09 19:42:34 +00:00
Glen Barber
90682fb3ab MFV r339226 (peter): Record merge of serf-1.3.9.
Sponsored by:	The FreeBSD Foundation
2018-10-08 15:16:04 +00:00
Glen Barber
01d4e2149e MFH r338661 through r339200.
Sponsored by:	The FreeBSD Foundation
2018-10-05 17:53:47 +00:00
Kurt Lidl
896571557d Document signal handling in blacklistd(8).
Reviewed by:	bcr@, 0mp@
Approved by:	re (gjb@)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D17423
2018-10-05 16:52:21 +00:00
Pawel Jakub Dawidek
58554c8d88 Remove invalid comments and correct some typos.
Approved by:	re (kib)
2018-10-04 05:57:27 +00:00
Pawel Jakub Dawidek
0785e8cedc When the adist_free list is empty and we lose connection to the receiver we
move all elements from the adist_send and adist_recv lists back onto the
adist_free list, but we don't wake consumers waitings for the adist_free list
to become non-empty. This can lead to the sender process stopping audit trail
files distribution and waiting forever.

Fix the problem by adding the missing wakeup.

While here slow down spinning on CPU in case of a short race in
sender_disconnect() and add an explaination when it can occur.

PR:		201953
Reported by:	peter
Approved by:	re (kib)
2018-10-04 05:54:57 +00:00
Pawel Jakub Dawidek
ac67acf0ef When we look for a new trail file there might be a race between find trail
file name and opening it. This race was not properly handled, because we were
copying new name before checking for openat(2) error and when we were trying
again we were starting with the next trail file. This could result in skipping
distribution of such a trail file.

Fix this problem by checking for ENOENT first (only for .not_terminated files)
and then updating (or not) tr_filename before restarting the search.

PR:		200139
Reported by:	peter
Approved by:	re (kib)
2018-10-04 05:48:09 +00:00
Ed Maste
1c45d770a7 libelf: correct mips64el test to use ELF header
libelf maintains two views of endianness: e_byteorder, and
e_ident[EI_DATA] in the ELF header itself.  e_byteorder is not always
kept in sync, so use the ELF header endianness to test for mips64el.

PR:		231790
Bisected by:	sbruno
Reviewed by:	jhb
Approved by:	re (kib)
MFC with:	r338478
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17380
2018-10-02 15:08:41 +00:00
Jung-uk Kim
41451aa34f Make sendmail work with OpenSSL 1.1 API. Taken from the ports tree.
https://svnweb.freebsd.org/ports/head/mail/sendmail/files/patch-tls.c?revision=466240

Requested by:	gshapiro
2018-10-01 20:55:01 +00:00
Jung-uk Kim
9f5609e914 Revert r338773. A patch from the ports tree will be committed.
Requested by:	gshapiro
2018-10-01 20:51:26 +00:00
Ed Maste
ea28e71e86 clang: allow ifunc resolvers to accept arguments
Previously Clang required ifunc resolution functions to take no
arguments, presumably because GCC documented ifunc resolvers as taking
no arguments.  However, GCC accepts resolvers accepting arguments, and
our rtld passes CPU ID information (cpuid, hwcap, etc.) to ifunc
resolvers.  Just remove the check from the in-tree compiler for our in-
tree compiler; a different (per-OS) approach may be required upstream.

Reported by:	mjg
Approved by:	re (rgrimes)
MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2018-09-29 20:01:23 +00:00
Dimitry Andric
678769a9fc Add compiler-rt's libFuzzer, not connected to buildworld yet.
For now, the libraries can be built and installed using:

cd /usr/src/lib/libclang_rt/fuzzer && \
  make obj && \
  make depend && \
  make && \
  sudo make install
cd /usr/src/lib/libclang_rt/fuzzer_no_main && \
  make obj && \
  make depend && \
  make && \
  sudo make install

See https://llvm.org/docs/LibFuzzer.html for more information.
2018-09-29 15:17:17 +00:00
Dimitry Andric
d07b9c7a7d Pull in r329557 from upstream lld trunk (by George Rimar):
[ELF] - Allow LLD to produce file symbols.

  This is for PR36716 and
  this enables emitting STT_FILE symbols.

  Output size affect is minor:
  lld binary size changes from 52,883,408 to 52,949,400
  clang binary size changes from 83,136,456 to 83,219,600

  Differential revision: https://reviews.llvm.org/D45261

This fixes a regression in lld that made it stop emitting STT_FILE
symbols, which ctfmerge relies upon to uniquify function table entries
that reference STB_LOCAL symbols.  Consequently, ctfmerge stopped
emitting entries for static functions into the function table, and
dtrace no longer gets type info for them.

Approved by:	re (kib)
Reported by:	markj
PR:		230444
MFC after:	3 days
2018-09-29 14:12:03 +00:00
Dimitry Andric
ce44d80853 Merge ^/head r338731 through r338987. 2018-09-27 20:00:07 +00:00
Mateusz Piotrowski
3d31df21e7 Cross-reference style.Makefile(5) from make(1) and make.conf(5).
Reviewed by:	krion, mat, sjg
Approved by:	re (gjb), krion (mentor), mat (mentor)
Sponsored by:	Bally Wulff Games & Entertainment GmbH
Differential Revision:	https://reviews.freebsd.org/D17170
2018-09-27 12:20:32 +00:00
Ed Maste
fb2f386360 libevent: eliminate in-tree usage of arc4random_addrandom
Apply r338059 to newly-added libevent 2.1.18.

Sponsored by:	The FreeBSD Foundation
2018-09-25 17:41:48 +00:00
Ed Maste
f874fbd8e8 Copy libevent sources to contrib
To replace the libevent embedded in ntp, for OpenSSL 1.1.1 compat.
2018-09-24 16:48:54 +00:00
Martin Matuska
482a81508c MFV r338797:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1019: Add allocation check for the zip_entry struct
  Oss-Fuzz #10192: Handle whitespace-only ACL fields correctly

Approved by:	re (kib)
MFC after:	1 week
2018-09-20 11:44:36 +00:00
Baptiste Daroussin
61d06d6bd1 Import mandoc 1.14.4
Approved by:	re (kib)
MFC after:	1 week
2018-09-20 10:58:52 +00:00
Martin Matuska
21d41b7887 Update vendor/libarchive/dist to git 0cda60af13e709e670af90553b2271bf194e7ccd
Relevant vendor changes:
  PR #1019: Add allocation check for the zip_entry struct
  Oss-Fuzz #10192: Handle whitespace-only ACL fields correctly
2018-09-19 10:26:45 +00:00
Jung-uk Kim
8eec4954fb Make unbound buildable. 2018-09-19 07:03:28 +00:00
Jung-uk Kim
b285c5df3a Make telnet(1) buildable. 2018-09-19 07:01:22 +00:00
Jung-uk Kim
ba3bb244c9 Update Apache Serf to 1.9.3 to support OpenSSL 1.1.1. 2018-09-19 06:59:28 +00:00
Jung-uk Kim
3459507c9d Revert r338774. Unrelated changes were committed with Apache Serf. 2018-09-19 06:56:37 +00:00
Jung-uk Kim
3d32dc633c Update Apache Serf to 1.3.9 to make it buildable with OpenSSL 1.1.1. 2018-09-19 06:49:55 +00:00
Jung-uk Kim
b7aeb266b0 Make sendmail(8) buildable. 2018-09-19 06:48:45 +00:00
Jung-uk Kim
4a189b08ba Make auditdistd(8) buildable. 2018-09-19 06:45:13 +00:00
Jung-uk Kim
cdc5b7da02 Make libldns buildable. 2018-09-19 06:44:31 +00:00
Jung-uk Kim
b86d13984b Make dma(8) buildable. 2018-09-19 06:42:05 +00:00
Jung-uk Kim
d66820f2c8 Make libbsnmp buildable. 2018-09-19 06:39:10 +00:00
Dimitry Andric
38fb40102a Merge llvm, clang, lld, lldb, compiler-rt and libc++ 7.0.0 release
r342383, and bump version numbers.

PR:		230240, 230355
2018-09-17 19:04:15 +00:00
Dimitry Andric
f5450581eb Pull in r325478 from upstream clang trunk (by Ivan A. Kosarev):
[CodeGen] Initialize large arrays by copying from a global

  Currently, clang compiles explicit initializers for array elements
  into series of store instructions. For large arrays of built-in types
  this results in bloated output code and significant amount of time
  spent on the instruction selection phase. This patch fixes the issue
  by initializing such arrays with global constants that store the
  binary image of the initializer.

  Differential Revision: https://reviews.llvm.org/D43181

This should fix a compiler hang (and excessive memory usage) while
building the science/rmg port.

Approved by:	re (kib)
Reported by:	yuri@tsoft.com
See also:	https://bugs.llvm.org/show_bug.cgi?id=38798
MFC after:	3 days
2018-09-15 21:22:50 +00:00
Dimitry Andric
c0b5e99154 Merge ^/head r338595 through r338689, and resolve conflicts. 2018-09-14 19:50:36 +00:00
Dimitry Andric
df57b3139f Pull in r335365 from upstream llvm trunk (by Krzysztof Parzyszek):
Initialize LiveRegs once in BranchFolder::mergeCommonTails

This should fix '(TRI && "LivePhysRegs is not initialized."' assertions
when building the lang/qt5-qml port in certain configurations.

Approved by:	re (kib)
Reported by:	Piotr Kubaj <pkubaj@anongoth.pl>
PR:		231355
MFC after:	3 days
2018-09-14 19:25:23 +00:00
Ed Maste
1ae9615a9a lld: add -z interpose support
-z interpose sets the DF_1_INTERPOSE flag, marking the object as an
interposer.

Committed upstream as LLVM r342239.

PR:		230604
Reported by:	jbeich
Reviewed by:	markj
Approved by:	re (kib)
MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17172
2018-09-14 15:15:16 +00:00
Glen Barber
fa8050170a Remove __DATE__ and __TIME__ from ibdiag_common.c, replacing with
the hard-coded string "not available" to ensure reproducible builds.

Discussed with:	emaste
Approved by:	re (rgrimes)
Sponsored by:	The FreeBSD Foundation
2018-09-13 16:41:15 +00:00
Hans Petter Selasky
e6895e8049 Fix for backends which doesn't support capsicum.
Not all libpcap backends use the BPF compatible set
of IOCTLs. For example the mlx5 backend uses libibverbs
which is currently not capsicum compatible.

Disable sandboxing for such backends.

MFC after:		3 days
Discussed with:		emaste@
Approved by:		re (kib)
Sponsored by:		Mellanox Technologies
2018-09-12 10:09:59 +00:00
Martin Matuska
a7bc28227e MFV r338519:
Update libarchive to 3.3.3

As all important changes have already been merged from libarchive git
this is just version number bump, documentation update and some
polishing for cpio tests. Other source code changes are not relevant to
FreeBSD.

Approved by:	re (gjb)
MFC after:	1 week
2018-09-11 20:51:34 +00:00
Dimitry Andric
c826f0db60 Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r341916, resolve conflicts, and bump version numbers.

PR:		230240, 230355
2018-09-11 18:50:40 +00:00
Dimitry Andric
3af64f0311 Merge ^/head r338392 through r338594. 2018-09-11 18:41:00 +00:00
Dag-Erling Smørgrav
7da0adf72b Upgrade Unbound to 1.7.3. More to follow.
Approved by:	re (kib@)
2018-09-10 17:37:34 +00:00
Dag-Erling Smørgrav
3bd4df0a68 Upgrade Unbound to 1.7.2. More to follow.
Approved by:	re (kib@)
2018-09-10 16:56:44 +00:00
Dag-Erling Smørgrav
dcaa814d35 Vendor import of Unbound 1.8.0. 2018-09-10 16:32:55 +00:00
Dag-Erling Smørgrav
7b6fdf425a Vendor import of Unbound 1.7.2. 2018-09-10 16:30:18 +00:00
John Baldwin
eb81f38a62 Fix objcopy for little-endian MIPS64 objects.
MIPS64 does not store the 'r_info' field of a relocation table entry as
a 64-bit value consisting of a 32-bit symbol index in the high 32 bits
and a 32-bit type in the low 32 bits as on other architectures.  Instead,
the 64-bit 'r_info' field is really a 32-bit symbol index followed by four
individual byte type fields.  For big-endian MIPS64, treating this as a
64-bit integer happens to be compatible with the layout expected by other
architectures (symbol index in upper 32-bits of resulting "native" 64-bit
integer).  However, for little-endian MIPS64 the parsed 64-bit integer
contains the symbol index in the low 32 bits and the 4 individual byte
type fields in the upper 32-bits (but as if the upper 32-bits were
byte-swapped).

To cope, add two helper routines in gelf_getrel.c to translate between the
correct native 'r_info' value and the value obtained after the normal
byte-swap translation.  Use these routines in gelf_getrel(), gelf_getrela(),
gelf_update_rel(), and gelf_update_rela().  This fixes 'readelf -r' on
little-endian MIPS64 objects which was previously decoding incorrect
relocations as well as 'objcopy: invalid symbox index' warnings from
objcopy when extracting debug symbols from kernel modules.

Even with this fixed, objcopy was still crashing when trying to extract
debug symbols from little-endian MIPS64 modules.  The workaround in
gelf_*rel*() depends on the current ELF object having a valid ELF header
so that the 'e_machine' field can be compared against EM_MIPS.  objcopy
was parsing the relocation entries to possibly rewrite the 'r_info' fields
in the update_relocs() function before writing the initial ELF header to
the destination object file.  Move the initial write of the ELF header
earlier before copy_contents() so that update_relocs() uses the correct
symbol index values.

Note that this change should really go upstream.  The binutils readelf
source has a similar hack for MIPS64EL though I implemented this version
from scratch using the MIPS64 ABI PDF as a reference.

Discussed with:	jkoshy
Reviewed by:	emaste, imp
Approved by:	re (gjb, kib)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D15734
2018-09-05 20:51:53 +00:00
Dimitry Andric
8ba00cf9b7 Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r340910, resolve conflicts, and bump version numbers.

PR:		230240, 230355
2018-08-29 20:53:24 +00:00
Dimitry Andric
7847e04111 Merge ^/head r338026 through r338297, and resolve conflicts. 2018-08-24 18:09:23 +00:00
Dimitry Andric
a0d1f77805 Apply r338251 ("Preserve relocations against ifuncs when -zifunc-noplt
is specified") on top of lld 7.0.0.  This is to prepare for another
merge from head.

Obtained from:	02f35faa6d
2018-08-24 17:48:05 +00:00
Bjoern A. Zeeb
0568fefeea Reduce the log level of tcpd_warn calls from ERR to WARNING.
This matches the name and avoids logging of warnings to console with
default syslog.conf, esp. getting rid of:
  warning: /etc/hosts.allow, line ..: can't verify hostname: \
     getaddrinfo(.., AF_INET) failed
2018-08-23 20:44:26 +00:00
Mark Johnston
4023442dc9 Add an lld option to emit PC-relative relocations for ifunc calls.
The current kernel ifunc implementation creates a PLT entry for each
ifunc definition.  ifunc calls therefore consist of a call to the
PLT entry followed by an indirect jump.  The jump target is written
during boot when the kernel linker resolves R_[*]_IRELATIVE relocations.
This implementation is defined by requirements for userland code, where
text relocations are avoided.  This requirement is not present for the
kernel, so the implementation has avoidable overhead (namely, an extra
indirect jump per call).

Address this for now by adding a special option to the static linker
to inhibit PLT creation for ifuncs.  Instead, relocations to ifunc call
sites are passed through to the output file, so the kernel linker can
enumerate such call sites and apply PC-relative relocations directly
to the text section.  Thus the overhead of an ifunc call becomes exactly
the same as that of an ordinary function call.  This option is only for
use by the kernel and will not work for regular programs.

The final form of this optimization is up for debate; for now, this
change is simple and static enough to be acceptable as an interim
solution.

Reviewed by:	emaste
Discussed with:	arichardson, dim
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D16748
2018-08-23 14:58:19 +00:00
Cy Schubert
cdba33f23c For CID 1394785, add a comment explaining that global->event_buf is
not really a char * but a struct rt_msghdr *.

MFC after:	3 days
2018-08-21 19:17:35 +00:00
Xin LI
4e1ef62a36 MFV r338092: ntp 4.2.8p12.
Relnotes:	yes
2018-08-21 02:38:07 +00:00
Xin LI
c1e80940f3 Update userland arc4random() with OpenBSD's Chacha20 based arc4random().
ObsoleteFiles.inc:

    Remove manual pages for arc4random_addrandom(3) and
    arc4random_stir(3).

  contrib/ntp/lib/isc/random.c:
  contrib/ntp/sntp/libevent/evutil_rand.c:

    Eliminate in-tree usage of arc4random_addrandom().

  crypto/heimdal/lib/roken/rand.c:
  crypto/openssh/config.h:

    Eliminate in-tree usage of arc4random_stir().

  include/stdlib.h:

    Remove arc4random_stir() and arc4random_addrandom() prototypes,
    provide temporary shims for transistion period.

  lib/libc/gen/Makefile.inc:

    Hook arc4random-compat.c to build, add hint for Chacha20 source for
    kernel, and remove arc4random_addrandom(3) and arc4random_stir(3)
    links.

  lib/libc/gen/arc4random.c:

    Adopt OpenBSD arc4random.c,v 1.54 with bare minimum changes, use the
    sys/crypto/chacha20 implementation of keystream.

  lib/libc/gen/Symbol.map:

    Remove arc4random_stir and arc4random_addrandom interfaces.

  lib/libc/gen/arc4random.h:

    Adopt OpenBSD arc4random.h,v 1.4 but provide _ARC4_LOCK of our own.

  lib/libc/gen/arc4random.3:

    Adopt OpenBSD arc4random.3,v 1.35 but keep FreeBSD r114444 and
    r118247.

  lib/libc/gen/arc4random-compat.c:

    Compatibility shims for arc4random_stir and arc4random_addrandom
    functions to preserve ABI.  Log once when called but do nothing
    otherwise.

  lib/libc/gen/getentropy.c:
  lib/libc/include/libc_private.h:

    Fold __arc4_sysctl into getentropy.c (renamed to arnd_sysctl).
    Remove from libc_private.h as a result.

  sys/crypto/chacha20/chacha.c:
  sys/crypto/chacha20/chacha.h:

    Make it possible to use the kernel implementation in libc.

PR:		182610
Reviewed by:	cem, markm
Obtained from:	OpenBSD
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D16760
2018-08-19 17:40:50 +00:00
Dimitry Andric
3611ec6048 Merge ^/head r337646 through r338014. 2018-08-18 12:15:54 +00:00
Dimitry Andric
7726714dff Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r339999, resolve conflicts, and bump version numbers.

PR:		230240,230355
2018-08-18 12:11:17 +00:00
Eugene Grosbein
1a498d2e68 bsnmpd(8): fix and optimize interface description processing
* correctly prepare a buffer to obtain interface description from a kernel and
  truncate long description instead of dropping it altogether and
  spamming logs;
* skip calling strlen() for each description and each SNMP request
  for MIB-II/ifXTable's ifAlias.
* teach bsnmpd to allocate memory dynamically for interface descriptions
  to decrease memory usage for common case and not to break
  if long description occurs;

PR:			217763
Reviewed by:		harti and others
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D16459
2018-08-18 10:58:44 +00:00
Dimitry Andric
af5b964ebb For now, revert upstream clang r323281 (by Wei Mi):
Adjust MaxAtomicInlineWidth for i386/i486 targets.

  This is to fix the bug reported in
  https://bugs.llvm.org/show_bug.cgi?id=34347#c6.  Currently, all
  MaxAtomicInlineWidth of x86-32 targets are set to 64.  However, i386
  doesn't support any cmpxchg related instructions. i486 only supports
  cmpxchg.  So in this patch MaxAtomicInlineWidth is reset as follows:
  For i386, the MaxAtomicInlineWidth should be 0 because no cmpxchg is
  supported.  For i486, the MaxAtomicInlineWidth should be 32 because
  it supports cmpxchg.  For others 32 bits x86 cpu, the
  MaxAtomicInlineWidth should be 64 because of cmpxchg8b.

  Differential Revision: https://reviews.llvm.org/D42154

This should fix buildworld on i386, because of our system libraries
missing __atomic_load_8, and possibly other 64 bit atomic functions, for
that architecture.

We should really fix that at some point, but since we have been actually
using cmpxchg8b for years now, it does not seem to matter much...
2018-08-17 16:25:59 +00:00
Mateusz Piotrowski
e896acd05e Fix a broken "SEE ALSO" section of hlfsd(8).
While here pet mandoc and igor.

Reviewed by:	bcr, eadler, krion, mat
Approved by:	krion (mentor), mat (mentor)
Differential Revision:	https://reviews.freebsd.org/D16376
2018-08-14 20:33:48 +00:00
Cy Schubert
0ec68024a0 MFV r337818:
WPA: Ignore unauthenticated encrypted EAPOL-Key data

Ignore unauthenticated encrypted EAPOL-Key data in supplicant
processing. When using WPA2, these are frames that have the Encrypted
flag set, but not the MIC flag.

When using WPA2, EAPOL-Key frames that had the Encrypted flag set but
not the MIC flag, had their data field decrypted without first verifying
the MIC. In case the data field was encrypted using RC4 (i.e., when
negotiating TKIP as the pairwise cipher), this meant that
unauthenticated but decrypted data would then be processed. An adversary
could abuse this as a decryption oracle to recover sensitive information
in the data field of EAPOL-Key messages (e.g., the group key).
(CVE-2018-14526)

Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>

Obtained from:  git://w1.fi/hostap.git
MFC after:      1 day
Security:       CVE-2018-14526
Security:       VuXML: 6bedc863-9fbe-11e8-945f-206a8a720317
2018-08-14 20:24:10 +00:00
Kyle Evans
e112e9d255 MFV r337586: lua: Update to 5.3.5
Bugfix release, nothing too major.

Tested with:	lualoader via userboot, lualoader live
Differential Revision:	https://reviews.freebsd.org/D16665
2018-08-14 18:58:01 +00:00
Warner Losh
243ff7d88b When the LUA floating point model is INT64, we don't need to do the
overflow dance. This avoids compile errors on latter-day gcc compilers
as well as simplifies the generated code.

Reviewed by: kevans@
2018-08-14 18:45:20 +00:00
Warner Losh
07d397d746 Prevent a wanring about checkdp being unused. It's not needed when we
have INT64 floats and somehow snuck through unused until now.

Reviewed by: kevans@
2018-08-14 18:45:16 +00:00
Martin Matuska
b6479158e1 MFV r337744:
Sync libarchive with vendor..

Vendor changes:
  PR #1042: validate iso9660 directory record length

MFC after:	3 days
Security:	CVE-2017-14501
2018-08-14 11:42:32 +00:00