Commit Graph

19110 Commits

Author SHA1 Message Date
christos 7351a5d259 Add the netpgp lua bindings so that the compat build can build them. 2018-05-01 19:50:34 +00:00
kamil 385d9c8955 Implement PTRACE_VFORK
Add support for tracing vfork(2) events in the context of ptrace(2).

This API covers other frontends to fork1(9) like posix_spawn(2) or clone(2),
if they cause parent to wait for exec(2) or exit(2) of the child.

Changes:
 - Add new argument to sigswitch() determining whether we need to acquire
   the proc_lock or whether it's already held.
 - Refactor fork1(9) for fork(2) and vfork(2)-like events.
   Call sigswitch() from fork(1) for forking or vforking parent, instead of
   emitting kpsignal(9). We need to emit the signal and suspend the parent,
   returning to user and relock proc_lock.
 - Add missing prototype for proc_stop_done() in kern_sig.c.
 - Make sigswitch a public function accessible from other kernel code
   including <sys/signalvar.h>.
 - Remove an entry about unimplemented PTRACE_VFORK in the ptrace(2) man page.
 - Permin PTRACE_VFORK in the ptrace(2) frontend for userland.
 - Remove expected failure for unimplemented PTRACE_VFORK tests in the ATF
   ptrace(2) test-suite.
 - Relax signal routing constraints under a debugger for a vfork(2)ed child.
   This intended to protect from signaling a parent of a vfork(2)ed child that
   called PT_TRACE_ME, but wrongly misrouted other signals in vfork(2)
   use-cases.

Add XXX comments about still existing problems and future enhancements:
 - correct vfork(2) + PT_TRACE_ME handling.
 - fork1(2) handling of scenarios when a process is collected in valid but
   rare cases.

All ATF ptrace(2) fork[1-8] and vfork[1-8] tests pass.

Fix PR kern/51630 by Kamil Rytarowski (myself).

Sponsored by <The NetBSD Foundation>
2018-05-01 16:37:23 +00:00
jmcneill e9bedda7d9 Add some compat stubs for aarch64. Not providing any actual compatibility
with old binaries (there are none), but having these symbols helps GNU
configure scripts.
2018-04-29 17:47:06 +00:00
christos 9cbfe7dcb3 fix and use the macro. 2018-04-07 19:28:32 +00:00
christos 04bd018918 function grew an extra argument now. 2018-04-07 13:57:12 +00:00
dholland 40a6999954 note to get rid of statfs() when bump time comes 2018-04-06 17:03:59 +00:00
wiz 349b123f81 Use mdoc macros. 2018-04-05 11:07:00 +00:00
kre deb0051437 Document opendisk1() - it has been around long enough.
(pity about the name...)

XXX pullup-8
2018-04-04 04:43:46 +00:00
ryo fe33aa2786 Add initial support for ARMv8 (AARCH64) (by nisimura@ and ryo@)
- sys/arch/evbarm64 is gone and integrated into sys/arch/evbarm. (by skrll@)
- add support fdt. evbarm/conf/GENERIC64 fdt (bcm2837,sunxi,tegra) based generic 64bit kernel config. (by skrll@, jmcneill@)
2018-04-01 04:35:01 +00:00
kamil 9ad30f3b4d Drop the USE_LIBTRE build option
libtre cannot be used any more as a replacement for regex(3).
Tt does not build and the library development is stalled in upstream.

Proposed on mailing list.

Sponsored by <The NetBSD Foundation>
2018-03-31 14:24:54 +00:00
joerg 2d65afd272 Move the complex logic for dynamically writing branches from ld.elf_so
into a header for reuse in crt0.o for static ifunc support. Change the
existing logic for sparc64 to use the Bicc variant of ba,a as it allows
+-8MB displacement compared to the BPcc variant's +-1MB. Teach the sparc
variant the same trick for using ba,a and not sethi+jmp when possible.
2018-03-29 13:23:39 +00:00
martin 4e1ffbe979 Add missing alias for ldexpl on ! __HAVE_LONG_DOUBLE architectures.
Pointed out by Hal Murray on port-arm.
2018-03-27 11:59:49 +00:00
roy 320ba6e2bf socket: report receive buffer overflows
Add soroverflow() which increments the overflow counter, sets so_error
to ENOBUFS and wakes the receive socket up.
Replace all code that manually increments this counter with soroverflow().
Add soroverflow() to raw_input().

This allows userland to detect route(4) overflows so it can re-sync
with the current state.
2018-03-19 16:26:25 +00:00
pgoyette 2461f62e8b Remove exgtraneous comma 2018-03-12 11:56:34 +00:00
eadler 736570df7c Fix signed overflow in atan2
As a component of atan2(y, x), the case of x == 1.0 is farmed out to
atan(y). The current implementation of this comparison is vulnerable
to signed integer underflow (that is, undefined behavior), and it's
performed in a somewhat more complicated way than it need be. Change
it to not be quite so cute, rather directly comparing the high/low
bits of x to the specific IEEE-754 bit pattern that encodes 1.0.

ok martin@ pgoyette@ maya@
obtained from FreeBSD
2018-03-10 09:44:47 +00:00
joerg a64ef2fb9e Add ifunc support for statically linked applications on x86, ppc, sparc
and ARM.
2018-03-09 20:20:47 +00:00
christos 462103bc5a avoid negative shift 2018-03-06 01:14:41 +00:00
christos 0efaeed61f comment out unused variable. 2018-03-05 23:00:55 +00:00
kamil 570f001093 Remove PT_GET_SIGMASK / PT_SET_SIGMASK
These operations cloned Linux's specific PTRACE_GETSIGMASK / PTRACE_SETSIGMASK.
This feature was useful in applications like rr/criu/reptyr-like, where
the ptrace(2) interface is abused for the purpose of constructing an arbitrary
process. It's not reliable and not portable. For the NetBSD case it will be
better to invent something dedicated for serializing and deserializing a
process with threads.

