OpenBSD CVS

CVS log for src/sys/kern/exec_elf.c


[BACK] Up to [local] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.186 / (download) - annotate - [select for diffs], Tue Apr 2 08:39:16 2024 UTC (2 months, 1 week ago) by deraadt
Branch: MAIN
CVS Tags: HEAD
Changes since 1.185: +11 -13 lines
Diff to previous 1.185 (colored)

Delete the msyscall mechanism entirely, since mimmutable+pinsyscalls has
replaced it with a more strict mechanism, which happens to be lockless O(1)
rather than micro-lock O(1)+O(log N).  Also nop-out the sys_msyscall(2) guts,
but leave the syscall around for a bit longer so that people can build through
it, since ld.so(1) still wants to call it.

Revision 1.185 / (download) - annotate - [select for diffs], Wed Jan 17 22:22:25 2024 UTC (4 months, 3 weeks ago) by kurt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.184: +17 -14 lines
Diff to previous 1.184 (colored)

Fix core file writing when a file map into memory has later been truncated
to be smaller than the mapping. Record which memory segments are backed by
vnodes while walking the uvm map and later suppress EFAULT errors caused
by the underlying file being truncated. okay miod@

Revision 1.184 / (download) - annotate - [select for diffs], Tue Jan 16 19:05:01 2024 UTC (4 months, 3 weeks ago) by deraadt
Branch: MAIN
Changes since 1.183: +134 -7 lines
Diff to previous 1.183 (colored)

The kernel will now read pinsyscall tables out of PT_OPENBSD_SYSCALLS in
the main program or ld.so, and accept a submission of that information
for libc.so from ld.so via pinsyscalls(2).  At system call invocation,
the syscall number is matched to the specific address it must come from.
ok kettenis, gnezdo, testing of variations by many people

Revision 1.168.2.1 / (download) - annotate - [select for diffs], Wed Jul 12 19:35:04 2023 UTC (10 months, 4 weeks ago) by tb
Branch: OPENBSD_7_2
Changes since 1.168: +12 -2 lines
Diff to previous 1.168 (colored) next main 1.169 (colored)

address incomplete validation of ELF program headers in execve(2) which could lead
to a panic in vmcmd_map_readvn() with a malformed binary/interpreter.

original crash found with Melkor, additional validation provided by
guenther@.

ok kettenis@ guenther@ deraadt@
from jasper

this is errata/7.2/030_elf.patch.sig

Revision 1.180.4.1 / (download) - annotate - [select for diffs], Wed Jul 12 19:35:01 2023 UTC (10 months, 4 weeks ago) by tb
Branch: OPENBSD_7_3
Changes since 1.180: +12 -2 lines
Diff to previous 1.180 (colored) next main 1.181 (colored)

address incomplete validation of ELF program headers in execve(2) which could lead
to a panic in vmcmd_map_readvn() with a malformed binary/interpreter.

original crash found with Melkor, additional validation provided by
guenther@.

ok kettenis@ guenther@ deraadt@
from jasper

this is errata/7.3/008_elf.patch.sig

Revision 1.183 / (download) - annotate - [select for diffs], Wed Jul 12 19:34:14 2023 UTC (10 months, 4 weeks ago) by jasper
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.182: +12 -2 lines
Diff to previous 1.182 (colored)

address incomplete validation of ELF program headers in execve(2) which could lead
to a panic in vmcmd_map_readvn() with a malformed binary/interpreter.

original crash found with Melkor, additional validation provided by
guenther@.

ok kettenis@ guenther@ deraadt@

Revision 1.182 / (download) - annotate - [select for diffs], Sat Jun 10 19:30:48 2023 UTC (12 months ago) by kettenis
Branch: MAIN
Changes since 1.181: +22 -1 lines
Diff to previous 1.181 (colored)

Implement support for pointer authentication (PAC) in userland.  With PAC
it is possible to "sign" pointers with a hidden key.  The signature is
placed in unused bits of the pointer and can be checked later.  This can
be used to provide "tail CFI" that is similar to what retguard provides.

Debuggers need to be aware of the fact that pointers can be signed.  For
this purpose a new PT_PACMASK ptrace(2) request is introduced that returns
as mask that indicates the bits used for the signature.  Separate masks
are provided for code and data pointers even though the masks are identical
in the current implementation.  These masks are also written into a special
note section in the core dump.

ok patrick@

Revision 1.181 / (download) - annotate - [select for diffs], Wed Apr 19 15:37:36 2023 UTC (13 months, 3 weeks ago) by kettenis
Branch: MAIN
Changes since 1.180: +5 -1 lines
Diff to previous 1.180 (colored)

Add a new PT_OPENBSD_NOBTCFI "segment type" to indicate that the kernel
should not enforce branch target control flow integrety for a binary.
This works analoguous to PT_OPENBSD_WXNEEDED in that we will set it on
binaries that don't have the necessary landing pads (yet).  The kernel
will enforce branch target CFI by default in the near future!

This is a better match for what we want to achieve than the GNU property
note mechanism that the Linux folks came up with.  We can still use the
GNU property notes for diagnostic purposes so we won't disable their
generation in the toolchain.  But ports will need to pass an explicit
-Wl,-z,nobtcfi option to disable branch target CFI.

Like with PT_OPENBSD_WXNEEDED we convert the presence of PT_OPENBSD_NOBTCFI
into a flag in struct exec_package.  From there MD code can pick it up
and set a struct process flag or take action in setregs().

ok deraadt@

