Commit Graph

2139 Commits

Author SHA1 Message Date
Konstantin Belousov
4352999e0e Pass CPUID[1] %edx (cpu_feature), %ecx (cpu_feature2) and
CPUID[7].%ebx (cpu_stdext_feature), %ecx (cpu_stdext_feature2) to the
ifunc resolvers on x86.

It is much more clean to use CPUID instruction in usermode to retrieve
this information than to pass AT_HWCAP aux vector from kernel, on
x86.  Still, the change does allow for use of AT_HWCAP on arches where it is
needed, by passing aux array to ifunc_init() initializer which should
prepare arguments for ifunc resolvers.

Current signature for resolvers on x86 is
	func_t iresolve(uint32_t cpu_feature, uint32_t cpu_feature2,
	    uint32_t cpu_stdext_feature, uint32_t cpu_stdext_feature2);
where arguments have identical meaning as the kernel variables of the
same name.  The ABIs allow to use resolvers with the void or shortened
list of arguments.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D8448
2016-11-15 09:43:26 +00:00
Konstantin Belousov
4562cfc40e Assert that there is no unresolved symbols during rtld linking.
Reviewed by:	emaste, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential revision:	https://reviews.freebsd.org/D8448
2016-11-15 09:40:03 +00:00
Konstantin Belousov
093513c76b Update hint to utilize user variable.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-11-15 09:37:35 +00:00
Kurt Lidl
959d78b29a Fix build when WITHOUT_BLACKLIST=yes is specified
PR:		214409
Submitted by:	matthew
Reported by:	matteo
MFC after:		3 days
Sponsored by:	The FreeBSD Foundation
2016-11-12 03:07:41 +00:00
John Baldwin
b5b4f379e0 Pass the correct flag to find_symdef() from _rtld_bind().
When symbol versioning was added to rtld, the boolean 'in_plt' argument
to find_symdef() was converted to a bitmask of flags.  The first flag
added was 'SYMLOOK_IN_PLT' which replaced the 'in_plt' bool.  This
happened to still work by accident as SYMLOOK_IN_PLT had the value of 1
which is the same as 'true', so there should be no functional change.

Tested on:	amd64
Reviewed by:	kan
MFC after:	2 weeks
Sponsored by:	DARPA / AFRL
2016-11-08 22:41:11 +00:00
Kurt Lidl
e07d11b691 Revisit blacklistd support in ftpd
Enhance blacklistd support to not log anything by default,
unless blacklistd support is enabled on the command line.
Document new flag in man page, cleanup patches to be less
intrusive in code.

Reported by:	Rick Adams
Reviewed by:	cem, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8374
2016-11-01 18:18:09 +00:00
Mark Johnston
1d08a87aa8 Reference the libc symbols ypresp_{allfn,data} instead of local symbols.
This fixes a regression introduced in r285926.

PR:		213506
MFC after:	3 days
2016-10-16 19:12:22 +00:00
Enji Cooper
92d317a9b5 Use SRCTOP instead of the longhand version for defining the path to contrib/atf
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2016-09-20 16:24:22 +00:00
Bryan Drewery
1eb4ec9c62 DIRDEPS_BUILD: Add some missing dirctories to the build.
Sponsored by:	EMC / Isilon Storage Division
2016-08-31 19:30:59 +00:00
Adrian Chadd
6f9dab906e [mips] flip from =v to =r - let the compiler choose a temp register.
=v is some ye olde gcc "use this specific register as the temp register"
thing that they've deprecated and clang/llvm doesn't implement.

