Commit Graph

1938 Commits

Author SHA1 Message Date
emaste
c801c4e674 MFC r292705: rtld: remove old XXX comment missed in r35529 2016-01-07 14:52:32 +00:00
bdrewery
8e2550bfa6 MFC r291348:
Use LIBEXECDIR for /usr/libexec.
2015-12-04 19:16:56 +00:00
kib
324b84edb0 MFC r289324:
Allow PT_NOTES segments to be located anywhere in the executable
image.
2015-10-28 11:32:39 +00:00
vangyzen
e22b776118 Disable SSE in libthr
Clang emits SSE instructions on amd64 in the common path of
pthread_mutex_unlock.  If the thread does not otherwise use SSE,
this usage incurs a context-switch of the FPU/SSE state, which
reduces the performance of multiple real-world applications by a
non-trivial amount (3-5% in one application).

Instead of this change, I experimented with eagerly switching the
FPU state at context-switch time.  This did not help.  Most of the
cost seems to be in the read/write of memory--as kib@ stated--and
not in the #NM handling.  I tested on machines with and without
XSAVEOPT.

One counter-argument to this change is that most applications already
use SIMD, and the number of applications and amount of SIMD usage
are only increasing.  This is absolutely true.  I agree that--in
general and in principle--this change is in the wrong direction.
However, there are applications that do not use enough SSE to offset
the extra context-switch cost.  SSE does not provide a clear benefit
in the current libthr code with the current compiler, but it does
provide a clear loss in some cases.  Therefore, disabling SSE in
libthr is a non-loss for most, and a gain for some.

I refrained from disabling SSE in libc--as was suggested--because
I can't make the above argument for libc.  It provides a wide variety
of code; each case should be analyzed separately.

https://lists.freebsd.org/pipermail/freebsd-current/2015-March/055193.html

Suggestions from:   dim, jmg, rpaulo
Sponsored by:   Dell Inc.
2015-10-26 16:21:56 +00:00
andrew
c8580db746 MFC r287369:
Ensure we use calculate_first_tls_offset, even if the main program doesn't
have TLS program header. This is needed on architectures with Variant I
tls, that is arm, arm64, mips, and powerpc. These place the thread control
block at the start of the buffer and, without this, this data may be
trashed.

This appears to not be an issue on mips or powerpc as they include a second
adjustment to move the thread local data, however this is on arm64 (with a
future change to fix placing this data), and should be on arm. I am unable
to trigger this on arm, even after changing the code to move the data
around to make it more likely to be hit. This is most likely because my
tests didn't use the variable in offset 0.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	ABT Systems Ltd
2015-09-08 12:00:13 +00:00
emaste
7b55f00a51 MFC r282551: Remove historical GNUC test
The requirement is for a GCC-compatible compiler and not necessarily
GCC itself. However, we currently expect any compiler used for building
the whole of FreeBSD to be GCC-compatible and many things will break if
not; there's no longer a need to have an explicit test for this in rtld.
2015-08-31 19:20:18 +00:00
wblock
be416ea336 MFC 284709:
Call /etc/crontab the "system crontab", not "root's crontab".  While
  here, fix some other wording issues
2015-06-30 19:53:26 +00:00
des
1bc136b874 MFH (r277695): allow tracing dlfunc() / dlsym() events 2015-06-30 14:17:02 +00:00
kib
a71e3ed924 MFC r282245:
Remove the #ifdef DEBUG code, which is not compilable on 64bit
architectures.

PR:	199767
2015-05-06 09:38:44 +00:00
kib
e55c1de276 MFC r282109:
Always do token substitution, do not require -z origin to do it.
2015-05-04 08:19:12 +00:00
emaste
412d04f751 MFC r281107: MIPS rtld: report missing symbol rather than segfaulting
This is only an interim fix; MIPS should be using the MI code instead,
  which does not have this issue.
2015-04-28 12:48:30 +00:00
emaste
f114cb2240 MFC r281005: Make die available as rtld_die for use by MD relocation code
Sponsored by:	The FreeBSD Foundation
2015-04-28 01:15:17 +00:00
kib
5ddf292b71 MFC r281549:
Implement support for -z global linker option.
2015-04-22 10:59:05 +00:00
peter
c8a0a7a3f7 MFC r268182: Initialize page sizes early for ia64. 2015-04-13 08:35:03 +00:00
kib
3937204485 MFC r280816:
Change default visibility for rtld to hidden, on x86.
2015-04-12 06:45:40 +00:00
kib
0fe937192c MFC r264346 (by alc):
Pass MAP_ALIGNED_SUPER to allocate the whole dso region if its text is large
enough for the superpage mapping.
2015-04-12 06:43:13 +00:00
jkim
88fa6bbce5 MFC: r279364
Use realpath(3) to properly expand $ORIGIN to its absolute path.
2015-03-06 22:31:35 +00:00
ngie
de8fb43ec9 MFC r278192:
Add the following options to enable/disable several features in the base system