Noted on tech-toolchain@ and blog entry

"LLDB restoration and return to ptrace(2)"
https://blog.netbsd.org/tnf/entry/lldb_restoration_and_return_to
2018-03-05 11:24:34 +00:00
lukem 287fdb86f8 PR/48585: Set errno when returning NULL for AF_INET
In inet_ntop4(), errno wasn't set before returning NULL.
Seems like an oversight in the existing fix for PR/48585.
Noticed by code inspection.
2018-03-02 06:31:53 +00:00
uwe ce9b54992a PIC code clobbers %r30 so we need to update the saved oucp with
caller's %r30 manually.  Makes old context happy when it needs to do
more function calls after restore.

(oops, forgot to commit this along with swapcontext.S)
2018-02-28 21:00:02 +00:00
uwe 8e33e1ffff PIC code clobbers %r30 so we need to update the saved oucp with
caller's %r30 manually.  Makes old context happy when it needs to do
more function calls after restore.
2018-02-28 20:51:58 +00:00
christos 7767204c93 PR/53058: Nikhil Benesch: use correctly typed variables (wchar_t vs wint_t)
as parameters.
2018-02-26 17:36:14 +00:00
kamil 00e03d5b87 Document ragasub(3) & regnsub(3) implementation detail
Added note:
  Only 10 elements of the rm array can be used.

Sponsored by <The NetBSD Foundation>
2018-02-26 14:04:43 +00:00
chs 9f52f2295e remove hard-coded -fomit-frame-pointer for pthread stuff,
let these use the same setting as the rest of the tree.
the performance difference is marginal and this allows
dtrace ustack() to work better.
2018-02-25 18:51:18 +00:00
pgoyette d831ae84a0 Remove extra "an"
Thanks to J. Lewis Muir
2018-02-22 08:33:43 +00:00
uwe ecb11c8936 Consistenly use "host byte order". 2018-02-21 14:11:09 +00:00
wiz c8f3c2c806 Fix endnetent prototype. Fix NULL. New sentence, new line. 2018-02-21 09:47:37 +00:00
kamil 01e8caecb0 Improve the getnetent(3) man-page
Document return type of setnetent(3) and endnetent(3). Both "void".

Sponsored by <The NetBSD Foundation>
2018-02-21 03:13:50 +00:00
uwe 9f4bd1d874 Markup "stdin". 2018-02-20 17:23:39 +00:00
uwe 250ec2c82f Make the list of STDBUF values and the list of mode values congruent
in formatting and spelling.
2018-02-20 17:21:11 +00:00
uwe e41e0b24d7 Use semantic markup. 2018-02-20 17:16:51 +00:00
wiz cb12e23020 Remove ineffective macros and arguments. 2018-02-20 09:36:26 +00:00
kamil 6dca39b9a1 Remove namespace restriction from pthread_condattr_{g,s}etclock(3)
These functions were marked as _NETBSD_SOURCE when introduced to the
sources. In fact they are regular POSIX threading functions available
since the 2001 standard. There is an older mention about alignment with
"IEEE Std 1003.1j-2000".

This corrects usage of these functions when a source code is compiled
with a POSIX namespace option.
2018-02-20 05:10:51 +00:00
kamil 9776919255 Improve the setbuf(3) man-page
Move historical lines to newly added HISTORY section.
Additional historical notes obtained from OpenBSD.
2018-02-20 02:52:41 +00:00
christos 5a7f327f24 Enforce that getpeereid only returns success on AF_LOCAL sockets, instead
of returning garbage for other socket types.
2018-02-16 19:21:49 +00:00
jakllsch 3f96c239a8 Fix __siglongjmp14().
Fixes SIGINT causing ksh to "longjmp botch", presumably due to incorrect
magic number.
cvs: ----------------------------------------------------------------------
2018-02-12 22:31:04 +00:00
wiz 5742f479cd Remove useless macros. Sort errors. 2018-02-11 13:30:55 +00:00
wiz 7f7561e0c4 Remove useless macro. 2018-02-11 13:28:49 +00:00
wiz 220a072a26 Remove Tn. Remove trailing whitespace. Remove useless Pp. 2018-02-11 13:28:26 +00:00
dholland 32cded6cc9 Typos. 2018-02-08 09:05:16 +00:00
christos 0f0387da88 Oops forgot one openssl version name change 2018-02-07 22:51:31 +00:00
maxv 26bc6e1cea Keep /dev/ksyms open in _kvm_open(). This way /dev/ksyms can be put into
$g_kmem without breaking the tools that need kmem+ksyms.

Discussed on tech-kern@ three weeks ago. The original issue was reported
by maya@, the patch was written by Tom Ivar Helbekkmo, ok christos@.
2018-02-07 14:03:18 +00:00
pgoyette 2829446e9d Fix typos, as reported by Eitan Adler. Update dates. 2018-02-07 11:16:05 +00:00
martin eaf667a162 Bump date for previous 2018-02-07 09:59:56 +00:00
martin c778dbed18 Fix typo, from Eitan Adler. 2018-02-07 09:55:35 +00:00
christos 97e40f12ae fix duplicate declaration of pthread_atfork in unistd.h 2018-02-06 20:22:23 +00:00
mrg 4146fd94aa copy the i386 workaround for amd64. 2018-02-05 22:12:37 +00:00
christos 6fec6006f2 pretend we have openssl-1.1 2018-02-05 11:57:28 +00:00
christos 04dc679937 Adjust to openssl 1.1 2018-02-05 00:43:06 +00:00