CVS: cvs.openbsd.org: src

2015-10-06 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2015/10/06 14:49:32

Modified files:
sys/dev/acpi   : acpihpet.c 

Log message:
0x is 32 bits, not 24 bits

ok deraadt



CVS: cvs.openbsd.org: src

2015-07-07 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2015/07/07 13:31:02

Modified files:
sys/ddb: db_dwarf.c 

Log message:
Return correct file name entry from DWARF line table

We run the DWARF line table program to generate each row of the table
until we find a row after the one we wanted, and then take the
previous row's entries.  The code correctly took the previous row's
line number entry, but incorrectly took the current row's file name
entry.  Notably, this caused DDB to report the wrong file names for
inlined calls to functions defined in header files.

ok mlarkin



CVS: cvs.openbsd.org: src

2014-10-09 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/10/09 02:21:48

Modified files:
sys/conf   : files 
sys/ddb: db_elf.c 
sys/lib/libsa  : loadfile_elf.c 

Log message:
ddb: add support for DWARF line number decoding

This allows ddb's trace command to include file and line numbers:

ddb{0} trace
Debugger() at Debugger+0x9 [../../../../arch/amd64/amd64/db_interface.c:405]
ddb_sysctl() at ddb_sysctl+0x1b4 [../../../../ddb/db_usrreq.c:104]
sys___sysctl() at sys___sysctl+0x216 [../../../../kern/kern_sysctl.c:229]
syscall() at syscall+0x297 [../../../../sys/syscall_mi.h:84]
--- syscall (number 202) ---
end of kernel
end trace frame: 0x7f7cf1d7, count: -4
acpi_pdirpa+0x4117aa:

For this to work, it requires using a new version of boot(8), and
booting a kernel with the .debug_line section present (e.g., building
with ``makeoptions DEBUG=-g'' and then booting the bsd.gdb kernel
instead of the stripped bsd kernel).

Still a WIP, but no failure reports yet.  Committing so further
development and testing can happen in tree.

prodding deraadt, guenther, mlarkin
ok mpi



CVS: cvs.openbsd.org: src

2014-10-02 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/10/02 12:04:49

Modified files:
sbin/dhclient  : dhclient.c 

Log message:
dhclient: add support for RFC 3442 local subnet routes

If the classless-static-routes option specifies the router IP address
as 0.0.0.0, then that indicates the route is a local subnet route
that should be directly routable via the interface. This reuses the
route add -net $dest -netmask $mask -cloning -iface $addr trick
suggested by claudio@ for r1.272.

Restores interoperability with Google Compute Engine after recent GCE
DHCP server changes.

ok krw, mpi



CVS: cvs.openbsd.org: src

2014-07-21 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/21 11:40:06

Modified files:
lib/libc/gen   : signal.3 
lib/libc/sys   : sigaction.2 

Log message:
Fix typo: s/lstate/lstat/



CVS: cvs.openbsd.org: src

2014-07-21 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/21 17:05:12

Modified files:
lib/libc/sys   : sigaction.2 
lib/libc/gen   : signal.3 

Log message:
Add pthread_sigmask() and raise() to the list of async signal safe
functions, per POSIX Issue 7

ok deraadt



CVS: cvs.openbsd.org: src

2014-07-19 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/19 02:55:22

Modified files:
lib/libc/gen   : signal.3 
lib/libc/sys   : sigaction.2 

Log message:
Document that abort() is async signal safe now that it doesn't flush
stdio buffers

While here replace SUSv[67] with POSIX Issue [67] and update
signal(3) to mention that pselect() and ppoll() are async signal safe
like sigaction(2) already does.

ok guenther



CVS: cvs.openbsd.org: src

2014-07-18 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/18 01:25:26

Modified files:
lib/libc/stdlib: lsearch.3 

Log message:
Remove const from the lsearch(3) manual's synopsis too.

Reminded by Rafael Neves



CVS: cvs.openbsd.org: src

2014-07-18 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/18 13:19:20

Modified files:
lib/libc/sys   : sigaction.2 

Log message:
Document that getentropy() is async signal safe.

Pointed out by Jean-Philippe Ouellet



CVS: cvs.openbsd.org: src

2014-07-18 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/18 13:24:42

Modified files:
lib/libc/sys   : sigaction.2 
lib/libc/gen   : signal.3 

Log message:
Oops, getentropy() is an extension interface, not a base interface

Also, update the async signal safe list in signal(3) too (reminded by
deraadt)



CVS: cvs.openbsd.org: src

2014-07-18 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/18 15:40:54

Modified files:
lib/libcrypto/crypto: arc4random_linux.h arc4random_osx.h 
  arc4random_solaris.h 

Log message:
Cleanup portable arc4random fork detection code:

1. Use len parameter instead of sizeof(*rs).

2. Simplify the atfork handler to be strictly async signal safe by
simply writing to a global volatile sig_atomic_t object, and then
checking for this in _rs_forkdetect().  (Idea from discussions with
Szabolcs Nagy and Rich Felker.)

3. Use memset(rs, 0, sizeof(*rs)) to match OpenBSD's MAP_INHERIT_ZERO
fork semantics to avoid any skew in behavior across platforms.

ok deraadt



CVS: cvs.openbsd.org: src

2014-07-17 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/17 22:16:09

Modified files:
include: search.h 
lib/libc/stdlib: lsearch.c 

Log message:
Change lsearch()'s base argument to require a non-const pointer to
align with POSIX and other systems.

Pointed out by Elliott Hughes on tech
ok deraadt



CVS: cvs.openbsd.org: src

2014-07-13 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/13 15:44:59

Modified files:
sys/kern   : kern_sched.c 

Log message:
Fix sched_stop_secondary_cpus() to properly drain CPUs

TAILQ_FOREACH() isn't safe to use in sched_chooseproc() to iterate
over the run queues because within the loop body we remove the threads
from their run queues and reinsert them elsewhere.  As a result, we
end up only draining the first thread of each run queue rather than
all of them.

ok kettenis



CVS: cvs.openbsd.org: src

2014-07-12 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/12 15:21:19

Modified files:
sys/sys: proc.h 
sys/kern   : kern_sig.c sys_generic.c 

Log message:
Refactor out dosigsuspend() function

Discussed with guenther and kettenis



CVS: cvs.openbsd.org: src

2014-07-10 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/10 13:00:23

Modified files:
lib/libc/sys   : mmap.2 
sys/sys: mman.h 

Log message:
Add MAP_ANONYMOUS as a synonym for MAP_ANON, per POSIX proposal

ok miod



CVS: cvs.openbsd.org: src

2014-07-10 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/10 13:14:40

Modified files:
share/man/man1 : gcc-local.1 
gnu/usr.bin/gcc/gcc: toplev.c 
gnu/gcc/gcc: common.opt opts.c 

Log message:
Backport support for -Wframe-larger-than=N to base GCC

This is the flag name that modern GCC and Clang have de facto
standardized on for the functionality that we locally named
-Wstack-larger-than-N.

ok brad, miod



CVS: cvs.openbsd.org: src

2014-07-10 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/10 13:33:16

Modified files:
share/man/man9 : Makefile malloc.9 
sys/sys: malloc.h 
sys/kern   : kern_malloc.c 

Log message:
Add mallocarray(9)

While here, change malloc(9)'s size argument from unsigned long to
size_t.

ok tedu



CVS: cvs.openbsd.org: src

2014-07-10 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/10 13:35:38

Modified files:
share/man/man9 : malloc.9 

Log message:
Oops, fix man page typo.

thx Jean-Philippe Ouellet



CVS: cvs.openbsd.org: src

2014-07-10 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/10 18:38:17

Modified files:
regress/lib/libc/explicit_bzero: explicit_bzero.c 

Log message:
Fix explicit_bzero regress for Solaris and OS X compatibility