WITHOUT_BOOTPARAMD - bootparamd
WITHOUT_BOOTPD - bootpd
WITHOUT_FINGER - finger, fingerd
WITHOUT_FTP - ftp, ftpd
WITHOUT_INETD - inetd
WITHOUT_RBOOTD - rbootd
WITHOUT_TCP_WRAPPERS - tcpd, et al
WITHOUT_TFTP - tftp, tftp-server
WITHOUT_TIMED - timed

Sponsored by: EMC / Isilon Storage Division
2015-03-01 22:03:52 +00:00
jhb
7b2a7d1b7b MFC 275412:
The runtime linker needs to include a path to itself in the link map
it exports to the debugger.  It currently has two choices: it can use
a compiled-in path (/libexec/ld-elf.so.1) or it can use the path stored
in the interpreter path in the binary being executed.  The runtime linker
currently prefers the second.  However, this is usually wrong for compat32
binaries since the binary specifies the path of rtld on a 32-bit system
(/libexec/ld-elf.so.1) instead of the actual path (/libexec/ld-elf32.so.1).
For now, always assume the compiled in path (/libexec/ld-elf32.so.1) as
the rtld path and ignore the path in the binary for the 32-bit runtime
linker.
2015-02-23 21:16:02 +00:00
ngie
9ed52cebd8 MFC r277676:
r277676:

  Add MK_TALK knob for building the talk and talkd

  Sponsored by: EMC / Isilon Storage Division
2015-02-13 21:19:54 +00:00
kib
e0c8cbf143 MFC r277936:
Use powerof2().  Remove single-use variable.
2015-02-06 08:58:06 +00:00
kib
375caa6c5f MFC r276627:
Add rtld private interface for dso to detect dynamic loading
vs. static linking.
2015-01-10 09:22:17 +00:00
ngie
d4c625976a MFC r264400,r265836:
r264400:

  NO_MAN= has been deprecated in favor of MAN= for some time, go ahead
  and finish the job. ncurses is now the only Makefile in the tree that
  uses it since it wasn't a simple mechanical change, and will be
  addressed in a future commit.

r265836:

  Remove last two NO_MAN= in the tree. In both of these cases, MAN= is
  what is needed.
2014-12-31 23:25:37 +00:00
ngie
dc3ad5131f MFC r273929:
r273929 (by jmmv):

  MFV: Import atf-0.21.
2014-12-21 08:30:18 +00:00
ngie
32112cfc28 MFC r274364:
Add baud rate support to telnet(1)

  This implements part of RFC-2217

  It's based off a patch originally written by Sujal Patel at Isilon, and
  contributions from other Isilon employees.

  PR: 173728
  Phabric: D995
  Reviewed by: markj, markm
  Sponsored by: EMC / Isilon Storage Division
2014-12-05 12:23:29 +00:00
emaste
b81b7af08d Always return pathname in dl_iterate_phdr's dlpi_name, as Linux does
Linux LD_ITERATE_PHDR(3):
    The dlpi_name field is a null-terminated string giving the
    pathname from which the shared object was loaded.

That functionality is much more useful than returning just the short
name.

Update dl_iterate_phdr(3) to follow r272842

MFC of r272842 and r272848
2014-11-14 21:52:31 +00:00
delphij
ee5d204051 MFC r271493,271688-271689,271696,271854,272139-272143:
Import HyperV Key-Value Pair (KVP) driver and daemon code by Microsoft,
many thanks for their continued support of FreeBSD.

While I'm there, also implement a new build knob, WITHOUT_HYPERV to
disable building and installing of the HyperV utilities when necessary.

The HyperV utilities are only built for i386 and amd64 targets.

Approved by:	re (gjb)
2014-09-30 17:54:57 +00:00
gjb
91dd3107b1 Properly revert r272128.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2014-09-26 03:03:58 +00:00
gjb
d7f7435644 Revert r272149, which introduces obscure vestiges from the
r272128 reversal.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2014-09-26 02:30:47 +00:00
gjb
9ffa63da8b Revert r272128:
Though this passes the buildworld test, this fails during
  installworld with:

  make[3]: "/releng/scripts-release/chroots/10/i386/release/etc/devd/Makefile"
  line 13: Malformed conditional (${MK_HYPERV} != "no")

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2014-09-26 01:08:31 +00:00
delphij
8e573ba7c9 MFC r271493,271688,271689,271696,271854:
Import HyperV Key-Value Pair (KVP) driver and daemon code by Microsoft,
many thanks for their continued support of FreeBSD.

