| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
ok gnezdo@ semarie@ mpi@
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
We did not reach a consensus about using SMR to unlock single_thread_set()
so there's no point in keeping this change.
|
|
|
|
|
|
| |
This allows us to unlock getppid(2).
ok mpi@
|
|
|
|
|
|
|
| |
Currently all iterations are done under KERNEL_LOCK() and therefor use
the *_LOCKED() variant.
From and ok claudio@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
instead of panicing
ok deraadt@, tedu@, mpi@
|
|
|
|
| |
Now that alpha is fixed, we can use sizeof().
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
| |
a bad/corrupt binary not returning ENOEXEC but some other error.
ok guenther kettenis bluhm
|
|
|
|
|
|
| |
later on, and it makes no sense for a binary to have such a segment.
ok bluhm@, guenther@
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
| |
ok deraadt@ krw@
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
|
| |
avoid leaking the contents of the kernel stack into userspace.
ok guenther@, deraadt@
|
|
|
|
|
|
|
| |
uvm_coredump_walkmap() to do both with a callback in between
so it can hold locks/change state across the two.
ok stefan@
|
|
|
|
|
|
| |
interpreter whose entry point isn't in its first PT_LOAD segment.
problem report and testing by patrick@
|
|
|
|
|
|
| |
last used by COMPAT_SYSV which was removed in 2011.
ok millert@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
|
| |
and not something we guarantee to userspace
ok jca@
|
|
|
|
|
|
| |
from all but one call
ok jca@
|
|
|
|
| |
ok jca@
|
|
|
|
|
|
| |
of ELFDEFNNAME(NO_ADDR)
ok jca@
|
|
|
|
|
|
| |
delete the no-longer-used probe hook support.
ok mpi@ jca@
|
|
|
|
|
|
| |
struct proc to struct process.
ok deraadt@ kettenis@
|
|
|
|
|
|
| |
initial thread
ok jsing@ kettenis@
|
|
|
|
| |
ok mpi@ mikeb@
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
the string into kernel space before logging the W^X binary warning.
ok jca@, guenther@
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
Remove "option COMPAT_LINUX" and everything directly tied to it from the
kernel and the corresponding man page documentation.
ok visa@ guenther@
|
|
|
|
|
|
|
|
|
|
| |
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@
|
| |
|
|
|
|
| |
ok guenther tedu
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
| |
ok deraadt@ millert@ miod@
|
|
|
|
|
| |
test cases provided by Alejandro Herna'ndez (nitrousenador (at) gmail.com)
ok deraadt@ jsg@
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
|
|
| |
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
|