Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jan 2016 20:55:20 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r293364 - user/cperciva/freebsd-update-build/patches/10.2-RELEASE
Message-ID:  <201601072055.u07KtKjS041543@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Thu Jan  7 20:55:20 2016
New Revision: 293364
URL: https://svnweb.freebsd.org/changeset/base/293364

Log:
  Drop into repo patches for 10.2-RELEASE.

Added:
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-EN-15:11.toolchain
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-EN-15:12.netstat
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-EN-15:13.vidcontrol
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-SA-15:20.expat
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/2-EN-15:15.pkg
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/2-SA-15:22.openssh
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/3-EN-15:16.pw
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/3-EN-15:17.libc
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/3-EN-15:18.pkg
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/4-SA-15:24.rpcbind
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/5-SA-15:24.rpcbind
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/6-SA-15:25.ntp
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/7-EN-15:19.ntp
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/7-EN-15:20.vm
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/7-EN-15:21.kqueue
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/8-SA-15:26.openssl
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/9-EN-15:21.filemon

Added: user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-EN-15:11.toolchain
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-EN-15:11.toolchain	Thu Jan  7 20:55:20 2016	(r293364)
@@ -0,0 +1,15 @@
+Index: Makefile.inc1
+===================================================================
+--- Makefile.inc1	(revision 286847)
++++ Makefile.inc1	(working copy)
+@@ -133,8 +133,8 @@ OSRELDATE=	0
+ .endif
+ 
+ .if !defined(VERSION)
+-REVISION!=	make -C ${SRCDIR}/release -V REVISION
+-BRANCH!=	make -C ${SRCDIR}/release -V BRANCH
++REVISION!=	${MAKE} -C ${SRCDIR}/release -V REVISION
++BRANCH!=	${MAKE} -C ${SRCDIR}/release -V BRANCH
+ SRCRELDATE!=	awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
+ 		${SRCDIR}/sys/sys/param.h
+ VERSION=	FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}