While I'm there, also implement a new build knob, WITHOUT_HYPERV to
disable building and installing of the HyperV utilities when necessary.

The HyperV utilities are only built for i386 and amd64 targets.

Approved by:	re (gjb)
2014-09-25 20:34:13 +00:00
kib
7102c46339 MFC r270798:
Process STT_GNU_IFUNC when doing non-plt relocations.

MFC r270802:
Only do the second pass over non-plt relocations when the first pass
found IFUNCs.

Approved by:	re (gjb)
2014-09-12 16:22:01 +00:00
ngie
e55bc1f0d7 MFC r267176, r267181, r268445 (ATF-related commits):
Phabric: https://reviews.freebsd.org/D706
Approved by: rpaulo (mentor)
Approved by: re (gjb)
Reviewed by: jmmv
Sponsored by: EMC / Isilon Storage Division

r267176:

 Add the *_TESTS_SH_SED_* functionality to atf.test.mk.

 This exists already in plain.test.mk and tap.test.mk and should have been
 added to atf.test.mk too when the feature was first introduced.

 (It is probably time to address the related TODOs but I will do that
 separately.)

r267181:

 Move atf-sh from /usr/bin/ to /usr/libexec/

 In r266650, we made libatf-c and libatf-c++ private libraries so that no
 components outside of the source tree could unintendedly depend on them.

 This change does the same for the "atf-sh library" by moving the atf-sh
 interpreter from its public location in /usr/bin/ to the private location
 in /usr/libexec/.  Our build system will ensure that our own test programs
 use the right binary, but users won't be able to depend on atf-sh by
 "mistake".

 Committing this now to ride the UPDATING notice added with r267172 today.

r268445:

 Fix atf-sh's integration_test

 With the move of atf-sh into /usr/libexec in r267181, some of the
 tests in the integration_test program broke because they could not
 execute atf-sh from the path any longer.

 This slipped through because I do have a local atf installation in
 my home directory that appears in my path, hence the tests could
 still execute my own version.

 Fix this by forcing /usr/libexec to appear at the beginning of the
 path when attempting to execute atf-sh.

 To make upgrading easy (and to avoid an unnecessary entry in UPDATING),
 make integration_test depend on the Makefile so that a rebuild of the
 shell script is triggered.  This requires a hack in the *.test.mk files
 to ensure the Makefile is not treated as a source to the generated
 program.  Ugly, I know, but I don't have a better way of doing this at
 the moment.  Will think of one once I address the TODO in the *.test.mk
 files that suggests generalizing the file generation functionality.

 PR:		191052
 Reviewed by:	Garrett Cooper
2014-09-09 04:00:30 +00:00
kib
75ec0c51d0 MFC r270803:
Document the whole settings needed to build a debug version of rtld.
2014-09-01 08:02:23 +00:00
ngie
b7b1b100cc MFC r266650, r267172 (both by jmmv):
r266650:

  Change libatf-c and libatf-c++ to be private libraries.

  We should not be leaking these interfaces to the outside world given
  that it's much easier for third-party components to use the devel/atf
  package from ports.

  As a side-effect, we can also drop the ATF pkgconfig and aclocal files
  from the base system.  Nothing in the base system needs these, and it
  was quite ugly to have to get them installed only so that a few ports
  could build.  The offending ports have been fixed to depend on
  devel/atf explicitly.

  Reviewed by:  bapt

r267172:

  Homogenize libatf-* version numbers with upstream.

  The libatf-* major version numbers in FreeBSD were one version ahead of
  upstream because, when atf was first imported into FreeBSD, the upstream
  numbers were not respected.  This is just confusing and bound to cause
  problems down the road.

  Fix this by taking advantage of the fact that libatf-* are now private
  and that atf is not yet built by default.  However, and unfortunately, a
  clean build is needed for tests to continue working once "make
  delete-old-libs" has been run; hence the note in UPDATING.

Phabric: D701
Approved by: jmmv (maintainer, mentor)
2014-08-31 23:09:23 +00:00
pfg
564b330f17 MFC r270256:
Always check the limits of array index variables before using them.

