OpenBSD CVS

CVS log for src/libexec/ld.so/boot.c


[BACK] Up to [local] / src / libexec / ld.so

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.19 / (download) - annotate - [select for diffs], Sat Jan 8 06:49:41 2022 UTC (2 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, HEAD
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

Prep .c files for removing the #includes from */archdep.h
 * replace #include "archdep.h" with #includes of what is used, pulling in
   "syscall.h", "util.h", and "archdep.h" as needed
 * delete #include <sys/syscall.h> from syscall.h
 * only pull in <sys/stat.h> to the three files that use _dl_fstat(),
   forward declare struct stat in syscall.h for the others
 * NBBY is for <sys/select.h> macros; just use '8' in dl_printf.c
 * <machine/vmparam.h> is only needed on i386; conditionalize it
 * stop using __LDPGSZ: use _MAX_PAGE_SHIFT (already used by malloc.c)
   where necessary
 * delete other bogus #includes, order legit per style: <sys/*> then
   <*/*>, then <*>, then "*"

dir.c improvement from jsg@
ok and testing assistance deraadt@

Revision 1.18 / (download) - annotate - [select for diffs], Sun Oct 20 03:44:49 2019 UTC (4 years, 7 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.17: +17 -83 lines
Diff to previous 1.17 (colored)

For more archs, ld.so itself only needs/uses the arch's "just add load offset"
'relative' relocation.  Take advantage of that to simplify ld.so's self-reloc
code:
 * give the exceptional archs (hppa and mips64) copies of the current boot.c
   as boot_md.c
 * teach the Makefile to use boot_md.c when present
 * reduce boot.c down to the minimum necessary to handle just relative reloc
 * teach the Makefile to fail if the built ld.so has other types of relocs

ok visa@ kettenis@

Revision 1.17 / (download) - annotate - [select for diffs], Fri May 10 13:29:21 2019 UTC (5 years ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

ld.so boot cleanup support:
 - put functions and data which are only used before calling the executable's
   start function into their own page-aligned segments for unmapping
   (only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
 - pass .init_array and .preinit_array functions an addition argument which
   is a callback to get a structure which includes a function that frees
   the boot text and data
 - sometimes delay doing RELRO processing: for a shared-object marked
   DF_1_INITFIRST do it after the object's .init_array, for the executable
   do it after the .preinit_array
 - improve test-ld.so to link against libpthread and trigger its initialization
   late
libc changes to use this will come later

ok kettenis@

Revision 1.16 / (download) - annotate - [select for diffs], Tue Oct 23 04:01:45 2018 UTC (5 years, 7 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.15: +1 -34 lines
Diff to previous 1.15 (colored)

Delay processing of ld.so's own PT_GNU_RELRO section until after environment
processing and malloc initialization, and then move variables set by those
steps, including malloc's mopts structure, into the .data.rel.ro segment.
This protects more data and eliminates the extra padding of the mopts.

ok kettenis@

Revision 1.15 / (download) - annotate - [select for diffs], Mon Jan 9 22:51:04 2017 UTC (7 years, 4 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.14: +29 -1 lines
Diff to previous 1.14 (colored)

Remove dependency on __got_{start,end} symbols and look at PT_GNU_RELRO
instead.  Result in a few more pages that aren't writable on some platforms
(such as hppa).  Based on an initial diff from guenther@.

Thanks to deraadt@ for testing.

ok guenther@

Revision 1.14 / (download) - annotate - [select for diffs], Sat Aug 13 20:57:04 2016 UTC (7 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.13: +2 -5 lines
Diff to previous 1.13 (colored)

Passing in &_DYNAMIC appears to have stuck, so eliminate the extra
variable

Revision 1.13 / (download) - annotate - [select for diffs], Tue Aug 9 03:58:35 2016 UTC (7 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.12: +1 -6 lines
Diff to previous 1.12 (colored)

Teach arm to pass &_DYNAMIC to _dl_boot_bind(); can optimize later in tree

Revision 1.12 / (download) - annotate - [select for diffs], Sun Aug 7 03:05:23 2016 UTC (7 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.11: +2 -4 lines
Diff to previous 1.11 (colored)

As with csu, alpha passes &_DYNAMIC to _reloc_alpha_got(), so just
save that and pass it to _dl_boot_bind() too

Revision 1.11 / (download) - annotate - [select for diffs], Sun Aug 7 03:03:44 2016 UTC (7 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

Teach i386 to pass &_DYNAMIC to _dl_boot_bind()

Revision 1.10 / (download) - annotate - [select for diffs], Sun Aug 7 03:01:53 2016 UTC (7 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

Teach mips64 to pass &_DYNAMIC to _dl_boot_bind()

mips64be testing by deraadt@

Revision 1.9 / (download) - annotate - [select for diffs], Sun Aug 7 02:59:27 2016 UTC (7 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

hahahah: amd64 has been passing &_DYNAMIC to _dl_boot_bind() for
*149 months*

Revision 1.8 / (download) - annotate - [select for diffs], Sun Aug 7 02:57:19 2016 UTC (7 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.7: +4 -5 lines
Diff to previous 1.7 (colored)

Flip the #ifdef logic: amd64, arm, i386, and mips64 are the only archs
using the #else case

Revision 1.7 / (download) - annotate - [select for diffs], Fri Jul 15 09:25:47 2016 UTC (7 years, 10 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

Switch m88k to pass &_DYNAMIC to _dl_boot_bind()

probably works: this ASM pattern is already used for _dl_dtors

Revision 1.6 / (download) - annotate - [select for diffs], Sun Dec 6 23:36:12 2015 UTC (8 years, 5 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.5: +78 -118 lines
Diff to previous 1.5 (colored)

Simplify the relocation code for the ld.so bootstrap and static pie: track
just the dynamic tags are needed instead of reusing the generic elf_object_t
structure.

testing and feedback from miod@
ok kettenis@

Revision 1.5 / (download) - annotate - [select for diffs], Fri Jan 16 16:18:07 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.4: +1 -2 lines
Diff to previous 1.4 (colored)

<sys/param.h> to <limits.h> conversion.  Verified binaries
ok millert, thanks to doug for process advice

Revision 1.4 / (download) - annotate - [select for diffs], Sat Nov 15 02:14:10 2014 UTC (9 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

ELF files have moved up a level

pointed out by deraadt@

Revision 1.3 / (download) - annotate - [select for diffs], Tue Aug 19 10:01:50 2014 UTC (9 years, 9 months ago) by uebayasi
Branch: MAIN
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

ld.so(1): Missing stack var initialization

Explicitly zero-clear stack array to read dynamic segments.  This code has
been working because stack is mapped as anon and zero'ed right after execve(2).

Found by work-in-progress Valgrind port for OpenBSD/amd64.

OK millert@ guenther@

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jul 6 17:33:10 2014 UTC (9 years, 10 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.1: +1 -2 lines
Diff to previous 1.1 (colored)

enable -Wall, explicitly call _dl_strsep, and zap some redundant includes
ok miod@

Revision 1.1 / (download) - annotate - [select for diffs], Sun Feb 16 01:16:38 2014 UTC (10 years, 3 months ago) by martynas
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5

Unbreak ld.so with ssp-strong/all on sparc64 and powerpc.  With the
new SSP logic it additionally protects functions which have their
local addresses taken of, and _dl_boot_bind() gets selected.

We have to go through GOT to reach __guard_local, however it hasn't
been relocated yet.  So add boot.c and don't protect everything up
to the point until it has been relocated and no longer needs the
loff adjustment.

OK matthew@.  Full build done & tested by florian@.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.