Added: user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-EN-15:12.netstat
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-EN-15:12.netstat	Thu Jan  7 20:55:20 2016	(r293364)
@@ -0,0 +1,42 @@
+Index: usr.bin/netstat/main.c
+===================================================================
+--- usr.bin/netstat/main.c	(revision 286847)
++++ usr.bin/netstat/main.c	(working copy)
+@@ -785,19 +785,31 @@ kread_counter(u_long addr)
+ int
+ kread_counters(u_long addr, void *buf, size_t size)
+ {
+-	uint64_t *c = buf;
++	uint64_t *c;
++	u_long *counters;
++	size_t i, n;
+ 
+ 	if (kvmd_init() < 0)
+ 		return (-1);
+ 
+-	if (kread(addr, buf, size) < 0)
++	if (size % sizeof(uint64_t) != 0) {
++		warnx("kread_counters: invalid counter set size");
+ 		return (-1);
++	}
+ 
+-	while (size != 0) {
+-		*c = kvm_counter_u64_fetch(kvmd, *c);
+-		size -= sizeof(*c);
+-		c++;
++	n = size / sizeof(uint64_t);
++	if ((counters = malloc(n * sizeof(u_long))) == NULL)
++		err(-1, "malloc");
++	if (kread(addr, counters, n * sizeof(u_long)) < 0) {
++		free(counters);
++		return (-1);
+ 	}
++
++	c = buf;
++	for (i = 0; i < n; i++)
++		c[i] = kvm_counter_u64_fetch(kvmd, counters[i]);
++
++	free(counters);
+ 	return (0);
+ }
+ 

Added: user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-EN-15:13.vidcontrol
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-EN-15:13.vidcontrol	Thu Jan  7 20:55:20 2016	(r293364)
@@ -0,0 +1,13 @@
+Index: usr.sbin/vidcontrol/vidcontrol.c
+===================================================================
+--- usr.sbin/vidcontrol/vidcontrol.c	(revision 286847)
++++ usr.sbin/vidcontrol/vidcontrol.c	(working copy)
+@@ -1343,7 +1343,7 @@ main(int argc, char **argv)
+ 	if (vt4_mode)
+ 		opts = "b:Cc:fg:h:Hi:M:m:pPr:S:s:T:t:x";
+ 	else
+-		opts = "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x";
++		opts = "b:Cc:dfg:h:Hi:l:LM:m:pPr:S:s:T:t:x";
+ 
+ 	while ((opt = getopt(argc, argv, opts)) != -1)
+ 		switch(opt) {

Added: user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-SA-15:20.expat
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/cperciva/freebsd-update-build/patches/10.2-RELEASE/1-SA-15:20.expat	Thu Jan  7 20:55:20 2016	(r293364)
@@ -0,0 +1,49 @@
+Index: contrib/expat/lib/xmlparse.c
+===================================================================
+--- contrib/expat/lib/xmlparse.c	(revision 286868)
++++ contrib/expat/lib/xmlparse.c	(working copy)
+@@ -1678,6 +1678,12 @@ XML_ParseBuffer(XML_Parser parser, int len, int is
+ void * XMLCALL
+ XML_GetBuffer(XML_Parser parser, int len)
+ {
++/* BEGIN MOZILLA CHANGE (sanity check len) */
++  if (len < 0) {
++    errorCode = XML_ERROR_NO_MEMORY;
++    return NULL;
++  }
++/* END MOZILLA CHANGE */
+   switch (ps_parsing) {
+   case XML_SUSPENDED:
+     errorCode = XML_ERROR_SUSPENDED;
+@@ -1689,8 +1695,13 @@ XML_GetBuffer(XML_Parser parser, int len)
+   }
+ 
+   if (len > bufferLim - bufferEnd) {
+-    /* FIXME avoid integer overflow */
+     int neededSize = len + (int)(bufferEnd - bufferPtr);
++/* BEGIN MOZILLA CHANGE (sanity check neededSize) */
++    if (neededSize < 0) {
++      errorCode = XML_ERROR_NO_MEMORY;
++      return NULL;
++    }
++/* END MOZILLA CHANGE */
+ #ifdef XML_CONTEXT_BYTES
+     int keep = (int)(bufferPtr - buffer);
+ 
+@@ -1719,7 +1730,15 @@ XML_GetBuffer(XML_Parser parser, int len)
+         bufferSize = INIT_BUFFER_SIZE;
+       do {
+         bufferSize *= 2;
+-      } while (bufferSize < neededSize);
++/* BEGIN MOZILLA CHANGE (prevent infinite loop on overflow) */
++      } while (bufferSize < neededSize && bufferSize > 0);
++/* END MOZILLA CHANGE */
++/* BEGIN MOZILLA CHANGE (sanity check bufferSize) */
++      if (bufferSize <= 0) {
++        errorCode = XML_ERROR_NO_MEMORY;
++        return NULL;
++      }
++/* END MOZILLA CHANGE */
+       newBuf = (char *)MALLOC(bufferSize);
+       if (newBuf == 0) {
+         errorCode = XML_ERROR_NO_MEMORY;

Added: user/cperciva/freebsd-update-build/patches/10.2-RELEASE/2-EN-15:15.pkg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/cperciva/freebsd-update-build/patches/10.2-RELEASE/2-EN-15:15.pkg	Thu Jan  7 20:55:20 2016	(r293364)
@@ -0,0 +1,34 @@
+Index: usr.sbin/pkg/pkg.c
+===================================================================
+--- usr.sbin/pkg/pkg.c	(revision 286787)
++++ usr.sbin/pkg/pkg.c	(working copy)
+@@ -749,7 +749,13 @@ bootstrap_pkg(bool force)
+ 		goto fetchfail;
+ 
+ 	if (signature_type != NULL &&
+-	    strcasecmp(signature_type, "FINGERPRINTS") == 0) {
++	    strcasecmp(signature_type, "NONE") != 0) {
++		if (strcasecmp(signature_type, "FINGERPRINTS") != 0) {
++			warnx("Signature type %s is not supported for "
++			    "bootstrapping.", signature_type);
++			goto cleanup;
++		}
++
+ 		snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX",
+ 		    getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP);
+ 		snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig",
+@@ -834,7 +840,13 @@ bootstrap_pkg_local(const char *pkgpath, bool forc
+ 		return (-1);
+ 	}
+ 	if (signature_type != NULL &&
+-	    strcasecmp(signature_type, "FINGERPRINTS") == 0) {
++	    strcasecmp(signature_type, "NONE") != 0) {
++		if (strcasecmp(signature_type, "FINGERPRINTS") != 0) {
++			warnx("Signature type %s is not supported for "
++			    "bootstrapping.", signature_type);
++			goto cleanup;
++		}
++
+ 		snprintf(path, sizeof(path), "%s.sig", pkgpath);
+ 
+ 		if ((fd_sig = open(path, O_RDONLY)) == -1) {

Added: user/cperciva/freebsd-update-build/patches/10.2-RELEASE/2-SA-15:22.openssh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/cperciva/freebsd-update-build/patches/10.2-RELEASE/2-SA-15:22.openssh	Thu Jan  7 20:55:20 2016	(r293364)
@@ -0,0 +1,68 @@
+Index: crypto/openssh/monitor.c
+===================================================================
+--- crypto/openssh/monitor.c	(revision 286787)
++++ crypto/openssh/monitor.c	(working copy)
+@@ -1027,9 +1027,7 @@ extern KbdintDevice sshpam_device;
+ int
+ mm_answer_pam_init_ctx(int sock, Buffer *m)
+ {
+-
+ 	debug3("%s", __func__);
+-	authctxt->user = buffer_get_string(m, NULL);
+ 	sshpam_ctxt = (sshpam_device.init_ctx)(authctxt);
+ 	sshpam_authok = NULL;
+ 	buffer_clear(m);
+@@ -1111,14 +1109,16 @@ mm_answer_pam_respond(int sock, Buffer *m)
+ int
+ mm_answer_pam_free_ctx(int sock, Buffer *m)
+ {
++	int r = sshpam_authok != NULL && sshpam_authok == sshpam_ctxt;
+ 
+ 	debug3("%s", __func__);
+ 	(sshpam_device.free_ctx)(sshpam_ctxt);
++	sshpam_ctxt = sshpam_authok = NULL;
+ 	buffer_clear(m);
+ 	mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m);
+ 	auth_method = "keyboard-interactive";
+ 	auth_submethod = "pam";
+-	return (sshpam_authok == sshpam_ctxt);
++	return r;
+ }
+ #endif
+ 
+Index: crypto/openssh/monitor_wrap.c
+===================================================================
+--- crypto/openssh/monitor_wrap.c	(revision 286787)
++++ crypto/openssh/monitor_wrap.c	(working copy)
+@@ -820,7 +820,6 @@ mm_sshpam_init_ctx(Authctxt *authctxt)
+ 
+ 	debug3("%s", __func__);
+ 	buffer_init(&m);
+-	buffer_put_cstring(&m, authctxt->user);
+ 	mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_INIT_CTX, &m);
+ 	debug3("%s: waiting for MONITOR_ANS_PAM_INIT_CTX", __func__);
+ 	mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PAM_INIT_CTX, &m);
+Index: crypto/openssh/mux.c
+===================================================================
+--- crypto/openssh/mux.c	(revision 286787)
++++ crypto/openssh/mux.c	(working copy)
+@@ -635,7 +635,8 @@ process_mux_open_fwd(u_int rid, Channel *c, Buffer
+ 	u_int lport, cport;
+ 	int i, ret = 0, freefwd = 1;
+ 
+-	fwd.listen_host = fwd.connect_host = NULL;
++	memset(&fwd, 0, sizeof(fwd));
++
+ 	if (buffer_get_int_ret(&ftype, m) != 0 ||
+ 	    (fwd.listen_host = buffer_get_string_ret(m, NULL)) == NULL ||
+ 	    buffer_get_int_ret(&lport, m) != 0 ||
+@@ -785,7 +786,8 @@ process_mux_close_fwd(u_int rid, Channel *c, Buffe
+ 	int i, listen_port, ret = 0;
+ 	u_int lport, cport;
+ 
+-	fwd.listen_host = fwd.connect_host = NULL;
++	memset(&fwd, 0, sizeof(fwd));
++
+ 	if (buffer_get_int_ret(&ftype, m) != 0 ||
+ 	    (fwd.listen_host = buffer_get_string_ret(m, NULL)) == NULL ||
+ 	    buffer_get_int_ret(&lport, m) != 0 ||

Added: user/cperciva/freebsd-update-build/patches/10.2-RELEASE/3-EN-15:16.pw
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/cperciva/freebsd-update-build/patches/10.2-RELEASE/3-EN-15:16.pw	Thu Jan  7 20:55:20 2016	(r293364)
@@ -0,0 +1,20 @@
+Index: usr.sbin/pw/pw.c
+===================================================================
+--- usr.sbin/pw/pw.c	(revision 287410)
++++ usr.sbin/pw/pw.c	(working copy)
+@@ -272,14 +272,7 @@
+ 				    errstr);
+ 			break;
+ 		case 'n':
+-			if (strspn(optarg, "0123456789") != strlen(optarg)) {
+-				name = optarg;
+-				break;
+-			}
+-			id = strtonum(optarg, 0, LONG_MAX, &errstr);
+-			if (errstr != NULL)
+-				errx(EX_USAGE, "Bad id '%s': %s", optarg,
+-				    errstr);
++			name = optarg;
+ 			break;
+ 		case 'o':
+ 			conf.checkduplicate = false;

Added: user/cperciva/freebsd-update-build/patches/10.2-RELEASE/3-EN-15:17.libc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/cperciva/freebsd-update-build/patches/10.2-RELEASE/3-EN-15:17.libc	Thu Jan  7 20:55:20 2016	(r293364)
@@ -0,0 +1,771 @@
+Index: lib/libc/amd64/gen/setjmp.S
+===================================================================
+--- lib/libc/amd64/gen/setjmp.S	(revision 287549)
++++ lib/libc/amd64/gen/setjmp.S	(working copy)
+@@ -55,7 +55,7 @@ ENTRY(setjmp)
+ 	movq	$0,%rsi			/* (sigset_t*)set  */
+ 	leaq	72(%rcx),%rdx		/* 9,10; (sigset_t*)oset */
+ 	/* stack is 16-byte aligned */
+-	call	PIC_PLT(CNAME(_sigprocmask))
++	call	__libc_sigprocmask
+ 	popq	%rdi
+ 	movq	%rdi,%rcx
+ 	movq	0(%rsp),%rdx		/* retval */
+@@ -83,7 +83,7 @@ ENTRY(__longjmp)
+ 	leaq	72(%rdx),%rsi		/* (sigset_t*)set  */
+ 	movq	$0,%rdx			/* (sigset_t*)oset */
+ 	subq	$0x8,%rsp		/* make the stack 16-byte aligned */
+-	call	PIC_PLT(CNAME(_sigprocmask))
++	call	__libc_sigprocmask
+ 	addq	$0x8,%rsp
+ 	popq	%rsi
+ 	popq	%rdi			/* jmpbuf */
+Index: lib/libc/amd64/gen/sigsetjmp.S
+===================================================================
+--- lib/libc/amd64/gen/sigsetjmp.S	(revision 287549)
++++ lib/libc/amd64/gen/sigsetjmp.S	(working copy)
+@@ -63,7 +63,7 @@ ENTRY(sigsetjmp)
+ 	movq	$0,%rsi			/* (sigset_t*)set  */
+ 	leaq	72(%rcx),%rdx		/* 9,10 (sigset_t*)oset */
+ 	/* stack is 16-byte aligned */
+-	call	PIC_PLT(CNAME(_sigprocmask))
++	call	__libc_sigprocmask
+ 	popq	%rdi
+ 2:	movq	%rdi,%rcx
+ 	movq	0(%rsp),%rdx		/* retval */
+@@ -92,7 +92,7 @@ ENTRY(__siglongjmp)
+ 	leaq	72(%rdx),%rsi		/* (sigset_t*)set  */
+ 	movq	$0,%rdx			/* (sigset_t*)oset */
+ 	subq	$0x8,%rsp		/* make the stack 16-byte aligned */
+-	call	PIC_PLT(CNAME(_sigprocmask))
++	call	__libc_sigprocmask
+ 	addq	$0x8,%rsp
+ 	popq	%rsi
+ 	popq	%rdi			/* jmpbuf */
+Index: lib/libc/compat-43/sigcompat.c
+===================================================================
+--- lib/libc/compat-43/sigcompat.c	(revision 287549)
++++ lib/libc/compat-43/sigcompat.c	(working copy)
+@@ -59,7 +59,7 @@ sigvec(signo, sv, osv)
+ 	} else
+ 		sap = NULL;
+ 	osap = osv != NULL ? &osa : NULL;
+-	ret = _sigaction(signo, sap, osap);
++	ret = __libc_sigaction(signo, sap, osap);
+ 	if (ret == 0 && osv != NULL) {
+ 		osv->sv_handler = osa.sa_handler;
+ 		osv->sv_flags = osa.sa_flags ^ SV_INTERRUPT;
+@@ -77,7 +77,7 @@ sigsetmask(mask)
+ 
+ 	sigemptyset(&set);
+ 	set.__bits[0] = mask;
+-	n = _sigprocmask(SIG_SETMASK, &set, &oset);
++	n = __libc_sigprocmask(SIG_SETMASK, &set, &oset);
+ 	if (n)
+ 		return (n);
+ 	return (oset.__bits[0]);
+@@ -92,7 +92,7 @@ sigblock(mask)
+ 
+ 	sigemptyset(&set);
+ 	set.__bits[0] = mask;
+-	n = _sigprocmask(SIG_BLOCK, &set, &oset);
++	n = __libc_sigprocmask(SIG_BLOCK, &set, &oset);
+ 	if (n)
+ 		return (n);
+ 	return (oset.__bits[0]);
+@@ -105,7 +105,7 @@ sigpause(int mask)
+ 
+ 	sigemptyset(&set);
+ 	set.__bits[0] = mask;
+-	return (_sigsuspend(&set));
++	return (__libc_sigsuspend(&set));
+ }
+ 
+ int
+@@ -113,11 +113,11 @@ xsi_sigpause(int sig)
+ {
+ 	sigset_t set;
+ 
+-	if (_sigprocmask(SIG_BLOCK, NULL, &set) == -1)
++	if (__libc_sigprocmask(SIG_BLOCK, NULL, &set) == -1)
+ 		return (-1);
+ 	if (sigdelset(&set, sig) == -1)
+ 		return (-1);
+-	return (_sigsuspend(&set));
++	return (__libc_sigsuspend(&set));
+ }
+ 
+ int
+@@ -128,7 +128,7 @@ sighold(int sig)
+ 	sigemptyset(&set);
+ 	if (sigaddset(&set, sig) == -1)
+ 		return (-1);
+-	return (_sigprocmask(SIG_BLOCK, &set, NULL));
++	return (__libc_sigprocmask(SIG_BLOCK, &set, NULL));
+ }
+ 
+ int
+@@ -138,7 +138,7 @@ sigignore(int sig)
+ 
+ 	bzero(&sa, sizeof(sa));
+ 	sa.sa_handler = SIG_IGN;
+-	return (_sigaction(sig, &sa, NULL));
++	return (__libc_sigaction(sig, &sa, NULL));
+ }
+ 
+ int
+@@ -149,7 +149,7 @@ sigrelse(int sig)
+ 	sigemptyset(&set);
+ 	if (sigaddset(&set, sig) == -1)
+ 		return (-1);
+-	return (_sigprocmask(SIG_UNBLOCK, &set, NULL));
++	return (__libc_sigprocmask(SIG_UNBLOCK, &set, NULL));
+ }
+ 
+ void
+@@ -161,26 +161,26 @@ void
+ 	sigemptyset(&set);
+ 	if (sigaddset(&set, sig) == -1)
+ 		return (SIG_ERR);
+-	if (_sigprocmask(SIG_BLOCK, NULL, &pset) == -1)
++	if (__libc_sigprocmask(SIG_BLOCK, NULL, &pset) == -1)
+ 		return (SIG_ERR);
+ 	if ((__sighandler_t *)disp == SIG_HOLD) {
+-		if (_sigprocmask(SIG_BLOCK, &set, &pset) == -1)
++		if (__libc_sigprocmask(SIG_BLOCK, &set, &pset) == -1)
+ 			return (SIG_ERR);
+ 		if (sigismember(&pset, sig))
+ 			return (SIG_HOLD);
+ 		else {
+-			if (_sigaction(sig, NULL, &psa) == -1)
++			if (__libc_sigaction(sig, NULL, &psa) == -1)
+ 				return (SIG_ERR);
+ 			return (psa.sa_handler);
+ 		}
+ 	} else {
+-		if (_sigprocmask(SIG_UNBLOCK, &set, &pset) == -1)
++		if (__libc_sigprocmask(SIG_UNBLOCK, &set, &pset) == -1)
+ 			return (SIG_ERR);
+ 	}
+ 
+ 	bzero(&sa, sizeof(sa));
+ 	sa.sa_handler = disp;
+-	if (_sigaction(sig, &sa, &psa) == -1)
++	if (__libc_sigaction(sig, &sa, &psa) == -1)
+ 		return (SIG_ERR);
+ 	if (sigismember(&pset, sig))
+ 		return (SIG_HOLD);
+Index: lib/libc/db/btree/bt_open.c
+===================================================================
+--- lib/libc/db/btree/bt_open.c	(revision 287549)
++++ lib/libc/db/btree/bt_open.c	(working copy)
+@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
+ #include <string.h>
+ #include <unistd.h>
+ #include "un-namespace.h"
++#include "libc_private.h"
+ 
+ #include <db.h>
+ #include "btree.h"
+@@ -401,10 +402,10 @@ tmp(void)
+ 	}
+ 
+ 	(void)sigfillset(&set);
+-	(void)_sigprocmask(SIG_BLOCK, &set, &oset);
++	(void)__libc_sigprocmask(SIG_BLOCK, &set, &oset);
+ 	if ((fd = mkostemp(path, O_CLOEXEC)) != -1)
+ 		(void)unlink(path);
+-	(void)_sigprocmask(SIG_SETMASK, &oset, NULL);
++	(void)__libc_sigprocmask(SIG_SETMASK, &oset, NULL);
+ 	return(fd);
+ }
+ 
+Index: lib/libc/db/hash/hash_page.c
+===================================================================
+--- lib/libc/db/hash/hash_page.c	(revision 287549)
++++ lib/libc/db/hash/hash_page.c	(working copy)
+@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
+ #include <assert.h>
+ #endif
+ #include "un-namespace.h"
++#include "libc_private.h"
+ 
+ #include <db.h>
+ #include "hash.h"
+@@ -861,10 +862,10 @@ open_temp(HTAB *hashp)
+ 
+ 	/* Block signals; make sure file goes away at process exit. */
+ 	(void)sigfillset(&set);
+-	(void)_sigprocmask(SIG_BLOCK, &set, &oset);
++	(void)__libc_sigprocmask(SIG_BLOCK, &set, &oset);
+ 	if ((hashp->fp = mkostemp(path, O_CLOEXEC)) != -1)
+ 		(void)unlink(path);
+-	(void)_sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
++	(void)__libc_sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
+ 	return (hashp->fp != -1 ? 0 : -1);
+ }
+ 
+Index: lib/libc/gen/daemon.c
+===================================================================
+--- lib/libc/gen/daemon.c	(revision 287549)
++++ lib/libc/gen/daemon.c	(working copy)
+@@ -41,10 +41,10 @@ __FBSDID("$FreeBSD$");
+ #include <signal.h>
+ #include <unistd.h>
+ #include "un-namespace.h"
++#include "libc_private.h"
+ 
+ int
+-daemon(nochdir, noclose)
+-	int nochdir, noclose;
++daemon(int nochdir, int noclose)
+ {
+ 	struct sigaction osa, sa;
+ 	int fd;
+@@ -56,7 +56,7 @@ int
+ 	sigemptyset(&sa.sa_mask);
+ 	sa.sa_handler = SIG_IGN;
+ 	sa.sa_flags = 0;
+-	osa_ok = _sigaction(SIGHUP, &sa, &osa);
++	osa_ok = __libc_sigaction(SIGHUP, &sa, &osa);
+ 
+ 	switch (fork()) {
+ 	case -1:
+@@ -74,7 +74,7 @@ int
+ 	newgrp = setsid();
+ 	oerrno = errno;
+ 	if (osa_ok != -1)
+-		_sigaction(SIGHUP, &osa, NULL);
++		__libc_sigaction(SIGHUP, &osa, NULL);
+ 
+ 	if (newgrp == -1) {
+ 		errno = oerrno;
+Index: lib/libc/gen/posix_spawn.c
+===================================================================
+--- lib/libc/gen/posix_spawn.c	(revision 287549)
++++ lib/libc/gen/posix_spawn.c	(working copy)
+@@ -118,15 +118,18 @@ process_spawnattr(const posix_spawnattr_t sa)
+ 			return (errno);
+ 	}
+ 
+-	/* Set signal masks/defaults */
++	/*
++	 * Set signal masks/defaults.
++	 * Use unwrapped syscall, libthr is in undefined state after vfork().
++	 */
+ 	if (sa->sa_flags & POSIX_SPAWN_SETSIGMASK) {
+-		_sigprocmask(SIG_SETMASK, &sa->sa_sigmask, NULL);
++		__sys_sigprocmask(SIG_SETMASK, &sa->sa_sigmask, NULL);
+ 	}
+ 
+ 	if (sa->sa_flags & POSIX_SPAWN_SETSIGDEF) {
+ 		for (i = 1; i <= _SIG_MAXSIG; i++) {
+ 			if (sigismember(&sa->sa_sigdefault, i))
+-				if (_sigaction(i, &sigact, NULL) != 0)
++				if (__sys_sigaction(i, &sigact, NULL) != 0)
+ 					return (errno);
+ 		}
+ 	}
+Index: lib/libc/gen/readpassphrase.c
+===================================================================
+--- lib/libc/gen/readpassphrase.c	(revision 287549)
++++ lib/libc/gen/readpassphrase.c	(working copy)
+@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
+ #include <unistd.h>
+ #include <readpassphrase.h>
+ #include "un-namespace.h"
++#include "libc_private.h"
+ 
+ static volatile sig_atomic_t signo[NSIG];
+ 
+@@ -104,15 +105,15 @@ restart:
+ 	sigemptyset(&sa.sa_mask);
+ 	sa.sa_flags = 0;		/* don't restart system calls */
+ 	sa.sa_handler = handler;
+-	(void)_sigaction(SIGALRM, &sa, &savealrm);
+-	(void)_sigaction(SIGHUP, &sa, &savehup);
+-	(void)_sigaction(SIGINT, &sa, &saveint);
+-	(void)_sigaction(SIGPIPE, &sa, &savepipe);
+-	(void)_sigaction(SIGQUIT, &sa, &savequit);
+-	(void)_sigaction(SIGTERM, &sa, &saveterm);
+-	(void)_sigaction(SIGTSTP, &sa, &savetstp);
+-	(void)_sigaction(SIGTTIN, &sa, &savettin);
+-	(void)_sigaction(SIGTTOU, &sa, &savettou);
++	(void)__libc_sigaction(SIGALRM, &sa, &savealrm);
++	(void)__libc_sigaction(SIGHUP, &sa, &savehup);
++	(void)__libc_sigaction(SIGINT, &sa, &saveint);
++	(void)__libc_sigaction(SIGPIPE, &sa, &savepipe);
++	(void)__libc_sigaction(SIGQUIT, &sa, &savequit);
++	(void)__libc_sigaction(SIGTERM, &sa, &saveterm);
++	(void)__libc_sigaction(SIGTSTP, &sa, &savetstp);
++	(void)__libc_sigaction(SIGTTIN, &sa, &savettin);
++	(void)__libc_sigaction(SIGTTOU, &sa, &savettou);
+ 
+ 	if (!(flags & RPP_STDIN))
+ 		(void)_write(output, prompt, strlen(prompt));
+@@ -142,15 +143,15 @@ restart:
+ 		    errno == EINTR && !signo[SIGTTOU])
+ 			continue;
+ 	}
+-	(void)_sigaction(SIGALRM, &savealrm, NULL);
+-	(void)_sigaction(SIGHUP, &savehup, NULL);
+-	(void)_sigaction(SIGINT, &saveint, NULL);
+-	(void)_sigaction(SIGQUIT, &savequit, NULL);
+-	(void)_sigaction(SIGPIPE, &savepipe, NULL);
+-	(void)_sigaction(SIGTERM, &saveterm, NULL);
+-	(void)_sigaction(SIGTSTP, &savetstp, NULL);
+-	(void)_sigaction(SIGTTIN, &savettin, NULL);
+-	(void)_sigaction(SIGTTOU, &savettou, NULL);
++	(void)__libc_sigaction(SIGALRM, &savealrm, NULL);
++	(void)__libc_sigaction(SIGHUP, &savehup, NULL);
++	(void)__libc_sigaction(SIGINT, &saveint, NULL);
++	(void)__libc_sigaction(SIGQUIT, &savequit, NULL);
++	(void)__libc_sigaction(SIGPIPE, &savepipe, NULL);
++	(void)__libc_sigaction(SIGTERM, &saveterm, NULL);
++	(void)__libc_sigaction(SIGTSTP, &savetstp, NULL);
++	(void)__libc_sigaction(SIGTTIN, &savettin, NULL);
++	(void)__libc_sigaction(SIGTTOU, &savettou, NULL);
+ 	if (input != STDIN_FILENO)
+ 		(void)_close(input);
+ 
+Index: lib/libc/gen/setmode.c
+===================================================================
+--- lib/libc/gen/setmode.c	(revision 287549)
++++ lib/libc/gen/setmode.c	(working copy)
+@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
+ #include <stdio.h>
+ #endif
+ #include "un-namespace.h"
++#include "libc_private.h"
+ 
+ #define	SET_LEN	6		/* initial # of bitcmd struct to malloc */
+ #define	SET_LEN_INCR 4		/* # of bitcmd structs to add as needed */
+@@ -187,10 +188,10 @@ setmode(const char *p)
+ 	 * as best we can.
+ 	 */
+ 	sigfillset(&sigset);
+-        (void)_sigprocmask(SIG_BLOCK, &sigset, &sigoset);
++	(void)__libc_sigprocmask(SIG_BLOCK, &sigset, &sigoset);
+ 	(void)umask(mask = umask(0));
+ 	mask = ~mask;
+-        (void)_sigprocmask(SIG_SETMASK, &sigoset, NULL);
++	(void)__libc_sigprocmask(SIG_SETMASK, &sigoset, NULL);
+ 
+ 	setlen = SET_LEN + 2;
+ 
+Index: lib/libc/gen/siginterrupt.c
+===================================================================
+--- lib/libc/gen/siginterrupt.c	(revision 287549)
++++ lib/libc/gen/siginterrupt.c	(working copy)
+@@ -43,14 +43,13 @@ __FBSDID("$FreeBSD$");
+  * after an instance of the indicated signal.
+  */
+ int
+-siginterrupt(sig, flag)
+-	int sig, flag;
++siginterrupt(int sig, int flag)
+ {
+ 	extern sigset_t _sigintr __hidden;
+ 	struct sigaction sa;
+ 	int ret;
+ 
+-	if ((ret = _sigaction(sig, (struct sigaction *)0, &sa)) < 0)
++	if ((ret = __libc_sigaction(sig, (struct sigaction *)0, &sa)) < 0)
+ 		return (ret);
+ 	if (flag) {
+ 		sigaddset(&_sigintr, sig);
+@@ -59,5 +58,5 @@ int
+ 		sigdelset(&_sigintr, sig);
+ 		sa.sa_flags |= SA_RESTART;
+ 	}
+-	return (_sigaction(sig, &sa, (struct sigaction *)0));
++	return (__libc_sigaction(sig, &sa, (struct sigaction *)0));
+ }
+Index: lib/libc/gen/signal.c
+===================================================================
+--- lib/libc/gen/signal.c	(revision 287549)
++++ lib/libc/gen/signal.c	(working copy)
+@@ -44,9 +44,7 @@ __FBSDID("$FreeBSD$");
+ sigset_t _sigintr __hidden;	/* shared with siginterrupt */
+ 
+ sig_t
+-signal(s, a)
+-	int s;
+-	sig_t a;
++signal(int s, sig_t a)
+ {
+ 	struct sigaction sa, osa;
+ 
+@@ -55,7 +53,7 @@ sig_t
+ 	sa.sa_flags = 0;
+ 	if (!sigismember(&_sigintr, s))
+ 		sa.sa_flags |= SA_RESTART;
+-	if (_sigaction(s, &sa, &osa) < 0)
++	if (__libc_sigaction(s, &sa, &osa) < 0)
+ 		return (SIG_ERR);
+ 	return (osa.sa_handler);
+ }
+Index: lib/libc/gen/wordexp.c
+===================================================================
+--- lib/libc/gen/wordexp.c	(revision 287549)
++++ lib/libc/gen/wordexp.c	(working copy)
+@@ -38,6 +38,7 @@
+ #include <unistd.h>
+ #include <wordexp.h>
+ #include "un-namespace.h"
++#include "libc_private.h"
+ 
+ __FBSDID("$FreeBSD$");
+ 
+@@ -127,12 +128,12 @@ we_askshell(const char *words, wordexp_t *we, int
+ 		return (WRDE_NOSPACE);	/* XXX */
+ 	(void)sigemptyset(&newsigblock);
+ 	(void)sigaddset(&newsigblock, SIGCHLD);
+-	(void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
++	(void)__libc_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
+ 	if ((pid = fork()) < 0) {
+ 		serrno = errno;
+ 		_close(pdes[0]);
+ 		_close(pdes[1]);
+-		(void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
++		(void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ 		errno = serrno;
+ 		return (WRDE_NOSPACE);	/* XXX */
+ 	}
+@@ -141,7 +142,7 @@ we_askshell(const char *words, wordexp_t *we, int
+ 		 * We are the child; just get /bin/sh to run the wordexp
+ 		 * builtin on `words'.
+ 		 */
+-		(void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
++		(void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ 		if ((pdes[1] != STDOUT_FILENO ?
+ 		    _dup2(pdes[1], STDOUT_FILENO) :
+ 		    _fcntl(pdes[1], F_SETFD, 0)) < 0)
+@@ -210,7 +211,7 @@ cleanup:
+ 	do
+ 		wpid = _waitpid(pid, &status, 0);
+ 	while (wpid < 0 && errno == EINTR);
+-	(void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
++	(void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ 	if (error != 0) {
+ 		errno = serrno;
+ 		return (error);
+Index: lib/libc/i386/gen/setjmp.S
+===================================================================
+--- lib/libc/i386/gen/setjmp.S	(revision 287549)
++++ lib/libc/i386/gen/setjmp.S	(working copy)
+@@ -50,21 +50,12 @@ __FBSDID("$FreeBSD$");
+ 
+ ENTRY(setjmp)
+ 	movl	4(%esp),%ecx
+-	PIC_PROLOGUE
+-#ifdef PIC
+-	subl	$12,%esp		/* make the stack 16-byte aligned */
+-#endif
+ 	leal	28(%ecx), %eax
+ 	pushl	%eax			/* (sigset_t*)oset */
+ 	pushl	$0			/* (sigset_t*)set  */
+ 	pushl	$1			/* SIG_BLOCK       */
+-	call	PIC_PLT(CNAME(_sigprocmask))
+-#ifdef PIC
+-	addl	$24,%esp
+-#else
++	call	__libc_sigprocmask
+ 	addl	$12,%esp
+-#endif
+-	PIC_EPILOGUE
+ 	movl	4(%esp),%ecx
+ 	movl	0(%esp),%edx
+ 	movl	%edx, 0(%ecx)
+@@ -82,21 +73,12 @@ END(setjmp)
+ 	.set CNAME(longjmp),CNAME(__longjmp)
+ ENTRY(__longjmp)
+ 	movl	4(%esp),%edx
+-	PIC_PROLOGUE
+-#ifdef PIC
+-	subl	$12,%esp		/* make the stack 16-byte aligned */
+-#endif
+ 	pushl	$0			/* (sigset_t*)oset */
+ 	leal	28(%edx), %eax
+ 	pushl	%eax			/* (sigset_t*)set  */
+ 	pushl	$3			/* SIG_SETMASK     */
+-	call	PIC_PLT(CNAME(_sigprocmask))
+-#ifdef PIC
+-	addl	$24,%esp
+-#else
++	call	__libc_sigprocmask
+ 	addl	$12,%esp
+-#endif
+-	PIC_EPILOGUE
+ 	movl	4(%esp),%edx
+ 	movl	8(%esp),%eax
+ 	movl	0(%edx),%ecx
+Index: lib/libc/i386/gen/sigsetjmp.S
+===================================================================
+--- lib/libc/i386/gen/sigsetjmp.S	(revision 287549)
++++ lib/libc/i386/gen/sigsetjmp.S	(working copy)
+@@ -59,21 +59,12 @@ ENTRY(sigsetjmp)
+ 	movl	%eax,44(%ecx)
+ 	testl	%eax,%eax
+ 	jz	2f
+-	PIC_PROLOGUE
+-#ifdef PIC
+-	subl	$12,%esp		/* make the stack 16-byte aligned */
+-#endif
+ 	leal	28(%ecx), %eax
+ 	pushl	%eax			/* (sigset_t*)oset */
+ 	pushl	$0			/* (sigset_t*)set  */
+ 	pushl	$1			/* SIG_BLOCK       */
+-	call	PIC_PLT(CNAME(_sigprocmask))
+-#ifdef PIC
+-	addl	$24,%esp
+-#else
++	call	__libc_sigprocmask
+ 	addl	$12,%esp
+-#endif
+-	PIC_EPILOGUE
+ 	movl	4(%esp),%ecx
+ 2:	movl	0(%esp),%edx
+ 	movl	%edx, 0(%ecx)
+@@ -93,21 +84,12 @@ ENTRY(__siglongjmp)
+ 	movl	4(%esp),%edx
+ 	cmpl	$0,44(%edx)
+ 	jz	2f
+-	PIC_PROLOGUE
+-#ifdef PIC
+-	subl	$12,%esp		/* make the stack 16-byte aligned */
+-#endif
+ 	pushl	$0			/* (sigset_t*)oset */
+ 	leal	28(%edx), %eax
+ 	pushl	%eax			/* (sigset_t*)set  */
+ 	pushl	$3			/* SIG_SETMASK     */
+-	call	PIC_PLT(CNAME(_sigprocmask))
+-#ifdef PIC
+-	addl	$24,%esp
+-#else
++	call	__libc_sigprocmask
+ 	addl	$12,%esp
+-#endif
+-	PIC_EPILOGUE
+ 	movl	4(%esp),%edx
+ 2:	movl	8(%esp),%eax
+ 	movl	0(%edx),%ecx
+Index: lib/libc/include/libc_private.h
+===================================================================
+--- lib/libc/include/libc_private.h	(revision 287549)
++++ lib/libc/include/libc_private.h	(working copy)
+@@ -368,6 +368,11 @@ __pid_t		__sys_wait6(enum idtype, __id_t, int *, i
+ __ssize_t	__sys_write(int, const void *, __size_t);
+ __ssize_t	__sys_writev(int, const struct iovec *, int);
+ 
++int		__libc_sigaction(int, const struct sigaction *,
++		    struct sigaction *) __hidden;
++int		__libc_sigprocmask(int, const __sigset_t *, __sigset_t *)
++		    __hidden;
++int		__libc_sigsuspend(const __sigset_t *) __hidden;
+ int		__libc_sigwait(const __sigset_t * __restrict,
+ 		    int * restrict sig);
+ int		__libc_system(const char *);
+Index: lib/libc/net/rcmd.c
+===================================================================
+--- lib/libc/net/rcmd.c	(revision 287549)
++++ lib/libc/net/rcmd.c	(working copy)
+@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
+ #endif
+ #include <arpa/nameser.h>
+ #include "un-namespace.h"
++#include "libc_private.h"
+ 
+ extern int innetgr( const char *, const char *, const char *, const char * );
+ 
+@@ -148,7 +149,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p,
+ 	refused = 0;
+ 	sigemptyset(&newmask);
+ 	sigaddset(&newmask, SIGURG);
+-	_sigprocmask(SIG_BLOCK, (const sigset_t *)&newmask, &oldmask);
++	__libc_sigprocmask(SIG_BLOCK, (const sigset_t *)&newmask, &oldmask);
+ 	for (timo = 1, lport = IPPORT_RESERVED - 1;;) {
+ 		s = rresvport_af(&lport, ai->ai_family);
+ 		if (s < 0) {
+@@ -163,7 +164,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p,
+ 				(void)fprintf(stderr, "rcmd: socket: %s\n",
+ 				    strerror(errno));
+ 			freeaddrinfo(res);
+-			_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask,
++			__libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask,
+ 			    NULL);
+ 			return (-1);
+ 		}
+@@ -181,7 +182,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p,
+ 			(void)fprintf(stderr, "%s: %s\n",
+ 				      *ahost, strerror(errno));
+ 			freeaddrinfo(res);
+-			_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask,
++			__libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask,
+ 			    NULL);
+ 			return (-1);
+ 		}
+@@ -306,7 +307,7 @@ again:
+ 		}
+ 		goto bad2;
+ 	}
+-	_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL);
++	__libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL);
+ 	freeaddrinfo(res);
+ 	return (s);
+ bad2:
+@@ -314,7 +315,7 @@ bad2:
+ 		(void)_close(*fd2p);
+ bad:
+ 	(void)_close(s);
+-	_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL);
++	__libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL);
+ 	freeaddrinfo(res);
+ 	return (-1);
+ }
+Index: lib/libc/stdio/tmpfile.c
+===================================================================
+--- lib/libc/stdio/tmpfile.c	(revision 287549)
++++ lib/libc/stdio/tmpfile.c	(working copy)
+@@ -46,9 +46,10 @@ __FBSDID("$FreeBSD$");
+ #include <string.h>
+ #include <paths.h>
+ #include "un-namespace.h"
++#include "libc_private.h"
+ 
+ FILE *
+-tmpfile()
++tmpfile(void)
+ {
+ 	sigset_t set, oset;
+ 	FILE *fp;
+@@ -69,7 +70,7 @@ FILE *
+ 		return (NULL);
+ 
+ 	sigfillset(&set);
+-	(void)_sigprocmask(SIG_BLOCK, &set, &oset);
++	(void)__libc_sigprocmask(SIG_BLOCK, &set, &oset);
+ 
+ 	fd = mkstemp(buf);
+ 	if (fd != -1)
+@@ -77,7 +78,7 @@ FILE *
+ 
+ 	free(buf);
+ 
+-	(void)_sigprocmask(SIG_SETMASK, &oset, NULL);
++	(void)__libc_sigprocmask(SIG_SETMASK, &oset, NULL);
+ 
+ 	if (fd == -1)
+ 		return (NULL);
+Index: lib/libc/stdlib/abort.c
+===================================================================
+--- lib/libc/stdlib/abort.c	(revision 287549)
++++ lib/libc/stdlib/abort.c	(working copy)
+@@ -61,7 +61,7 @@ abort()
+ 	 * any errors -- ISO C doesn't allow abort to return anyway.
+ 	 */
+ 	sigdelset(&act.sa_mask, SIGABRT);
+-	(void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
++	(void)__libc_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
+ 	(void)raise(SIGABRT);
+ 
+ 	/*
+@@ -71,9 +71,9 @@ abort()
+ 	act.sa_handler = SIG_DFL;
+ 	act.sa_flags = 0;
+ 	sigfillset(&act.sa_mask);
+-	(void)_sigaction(SIGABRT, &act, NULL);
++	(void)__libc_sigaction(SIGABRT, &act, NULL);
+ 	sigdelset(&act.sa_mask, SIGABRT);
+-	(void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
++	(void)__libc_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
+ 	(void)raise(SIGABRT);
+ 	exit(1);
+ }
+Index: lib/libc/stdlib/system.c
+===================================================================
+--- lib/libc/stdlib/system.c	(revision 287549)
++++ lib/libc/stdlib/system.c	(working copy)
+@@ -70,16 +70,20 @@ __libc_system(const char *command)
+ 	(void)sigaddset(&newsigblock, SIGCHLD);
+ 	(void)sigaddset(&newsigblock, SIGINT);
+ 	(void)sigaddset(&newsigblock, SIGQUIT);
+-	(void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
++	(void)__libc_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
+ 	switch(pid = vfork()) {
++	/*
++	 * In the child, use unwrapped syscalls.  libthr is in
++	 * undefined state after vfork().
++	 */
+ 	case -1:			/* error */
+-		(void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
++		(void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ 		return (-1);
+ 	case 0:				/* child */
+ 		/*
+ 		 * Restore original signal dispositions and exec the command.
+ 		 */
+-		(void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
++		(void)__sys_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ 		execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL);
+ 		_exit(127);
+ 	}
+@@ -92,16 +96,16 @@ __libc_system(const char *command)
+ 	memset(&ign, 0, sizeof(ign));
+ 	ign.sa_handler = SIG_IGN;
+ 	(void)sigemptyset(&ign.sa_mask);
+-	(void)_sigaction(SIGINT, &ign, &intact);
+-	(void)_sigaction(SIGQUIT, &ign, &quitact);
++	(void)__libc_sigaction(SIGINT, &ign, &intact);
++	(void)__libc_sigaction(SIGQUIT, &ign, &quitact);
+ 	savedpid = pid;
+ 	do {
+ 		pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0);
+ 	} while (pid == -1 && errno == EINTR);
+-	(void)_sigaction(SIGINT, &intact, NULL);
+-	(void)_sigaction(SIGQUIT,  &quitact, NULL);
+-	(void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+-	return(pid == -1 ? -1 : pstat);
++	(void)__libc_sigaction(SIGINT, &intact, NULL);
++	(void)__libc_sigaction(SIGQUIT,  &quitact, NULL);
++	(void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
++	return (pid == -1 ? -1 : pstat);
+ }
+ 
+ __weak_reference(__libc_system, __system);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601072055.u07KtKjS041543>