1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other
build-only utility libraries.
2. Another 40% is fixed by generating _pic.a variants of various libraries.
3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR)
where it never would work anyhow, such as csu or loader. This suggests
there may be better ways of adding support to the tree. Many of these
cases can be fixed such that -fPIE will work but there is really no
reason to have it in those cases.
4. Some of the uses are working around hacks done to some Makefiles that are
really building libraries but have been using bsd.prog.mk because the code
is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have
been needed.
We likely do want to enable PIE by default (opt-out) for non-tree consumers
(such as ports). For in-tree though we probably want to only enable PIE
(opt-in) for common attack targets such as remote service daemons and setuid
utilities. This is also a great performance compromise since ASLR is expected
to reduce performance. As such it does not make sense to enable it in all
utilities such as ls(1) that have little benefit to having it enabled.
Reported by: kib
This is currently an opt-in build flag. Once ASLR support is ready and stable
it should changed to opt-out and be enabled by default along with ASLR.
Each application Makefile uses opt-out to ensure that ASLR will be enabled by
default in new directories when the system is compiled with PIE/ASLR. [2]
Mark known build failures as NO_PIE for now.
The only known runtime failure was rtld.
[1] http://www.bsdcan.org/2014/schedule/events/452.en.html
Submitted by: Shawn Webb <lattera@gmail.com>
Discussed between: des@ and Shawn Webb [2]
what btxldr expects (.set MEM_DATA,start+0x1000 in btxldr.S).
This makes resulting ELF binaries bootable with grub, gptboot and boot2.
PR: 153801
Submitted by: Gleb Kurtsou <gleb.kurtsou at gmail.com>
Tested by: Ruben Kerkhof <ruben at rubenkerkhof.com>
Glanced at by: jhb, peter
MFC after: 1 month
Rather than writing out a MID of '0', write a MID of 0x86 (aka
MID_I386) so that file gets it right.
This is a nop for boot2. It just checks the MAGIC part of the field,
ignoring the MID. boot2 is the only thing that loads this file, and
only on x86 so the MID_i386 is always the right value (the rest of the
code is already x86 specific).
Reviewed by: bde@, jhb@
MFC after: 8.0 is out the door :)
+ Include netinet/in.h for ntohl()
* Since the return value was tested separately, cast the values to
size_t in order to shut up compiler warnings.
+ Raise WARNS= level to 6
PR: bin/71666
always compatible with the i386 version.
This fixes one of the problems I had cross-releasing i386 on
Alpha: the produced "-f aout" binaries are now identical.
o s/unsigned/unsigned int/g
o Add -Wall
btxld can now be built as a cross-tool for cross-building i386/pc98 on
platforms that don't have btxld (such as alpha).