Poked again and again by: sbruno
2016-08-25 22:32:10 +00:00
Baptiste Daroussin
2382c29e5f Import Dragonfly Mail Agent snapshort from 20160806 aka v0.11+
Most important change being:
dma - Fix security hole (#46)

Affecting DragonFly 4.6 and earlier, Matt Dillon fixed this in base after
finding out from BSDNow Episode 152. Comments following were from his commit
which explains better than I. Just taking his change and putting it here as well.

* dma makes an age-old mistake of not properly checking whether a file
owned by a user is a symlink or not, a bug which the original mail.local
also had.

* Add O_NOFOLLOW to disallow symlinks.

Thanks-to: BSDNow Episode 152, made me dive dma to check when they talked
about the mail.local bug.

MFC After:	2 days
2016-08-20 16:36:05 +00:00
Konstantin Belousov
f214036e99 Move defines common between rtld and libsysdecode into the header,
instead of copying inline into sources.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-12 19:31:41 +00:00
Konstantin Belousov
09944776b5 Fill phdr and phsize for rtld object. It is needed for
dl_iterate_phdr() reporting the correct values.

PR:	211367
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-12 18:31:44 +00:00
Konstantin Belousov
20ee0f7112 Remove all remaining uses of TAILQ_FOREACH_FROM() from rtld-elf.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-12 18:29:11 +00:00
Adrian Chadd
b812fe4d6b [mips] add support for using the MIPS user register for TLS data.
This work, originally from Stacey Son, uses the MIPS UserReg for
reading the TLS data, and will fall back to the normal syscall path
when it isn't supported.

This code dynamically patches cpu_switch() to bypass the UserReg
instruction so to avoid generating a machine exception.

Thanks to sson for the original work, and to Dan Nelson for
bringing it to date and testing it on MIPS32 with me.

Tested:

* mips64 (sson)
* mips74k (dnelson_1901@yahoo.com) - AR9344 SoC, UserReg support
* mips24k (adrian) - AR9331 SoC, no UserReg support

Obtained from:	sson, dnelson_1901@yahoo.com
2016-08-07 01:29:55 +00:00
Bryan Drewery
1c1093d6d6 Fix dlsym(RTLD_NEXT) handling to only return the next library in last library cases.
The root of the problem here is that TAILQ_FOREACH_FROM will default to
the head of the list if passed NULL, which will be the case if there are
no libraries loaded after this one.  Thus all libraries, including the
current, were iterated in that case rather than none.

This was broken in r294373.

Reviewed by:	markj (earlier version), cem, kib, ngie
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D7216
2016-07-15 19:07:00 +00:00
Bryan Drewery
e7debdcb15 Fix race for incrementally rebuilding VERSION_MAP.
The dependency is needed in PROG_FULL since only the build of PROG_FULL
is using the LDFLAGS and depending on VERSION_MAP.  This was not a problem
with MK_DEBUG_FILES==no since it only builds PROG.

This should probably be using bsd.lib.mk instead [1]

Reported by:	swills, gjb
Reviewed by:	emaste
Noted by:	rgrimes [1]
Sponsored by:	EMC / Isilon Storage Division
Approved by:	re (kib)
2016-07-03 17:28:39 +00:00
Bryan Drewery
8779595527 DIRDEPS_BUILD: Update dependencies
Approved by:	re (gjb)
Sponsored by:	EMC / Isilon Storage Division
2016-06-14 16:55:05 +00:00
Kurt Lidl
c0759dac0d Separate BLACKLIST vs BLACKLIST_SUPPORT properly
Sponsored by:	The FreeBSD Foundation
2016-06-07 16:31:03 +00:00
Kurt Lidl
504422fab3 Update blacklist support in ftpd to clarify fd usage
The ftp daemon dups the control socket to stdin and uses that fd
throughout the code.  Clarify this usage slightly by changing from
explicit use of "0" for the fd to a variable, to make it clear what
the zero represents in the non-blacklist code. Make the
blacklist_notify routine use STDIN_FILENO so as to have less of a
"magic number" feel to the code.

Reviewed by:	cem
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6716
2016-06-06 20:00:13 +00:00
Kurt Lidl
aed8f11013 Add blacklist support to rlogind
Reviewed by:	rpaulo
Approved by:	rpaulo
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6593
2016-06-05 01:42:58 +00:00
Bryan Drewery
6e9a3c415e DIRDEPS_BUILD: Connect new directories and update dependencies.
Sponsored by:	EMC / Isilon Storage Division
2016-06-03 19:25:30 +00:00
Kurt Lidl
2ec2c64187 Add blacklist support to fingerd
Reviewed by:	rpaulo
Approved by:	rpaulo
Relnotes:	YES
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D5916
2016-06-03 07:00:28 +00:00
Kurt Lidl
ac6edff45f Add blacklist support to rshd
Reviewed by:	rpaulo
Approved by:	rpaulo
Relnotes:	YES
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6594
2016-06-03 06:58:20 +00:00
Kurt Lidl
3656f22999 Add blacklist support to ftpd
Reviewed by:	rpaulo
Approved by:	rpaulo
Relnotes:	YES
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6703
2016-06-03 06:24:03 +00:00
Kurt Lidl
95856e1457 Add basic blacklist build support
Reviewed by:	rpaulo
Approved by:	rpaulo
Relnotes:	YES
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D5913
2016-06-02 19:06:04 +00:00
Glen Barber
ea580d0b45 Revert r301137 and r301163, and implement a correct fix
for the CONFS issue with dma.conf and ppp.conf.

Thank you very much to Bryan Drewery for looking into the
problem and providing this fix.

Pointyhat:	gjb
Sponsored by:	The FreeBSD Foundation
2016-06-01 20:44:28 +00:00
Glen Barber
d1900df6cc Implement a hack to re-enable installation of the dma.conf.
The 'CONFS' entries in share/mk/bsd.confs.mk explicitly check
for the 'installconfig', but does not behave properly with the
'distribute' target.

This seems to be related to the previously-reported issues
with files within /etc in the past.

Reported by:	Ben Woods
Sponsored by:	The FreeBSD Foundation
2016-06-01 20:06:55 +00:00
Konstantin Belousov
360ba6bc13 Fix issues found by Coverity in the rtld-elf.c:gethints().
Check that the dirlist path string specification does not cause
overflow and is fully contained in the hints file.
Check that the dirlist string is nul-terminated.
Make 'hdr' static variable, so that hdr.dirlistlen is available when
hints cached value is used on next function calls.  Reset hdr.dirlistlen
to zero if error was detected, so that allocations use reasonable size.
Use 'hints', and not 'p' in the body, since p is only initialized on the
first call.

Reported and reviewed by:	truckman (previous version)
Sponsored by:	The FreeBSD Foundation
CIDs:	1006503, 1006504, 1006676, 1008488, 1007263
MFC after:	2 weeks
2016-05-25 18:10:44 +00:00
Don Lewis
8877d1dbe6 Declare line[] in the outermost scope of retrieve() instead of
declaring it in an inner scope and then using it via a pointer
in the outer scope.

Reported by:    Coverity
CID:            605895
2016-05-13 01:52:41 +00:00
Baptiste Daroussin
f03ef8405b Rename getline with get_line to avoid collision with getline(3)
When getline(3) in 2009 was added a _WITH_GETLINE guard has also been added.
This rename is made in preparation for the removal of this guard
2016-05-10 11:12:31 +00:00
Enji Cooper
430f7286a5 Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed
after r298107

Summary of changes:

- Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that
  namespacing is kept with FILES appropriately, and that this shouldn't need
  to be repeated if the namespace changes -- only the definition of PACKAGE
  needs to be changed
- Allow PACKAGE to be overridden by callers instead of forcing it to always be
  `tests`. In the event we get to the point where things can be split up
  enough in the base system, it would make more sense to group the tests
  with the blocks they're a part of, e.g. byacc with byacc-tests, etc
- Remove PACKAGE definitions where possible, i.e. where FILES wasn't used
  previously.
- Remove unnecessary TESTSPACKAGE definitions; this has been elided into
  bsd.tests.mk
- Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES;
  ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk.
- Fix installation of files under data/ subdirectories in lib/libc/tests/hash
  and lib/libc/tests/net/getaddrinfo
- Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup)