Revision 1.180 / (download) - annotate - [select for diffs], Mon Jan 16 07:09:11 2023 UTC (16 months, 3 weeks ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE
Branch point for: OPENBSD_7_3
Changes since 1.179: +5 -1 lines
Diff to previous 1.179 (colored)

Currently we disable kbind(2) for static program from libc.a's
preinit hook.  Delete that and instead have the kernel disable kbind
at exec-time if the program doesn't have an ELF interpreter.  For
now, permit userland calls to disable it when already disabled so
existing static programs continue to work.

prompted by deraadt@ questioning about the call in libc.a

ok deraadt@ miod@

Revision 1.179 / (download) - annotate - [select for diffs], Fri Jan 13 23:02:43 2023 UTC (16 months, 3 weeks ago) by kettenis
Branch: MAIN
Changes since 1.178: +16 -3 lines
Diff to previous 1.178 (colored)

Since the signal trampoline is now execute-only we no longer write it
into core dumps.  As a result backtraces through signal handlers no
longer work in gdb and other debuggers.

Fix this by keeping a read-only mapping of the signal trampoline in the
kernel and writing it into the core dump at the virtual address where it
is mapped in the process.

ok deraadt@, tb@

Revision 1.178 / (download) - annotate - [select for diffs], Wed Dec 21 07:16:03 2022 UTC (17 months, 2 weeks ago) by deraadt
Branch: MAIN
Changes since 1.177: +5 -3 lines
Diff to previous 1.177 (colored)

fix a mangled comment

Revision 1.177 / (download) - annotate - [select for diffs], Mon Dec 5 23:18:37 2022 UTC (18 months ago) by deraadt
Branch: MAIN
Changes since 1.176: +3 -3 lines
Diff to previous 1.176 (colored)

zap a pile of dangling tabs

Revision 1.176 / (download) - annotate - [select for diffs], Wed Nov 23 11:00:27 2022 UTC (18 months, 2 weeks ago) by mbuhl
Branch: MAIN
Changes since 1.175: +3 -22 lines
Diff to previous 1.175 (colored)

cache ps_auxinfo inside the kernel, to avoid codedump() reading the
copy on userland stack which points at an illicit region.
ok kettenis, deraadt

Revision 1.175 / (download) - annotate - [select for diffs], Mon Nov 14 17:25:00 2022 UTC (18 months, 3 weeks ago) by visa
Branch: MAIN
Changes since 1.174: +3 -3 lines
Diff to previous 1.174 (colored)

Fix tag type and buffer limit in DT_TEXTREL lookup.

OK deraadt@ kettenis@

Revision 1.174 / (download) - annotate - [select for diffs], Sat Nov 5 10:31:16 2022 UTC (19 months ago) by deraadt
Branch: MAIN
Changes since 1.173: +8 -6 lines
Diff to previous 1.173 (colored)

For textrel binaries, skipping immutability on text segments is not enough:
It needs to be all non-writeable segments, which really means rodata.
crt0 and ld.so will need to call mimmutable() later on these regions.
ok kettenis

Revision 1.173 / (download) - annotate - [select for diffs], Thu Oct 27 22:48:17 2022 UTC (19 months, 2 weeks ago) by deraadt
Branch: MAIN
Changes since 1.172: +53 -17 lines
Diff to previous 1.172 (colored)

Unfortunately there are still ugly text-relocation binaries in the wild.
Libraries are less of a concern, because ld.so can fix them in the right
order.  So we must scan DYNAMIC for the TEXTREL marker, and not make
X LOADs immutable.  ld.so will apply changes to the text segment.  In
upcoming diff, crt0 and ld.so will then apply immutability.
ok kettenis

Revision 1.172 / (download) - annotate - [select for diffs], Thu Oct 27 16:01:18 2022 UTC (19 months, 2 weeks ago) by deraadt
Branch: MAIN
Changes since 1.171: +4 -4 lines
Diff to previous 1.171 (colored)

VMCMD_SYSCALL cannot be incorporated into flags variable, because flags
is inspected narrowly for base address later.
ok kettenis

Revision 1.171 / (download) - annotate - [select for diffs], Sun Oct 23 02:53:14 2022 UTC (19 months, 2 weeks ago) by deraadt
Branch: MAIN
Changes since 1.170: +15 -6 lines
Diff to previous 1.170 (colored)

A better workaround for mips64 mimmutable problem.  The problem is the
DT_DEBUG word is inside a R LOAD that gets marked immutable, but ld.so
does a mprotect RW + adjustment + mprotect R.  DT_DEBUG is specified as
being inside the DYNAMIC range, solet's do all the immutables and then,
 on mips64 only, turn around and make DYNAMIC mutable.  That gives us
time to see if we can move DT_DEBUG or change what ld.so is doing.
discussed at length with kettenis

Revision 1.170 / (download) - annotate - [select for diffs], Sat Oct 22 15:06:47 2022 UTC (19 months, 2 weeks ago) by deraadt
Branch: MAIN
Changes since 1.169: +4 -1 lines
Diff to previous 1.169 (colored)

automatic immutable for base executable is not ready on mips
because DT_DEBUG isn't in the right place

Revision 1.169 / (download) - annotate - [select for diffs], Fri Oct 21 18:10:56 2022 UTC (19 months, 2 weeks ago) by deraadt
Branch: MAIN
Changes since 1.168: +20 -1 lines
Diff to previous 1.168 (colored)

automatically mark immutable certain regions in program&ld.so LOADs.
The large commented block in elf_load_psection explains the sitaution.
ok kettenis.

Revision 1.168 / (download) - annotate - [select for diffs], Mon Aug 29 16:53:46 2022 UTC (21 months, 1 week ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE
Branch point for: OPENBSD_7_2
Changes since 1.167: +2 -1 lines
Diff to previous 1.167 (colored)

If ld.so loading fails inside execve, uprintf a message to report this
before the SIGABRT kills the process.  This clarifies the failure mode
(and resolution to take) when a dynamic executable is run while /usr
isn't mounted.  ok miod kettenis

Revision 1.167 / (download) - annotate - [select for diffs], Sun Aug 14 01:58:27 2022 UTC (21 months, 4 weeks ago) by jsg
Branch: MAIN
Changes since 1.166: +1 -5 lines
Diff to previous 1.166 (colored)

remove unneeded includes in sys/kern
ok mpi@ miod@

Revision 1.166 / (download) - annotate - [select for diffs], Thu May 12 16:29:58 2022 UTC (2 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.165: +2 -1 lines
Diff to previous 1.165 (colored)

During coredumps only a single thread should be active, check this
by checking that it is a single threaded process or that ps_single is set.
OK mpi@

Revision 1.165 / (download) - annotate - [select for diffs], Thu Dec 9 00:26:10 2021 UTC (2 years, 6 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.164: +1 -16 lines
Diff to previous 1.164 (colored)

We only have one syscall table: inline sysent/SYS_MAXSYSCALL and
SYS_syscall as the nosys() function into the MD syscall entry
routines and the SYSCALL_DEBUG support.  Adjust alpha's syscall
check to match the other archs.  Also, make sysent const to get it
into .rodata.

With that, 'struct emul' is unused: delete it and all its references

ok millert@

Revision 1.164 / (download) - annotate - [select for diffs], Tue Dec 7 22:17:02 2021 UTC (2 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.163: +1 -17 lines
Diff to previous 1.163 (colored)

Delete the last emulation callbacks: we're Just ELF, so declare
exec_elf_fixup() and coredump_elf() in <sys/exec_elf.h> and call
them and the MD setregs() directly in kern_exec.c and kern_sig.c

Also delete e_name[] (only used by sysctl), e_errno (unused), and
e_syscallnames[] (only used by SYSCALL_DEBUG) and constipate
syscallnames to 'const char *const[]'

ok kettenis@

Revision 1.163 / (download) - annotate - [select for diffs], Tue Dec 7 17:51:04 2021 UTC (2 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.162: +1 -5 lines
Diff to previous 1.162 (colored)

Continue to delete emulation support: we only have one sigcode and
sigobject.  Just use the existing globals for the former and use a
global for the latter.

ok jsg@ kettenis@

Revision 1.162 / (download) - annotate - [select for diffs], Tue Dec 7 04:19:24 2021 UTC (2 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.161: +3 -9 lines
Diff to previous 1.161 (colored)

Continue to delete emulation support: since we're Just ELF, the size
of the auxinfo is fixed: provide ELF_AUX_WORDS in <sys/exec_elf.h>
as a replacement for emul->e_arglen

ok millert@

Revision 1.161 / (download) - annotate - [select for diffs], Mon Dec 6 21:21:10 2021 UTC (2 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.160: +7 -33 lines
Diff to previous 1.160 (colored)

Start to delete emulation support: since we're Just ELF, make
copyargs() return 0/1 and merge elf_copyargs() into it.  Rename
ep_emul_arg and ep_emul_argp to have clearer meaning and type and
eliminate ep_emul_argsize as no longer necessary.  Make sure
ep_auxinfo (nee ep_emul_argp) is initialized as powerpc64 always
uses it in setregs().

ok semarie@ deraadt@ kettenis@

Revision 1.160 / (download) - annotate - [select for diffs], Wed Mar 10 10:21:47 2021 UTC (3 years, 3 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.159: +2 -2 lines
Diff to previous 1.159 (colored)

spelling

ok gnezdo@ semarie@ mpi@

Revision 1.159 / (download) - annotate - [select for diffs], Mon Mar 8 05:57:34 2021 UTC (3 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.158: +2 -7 lines
Diff to previous 1.158 (colored)

Remove the workaround which identified Go executables, and permitted them
to do syscalls directly.  Go executables now use shared libc like all other
dynamic binaries.  This makes the "where are syscalls done from" checker
strict for all binaries, and also opens the door to change the underlying
syscall ABI to the kernel in the future very easily (if we find cause).
ok jsing

Revision 1.158 / (download) - annotate - [select for diffs], Mon Feb 8 10:51:01 2021 UTC (3 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.157: +2 -3 lines
Diff to previous 1.157 (colored)

Revert the convertion of per-process thread into a SMR_TAILQ.

We did not reach a consensus about using SMR to unlock single_thread_set()
so there's no point in keeping this change.

Revision 1.157 / (download) - annotate - [select for diffs], Sun Jan 17 15:28:21 2021 UTC (3 years, 4 months ago) by mvs
Branch: MAIN
Changes since 1.156: +2 -2 lines
Diff to previous 1.156 (colored)

Cache parent's pid as `ps_ppid' and use it instead of `ps_pptr->ps_pid'.
This allows us to unlock getppid(2).

ok mpi@

Revision 1.156 / (download) - annotate - [select for diffs], Mon Dec 7 16:55:28 2020 UTC (3 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.155: +3 -2 lines
Diff to previous 1.155 (colored)

Convert the per-process thread list into a SMR_TAILQ.

Currently all iterations are done under KERNEL_LOCK() and therefor use
the *_LOCKED() variant.

From and ok claudio@

Revision 1.155 / (download) - annotate - [select for diffs], Mon Jul 6 13:33:09 2020 UTC (3 years, 11 months ago) by pirofti
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.154: +6 -2 lines
Diff to previous 1.154 (colored)

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@

Revision 1.154 / (download) - annotate - [select for diffs], Sat Jan 25 01:28:38 2020 UTC (4 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.153: +77 -55 lines
Diff to previous 1.153 (colored)

The ELF NOTE parser would only inspect the first NOTE for 'OpenBSD'.
Furthermore the parser was unaware a NOTE could contain multiple
records. The scanner has been rewritten.  Another bonus bug: if the
binary was labelled as OPENBSD ABI, NOTE parsing was completely
skipped so WXNEEDED wasn't learned either...

Now that NOTEs are scanned correctly, search for the 'Go' NOTE. (During
this work found the Go linker produces slightly broken NOTEs - Go team
will probably fix that).

Work is happening for our Go dynamic-binaries to use libc syscall
stubs, but the change isn't ready.  Go (and reportedly free-pascal
also?) binaries are the only dynamic programs which require syscalls
in the main-program.  Since Go binaries are now identifiable, we can
disable syscalls in all other regular dynamic-main-programs, gaining
the strict enforcement we want.  When the the Go-libc-stub change
arrives we'll delete the Go NOTE scan and treat Go binaries same as
regular binaries.

This change probably breaks free-pascal, a lower priority item to repair.

some discussion with jsing, ok kettenis

Revision 1.153 / (download) - annotate - [select for diffs], Mon Dec 9 18:19:09 2019 UTC (4 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.152: +2 -2 lines
Diff to previous 1.152 (colored)

typo

Revision 1.152 / (download) - annotate - [select for diffs], Fri Nov 29 06:34:45 2019 UTC (4 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.151: +15 -2 lines
Diff to previous 1.151 (colored)

Repurpose the "syscalls must be on a writeable page" mechanism to
enforce a new policy: system calls must be in pre-registered regions.
We have discussed more strict checks than this, but none satisfy the
cost/benefit based upon our understanding of attack methods, anyways
let's see what the next iteration looks like.

This is intended to harden (translation: attackers must put extra
effort into attacking) against a mixture of W^X failures and JIT bugs
which allow syscall misinterpretation, especially in environments with
polymorphic-instruction/variable-sized instructions.  It fits in a bit
with libc/libcrypto/ld.so random relink on boot and no-restart-at-crash
behaviour, particularily for remote problems. Less effective once on-host
since someone the libraries can be read.

For static-executables the kernel registers the main program's
PIE-mapped exec section valid, as well as the randomly-placed sigtramp
page.  For dynamic executables ELF ld.so's exec segment is also
labelled valid; ld.so then has enough information to register libc's
exec section as valid via call-once msyscall(2)

For dynamic binaries, we continue to to permit the main program exec
segment because "go" (and potentially a few other applications) have
embedded system calls in the main program.  Hopefully at least go gets
fixed soon.

We declare the concept of embedded syscalls a bad idea for numerous
reasons, as we notice the ecosystem has many of
static-syscall-in-base-binary which are dynamically linked against
libraries which in turn use libc, which contains another set of
syscall stubs.  We've been concerned about adding even one additional
syscall entry point... but go's approach tends to double the entry-point
attack surface.

This was started at a nano-hackathon in Bob Beck's basement 2 weeks
ago during a long discussion with mortimer trying to hide from the SSL
scream-conversations, and finished in more comfortable circumstances
next to a wood-stove at Elk Lakes cabin with UVM scream-conversations.

ok guenther kettenis mortimer, lots of feedback from others
conversations about go with jsing tb sthen

Revision 1.151 / (download) - annotate - [select for diffs], Mon May 13 19:21:31 2019 UTC (5 years ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.150: +2 -2 lines
Diff to previous 1.150 (colored)

When killing a process, the signal is handled by any thread that
does not block the signal.  If all threads block the signal, we
delivered it to the main thread.  This does not conform to POSIX.
If any thread unblocks the signal, it should be delivered immediately
to this thread.
Mark such signals pending at the process instead of a single thread.
Then any thread can handle it later.
OK kettenis@ guenther@

Revision 1.150 / (download) - annotate - [select for diffs], Sat May 11 19:59:26 2019 UTC (5 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.149: +1 -14 lines
Diff to previous 1.149 (colored)

wxneeded binaries on wxallowed filesystems were refused execution.  We have
encountered a wxneeded binary that attempts correct operation when started
on a nowxallowed filesystem (it tries mprotect with RWX, notices ENOTSUP
and acts in a different way).  So permit execution (but of course don't
allow W^X violating mappings)
ok sthen kettenis robert

Revision 1.149 / (download) - annotate - [select for diffs], Thu May 9 22:25:42 2019 UTC (5 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.148: +4 -2 lines
Diff to previous 1.148 (colored)

If mallocing the array program header fails, give up on coredumping
instead of panicing

ok deraadt@, tedu@, mpi@

Revision 1.148 / (download) - annotate - [select for diffs], Sat Apr 20 23:11:20 2019 UTC (5 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.147: +2 -2 lines
Diff to previous 1.147 (colored)

#define        ELFROUNDSIZE    4       /* XXX Should it be sizeof(Elf_Word)? */
Now that alpha is fixed, we can use sizeof().

Revision 1.147 / (download) - annotate - [select for diffs], Thu Dec 6 18:59:31 2018 UTC (5 years, 6 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.146: +65 -8 lines
Diff to previous 1.146 (colored)

Core files with >65535 sections have to use PN_XNUM and a section header
to pass the real count, with a minimal .shstrtab segment for consistency.
Also, add support for PN_XNUM to readelf.

problem reported and testing by claudio@
ok kettenis@

Revision 1.146 / (download) - annotate - [select for diffs], Sun Aug 5 14:23:57 2018 UTC (5 years, 10 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.145: +2 -1 lines
Diff to previous 1.145 (colored)

Decouple unveil from the pledge flags, by adding dedicated unveil flags
to the namei args. This fixes a bug where chmod would be allowed when
with only READ. This also allows some further cleanup of some awkward
things like PLEDGE_STAT that will follow
Lots of assistence from semarie@ - thanks!
ok semarie@

Revision 1.142.2.1 / (download) - annotate - [select for diffs], Tue Jul 24 09:31:33 2018 UTC (5 years, 10 months ago) by bluhm
Branch: OPENBSD_6_3
Changes since 1.142: +7 -3 lines
Diff to previous 1.142 (colored) next main 1.143 (colored)

Fail if a PT_LOAD segment has a memory size of 0.  This prevents a panic
later on, and it makes no sense for a binary to have such a segment.
found by Thomas Barabosch with Melkor_ELF_Fuzzer
from kettenis@; OK bluhm@ guenther@
OpenBSD 6.3 errata 012

Revision 1.141.4.1 / (download) - annotate - [select for diffs], Tue Jul 24 09:29:18 2018 UTC (5 years, 10 months ago) by bluhm
Branch: OPENBSD_6_2
Changes since 1.141: +7 -3 lines
Diff to previous 1.141 (colored) next main 1.142 (colored)

Fail if a PT_LOAD segment has a memory size of 0.  This prevents a panic
later on, and it makes no sense for a binary to have such a segment.
found by Thomas Barabosch with Melkor_ELF_Fuzzer
from kettenis@; OK bluhm@ guenther@
OpenBSD 6.2 errata 018

Revision 1.145 / (download) - annotate - [select for diffs], Fri Jul 20 21:57:26 2018 UTC (5 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.144: +2 -3 lines
Diff to previous 1.144 (colored)

Remove a few leftovers from the days of emulation, which could result in
a bad/corrupt binary not returning ENOEXEC but some other error.
ok guenther kettenis bluhm

Revision 1.144 / (download) - annotate - [select for diffs], Fri Jul 20 21:48:27 2018 UTC (5 years, 10 months ago) by kettenis
Branch: MAIN
Changes since 1.143: +7 -3 lines
Diff to previous 1.143 (colored)

Fail if a PT_LOAD segment has a memory size of 0.  This prevents a panic
later on, and it makes no sense for a binary to have such a segment.

ok bluhm@, guenther@

Revision 1.143 / (download) - annotate - [select for diffs], Tue Jul 10 04:19:59 2018 UTC (5 years, 11 months ago) by guenther
Branch: MAIN
Changes since 1.142: +1 -2 lines
Diff to previous 1.142 (colored)

Move from sendsig() to its callers the initsiginfo() calls and
instead of passing sendsig() the code+type+val, pass a siginfo_t*
to copy from.  Eliminate the indirection through struct emul for
sendsig(); we no longer have a SunOS4-compat version of sendsig()

ok deraadt@

Revision 1.142 / (download) - annotate - [select for diffs], Sat Dec 30 23:08:29 2017 UTC (6 years, 5 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE
Branch point for: OPENBSD_6_3
Changes since 1.141: +2 -2 lines
Diff to previous 1.141 (colored)

Don't pull in <sys/file.h> just to get fcntl.h

ok deraadt@ krw@

Revision 1.141 / (download) - annotate - [select for diffs], Thu Sep 7 11:32:14 2017 UTC (6 years, 9 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE
Branch point for: OPENBSD_6_2
Changes since 1.140: +2 -2 lines
Diff to previous 1.140 (colored)

In elf_load_file() to not call free(9) with an uninitialized size
even if the pointer is NULL.  This is not a real bug as free(9)
checks the addr pointer before the size value, but the compiler
cannot know that.
found by clang -Wuninitialized; OK deraadt@

Revision 1.126.2.1 / (download) - annotate - [select for diffs], Tue Mar 21 21:11:48 2017 UTC (7 years, 2 months ago) by benno
Branch: OPENBSD_6_0
Changes since 1.126: +2 -1 lines
Diff to previous 1.126 (colored) next main 1.127 (colored)

OpenBSD 6.0 Errata 020: SECURITY FIX: March 20, 2017
MFC sys/kern/exec_elf.c exec_elf.c rev v 1.140 kettenis

    Initialize the stack buffer used to build the auxiliary vector to zero to
    avoid leaking the contents of the kernel stack into userspace.

    ok guenther@, deraadt@

Revision 1.119.2.1 / (download) - annotate - [select for diffs], Tue Mar 21 21:11:09 2017 UTC (7 years, 2 months ago) by benno
Branch: OPENBSD_5_9
Changes since 1.119: +2 -1 lines
Diff to previous 1.119 (colored) next main 1.120 (colored)

OpenBSD 5.9 Errata 037: SECURITY FIX: March 20, 2017
MFC sys/kern/exec_elf.c exec_elf.c rev v 1.140 kettenis
    Initialize the stack buffer used to build the auxiliary vector to zero to
    avoid leaking the contents of the kernel stack into userspace.

    ok guenther@, deraadt@

Revision 1.140 / (download) - annotate - [select for diffs], Mon Mar 20 00:05:21 2017 UTC (7 years, 2 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.139: +2 -1 lines
Diff to previous 1.139 (colored)

Initialize the stack buffer used to build the auxiliary vector to zero to
avoid leaking the contents of the kernel stack into userspace.

ok guenther@, deraadt@

Revision 1.139 / (download) - annotate - [select for diffs], Sun Mar 5 00:45:30 2017 UTC (7 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.138: +118 -125 lines
Diff to previous 1.138 (colored)

Generating a coredump requires walking the map twice; change
uvm_coredump_walkmap() to do both with a callback in between
so it can hold locks/change state across the two.

ok stefan@

Revision 1.138 / (download) - annotate - [select for diffs], Sat Feb 11 06:07:03 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.137: +4 -2 lines
Diff to previous 1.137 (colored)

Correct the entry point and base address calculations for an
interpreter whose entry point isn't in its first PT_LOAD segment.

problem report and testing by patrick@

Revision 1.137 / (download) - annotate - [select for diffs], Wed Feb 8 21:04:44 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.136: +12 -21 lines
Diff to previous 1.136 (colored)

Remove support for forcing the ELF interpreter to a specific address,
last used by COMPAT_SYSV which was removed in 2011.

ok millert@

Revision 1.136 / (download) - annotate - [select for diffs], Wed Feb 8 05:09:25 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.135: +77 -78 lines
Diff to previous 1.135 (colored)

In exec_elf.c: expand ELFNAME(), ELFNAME2(), and ELFNAMEEND() except
leaving out the size, so that
	ELFNAME2(exec,makecmds)
becomes
	exec_elf_makecmds
instead of
	exec_elf{32,64}_makecmds
and then delete the ELFNAME2() and ELFNAMEEND() macros.

Move the prototypes for functions local to exec_elf.c to there from
exec_elf.h.

Simplify the SMALL_KERNEL conditionals around the ELF coredump code.

Change exec_conf.c to use the size-generic names and macros

Remove exec_elf{32,64}.c and just build exec_elf.c; delete the
_KERN_DO_ELF and _KERN_DO_ELF64 #defines.

ok jca@, encouragement from deraadt@ and tom@

Revision 1.135 / (download) - annotate - [select for diffs], Wed Feb 8 05:02:05 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.134: +6 -1 lines
Diff to previous 1.134 (colored)

Move ELF_AUX_ENTRIES from exec_elf.h to exec_elf.c; it's totally internal
and not something we guarantee to userspace

ok jca@

Revision 1.134 / (download) - annotate - [select for diffs], Wed Feb 8 04:55:38 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.133: +8 -9 lines
Diff to previous 1.133 (colored)

Change ELFNAME(read_from)'s buf parameter to be void*, eliminating a cast
from all but one call

ok jca@

Revision 1.133 / (download) - annotate - [select for diffs], Wed Feb 8 04:47:23 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.132: +1 -13 lines
Diff to previous 1.132 (colored)

elf{32,64}_check_brand() isn't used; delete it

ok jca@

Revision 1.132 / (download) - annotate - [select for diffs], Wed Feb 8 04:34:29 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.131: +11 -11 lines
Diff to previous 1.131 (colored)

Provide size-generic ELF_NO_ADDR in <sys/exec_elf.h> and use that instead
of ELFDEFNNAME(NO_ADDR)

ok jca@

Revision 1.131 / (download) - annotate - [select for diffs], Sun Feb 5 19:51:27 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.130: +5 -23 lines
Diff to previous 1.130 (colored)

Since we expect to never do binary compat with other OSes again,
delete the no-longer-used probe hook support.

ok mpi@ jca@

Revision 1.130 / (download) - annotate - [select for diffs], Sat Jan 21 05:42:03 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.129: +2 -2 lines
Diff to previous 1.129 (colored)

p_comm is the process's command and isn't per thread, so move it from
struct proc to struct process.

ok deraadt@ kettenis@

Revision 1.129 / (download) - annotate - [select for diffs], Mon Nov 7 00:26:32 2016 UTC (7 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.128: +2 -2 lines
Diff to previous 1.128 (colored)

Split PID from TID, giving processes a PID unrelated to the TID of their
initial thread

ok jsing@ kettenis@

Revision 1.128 / (download) - annotate - [select for diffs], Wed Oct 5 02:31:52 2016 UTC (7 years, 8 months ago) by guenther
Branch: MAIN
Changes since 1.127: +2 -2 lines
Diff to previous 1.127 (colored)

Display/test/use the process PID, not the thread's TID, in a few places.

ok mpi@ mikeb@

Revision 1.127 / (download) - annotate - [select for diffs], Mon Sep 12 00:35:54 2016 UTC (7 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.126: +6 -5 lines
Diff to previous 1.126 (colored)

When trying to run an ELF binary marked PT_OPENBSD_WXNEEDED from a
file system mounted without MNT_WXALLOWED, fail with EACCES rather
than with ENOEXEC, to discourage the shell from trying to run the
file as a shell script.
OK deraadt@ millert@; tedu@ and halex@ agreed with the general direction.

Revision 1.126 / (download) - annotate - [select for diffs], Sat Jun 11 21:04:08 2016 UTC (8 years ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE
Branch point for: OPENBSD_6_0
Changes since 1.125: +5 -2 lines
Diff to previous 1.125 (colored)

Since epp->ep_name is a userland pointer, use copyinstr(9) to get a copy ok
the string into kernel space before logging the W^X binary warning.

ok jca@, guenther@

Revision 1.125 / (download) - annotate - [select for diffs], Wed Jun 8 12:07:52 2016 UTC (8 years ago) by kettenis
Branch: MAIN
Changes since 1.124: +9 -2 lines
Diff to previous 1.124 (colored)

Enforce W^X and map W|X segments without X permission initially.  The
dynamic linker will make these read-only and add back X permission after
elocation processing.  Static executables with W|X segments will probably
crash.

ok deraadt@, guenther@

Revision 1.124 / (download) - annotate - [select for diffs], Mon May 30 21:31:29 2016 UTC (8 years ago) by deraadt
Branch: MAIN
Changes since 1.123: +19 -1 lines
Diff to previous 1.123 (colored)

Identify W^X labelled binaries at execve() time based upon WX_OPENBSD_WXNEEDED
flag set by ld -zwxneeded.  Such binaries are allowed to run only on wxallowed
mountpoints.  They do not report mmap/mprotect problems.

Rate limit mmap/mprotect reports from other binaries.

These semantics are chosen to encourage progress in the ports ecosystem,
without overwhelming the developers who work in the area.
ok sthen kettenis

Revision 1.123 / (download) - annotate - [select for diffs], Mon May 30 21:25:48 2016 UTC (8 years ago) by deraadt
Branch: MAIN
Changes since 1.122: +0 -18 lines
Diff to previous 1.122 (colored)

backout to insert correct commit message

Revision 1.122 / (download) - annotate - [select for diffs], Mon May 30 21:22:45 2016 UTC (8 years ago) by deraadt
Branch: MAIN
Changes since 1.121: +19 -1 lines
Diff to previous 1.121 (colored)

*** empty log message ***

Revision 1.121 / (download) - annotate - [select for diffs], Tue May 10 18:39:51 2016 UTC (8 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.120: +3 -2 lines
Diff to previous 1.120 (colored)

SROP mitigation.  sendsig() stores a (per-process ^ &sigcontext) cookie
inside the sigcontext.  sigreturn(2) checks syscall entry was from the
exact PC addr in the (per-process ASLR) sigtramp, verifies the cookie,
and clears it to prevent sigcontext reuse.
not yet tested on landisk, sparc, *88k, socppc.
ok kettenis

Revision 1.120 / (download) - annotate - [select for diffs], Sun Feb 28 15:46:18 2016 UTC (8 years, 3 months ago) by naddy
Branch: MAIN
Changes since 1.119: +1 -8 lines
Diff to previous 1.119 (colored)

Support for running Linux binaries under emulation is going away.

Remove "option COMPAT_LINUX" and everything directly tied to it from the
kernel and the corresponding man page documentation.

ok visa@ guenther@

Revision 1.119 / (download) - annotate - [select for diffs], Mon Nov 2 16:31:55 2015 UTC (8 years, 7 months ago) by semarie
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE
Branch point for: OPENBSD_5_9
Changes since 1.118: +2 -2 lines
Diff to previous 1.118 (colored)

move the pledgenote annotation from `struct proc' to `struct nameidata'

pledgenote is used for annotate the policy for a namei context. So make it
tracking the nameidata.

It is expected for the caller to explicitly define the policy. It is a kernel
bug to not do so.

ok deraadt@

Revision 1.118 / (download) - annotate - [select for diffs], Wed Oct 28 11:59:08 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.117: +3 -1 lines
Diff to previous 1.117 (colored)

Paranoa: p_pledgenote the NAMEI for ld.so loading

Revision 1.117 / (download) - annotate - [select for diffs], Mon Sep 28 20:32:59 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.116: +4 -3 lines
Diff to previous 1.116 (colored)

Track size of an opaque allocation to pass to free() later
ok guenther tedu

Revision 1.100.4.1 / (download) - annotate - [select for diffs], Thu Apr 30 19:30:14 2015 UTC (9 years, 1 month ago) by guenther
Branch: OPENBSD_5_6
Changes since 1.100: +10 -2 lines
Diff to previous 1.100 (colored) next main 1.101 (colored)

Backport r1.114-1.116 by myself and jsg:
Missing validity checks in the kernel ELF loader meant malformed binaries
could trigger kernel panics or view kernel memory.

Revision 1.112.2.1 / (download) - annotate - [select for diffs], Thu Apr 30 19:29:04 2015 UTC (9 years, 1 month ago) by guenther
Branch: OPENBSD_5_7
Changes since 1.112: +10 -2 lines
Diff to previous 1.112 (colored) next main 1.113 (colored)

Backport r1.114-1.116 by myself and jsg:
Missing validity checks in the kernel ELF loader meant malformed binaries
could trigger kernel panics or view kernel memory.

Revision 1.116 / (download) - annotate - [select for diffs], Thu Apr 30 11:15:28 2015 UTC (9 years, 1 month ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.115: +2 -2 lines
Diff to previous 1.115 (colored)

Now we use p_filesz - 1 to test for NUL check that p_filesz is
at least two and while here allow the upper bound to be
MAXPATHLEN by changing a >= to > as suggested by krw@ in a thread
on tech where Maxime Villard proposed additional PT_INTERP checks.

tested by and ok guenther@

Revision 1.115 / (download) - annotate - [select for diffs], Thu Apr 30 03:11:21 2015 UTC (9 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.114: +3 -1 lines
Diff to previous 1.114 (colored)

Error out if the PT_INTERP segment isn't NUL terminated

ok deraadt@ millert@ miod@

Revision 1.114 / (download) - annotate - [select for diffs], Sun Apr 26 05:30:42 2015 UTC (9 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.113: +7 -1 lines
Diff to previous 1.113 (colored)

Require a PT_LOAD segment's p_filesz to be no larger than its p_memsz.

test cases provided by Alejandro Herna'ndez (nitrousenador (at) gmail.com)
ok deraadt@ jsg@

Revision 1.113 / (download) - annotate - [select for diffs], Mon Mar 30 21:08:38 2015 UTC (9 years, 2 months ago) by miod
Branch: MAIN
Changes since 1.112: +3 -2 lines
Diff to previous 1.112 (colored)

Extend uvm_map_hint() to get an address range as extra arguments, and make
sure it will return an address within that range.

Use this in uaddr_rnd_select() to make sure we will not attempt to pick
an address beyond what we are allowed to map.

In my trees for 9 months, blackmailed s2k15 attendees into agreeing now would
be a good time to commit.

Revision 1.112 / (download) - annotate - [select for diffs], Tue Feb 10 23:39:57 2015 UTC (9 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE
Branch point for: OPENBSD_5_7
Changes since 1.111: +10 -11 lines
Diff to previous 1.111 (colored)

Don't use an uninitialized variable when a PT_LOAD segment with
alignment 0 or 1 is encountered.  The result before was just a
spurious failure by execve(), though I had to manually mangle a
binary to hit this case: segments are all long-aligned or better
in practice.

uninitialized variable noted by Maxime Villard (rustyBSD (at) gmx.fr)
ok and prod jsg@

Revision 1.111 / (download) - annotate - [select for diffs], Fri Feb 6 23:58:12 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.110: +1 -4 lines
Diff to previous 1.110 (colored)

Raise ELF_RANDOMIZE_LIMIT to 64K, so that programs and libraries can
legitimately use random section variables without execve failures...
Because this section is not demand faulted, yield() every page during
the fill otherwise the costs are charged poorly.
ok tedu matthew

Revision 1.110 / (download) - annotate - [select for diffs], Tue Jan 27 00:33:21 2015 UTC (9 years, 4 months ago) by kurt
Branch: MAIN
Changes since 1.109: +11 -5 lines
Diff to previous 1.109 (colored)

Require EFT shared objects have a PT_PHDR entry to be considered
a pie binary. The kernel will now reject executing a typical shared
library with EINVAL. This breaks compatibility with initial static pie
binaries and requires a recent user-land prior to upgrading. In
addition, more fine grained errors can be returned from execve(2)
when errors occur while attempting to execute ELF objects.

okay guenther@, kettenis@, deraadt@

Revision 1.109 / (download) - annotate - [select for diffs], Tue Jan 20 19:43:21 2015 UTC (9 years, 4 months ago) by kettenis
Branch: MAIN
Changes since 1.108: +2 -2 lines
Diff to previous 1.108 (colored)

Move ps_strings "after" the random stackgap.  This makes its location a
per-process value, and therefpore turns the VM_PSSTRINGS sysctl into a
per-process one as well.  This gets rid of a pointer to the bottom of the
stack at a fixed location.  Also clears the road for unmapping the stackgap.

ok deraadt@

Revision 1.108 / (download) - annotate - [select for diffs], Mon Dec 22 15:05:24 2014 UTC (9 years, 5 months ago) by kettenis
Branch: MAIN
Changes since 1.107: +12 -9 lines
Diff to previous 1.107 (colored)

Make it possible to execute PIE binaries that don't have an PT_INTERP segment
(and therefore no interpreter).  Necessary to make self-relocating "static"
PIE working.

This will also allow execution of shared libraries that have the 'x' bit set.
Those shouldn't exist, but unfortunately people outside OpenBSD think
differently which means third-party software sometimes installs shared
libraries with the 'x' bit set.

ok kurt@, deraadt@

Revision 1.107 / (download) - annotate - [select for diffs], Tue Dec 16 18:30:03 2014 UTC (9 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.106: +3 -1 lines
Diff to previous 1.106 (colored)

primary change: move uvm_vnode out of vnode, keeping only a pointer.
objective: vnode.h doesn't include uvm_extern.h anymore.
followup changes: include uvm_extern.h or lock.h where necessary.
ok and help from deraadt

Revision 1.106 / (download) - annotate - [select for diffs], Sun Nov 16 12:31:00 2014 UTC (9 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.105: +10 -10 lines
Diff to previous 1.105 (colored)

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis

Revision 1.105 / (download) - annotate - [select for diffs], Fri Nov 14 23:26:48 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.104: +2 -2 lines
Diff to previous 1.104 (colored)

prefer sizeof(*ptr) to sizeof(struct) for malloc and free

Revision 1.104 / (download) - annotate - [select for diffs], Thu Nov 6 17:31:19 2014 UTC (9 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.103: +1 -3 lines
Diff to previous 1.103 (colored)

printf debugging worked! figured out the bug (in free()) just after
committing the printfs. revert.

Revision 1.103 / (download) - annotate - [select for diffs], Thu Nov 6 17:23:40 2014 UTC (9 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.102: +8 -11 lines
Diff to previous 1.102 (colored)

Make better use of the value of psectionslen instead of recomputing
it multiple times.  Also remove an unused variable.  OK deraadt@ tedu@

Revision 1.102 / (download) - annotate - [select for diffs], Thu Nov 6 16:43:42 2014 UTC (9 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.101: +3 -1 lines
Diff to previous 1.101 (colored)

resort to printf debugging hints until we can figure this out. ok deraadt

Revision 1.101 / (download) - annotate - [select for diffs], Mon Nov 3 03:08:00 2014 UTC (9 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.100: +10 -9 lines
Diff to previous 1.100 (colored)

pass size argument to free()
ok doug tedu

Revision 1.100 / (download) - annotate - [select for diffs], Sun Jul 13 23:59:58 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE
Branch point for: OPENBSD_5_6
Changes since 1.99: +5 -5 lines
Diff to previous 1.99 (colored)

use mallocarray for multiplied value checking

Revision 1.99 / (download) - annotate - [select for diffs], Sat Jul 12 18:43:32 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.98: +10 -10 lines
Diff to previous 1.98 (colored)

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.

Revision 1.98 / (download) - annotate - [select for diffs], Tue Jul 8 17:19:25 2014 UTC (9 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.97: +1 -2 lines
Diff to previous 1.97 (colored)

decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.h
don't need to be married.
ok guenther miod beck jsing kettenis

Revision 1.97 / (download) - annotate - [select for diffs], Sun Mar 30 21:54:48 2014 UTC (10 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.96: +5 -5 lines
Diff to previous 1.96 (colored)

Eliminates struct pcred by moving the real and saved ugids into
struct ucred; struct process then directly links to the ucred

Based on a discussion at c2k10 or so before noting that FreeBSD and
NetBSD did this too.

ok matthew@

Revision 1.96 / (download) - annotate - [select for diffs], Wed Mar 26 05:23:42 2014 UTC (10 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.95: +3 -3 lines
Diff to previous 1.95 (colored)

Move p_emul and p_sigcode from proc to process.
Tweak the handling of ktrace EMUL when changing ktracing: only
generate one per process (not one per thread) and pass the correct
proc pointer down to the VFS layer.  Permit generating of NAMI and
CSW records inside ktrace(2) itself.

ok deraadt@ millert@

Revision 1.95 / (download) - annotate - [select for diffs], Sat Mar 22 06:05:45 2014 UTC (10 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.94: +3 -3 lines
Diff to previous 1.94 (colored)

Move p_sigacts from struct proc to struct process.

testing help mpi@

Revision 1.94 / (download) - annotate - [select for diffs], Tue Jan 21 01:48:44 2014 UTC (10 years, 4 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.93: +3 -3 lines
Diff to previous 1.93 (colored)

bzero -> memset

Revision 1.93 / (download) - annotate - [select for diffs], Thu Jul 4 17:37:05 2013 UTC (10 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.92: +4 -7 lines
Diff to previous 1.92 (colored)

now that free(null) is safe, delete checks

Revision 1.92 / (download) - annotate - [select for diffs], Sun Jun 2 16:41:37 2013 UTC (11 years ago) by guenther
Branch: MAIN
Changes since 1.91: +4 -3 lines
Diff to previous 1.91 (colored)

Coredumping is now single-threaded, so update comment about locking

Revision 1.91 / (download) - annotate - [select for diffs], Thu Mar 28 16:55:25 2013 UTC (11 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.90: +1 -2 lines
Diff to previous 1.90 (colored)

do not include machine/cpu.h from a .c file; it is the responsibility of
.h files to pull it in, if needed
ok tedu

Revision 1.90 / (download) - annotate - [select for diffs], Tue Jan 15 01:34:27 2013 UTC (11 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.89: +4 -1 lines
Diff to previous 1.89 (colored)

Slice & dice coredump write requests into MAXPHYS blocks, and
yield between operations.  Re-grab the vnode every operation,
so that multiple coredumps can be saved at the same time.
ok guenther beck etc

Revision 1.89 / (download) - annotate - [select for diffs], Mon Sep 17 17:11:49 2012 UTC (11 years, 8 months ago) by matthew
Branch: MAIN
Changes since 1.88: +3 -2 lines
Diff to previous 1.88 (colored)

Recognize executables tagged with ELFOSABI_OPENBSD (such as generated
by the Go linker) as native executables even if they don't contain an
OpenBSD PT_NOTE segment.

Confirmed to fix Go by sthen
ok kettenis, deraadt

Revision 1.88 / (download) - annotate - [select for diffs], Tue Sep 11 15:44:19 2012 UTC (11 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.87: +7 -21 lines
Diff to previous 1.87 (colored)

Remove the 'OLF method' used for the transition from a.out to ELF and
for all the compat layers which are now gone.  Linux compat still works
because it always used another method in any case, and nothing looks at
p_os anymore.
ok jsing

Revision 1.87 / (download) - annotate - [select for diffs], Mon Aug 20 23:25:07 2012 UTC (11 years, 9 months ago) by matthew
Branch: MAIN
Changes since 1.86: +26 -1 lines
Diff to previous 1.86 (colored)

Add support for .openbsd.randomdata sections and PT_OPENBSD_RANDOMIZE
segments to the kernel, ld (2.15), and ld.so.  Tested on alpha, amd64,
i386, macppc, and sparc64 (thanks naddy, mpi, and okan!).

Idea discussed for some time; committing now for further testing.
ok deraadt

Revision 1.86 / (download) - annotate - [select for diffs], Fri Mar 9 13:01:28 2012 UTC (12 years, 3 months ago) by ariane
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.85: +14 -12 lines
Diff to previous 1.85 (colored)

New vmmap implementation.

no oks (it is really a pain to review properly)
extensively tested, I'm confident it'll be stable
'now is the time' from several icb inhabitants

Diff provides:
- ability to specify different allocators for different regions/maps
- a simpler implementation of the current allocator
- currently in compatibility mode: it will generate similar addresses
  as the old allocator

Revision 1.85 / (download) - annotate - [select for diffs], Tue Jul 5 04:48:02 2011 UTC (12 years, 11 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.84: +5 -5 lines
Diff to previous 1.84 (colored)

Recommit the reverted sigacts change now that the NFS use-after-free
problem has been tracked down.  This fixes the sharing of the signal
handling state: shared bits go in sigacts, per-rthread bits goes in
struct proc.

ok deraadt@

Revision 1.84 / (download) - annotate - [select for diffs], Mon Jul 4 22:53:53 2011 UTC (12 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.83: +1 -8 lines
Diff to previous 1.83 (colored)

remove compat_svr4 support.  ok deraadt

Revision 1.83 / (download) - annotate - [select for diffs], Mon Jun 6 17:10:23 2011 UTC (13 years ago) by ariane
Branch: MAIN
Changes since 1.82: +11 -13 lines
Diff to previous 1.82 (colored)

Backout vmmap in order to repair virtual address selection algorithms
outside the tree.

Revision 1.82 / (download) - annotate - [select for diffs], Tue May 24 15:27:36 2011 UTC (13 years ago) by ariane
Branch: MAIN
Changes since 1.81: +13 -11 lines
Diff to previous 1.81 (colored)

Reimplement uvm/uvm_map.

vmmap is designed to perform address space randomized allocations,
without letting fragmentation of the address space go through the roof.

Some highlights:
- kernel address space randomization
- proper implementation of guardpages
- roughly 10% system time reduction during kernel build

Tested by alot of people on tech@ and developers.
Theo's machines are still happy.

Revision 1.81 / (download) - annotate - [select for diffs], Mon Apr 18 21:44:56 2011 UTC (13 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.80: +4 -4 lines
Diff to previous 1.80 (colored)

Revert the sigacts diff: NFS can apparently retain pointers to processes
until they're zombies and then send them signals (for intr mounts).  Until
that is untangled, the sigacts change is unsafe.  sthen@ was the victim
for this one

Revision 1.80 / (download) - annotate - [select for diffs], Fri Apr 15 04:52:40 2011 UTC (13 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.79: +5 -5 lines
Diff to previous 1.79 (colored)

Correct the sharing of the signal handling state: stuff that should
be shared (p_sigignore, p_sigcatch, P_NOCLDSTOP, P_NOCLDWAIT) moves
to struct sigacts, wihle stuff that should be per rthread (ps_oldmask,
SAS_OLDMASK, ps_sigstk) moves to struct proc.  Treat the coredumping
state bits (ps_sig, ps_code, ps_type, ps_sigval) as per-rthread
until our locking around coredumping is better.

Oh, and remove the old SunOS-compat ps_usertramp member.

"I like the sound of this" tedu@

Revision 1.79 / (download) - annotate - [select for diffs], Tue Apr 5 12:50:15 2011 UTC (13 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.78: +1 -8 lines
Diff to previous 1.78 (colored)

Push COMPAT_FREEBSD in front of a whale.  Buggy, out of date, no
one has been weeding it, and it makes life harder.

Toasts of Brennivin for its passing from many; diff ok henning@

Revision 1.78 / (download) - annotate - [select for diffs], Wed Dec 15 04:59:52 2010 UTC (13 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.77: +4 -4 lines
Diff to previous 1.77 (colored)

add a BRKSIZ define and use it for the heap gap constant, decoupling
heap gap from max data size.  nothing else changes yet.  ok deraadt

Revision 1.77 / (download) - annotate - [select for diffs], Fri Sep 17 14:03:09 2010 UTC (13 years, 8 months ago) by mikeb
Branch: MAIN
Changes since 1.76: +3 -1 lines
Diff to previous 1.76 (colored)

don't forget to free program header sections when writing
core files.  fixes a local DoS that can be carried out by
an unprivileged user.

ok kettenis

Revision 1.76 / (download) - annotate - [select for diffs], Mon Jul 26 01:56:27 2010 UTC (13 years, 10 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.75: +8 -7 lines
Diff to previous 1.75 (colored)

Correct the links between threads, processes, pgrps, and sessions,
so that the process-level stuff is to/from struct process and not
struct proc.  This fixes a bunch of problem cases in rthreads.
Based on earlier work by blambert and myself, but mostly written
at c2k10.

Tested by many: deraadt, sthen, krw, ray, and in snapshots

Revision 1.75 / (download) - annotate - [select for diffs], Sat Jul 24 09:50:45 2010 UTC (13 years, 10 months ago) by guenther
Branch: MAIN
Changes since 1.74: +2 -2 lines
Diff to previous 1.74 (colored)

struct emul's e_arglen member is expected to count in units of
sizeof(char *), not in bytes, so we've been allocating and copying around
four or eight times as many bytes as we needed to

ok kettenis@ deraadt@

Revision 1.74 / (download) - annotate - [select for diffs], Tue Jun 29 00:28:14 2010 UTC (13 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.73: +1 -5 lines
Diff to previous 1.73 (colored)

Eliminate RTHREADS kernel option in favor of a sysctl.  The actual status
(not done) hasn't changed, but now it's less work to test things.
ok art deraadt

Revision 1.73 / (download) - annotate - [select for diffs], Sun May 2 11:15:29 2010 UTC (14 years, 1 month ago) by kettenis
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

Use intermediate vaddr_t cast when casting a pointer to off_t.  Prevents
gcc4 from complaining about casting a pointer to an integer type of different
size.

ok guenther@, jsg@

Revision 1.72 / (download) - annotate - [select for diffs], Thu Jan 14 23:12:11 2010 UTC (14 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.71: +4 -4 lines
Diff to previous 1.71 (colored)

fix typos in comments, no code changes;
from Brad Tilley <brad at 16systems dot com>;
ok oga@

Revision 1.71 / (download) - annotate - [select for diffs], Thu Nov 19 02:36:27 2009 UTC (14 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.70: +1 -10 lines
Diff to previous 1.70 (colored)

Dell's SVR4 apparently mapped page zero to the executable.  We don't
do that and, given the security issues it exacerbates, never will.
So document it and delete the disabled support.

ok deraadt@ tedu@

Revision 1.70 / (download) - annotate - [select for diffs], Sat Jun 6 21:25:19 2009 UTC (15 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.69: +17 -1 lines
Diff to previous 1.69 (colored)

We need miod's no-coredumps-on-ramdisks diff, because we have grown the
media just a wee bit too much.

Revision 1.69 / (download) - annotate - [select for diffs], Sun Mar 8 14:28:52 2009 UTC (15 years, 3 months ago) by kettenis
Branch: MAIN
Changes since 1.68: +5 -2 lines
Diff to previous 1.68 (colored)

If a session leader exists s_leader is set to NULL, so don't dereference it
unconditionally.

ok miod@

Revision 1.68 / (download) - annotate - [select for diffs], Thu Mar 5 19:52:24 2009 UTC (15 years, 3 months ago) by kettenis
Branch: MAIN
Changes since 1.67: +475 -1 lines
Diff to previous 1.67 (colored)

Make ELF platforms generate ELF core dumps.  Somewhat based on code from
NetBSD.

ok kurt@, drahn@, miod@

Revision 1.67 / (download) - annotate - [select for diffs], Mon Nov 10 03:56:16 2008 UTC (15 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.66: +4 -1 lines
Diff to previous 1.66 (colored)

vm_map_lock() around calls to uvm_map_findspace(); ok tedu

Revision 1.66 / (download) - annotate - [select for diffs], Fri Jul 18 16:58:06 2008 UTC (15 years, 10 months ago) by kurt
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.65: +53 -23 lines
Diff to previous 1.65 (colored)

Add support for the kernel to recognize, load and execute position
independent executables using the uvm_map_pie() function to
randomize the load address. okay miod@, kettenis@, drahn@

Revision 1.65 / (download) - annotate - [select for diffs], Thu Jun 12 17:02:04 2008 UTC (16 years ago) by miod
Branch: MAIN
Changes since 1.64: +2 -4 lines
Diff to previous 1.64 (colored)

Oops, do not dereference a NULL function pointer used as an array end
marker; found the hard way by sturm@

Revision 1.64 / (download) - annotate - [select for diffs], Thu Jun 12 04:33:37 2008 UTC (16 years ago) by miod
Branch: MAIN
Changes since 1.63: +4 -4 lines
Diff to previous 1.63 (colored)

Reorder foreign binaries probe list, so that more permissive ones are at the
end. Makes static linux binaries run again.

Revision 1.63 / (download) - annotate - [select for diffs], Sat Jun 7 17:19:28 2008 UTC (16 years ago) by miod
Branch: MAIN
Changes since 1.62: +7 -13 lines
Diff to previous 1.62 (colored)

Remove the OLF os bitmask field from the compat probe functions array;
ok deraadt@

Revision 1.62 / (download) - annotate - [select for diffs], Wed Jun 4 21:12:50 2008 UTC (16 years ago) by deraadt
Branch: MAIN
Changes since 1.61: +3 -63 lines
Diff to previous 1.61 (colored)

olf support starts to die (easy stuff first); ok miod

Revision 1.61 / (download) - annotate - [select for diffs], Mon May 28 23:10:10 2007 UTC (17 years ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.60: +1 -8 lines
Diff to previous 1.60 (colored)

Maintaining a broken compatibility layer for a broken OS is not a productive
activity for anyone. Bye bye COMPAT_NETBSD. ok tedu@, deraadt@, and many others
in the hackathon room.

Revision 1.60 / (download) - annotate - [select for diffs], Tue Apr 10 17:47:55 2007 UTC (17 years, 2 months ago) by miod
Branch: MAIN
Changes since 1.59: +3 -3 lines
Diff to previous 1.59 (colored)

``it's'' -> ``its'' when the grammar gods require this change.

Revision 1.59 / (download) - annotate - [select for diffs], Tue Mar 20 12:32:07 2007 UTC (17 years, 2 months ago) by thib
Branch: MAIN
Changes since 1.58: +1 -3 lines
Diff to previous 1.58 (colored)

zap unused variable.

ok pedro@

Revision 1.58 / (download) - annotate - [select for diffs], Wed Mar 14 16:41:15 2007 UTC (17 years, 3 months ago) by kettenis
Branch: MAIN
Changes since 1.57: +3 -1 lines
Diff to previous 1.57 (colored)

Clean up after miod.

Revision 1.57 / (download) - annotate - [select for diffs], Tue Mar 13 19:34:44 2007 UTC (17 years, 3 months ago) by miod
Branch: MAIN
Changes since 1.56: +13 -5 lines
Diff to previous 1.56 (colored)

Don't bother checking for OLF binaries if option SMALL_KERNEL.

Revision 1.56 / (download) - annotate - [select for diffs], Fri Dec 29 13:04:37 2006 UTC (17 years, 5 months ago) by pedro
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.55: +2 -2 lines
Diff to previous 1.55 (colored)

Avoid void * arithmetic, okay deraadt@, suggestions from millert@

Revision 1.55 / (download) - annotate - [select for diffs], Tue Nov 14 18:00:27 2006 UTC (17 years, 7 months ago) by jmc
Branch: MAIN
Changes since 1.54: +2 -2 lines
Diff to previous 1.54 (colored)

grammar, spelling, and style fixes from bret lambert;
kern_descrip.c change ok deraadt

Revision 1.54 / (download) - annotate - [select for diffs], Mon Jul 10 20:00:08 2006 UTC (17 years, 11 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.53: +10 -1 lines
Diff to previous 1.53 (colored)

Handle executables that have all load sections marked read-only.
ok drahn@

Revision 1.53 / (download) - annotate - [select for diffs], Thu Jan 19 17:54:47 2006 UTC (18 years, 4 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.52: +29 -33 lines
Diff to previous 1.52 (colored)

redo (w/ proper changes everywhere ;):
take interp[MAXPATHLEN] off the stack.  from mickey, ok otto
while here, switch above from malloc to pool, remove stupid casts
tedu@ miod@ ok

Revision 1.52 / (download) - annotate - [select for diffs], Sat Jan 7 04:18:47 2006 UTC (18 years, 5 months ago) by aaron
Branch: MAIN
Changes since 1.51: +32 -28 lines
Diff to previous 1.51 (colored)

Backout last revision, it's broken.  Try pkg_add redhat_base-8.0p7 on i386
to see; page fault trap in linux_elf_probe (char *itp is being passed as NULL
and then "if (itp[0])" attempts to dereference it).  deraadt@ "trash it asap"

Revision 1.51 / (download) - annotate - [select for diffs], Fri Jan 6 06:46:04 2006 UTC (18 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.50: +29 -33 lines
Diff to previous 1.50 (colored)

take interp[MAXPATHLEN] off the stack.  from mickey, ok otto
while here, switch above from malloc to pool, remove stupid casts

Revision 1.50 / (download) - annotate - [select for diffs], Fri Nov 11 16:41:24 2005 UTC (18 years, 7 months ago) by drahn
Branch: MAIN
Changes since 1.49: +8 -1 lines
Diff to previous 1.49 (colored)

Allow binaries to run if all sections are marked writable
(some unusual linux binaries), ok deraadt.

Revision 1.29.2.11 / (download) - annotate - [select for diffs], Thu Feb 19 10:56:37 2004 UTC (20 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.29.2.10: +3 -1 lines
Diff to previous 1.29.2.10 (colored) to branchpoint 1.29 (colored) next main 1.30 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.48.2.1 / (download) - annotate - [select for diffs], Mon Nov 3 23:23:50 2003 UTC (20 years, 7 months ago) by brad
Branch: OPENBSD_3_4
Changes since 1.48: +2 -1 lines
Diff to previous 1.48 (colored) next main 1.49 (colored)

MFC:
Fix by tedu@

verify exec headers before attempting malloc.  reported by Georgi Guninski.

ok millert@

Revision 1.44.2.1 / (download) - annotate - [select for diffs], Mon Nov 3 22:07:49 2003 UTC (20 years, 7 months ago) by margarida
Branch: OPENBSD_3_3
Changes since 1.44: +2 -1 lines
Diff to previous 1.44 (colored) next main 1.45 (colored)

Pull patch from -current:
Fixed by tedu@

verify exec headers before attempting malloc.  reported by Georgi Guninski.

ok millert@

Revision 1.49 / (download) - annotate - [select for diffs], Mon Nov 3 19:58:22 2003 UTC (20 years, 7 months ago) by tedu
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6, OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.48: +2 -1 lines
Diff to previous 1.48 (colored)

verify exec headers before attempting malloc.  reported by Georgi Guninski.

Revision 1.48 / (download) - annotate - [select for diffs], Thu Aug 21 18:56:07 2003 UTC (20 years, 9 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE
Branch point for: OPENBSD_3_4
Changes since 1.47: +2 -1 lines
Diff to previous 1.47 (colored)

emulation is now controlled by sysctl.  changes:
add e_flags to struct emul.  this stores on/off and native flags.
check for emul enabled in check_exec().  gather all the emuls into a
emulsw so a sysctl can find them.  create sysctl.  move maxhdrsiz calcualation
into init_main so it cleans up sys_execve codepath.  teach sysctl utility
to grok kern.emul hierarchy.
requested and ok deraadt@  some comments from mickey@

Revision 1.29.2.10 / (download) - annotate - [select for diffs], Sat Jun 7 11:03:40 2003 UTC (21 years ago) by ho
Branch: SMP
Changes since 1.29.2.9: +2 -2 lines
Diff to previous 1.29.2.9 (colored) to branchpoint 1.29 (colored)

Sync SMP branch to -current

Revision 1.37.2.3 / (download) - annotate - [select for diffs], Mon May 19 22:31:09 2003 UTC (21 years ago) by tedu
Branch: UBC
Changes since 1.37.2.2: +151 -44 lines
Diff to previous 1.37.2.2 (colored) to branchpoint 1.37 (colored) next main 1.38 (colored)

sync

Revision 1.47 / (download) - annotate - [select for diffs], Sat May 17 14:02:06 2003 UTC (21 years, 1 month ago) by grange
Branch: MAIN
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored)

Typos; from Julien Bordet <zejames@greyhats.org>
Close PR 3262

Revision 1.29.2.9 / (download) - annotate - [select for diffs], Fri May 16 00:29:43 2003 UTC (21 years, 1 month ago) by niklas
Branch: SMP
Changes since 1.29.2.8: +7 -3 lines
Diff to previous 1.29.2.8 (colored) to branchpoint 1.29 (colored)

merge the trunk so we will get the genfs and locking fixes

Revision 1.29.2.8 / (download) - annotate - [select for diffs], Tue May 13 19:21:28 2003 UTC (21 years, 1 month ago) by ho
Branch: SMP
Changes since 1.29.2.7: +85 -13 lines
Diff to previous 1.29.2.7 (colored) to branchpoint 1.29 (colored)

Sync the SMP branch to -current. This includes moving to ELF.

Revision 1.46 / (download) - annotate - [select for diffs], Tue May 13 16:39:23 2003 UTC (21 years, 1 month ago) by millert
Branch: MAIN
CVS Tags: UBC_SYNC_A
Changes since 1.45: +7 -3 lines
Diff to previous 1.45 (colored)

Use EI_OSABI instead of EI_BRAND

Revision 1.45 / (download) - annotate - [select for diffs], Wed Apr 16 21:17:52 2003 UTC (21 years, 2 months ago) by drahn
Branch: MAIN
Changes since 1.44: +85 -13 lines
Diff to previous 1.44 (colored)

Use uvm_findspace() to verify that the addresses allocated to ld.so are
not already used. limit nphdr to 32. ok tedu@

Revision 1.29.2.7 / (download) - annotate - [select for diffs], Fri Mar 28 00:41:26 2003 UTC (21 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.29.2.6: +89 -56 lines
Diff to previous 1.29.2.6 (colored) to branchpoint 1.29 (colored)

Sync the SMP branch with 3.3

Revision 1.44 / (download) - annotate - [select for diffs], Tue Feb 18 03:54:40 2003 UTC (21 years, 3 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE
Branch point for: OPENBSD_3_3
Changes since 1.43: +24 -15 lines
Diff to previous 1.43 (colored)

Map just the requested pages not p_aligned pages. ok art@

Revision 1.43 / (download) - annotate - [select for diffs], Fri Nov 22 22:10:21 2002 UTC (21 years, 6 months ago) by drahn
Branch: MAIN
Changes since 1.42: +38 -16 lines
Diff to previous 1.42 (colored)

Allow more than two load sections on ELF executables, this limit
should not be required, and may be violated soon. With two fixes art
pointed out. ok art@

Revision 1.37.2.2 / (download) - annotate - [select for diffs], Tue Oct 29 00:36:44 2002 UTC (21 years, 7 months ago) by art
Branch: UBC
Changes since 1.37.2.1: +34 -32 lines
Diff to previous 1.37.2.1 (colored) to branchpoint 1.37 (colored)

sync to -current

Revision 1.42 / (download) - annotate - [select for diffs], Sun Oct 6 22:39:25 2002 UTC (21 years, 8 months ago) by art
Branch: MAIN
CVS Tags: UBC_SYNC_B
Changes since 1.41: +4 -21 lines
Diff to previous 1.41 (colored)

Move out the execution of vmcmds into a separate function.

Revision 1.41 / (download) - annotate - [select for diffs], Mon Sep 23 01:41:09 2002 UTC (21 years, 8 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.40: +40 -23 lines
Diff to previous 1.40 (colored)

Add support for vmcmds that load sections relative to a base section.
You mark one section with VMCMD_BASE and the rest are marked RELATIVE.
Use that to load ELF interpreter correctly in all cases.

Inspired by NetBSD. Great debugging help from drahn@
deraadt@ ok

Revision 1.40 / (download) - annotate - [select for diffs], Wed Sep 18 22:07:50 2002 UTC (21 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.39: +3 -1 lines
Diff to previous 1.39 (colored)

Mark ELF ld.so as VTEXT to prevent the file from being overwritten.
ok deraadt@ art@

Revision 1.39 / (download) - annotate - [select for diffs], Thu Aug 22 22:04:42 2002 UTC (21 years, 9 months ago) by art
Branch: MAIN
Changes since 1.38: +2 -2 lines
Diff to previous 1.38 (colored)

Change the vnode locking in exec to not keep the vnode locked almost all
the time.

This could lead to problems when a process wants to do an exec on the same
vnode it's being run from and needs to copy in arguments from an uncached
page in the data segment. When that happens uvm detects a vnode deadlock
and returns an error causing execve() return EFAULT.

This fixes the regress test in regress/sys/kern/exec_self

Also, initialize scriptvp early in exec_script because it could be
used uninitialized in a failure case.

Revision 1.37.2.1 / (download) - annotate - [select for diffs], Tue Jun 11 03:29:40 2002 UTC (22 years ago) by art
Branch: UBC
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

Sync UBC branch to -current

Revision 1.29.2.6 / (download) - annotate - [select for diffs], Thu Mar 28 11:43:04 2002 UTC (22 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.29.2.5: +2 -2 lines
Diff to previous 1.29.2.5 (colored) to branchpoint 1.29 (colored)

Merge in -current from about a week ago

Revision 1.38 / (download) - annotate - [select for diffs], Thu Mar 14 01:27:03 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

First round of __P removal in sys

Revision 1.29.2.5 / (download) - annotate - [select for diffs], Wed Dec 5 01:02:39 2001 UTC (22 years, 6 months ago) by niklas
Branch: SMP
Changes since 1.29.2.4: +1 -1 lines
Diff to previous 1.29.2.4 (colored) to branchpoint 1.29 (colored)

Merge in -current

Revision 1.37 / (download) - annotate - [select for diffs], Thu Nov 15 06:22:30 2001 UTC (22 years, 7 months ago) by art
Branch: MAIN
CVS Tags: UBC_BASE
Branch point for: UBC
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

New function vn_marktext - mark a vnode as executing a text image.
Use where VTEXT was set in vnode flags before. Doesn't do anything else (yet).

Revision 1.29.2.4 / (download) - annotate - [select for diffs], Tue Nov 13 23:04:23 2001 UTC (22 years, 7 months ago) by niklas
Branch: SMP
Changes since 1.29.2.3: +2 -2 lines
Diff to previous 1.29.2.3 (colored) to branchpoint 1.29 (colored)

merge in -current

Revision 1.36 / (download) - annotate - [select for diffs], Tue Nov 6 19:53:20 2001 UTC (22 years, 7 months ago) by miod
Branch: MAIN
Changes since 1.35: +2 -2 lines
Diff to previous 1.35 (colored)

Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.
(Look ma, I might have broken the tree)

Revision 1.29.2.3 / (download) - annotate - [select for diffs], Wed Oct 31 03:26:28 2001 UTC (22 years, 7 months ago) by nate
Branch: SMP
Changes since 1.29.2.2: +175 -133 lines
Diff to previous 1.29.2.2 (colored) to branchpoint 1.29 (colored)

Sync the SMP branch to something just after 3.0

Revision 1.35 / (download) - annotate - [select for diffs], Wed Sep 19 13:28:43 2001 UTC (22 years, 8 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.34: +167 -131 lines
Diff to previous 1.34 (colored)

Unify elf32 and elf64 code with macros. This forced a renaming
of a few functions from elf32.

Revision 1.31.2.1 / (download) - annotate - [select for diffs], Fri Aug 17 23:39:28 2001 UTC (22 years, 9 months ago) by jason
Branch: OPENBSD_2_9
Changes since 1.31: +9 -1 lines
Diff to previous 1.31 (colored) next main 1.32 (colored)

Pull in patch from current:
Fix (art):
Add a check for too big e_phnum that could cause us to malloc to
much and barf.
This should have been merged into this file from exec_elf64.c a long time ago.
Looking for volunteers to merge exec_elf.c and exec_elf64.c

Revision 1.34 / (download) - annotate - [select for diffs], Sat Aug 11 23:14:22 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.33: +1 -3 lines
Diff to previous 1.33 (colored)

Why is it so popular to include <vm/*.h> everywhere?

Revision 1.33 / (download) - annotate - [select for diffs], Mon Jul 30 11:58:36 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.32: +9 -1 lines
Diff to previous 1.32 (colored)

Add a check for too big e_phnum that could cause us to malloc to
much and barf.
This should have been merged into this file from exec_elf64.c a long time ago.
Looking for volunteers to merge exec_elf.c and exec_elf64.c

Revision 1.29.2.2 / (download) - annotate - [select for diffs], Wed Jul 4 10:48:12 2001 UTC (22 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.29.2.1: +24 -26 lines
Diff to previous 1.29.2.1 (colored) to branchpoint 1.29 (colored)

Merge in -current from two days ago in the SMP branch.
As usual with merges, they do not indicate progress, so do not hold
your breath for working SMP, and do not mail me and ask about the
state of it.  It has not changed.  There is work ongoing, but very, very
slowly.  The commit is done in parts as to not lock up the tree in too
big chunks at a time.

Revision 1.32 / (download) - annotate - [select for diffs], Fri Jun 22 14:14:07 2001 UTC (22 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.31: +24 -26 lines
Diff to previous 1.31 (colored)

KNF

Revision 1.29.2.1 / (download) - annotate - [select for diffs], Mon May 14 22:32:38 2001 UTC (23 years, 1 month ago) by niklas
Branch: SMP
Changes since 1.29: +4 -4 lines
Diff to previous 1.29 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.31 / (download) - annotate - [select for diffs], Mon Jan 22 14:25:03 2001 UTC (23 years, 4 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE
Branch point for: OPENBSD_2_9
Changes since 1.30: +3 -3 lines
Diff to previous 1.30 (colored)

NATIVE_ELF -> NATIVE_EXEC_ELF (just some leftovers)

Revision 1.30 / (download) - annotate - [select for diffs], Tue Jan 16 15:49:00 2001 UTC (23 years, 4 months ago) by art
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

Indentation nit.

Revision 1.29 / (download) - annotate - [select for diffs], Sat Jan 1 21:11:18 2000 UTC (24 years, 5 months ago) by mickey
Branch: MAIN
CVS Tags: SMP_BASE, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7
Branch point for: SMP
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

grammar in comment

Revision 1.28 / (download) - annotate - [select for diffs], Thu Nov 25 13:41:30 1999 UTC (24 years, 6 months ago) by art
Branch: MAIN
CVS Tags: kame_19991208
Changes since 1.27: +3 -3 lines
Diff to previous 1.27 (colored)

Use PAGE_SIZE instead of NBPG.

Revision 1.27 / (download) - annotate - [select for diffs], Thu Aug 12 20:37:16 1999 UTC (24 years, 10 months ago) by niklas
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.26: +4 -4 lines
Diff to previous 1.26 (colored)

Probe svr4 before linux

Revision 1.26 / (download) - annotate - [select for diffs], Tue Jul 20 12:14:34 1999 UTC (24 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.25: +4 -4 lines
Diff to previous 1.25 (colored)

correct os_mask handling for OLF; pefo

Revision 1.25 / (download) - annotate - [select for diffs], Tue Jun 1 17:54:31 1999 UTC (25 years ago) by pefo
Branch: MAIN
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

Fix some mips -> __mips__ stuff.

Revision 1.24 / (download) - annotate - [select for diffs], Wed Feb 10 08:07:20 1999 UTC (25 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.23: +21 -4 lines
Diff to previous 1.23 (colored)

branding support and freebsd elf

Revision 1.23 / (download) - annotate - [select for diffs], Mon Jan 11 05:12:22 1999 UTC (25 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

panic prints a newline for you, don't do it in the panic string

Revision 1.22 / (download) - annotate - [select for diffs], Tue Jul 28 00:13:02 1998 UTC (25 years, 10 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

Return EINVAL when msg_iovlen or iovcnt <= 0; Make uio_resid unsigned (size_t) and don't return EINVAL if it is < 0 in sys_{read,write}.  Remove check for uio_resid < 0 uiomove() now that uio_resid is unsigned and brack remaining panics with #ifdef DIAGNOSTIC.  vn_rdwr() must now take a size_t * as its 9th argument so change that and clean up uses of vn_rdwr().  Fixes 549 + more

Revision 1.21 / (download) - annotate - [select for diffs], Fri Mar 6 21:49:50 1998 UTC (26 years, 3 months ago) by niklas
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.20: +41 -32 lines
Diff to previous 1.20 (colored)

Ensure the correct probe will be run for an OLF binary

Revision 1.20 / (download) - annotate - [select for diffs], Sun Feb 22 01:13:12 1998 UTC (26 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.19: +100 -79 lines
Diff to previous 1.19 (colored)

Save possible OLF OS tag, or similar deduced ELF info for later perusal.
KNF.  This has been sitting for a long time in my tree now.

Revision 1.19 / (download) - annotate - [select for diffs], Mon Dec 23 02:42:43 1996 UTC (27 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2, OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.18: +6 -10 lines
Diff to previous 1.18 (colored)

use _{NLIST,KERN}_DO_{AOUT,ELF,ECOFF} to select binary types

Revision 1.18 / (download) - annotate - [select for diffs], Sun Nov 24 18:31:25 1996 UTC (27 years, 6 months ago) by etheisen
Branch: MAIN
Changes since 1.17: +47 -9 lines
Diff to previous 1.17 (colored)

OLF is ALIVE!

Revision 1.17 / (download) - annotate - [select for diffs], Thu Sep 12 18:52:17 1996 UTC (27 years, 9 months ago) by pefo
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.16: +3 -1 lines
Diff to previous 1.16 (colored)

ok, must have read access at least.

Revision 1.16 / (download) - annotate - [select for diffs], Thu Sep 12 14:43:30 1996 UTC (27 years, 9 months ago) by pefo
Branch: MAIN
Changes since 1.15: +1 -10 lines
Diff to previous 1.15 (colored)

remove excess tests...

Revision 1.15 / (download) - annotate - [select for diffs], Thu Sep 5 17:31:06 1996 UTC (27 years, 9 months ago) by pefo
Branch: MAIN
Changes since 1.14: +5 -1 lines
Diff to previous 1.14 (colored)

ld has some funny things going with alignments...

Revision 1.14 / (download) - annotate - [select for diffs], Sat Aug 31 09:24:07 1996 UTC (27 years, 9 months ago) by pefo
Branch: MAIN
Changes since 1.13: +159 -89 lines
Diff to previous 1.13 (colored)

Cleanup exec

Revision 1.13 / (download) - annotate - [select for diffs], Mon Aug 5 10:48:18 1996 UTC (27 years, 10 months ago) by niklas
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

layout style nit (am I a pedant, or what?)

Revision 1.12 / (download) - annotate - [select for diffs], Sun Jun 16 20:05:08 1996 UTC (28 years ago) by etheisen
Branch: MAIN
Changes since 1.11: +3 -2 lines
Diff to previous 1.11 (colored)

Whoops. Don't forget to take alignment into account when processing file.
Thanks Per.

Revision 1.11 / (download) - annotate - [select for diffs], Sat Jun 15 07:30:05 1996 UTC (28 years ago) by etheisen
Branch: MAIN
Changes since 1.10: +22 -30 lines
Diff to previous 1.10 (colored)

elf_check_header() is now fully functional.  Still need to add OS checks.

Revision 1.10 / (download) - annotate - [select for diffs], Mon Jun 10 03:39:06 1996 UTC (28 years ago) by deraadt
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

emul_elf has a name of "native"

Revision 1.9 / (download) - annotate - [select for diffs], Mon Jun 10 00:48:59 1996 UTC (28 years ago) by deraadt
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

use a shorter emul name

Revision 1.8 / (download) - annotate - [select for diffs], Sun Jun 9 20:47:13 1996 UTC (28 years ago) by deraadt
Branch: MAIN
Changes since 1.7: +40 -40 lines
Diff to previous 1.7 (colored)

emulation name is "native elf"

Revision 1.7 / (download) - annotate - [select for diffs], Thu Jun 6 07:39:37 1996 UTC (28 years ago) by pefo
Branch: MAIN
Changes since 1.6: +71 -6 lines
Diff to previous 1.6 (colored)

Paging exec_elf + mips enhancements

Revision 1.6 / (download) - annotate - [select for diffs], Wed May 22 07:44:28 1996 UTC (28 years ago) by etheisen
Branch: MAIN
Changes since 1.5: +21 -21 lines
Diff to previous 1.5 (colored)

Moved contents of elf_abi.h into exec_elf.h. Modified dependant files to
reflect this.

Revision 1.5 / (download) - annotate - [select for diffs], Thu Apr 18 17:15:52 1996 UTC (28 years, 1 month ago) by niklas
Branch: MAIN
Changes since 1.4: +1 -1 lines
Diff to previous 1.4 (colored)

Rename the COMPAT_SVR4_MAP_PAGE_ZERO option to ELF_MAP_PAGE_ZERO as the
change affected all ELF formats

Revision 1.4 / (download) - annotate - [select for diffs], Thu Apr 18 15:58:33 1996 UTC (28 years, 1 month ago) by niklas
Branch: MAIN
Changes since 1.3: +7 -1 lines
Diff to previous 1.3 (colored)

Support mapping of page zero read-only if COMPAT_SVR4_MAP_PAGE_ZERO
is used.  Dell SVR4 behaved this way, and some binaries rely on such icky
behaviour.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Mar 3 17:19:37 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.2: +16 -2 lines
Diff to previous 1.2 (colored)

From NetBSD: 960217 merge

Revision 1.2 / (download) - annotate - [select for diffs], Mon Jan 29 07:09:05 1996 UTC (28 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +40 -93 lines
Diff to previous 1.1 (colored)

from netbsd:
Don't rely on the protection bits of segments anymore to decide whether
it's text or data; use the entry point instead (this solves some trouble
with ELF executables with strange permissions)
Incorporate some fixes from r_friedl@informatik.uni-kl.de sent to
netbsd-bugs a while ago

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:52:43 1995 UTC (28 years, 8 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:52:43 1995 UTC (28 years, 8 months ago) by deraadt
Branch: MAIN

Initial revision

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.