Obtained from:	DragonFlyBSD
2014-08-28 18:11:05 +00:00
des
bee605bad2 MFH (r263160): remove lukemftpd 2014-08-23 15:07:09 +00:00
markj
95576e5070 MFC r265456, r265578:
Add a postinit debugger hook to rtld. This will be used by dtrace(1) to halt
the victim process before its entry point is called, at which point probes
and DOF data are registered with the kernel. The r_debug_state hook cannot
be used for this purpose, as it is called before the program's init routines
are invoked and in particular before DOF data is registered (via drti.o).
2014-08-07 18:36:47 +00:00
delphij
971decf64b MFC r268979:
Don't save entropy inside jails.

As of r126744, we no longer feed the entropy device in jails upon
start, and collecting them is no longer useful.

PR:		conf/126744
Submitted by:	Eugene Grosbein <eugen grosbein net> (with minor changes)
Approved by:	so (des)
2014-07-29 06:00:16 +00:00
nwhitehorn
dc45432cd4 MFC r260913,266895:
Add a new flag to /etc/ttys: onifconsole. This is equivalent to "on" if the
device is an active kernel console and "off" otherwise. This is designed to
allow serial-booting x86 systems to provide a login prompt on the serial line
by default without providing one on all systems by default. Set this flag
on x86 systems for ttyu0.

Comments and suggestions by:	grehan, dteske, jilles
2014-06-08 17:50:07 +00:00
kib
8d9dc2de3a MFC r266609:
Change the _rtld_atfork() to lock the bind lock in write mode.
2014-06-07 02:45:24 +00:00
kib
b991c9938f MFC r266411:
Fix LD_LIBMAP.
2014-05-25 00:57:07 +00:00
ghelmer
037558ada7 MFC r264617:
Fix releasing the lock in the parent atrun process after the queue
directory has been processed. Otherwise, a long-running child process
caused other atrun invocations to stall unnecessarily.

Submitted by:	J.R. Oldroyd  jr at opal.com
2014-05-05 16:52:38 +00:00
kib
b78abef02b MFC r264481:
Add dwarf annotations to the amd64 _rtld_bind_start to allow debuggers
to unwind around the calls from PLT to binder.
2014-04-21 02:55:27 +00:00
jmmv
63fa6c9a5b MFC refactoring of the *.test.mk files.
- r263161 Make bsd.test.mk the only public mk fragment for the building of tests.
- r263172 Move FreeBSD Test Suite-specific code to a suite.test.mk file.
- r263204 Add some documentation for bsd.test.mk.
- r263217 Document support for TAP-compliant Perl test programs.

This is "make tinderbox" clean.
2014-04-14 23:51:57 +00:00
brueffer
af75007ff3 MFC: r263121
Re-format the license to conform to our BSD license template as much
as possible.  This does not change the wording in any way.

Remove the 3rd clause ("advertising clause") of the BSD license as
permitted by the University of Berkeley on July 22, 1999.  While the
clause itself mentions Lawrence Berkeley Laboratory, UCB is the sole
copyright holder of this file.

Reviewed by:	imp, emaste, eadler
2014-03-27 20:13:53 +00:00
davidxu
3c6681dc2c MFC r262277:
malloc_aligned() may not leave enough space for pointer to allocated memory,
saving the pointer will overwrite bytes belongs to another memory block
unexpectly, to fix the problem, use (allocated address + sizeof(void *)) as
initial value, and slip to next aligned address, so maximum extra bytes is
sizeof(void *) + align - 1.

Tested by: Andre Albsmeier < mail at ma17 dot ata dot myota dot orgndre >

MFC r262334:

Increase alignment to size of pointer if the alignment is too small.
Some modules do not align data at least to size of pointer, they uses a
smaller alignment, but our pointer should be aligned to its native
boundary, otherwise on some platforms, hardware alignment checking
will cause bus error.
2014-02-27 02:36:09 +00:00
brueffer
1ce9ab6c9a MFC: r262136
Remove the 3rd clause ("advertising clause") of the BSD license as
permitted by the University of Berkeley on July 22, 1999.

Reviewed by:	imp
2014-02-24 08:21:49 +00:00
brueffer
2edb1855d7 MFC: r262135
Add $FreeBSD$.
2014-02-24 08:18:11 +00:00
brueffer
ffebb434a5 MFC: r261885
In sgetpwnam(), save and free pw_class like all other char members
of struct passwd.  This fixes spurious "login_getclass: unknown class"
errors.

PR:		186439
Submitted by:	UEMURA Tetsuya <t_uemura at macome.co.jp>
2014-02-21 09:19:16 +00:00