Document the proposed changes in share/examples/tests/tests/... via examples
so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of
replacing FILES. share/mk/bsd.README didn't seem like the appropriate method
of communicating that info.

MFC after: never probably
X-MFC with: r298107
PR: 209114
Relnotes: yes
Tested with: buildworld, installworld, checkworld; buildworld, packageworld
Sponsored by: EMC / Isilon Storage Division
2016-05-04 23:20:53 +00:00
Pedro F. Giffuni
ec489d64bb libexec: minor spelling fixes in comments.
No functional change.
2016-05-01 19:39:23 +00:00
Glen Barber
49dae58b28 Fix including Kyuafile in packaged base system.
Fix a related typo while here.

Note, this change results in the Kyuafile inclusion in the runtime
package, which needs to be fixed, however addresses the PR as far
as I can tell in my tests.

PR:		209114
Submitted by:	ngie
Sponsored by:	The FreeBSD Foundation
2016-04-29 05:28:40 +00:00
Pedro F. Giffuni
260111ffce rtld-elf: use our roundup2() macro when param.h is available. 2016-04-19 20:12:46 +00:00
Pedro F. Giffuni
a5d5e8dd7c rtld-elf: use NULL instead of zero for pointers. 2016-04-19 19:03:55 +00:00
Pedro F. Giffuni
46266845a4 rbootd: use NULL instead of zero for pointers. 2016-04-18 15:05:48 +00:00
Pedro F. Giffuni
6e4fcca0f8 ftpd: replace malloc + memset 0 with calloc.
It is faster and usually safer.
Use NULL instead of zero for the pointer.
2016-04-18 15:01:49 +00:00
Glen Barber
659a0a5d64 Remove lib/libcapsicum and libexec/casper, brought back as
part of a merge mishap.