Solaris and OS X clobber the signal stack when returning to the main
stack, which caused the original testing strategy (inspecting the
signal stack once we're back on the main stack) to fail.

To be compatible with this behavior, the regress test now inspects the
signal stack space while we're still executing on it.  This is a bit
iffy because we might clobber it ourselves while inspecting it, but we
as long as its not completely clobbered we should be okay.

thx bcook for the Solaris test account



CVS: cvs.openbsd.org: src

2014-07-10 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/10 19:10:35

Modified files:
regress/lib/libc/explicit_bzero: explicit_bzero.c 

Log message:
Fix dumb copy/paste mistake.

Noticed testing with clang.



CVS: cvs.openbsd.org: src

2014-07-09 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/09 12:02:24

Modified files:
regress/lib/libc/explicit_bzero: explicit_bzero.c 

Log message:
Better workaround for OS X sigaltstack() bug

OS X's sigaltstack() fails with ENOMEM if ss_size  MINSIGSTKSZ even
if SS_DISABLE is specified in ss_flags.  Rather than add code to try
to cope with this stupidity, just don't bother restoring the original
signal stack.



CVS: cvs.openbsd.org: src

2014-07-09 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/09 12:19:40

Modified files:
regress/lib/libc/arc4random-fork: arc4random-fork.c 

Log message:
Minor cleanups

Rename _waitpid() to safewaitpid() to avoid POSIX reserved identifier
namespace.

KNF nit: return value expressions should be surrounded by parentheses,
per style(9).

Ensure SIGCHLD is set to SIG_DFL, not SIG_IGN.  POSIX allows (and
requires under XSI) that terminated child processes not leave zombies
if SIGCHLD is set to SIG_IGN, and it also allows execve() to leave
SIGCHLD set to SIG_IGN.



CVS: cvs.openbsd.org: src

2014-07-09 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/09 17:54:00

Modified files:
regress/lib/libc/explicit_bzero: explicit_bzero.c 

Log message:
Add some extra sanity checks to make sure the test functions actually
run on altstack.



CVS: cvs.openbsd.org: src

2014-07-07 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/07 13:59:00

Modified files:
sys/kern   : syscalls.master 

Log message:
Mark get{,e,res}{u,g}id() and getgroups() as NOLOCK

A little while back, guenther moved user credentials to a per-process
property, but also kept a per-thread cache that would remain stable
for the duration of a thread's system call.  These system calls now
only access the thread's cached credentials, so they're safe to run
without the kernel lock.

ok kettenis, guenther



CVS: cvs.openbsd.org: src

2014-07-07 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/07 14:01:21

Modified files:
sys/sys: syscall.h syscallargs.h 
sys/kern   : init_sysent.c syscalls.c 

Log message:
regen



CVS: cvs.openbsd.org: src

2014-07-07 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/07 18:40:56

Modified files:
lib/libc/gen   : shm_open.3 

Log message:
Document that shm_open() et al have been available since OpenBSD 5.4



CVS: cvs.openbsd.org: src

2014-07-06 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/06 23:31:42

Modified files:
share/man/man9 : fork1.9 
sys/kern   : kern_fork.c 

Log message:
fork1: FORK_THREAD requires FORK_SHAREFILES

Now that file descriptor tables have moved from a per-thread resource
to per-process, it's impossible to fork a thread without sharing the
file descriptor table.

ok guenther



CVS: cvs.openbsd.org: src

2014-07-03 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/03 00:55:59

Modified files:
share/man/man9 : uvm.9 

Log message:
Move failure case text from uvm_pagerealloc() to uvm_pagealloc()

uvm_pagerealloc() is a void function and it doesn't attempt to find
any pages, so it doesn't make sense that it might return NULL when no
page can be found.



CVS: cvs.openbsd.org: src

2014-07-03 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/03 15:15:28

Modified files:
sys/arch/amd64/amd64: identcpu.c 
sys/arch/amd64/include: specialreg.h 
sys/arch/i386/include: specialreg.h 
sys/arch/i386/i386: machdep.c 

Log message:
Add identcpu detection for 1-GByte pages

ok mlarkin



CVS: cvs.openbsd.org: src

2014-07-02 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/02 00:09:49

Modified files:
share/man/man9 : uvm.9 
sys/dev/pci/drm: drm_drv.c 
sys/kern   : exec_subr.c 
sys/uvm: uvm_device.c uvm_device.h uvm_vnode.c 
 uvm_extern.h uvm_mmap.c 

Log message:
Use real parameter types for u{dv,vn}_attach() instead of void *

ok guenther



CVS: cvs.openbsd.org: src

2014-07-02 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/02 13:08:40

Modified files:
lib/libc/sys   : mmap.2 mprotect.2 

Log message:
Sync description of PROT_* flags between mmap.2 and mprotect.2

ok guenther



CVS: cvs.openbsd.org: src

2014-07-02 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/02 16:22:35

Modified files:
lib/libc/sys   : madvise.2 mincore.2 minherit.2 mlock.2 
 mlockall.2 mmap.2 mprotect.2 mquery.2 msync.2 
 munmap.2 

Log message:
Various small typographic fixes for mman.h manual pages:

Use .Fn instead of .Nm as appropriate
Use .In for include lines
Use .Rv -std where possible
Use .Xr to refer to functions from other manual pages
Remove extraneous sys/types.h include

More substantive changes to follow.

Discussed with schwarze



CVS: cvs.openbsd.org: src

2014-07-02 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/02 16:35:42

Modified files:
share/man/man4 : cd.4 sd.4 vnd.4 

Log message:
Document the ioctl() argument types for sd(4)'s ioctls

Also, cleanup some lies about which header defines these ioctls



CVS: cvs.openbsd.org: src

2014-07-02 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/07/02 17:46:52

Modified files:
share/man/man9 : uvm.9 

Log message:
Sync uvm_page_physload()'s parameter types with reality

uvm_page.c r1.19 (July 25, 2001) changed them from vaddr_t to paddr_t



CVS: cvs.openbsd.org: src

2014-06-30 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/30 11:57:15

Modified files:
share/man/man9 : uvm.9 

Log message:
Update to reflect that UVM_INH_ZERO has replaced UVM_INH_DONATE.



CVS: cvs.openbsd.org: src

2014-06-30 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/30 15:48:09

Modified files:
share/man/man9 : uvm.9 Makefile 

Log message:
Remove some dead functions from uvm.9:

uvm_fork() was removed by uvm_glue.c r1.65 (2014-05-15)

uvm_scheduler() was removed by uvm_glue.c r1.50 (2009-08-11)

uvm_swapin() was removed by uvm_glue.c r1.45 (2006-11-29)

RIP



CVS: cvs.openbsd.org: src

2014-06-28 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/28 00:18:26

Modified files:
share/man/man4 : cd.4 scsi.4 st.4 

Log message:
Cleanup documentation for SCSI device driver ioctl()s.



CVS: cvs.openbsd.org: src

2014-06-28 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/28 00:27:31

Modified files:
share/man/man4 : video.4 

Log message:
Use Dv and Fa as appropriate for describing video(4) ioctl() commands.



CVS: cvs.openbsd.org: src

2014-06-28 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/28 00:34:22

Modified files:
share/man/man4 : bio.4 

Log message:
Add argument types for bio(4) ioctl() commands



CVS: cvs.openbsd.org: src

2014-06-28 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/28 00:39:50

Modified files:
share/man/man4 : bio.4 pci.4 

Log message:
Fix indenting for bio(4) and pci(4) ioctl()s.



CVS: cvs.openbsd.org: src

2014-06-28 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/28 00:42:42

Modified files:
share/man/man4 : vscsi.4 

Log message:
Use Fa for vscsi(4) ioctl() commands.



CVS: cvs.openbsd.org: src

2014-06-28 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/28 00:59:45

Modified files:
share/man/man4 : audio.4 

Log message:
audio(4) has nothing to do with string.h



CVS: cvs.openbsd.org: src

2014-06-28 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/28 02:20:51

Modified files:
share/man/man4 : audio.4 

Log message:
espie points out string.h is needed for the AUDIO_INITINFO() macro



CVS: cvs.openbsd.org: src

2014-06-28 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/28 15:20:19

Modified files:
sys/compat/linux: linux_misc.c 

Log message:
Don't use meaningless MAP_TRYFIXED flag in compat_linux

Pointed out by deraadt



CVS: cvs.openbsd.org: src

2014-06-27 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/27 13:02:54

Modified files:
lib/libc/sys   : mmap.2 

Log message:
Revise wording to reflect that callers should always specify (exactly)
one of MAP_PRIVATE or MAP_SHARED, as required by POSIX.  However, also
caveat that currently OpenBSD doesn't strictly enforce this behavior.



CVS: cvs.openbsd.org: src

2014-06-27 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/27 13:26:36

Modified files:
lib/libc/sys   : mmap.2 

Log message:
Split out mmap's compatibility flags into a separate section, so users
aren't misled into thinking they're useful on OpenBSD.



CVS: cvs.openbsd.org: src

2014-06-27 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/27 14:40:02

Modified files:
lib/libc/sys   : mmap.2 

Log message:
OpenBSD supports mmap() on block special files too.



CVS: cvs.openbsd.org: src

2014-06-27 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/27 14:50:43

Modified files:
sys/sys: mman.h 
sys/uvm: uvm_mmap.c 
usr.bin/kdump  : mksubr 

Log message:
Cleanup support for legacy mmap flags

Move all legacy MAP_FOO values behind #ifndef _KERNEL and redefine
them to either be aliases for existing flags (e.g., MAP_COPY -
MAP_PRIVATE) or 0.

Also, add MAP_OLDFOO defines (behind #ifndef _KERNEL) so the kernel
and kdump can remain compatible with current OpenBSD binaries.

ok deraadt



CVS: cvs.openbsd.org: src

2014-06-27 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/27 15:06:33

Modified files:
lib/libc/sys   : ioctl.2 

Log message:
Cleanup ioctl.2 slightly:

- Markup ioctl argument types with Fa
- Be clearer that ioctl arguments are pointers to ints.

Similar changes to follow for manual pages that describe
device-specific ioctl commands.

Discussed with jmc and schwarze.



CVS: cvs.openbsd.org: src

2014-06-27 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/27 17:21:47

Modified files:
lib/librthread : rthread_sem.c rthread_stack.c 

Log message:
Fix mmap() flag usage: explicitly specify MAP_PRIVATE and drop useless
MAP_FILE and MAP_HASSEMAPHORE flags.

Discussed with deraadt, tedu, and kettenis



CVS: cvs.openbsd.org: src

2014-06-26 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/26 12:30:36

Modified files:
lib/libc/sys   : mmap.2 

Log message:
Document that mmap() confirms to POSIX 2008, except that we generate
SIGSEGV instead of SIGBUS for page references beyond the end of a
mapped object.



CVS: cvs.openbsd.org: src

2014-06-25 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/25 19:36:49

Modified files:
share/man/man4 : vscsi.4 

Log message:
Document that VSCSI_I2T is a non-blocking operation and can be
monitored with select(2).



CVS: cvs.openbsd.org: src

2014-06-24 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/24 13:05:42

Modified files:
regress/sys/kern/siginfo-fault: siginfo-fault.c 

Log message:
POSIX doesn't specify MAP_FILE and it's a noop anyway, so remove it to
make test portable to other OSes.



CVS: cvs.openbsd.org: src

2014-06-23 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/23 14:31:19

Modified files:
gnu/gcc/gcc: cfgexpand.c 

Log message:
gcc4: emit warning when ignoring alignment constraints

Currently, GCC 4.2 silently ignores the aligned attribute for
objects allocated on the stack if the specified minimum alignment
exceeds the platform's natural stack alignment.  This has bitten us in
the past, so we shouldn't allow this to continue.

Fixing the ignores problem seems hard, so this commit settles for
tackling the silently problem instead.

ok miod, and possibly guenther and deraadt



CVS: cvs.openbsd.org: src

2014-06-23 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/23 15:06:05

src/regress/sys/kern/siginfo-fault

Update of /cvs/src/regress/sys/kern/siginfo-fault
In directory cvs.openbsd.org:/tmp/cvs-serv27380/siginfo-fault

Log Message:
Directory /cvs/src/regress/sys/kern/siginfo-fault added to the repository



CVS: cvs.openbsd.org: src

2014-06-23 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/23 15:10:03

Added files:
regress/sys/kern/siginfo-fault: Makefile siginfo-fault.c 

Log message:
Add regress test for SIGSEGV and SIGBUS siginfo semantics.

According to POSIX, SIGSEGV should specify SEGV_ACCERR if the memory
pages are mapped, but the protections don't match the user's access
attempts, while SEGV_MAPERR should only be specified for pages that
are unmapped.  Some platforms currently handle this correctly, but not
all.

Additionally, SIGBUS/BUS_ADRERR should be generated instead of SIGSEGV
for access to file mapped pages that exceed the end of the file.
(Thanks to kettenis@ for suggesting this test.)

Currently failing, so not linked into the regress tree yet.



CVS: cvs.openbsd.org: src

2014-06-20 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/20 20:34:26

Modified files:
lib/libc/string: explicit_bzero.c 
sys/lib/libkern: explicit_bzero.c 

Log message:
Protect explicit_bzero() from link-time optimization

Modern compiler toolchains are capable of optimizing even across
translation unit boundaries, so simply moving the memory clearing into
a separate function is not guaranteed to clear memory.

To avoid this, we take advantage of ELF weak symbol semantics, and
insert a call to an empty, weakly named function.  The semantics of
calling this function aren't determinable until load time, so the
compiler and linker need to keep the memset() call.

There are still ways a toolchain might defeat this trick (e.g.,
optimistically expecting the weak symbol to not be overloaded, and
only calling memset() if it is; promoting weak symbols to strong
symbols at link-time when emitting a static binary because they won't
be interposed; implementing load-time optimizations).  But at least
for the foreseeable future, these seem unlikely.

ok deraadt



CVS: cvs.openbsd.org: src

2014-06-19 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/19 13:32:20

src/regress/sys/uvm/mmap_noreplace

Update of /cvs/src/regress/sys/uvm/mmap_noreplace
In directory cvs.openbsd.org:/tmp/cvs-serv14136/mmap_noreplace

Log Message:
Directory /cvs/src/regress/sys/uvm/mmap_noreplace added to the repository



CVS: cvs.openbsd.org: src

2014-06-19 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/19 13:34:22

Modified files:
regress/sys/uvm: Makefile 
Added files:
regress/sys/uvm/mmap_noreplace: Makefile mmap_noreplace.c 

Log message:
Add a basic regress test for __MAP_NOREPLACE.



CVS: cvs.openbsd.org: src

2014-06-19 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/19 18:02:12

Modified files:
lib/libc/crypt : arc4random.c 

Log message:
arc4random: hard fail with raise(SIGKILL) if getentropy() returns -1

Allow other non-zero return values in case we change our mind to
return an ssize_t byte count instead of simple success/fail.

ok deraadt, djm



CVS: cvs.openbsd.org: src

2014-06-18 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/18 02:21:09

src/regress/lib/libc/arc4random-fork

Update of /cvs/src/regress/lib/libc/arc4random-fork
In directory cvs.openbsd.org:/tmp/cvs-serv2785/arc4random-fork

Log Message:
Directory /cvs/src/regress/lib/libc/arc4random-fork added to the repository



CVS: cvs.openbsd.org: src

2014-06-18 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/18 02:24:00

Modified files:
regress/lib/libc: Makefile 
Added files:
regress/lib/libc/arc4random-fork: Makefile arc4random-fork.c 

Log message:
Add regress tests to make sure arc4random(3) is reinitialized
correctly in fork children.



CVS: cvs.openbsd.org: src

2014-06-18 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/18 18:13:22

Modified files:
lib/libc/crypt : arc4random.c 

Log message:
Move rs_chacha and rs_buf into the same memory page and don't mark it
MAP_INHERIT_ZERO anymore.  This restores arc4random's previous
behavior where fork children would mix in some randomness from the
parent process.

New behavior noticed by deraadt
ok deraadt, tedu



CVS: cvs.openbsd.org: src

2014-06-17 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/17 20:59:13

Modified files:
usr.bin/ssh: sandbox-systrace.c 

Log message:
Now that we have a dedicated getentropy(2) system call for
arc4random(3), we can disallow __sysctl(2) in OpenSSH's systrace
sandbox.

ok djm



CVS: cvs.openbsd.org: src

2014-06-16 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/16 18:37:07

Modified files:
lib/libc/crypt : arc4random.c 

Log message:
Use MAP_INHERIT_ZERO in arc4random(3)

Now instead of calling getpid() each time a user invokes arc4random(),
we're able to rely on the kernel zero'ing out the RNG state if the
process forks.

ok deraadt, djm



CVS: cvs.openbsd.org: src

2014-06-15 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/15 14:22:12

Modified files:
sys/dev: systrace.c 

Log message:
Fix vnode leak in systrace(4).

If a user calls STRIOCGETCWD two or more times in a row without an
intervening STRIOCRESCWD, then the references held on fst-fd_{c,r}dir
would leak.

ok miod



CVS: cvs.openbsd.org: src

2014-06-15 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/15 14:39:22

Modified files:
sys/kern   : kern_descrip.c 

Log message:
Use sizeof(struct file *) consistently for memcpy()'ing fd_ofiles.

Pointed out by Jean-Philippe Ouellet.



CVS: cvs.openbsd.org: src

2014-06-13 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/13 01:15:39

src/regress/sys/uvm/minherit_zero

Update of /cvs/src/regress/sys/uvm/minherit_zero
In directory cvs.openbsd.org:/tmp/cvs-serv7546/minherit_zero

Log Message:
Directory /cvs/src/regress/sys/uvm/minherit_zero added to the repository



CVS: cvs.openbsd.org: src

2014-06-13 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/13 01:17:54

Modified files:
regress/sys/uvm: Makefile 
Added files:
regress/sys/uvm/minherit_zero: Makefile minherit_zero.c 

Log message:
Add regress test for MAP_INHERIT_ZERO.



CVS: cvs.openbsd.org: src

2014-06-13 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/13 16:40:31

Modified files:
sys/sys: wait.h 

Log message:
Remove support for union wait and WSTOPPED.

union wait has been deprecated since 4.3BSD, and WSTOPPED means
something else now in POSIX, that we don't yet support.

Original diff by guenther, from 2.5 years ago.
Ports tree cleanup and re-testing by naddy.

ok deraadt, kettenis



CVS: cvs.openbsd.org: src

2014-06-13 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/13 18:17:52

Modified files:
share/man/man4 : systrace.4 

Log message:
Update documentation for STRIOCGETCWD.

Back in 2011, I changed it from taking a pid_t * to a struct
systrace_getcwd * so that systrace(1) could resolve filenames passed
to openat(2), etc, but apparently failed to document the change.



CVS: cvs.openbsd.org: src

2014-06-13 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/13 18:24:38

Modified files:
share/man/man4 : systrace.4 

Log message:
Fix a couple systrace(4) nits

Mention SYSTRACE_POLICY_KILL again later as appropriate and document
that STRIOCINJECT takes a pointer to a struct systrace_inject.



CVS: cvs.openbsd.org: src

2014-06-12 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/12 15:58:14

src/regress/lib/libc/explicit_bzero

Update of /cvs/src/regress/lib/libc/explicit_bzero
In directory cvs.openbsd.org:/tmp/cvs-serv3244/explicit_bzero

Log Message:
Directory /cvs/src/regress/lib/libc/explicit_bzero added to the repository



CVS: cvs.openbsd.org: src

2014-06-12 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/12 16:01:55

Modified files:
regress/lib/libc: Makefile 
Added files:
regress/lib/libc/explicit_bzero: Makefile explicit_bzero.c 

Log message:
Add regress test for explicit_bzero.



CVS: cvs.openbsd.org: src

2014-06-12 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/12 19:48:52

Modified files:
lib/libc/sys   : minherit.2 
sys/sys: mman.h 
sys/uvm: uvm_extern.h uvm_map.c 

Log message:
Add support for MAP_INHERIT_ZERO.

This provides a way for a process to designate pages in its address
space that should be replaced by fresh, zero-initialized anonymous
memory in forked child processes, rather than being copied or shared.

ok jmc, kettenis, tedu, deraadt; positive feedback from many more



CVS: cvs.openbsd.org: src

2014-06-12 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/12 19:52:21

src/regress/lib/libc/timingsafe

Update of /cvs/src/regress/lib/libc/timingsafe
In directory cvs.openbsd.org:/tmp/cvs-serv30631/timingsafe

Log Message:
Directory /cvs/src/regress/lib/libc/timingsafe added to the repository



CVS: cvs.openbsd.org: src

2014-06-12 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/12 19:55:02

Modified files:
regress/lib/libc: Makefile 
Added files:
regress/lib/libc/timingsafe: Makefile timingsafe.c 

Log message:
Add regress tests for timingsafe_bcmp and timingsafe_memcmp.

timingsafe_memcmp tests are disabled for now, pending its addition to
libc.



CVS: cvs.openbsd.org: src

2014-06-12 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/12 20:12:17

Modified files:
include: string.h 
lib/libc/string: Makefile.inc bcmp.3 memcmp.3 
regress/lib/libc/timingsafe: timingsafe.c 
Added files:
lib/libc/string: timingsafe_bcmp.3 timingsafe_memcmp.c 

Log message:
Add timingsafe_memcmp().

ok deraadt, jmc, tedu



CVS: cvs.openbsd.org: src

2014-06-11 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/11 11:32:59

Modified files:
sys/kern   : kern_sysctl.c 

Log message:
Add bounds checks for CTL_DEBUG sysctl variable.



CVS: cvs.openbsd.org: src

2014-06-11 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/11 14:31:15

Modified files:
sys/dev: ksyms.c 

Log message:
Reject negative file offsets in /dev/ksyms.

ok deraadt, kettenis



CVS: cvs.openbsd.org: src

2014-06-11 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/11 14:39:18

Modified files:
sys/kern   : kern_exit.c 

Log message:
Fix wait4 to not modify status or rusage if we return 0 because of
WNOHANG, in accordance with POSIX.  Additionally, if rusage is
requested but the waited-on process did not terminate, return zero
bytes instead of kernel stack garbage.

ok deraadt, millert



CVS: cvs.openbsd.org: src

2014-06-06 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/06 16:44:18

Modified files:
sys/kern   : tty.c 

Log message:
Allocate the struct itty array in ttystats_init() with M_ZERO.

ok millert



CVS: cvs.openbsd.org: src

2014-06-04 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/06/04 14:13:49

Modified files:
lib/libc/arch/amd64: SYS.h 
lib/libc/arch/arm: SYS.h 
lib/libc/arch/i386: SYS.h 
lib/libc/arch/m88k: SYS.h 
lib/libc/arch/mips64: SYS.h 
lib/libc/arch/powerpc: SYS.h 
lib/libc/arch/sh: SYS.h 
lib/libc/arch/sparc: SYS.h 
lib/libc/arch/sparc64: SYS.h 
lib/libc/arch/vax: SYS.h 

Log message:
Apply unifdef -D__STDC__ to libc/arch/*/SYS.h

A while back, pascal@ converted our system call stubs from using cpp
| as to cc -x assembler-with-cpp, so there's no need to stay
compatible with ancient preprocessor semantics.

ok miod



CVS: cvs.openbsd.org: src

2014-04-17 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/04/17 15:11:28

Modified files:
lib/libssl/src/apps: apps.h 

Log message:
OpenBSD isn't NetWare or Windows, and it has SIGPIPE.

ok lteo miod



CVS: cvs.openbsd.org: src

2014-04-17 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/04/17 16:44:34

Modified files:
lib/libssl/src/apps: apps.h openssl.c req.c s_server.c 
usr.sbin/openssl: Makefile 

Log message:
Make MONOLITH the default and only option

ok deraadt



CVS: cvs.openbsd.org: src

2014-04-15 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/04/15 19:35:37

Modified files:
lib/libssl/src/crypto: mem.c 

Log message:
Remove disabled code that wouldn't work now that cleanse_ptr was
removed.

Also, fix some nearby KNF nits that were bothering me.

ok beck



CVS: cvs.openbsd.org: src

2014-04-13 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/04/13 17:58:18

Modified files:
lib/libssl/src/crypto/bio: bss_acpt.c bss_conn.c 

Log message:
Use shutdown(s, SHUT_RDWR) instead of shutdown(s, 2).

ok beck deraadt



CVS: cvs.openbsd.org: src

2014-03-31 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/03/31 16:20:15

Modified files:
sys/sys: proc.h 

Log message:
Fix octal constant: \018 - \020

ok guenther



CVS: cvs.openbsd.org: src

2014-03-31 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2014/03/31 23:04:50

Modified files:
sys/sys: stdint.h 
include: unistd.h 

Log message:
Define intptr_t in unistd.h as specified by POSIX

ok millert



CVS: cvs.openbsd.org: src

2013-12-20 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2013/12/20 14:50:49

Modified files:
sys/arch/amd64/conf: GENERIC RAMDISK_CD 
sys/arch/i386/conf: GENERIC RAMDISK_CD 
sys/dev/pci: files.pci 
Added files:
sys/dev/pci: vioscsi.c vioscsireg.h 

Log message:
Add vioscsi(4) driver.

Still a work-in-progress, but functional enough to work with both
Google Compute Engine and RHEVM.  Committing so additional testing and
cleanup can be handled in tree.

thx Jiri B for RHEVM testing
ok dlg, deraadt



CVS: cvs.openbsd.org: src

2013-12-20 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2013/12/20 15:10:19

Modified files:
share/man/man4 : Makefile virtio.4 
Added files:
share/man/man4 : vioscsi.4 

Log message:
Add basic vioscsi(4) manual page.



CVS: cvs.openbsd.org: src

2013-12-20 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2013/12/20 15:15:50

Modified files:
sys/dev/pci: pcidevs 

Log message:
add virtio scsi



CVS: cvs.openbsd.org: src

2013-12-20 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2013/12/20 15:16:40

Modified files:
sys/dev/pci: pcidevs.h pcidevs_data.h 

Log message:
regen



CVS: cvs.openbsd.org: src

2013-12-16 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2013/12/16 19:41:07

Modified files:
sys/netinet: in_proto.c ip_output.c ip_var.h 

Log message:
Change ip_output()'s non-optional arguments to be standard arguments
instead of variable arguments.

Allows stricter type checking by the compiler at call sites and also
saves a bit of code size on some platforms (e.g., ~200 bytes on
amd64).

ok mikeb



CVS: cvs.openbsd.org: src

2013-12-04 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2013/12/04 15:14:33

Modified files:
sbin/dhclient  : dhclient.c 

Log message:
When we receive a /32 IP address assignment, mimick ISC DHCP by adding
a direct route for the default gateway IP with equivalent to

route add -net $gw -netmask 255.255.255.255 -cloning -iface $myip

so that the subsequent

route add default $gw

can succeed.

Magic route(8) incantation thanks to claudio.
Tested successfully on Compute Engine.
Committing now so additional testing/discussion can happen in-tree.

Discussed with deraadt, krw, claudio.



CVS: cvs.openbsd.org: src

2013-11-25 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2013/11/25 16:15:58

Modified files:
sys/kern   : sysv_sem.c 

Log message:
Fix infinite loop pointed out by clang/brad.

ok guenther



CVS: cvs.openbsd.org: src

2013-07-09 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2013/07/09 11:28:10

Modified files:
share/man/man5 : elf.5 

Log message:
Update elf(5) to reflect that we now use ELF on all supported
platforms.

Pointed out by Simon Kuhnle
ok espie, jmc



CVS: cvs.openbsd.org: src

2013-06-11 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2013/06/11 09:59:16

Modified files:
include: inttypes.h 
sys/sys: stdint.h 

Log message:
Contrary to C99's advice, C++ TR1 and C++ 11 require that inttypes.h
and stdint.h should unconditionally define all of their macros
regardless of whether the __STDC_*_MACROS macros are defined.

ok guenther, espie
bulk build tested by landry



CVS: cvs.openbsd.org: src

2013-06-02 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2013/06/02 09:22:20

Modified files:
lib/libc/locale: _wcstod.h 

Log message:
Fix wcsto{f,d,ld}() C99 compliance to now correctly

1. handle inf, infinity, nan, and nan(whatever),

2. reject bare minus and plus signs,

3. handle multi-byte characters, and

4. set *endptr = nptr for all failure cases.

Fixes libc++'s test cases for std::sto{f,d,ld}().

ok stsp



CVS: cvs.openbsd.org: src

2013-06-02 Thread Matthew Dempsky
CVSROOT:/cvs
Module name:src
Changes by: matt...@cvs.openbsd.org 2013/06/02 15:08:36

Modified files:
lib/libc/stdlib: atexit.h atexit.c 

Log message:
Two small cleanups to atexit: remove unneeded __atexit_invalid, and
move the call_depth decrement so it happens unconditionally and can
still return to 0 when called with dso!=NULL.

ok millert



  1   2   3   4   5   >