Commit Graph

8101 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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