Reported by:	junovitch
Sponsored by:	The FreeBSD Foundation
2016-04-17 02:51:04 +00:00
Glen Barber
9c831bbd69 MFH
Sponsored by:	The FreeBSD Foundation
2016-04-13 02:04:09 +00:00
Pedro F. Giffuni
9a9048e13d Restore some comments in previous commit. 2016-04-12 18:24:02 +00:00
Pedro F. Giffuni
07ee9f80d7 bootpd(8): De-register and minor cleanups.
For bootptest(8) also remuve an unused variable and replace
0 with a NULL for a pointer.
2016-04-12 18:18:26 +00:00
Glen Barber
d60840138f MFH
Sponsored by:	The FreeBSD Foundation
2016-04-04 23:55:32 +00:00
Bryan Drewery
c0f5aeb032 WITHOUT_TOOLCHAIN: Fix build of rtld.
MK_TOOLCHAIN==no disables building and installing of pic archives.
c_pic.a is still needed for rtld though so force it to build in lib/libc
and link directly to the objdir version of it for rtld.

Somehow this has been broken since r148725.

Sponsored by:	EMC / Isilon Storage Division
2016-03-31 17:27:01 +00:00
Alexander Kabaev
05e7782363 Do not override top level CFLAGS in libexec/dma 2016-03-27 23:19:14 +00:00
Baptiste Daroussin
f0d5be8303 Install a usable mailer.conf for dragonfly mailer agent if sendmail is disabled 2016-03-24 08:25:05 +00:00
Glen Barber
7d536dc855 MFH
Sponsored by:	The FreeBSD Foundation
2016-03-10 21:16:01 +00:00
Bryan Drewery
15c433351f DIRDEPS_BUILD: Connect MK_TESTS.
Sponsored by:	EMC / Isilon Storage Division
2016-03-09 22:46:01 +00:00
Glen Barber
42d27ee343 MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 23:53:08 +00:00
Konstantin Belousov
ca8c8dc3eb Fix handling of DT_TEXTREL for an object with more than one read-only
segment.  According to gABI spec, presence of the tag indicates that
dynamic linker must be prepared to handle relocations against any
read-only segment, not only the segment which we, somewhat arbitrary,
declared the text.

For each read-only segment, add write permission before relocs are
processed, and return to the mapping mode requested by the phdr, after
relocs are done.

Reported, tested, and reviewed by:	emaste
PR:	207631
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-03-02 16:36:24 +00:00