summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2016-05-23 00:18:56 +0000
committerguenther <guenther@openbsd.org>2016-05-23 00:18:56 +0000
commitfbe95b356396ba2cd9b02ba74d5500decce5730c (patch)
tree2211d61df290561f6492fed039808fc63436b80b /lib/libc
parentPlug mem leak in filter_proposal. ok djm@ (diff)
downloadwireguard-openbsd-fbe95b356396ba2cd9b02ba74d5500decce5730c.tar.xz
wireguard-openbsd-fbe95b356396ba2cd9b02ba74d5500decce5730c.zip
Stop supporting longjmperror(); it's not used, not portable, and the checks
longjmp performs can't really be relied upon, even after we got rid of the false positives... ok millert@ deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/Symbols.list1
-rw-r--r--lib/libc/arch/arm/gen/_setjmp.S5
-rw-r--r--lib/libc/arch/arm/gen/setjmp.S5
-rw-r--r--lib/libc/arch/m88k/gen/_setjmp.S8
-rw-r--r--lib/libc/arch/m88k/gen/setjmp.S8
-rw-r--r--lib/libc/arch/m88k/gen/sigsetjmp.S8
-rw-r--r--lib/libc/arch/mips64/gen/_setjmp.S4
-rw-r--r--lib/libc/arch/mips64/gen/setjmp.S4
-rw-r--r--lib/libc/gen/Makefile.inc4
-rw-r--r--lib/libc/gen/setjmp.335
-rw-r--r--lib/libc/gen/setjmperr.c46
11 files changed, 22 insertions, 106 deletions
diff --git a/lib/libc/Symbols.list b/lib/libc/Symbols.list
index ebe477a4ded..f9b15587c26 100644
--- a/lib/libc/Symbols.list
+++ b/lib/libc/Symbols.list
@@ -676,7 +676,6 @@ login_getcaptime
login_getclass
login_getstyle
longjmp
-longjmperror
modf
nftw
nice
diff --git a/lib/libc/arch/arm/gen/_setjmp.S b/lib/libc/arch/arm/gen/_setjmp.S
index 8f63bf625cb..dca5158a01a 100644
--- a/lib/libc/arch/arm/gen/_setjmp.S
+++ b/lib/libc/arch/arm/gen/_setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: _setjmp.S,v 1.2 2004/02/01 05:40:52 drahn Exp $ */
+/* $OpenBSD: _setjmp.S,v 1.3 2016/05/23 00:18:57 guenther Exp $ */
/* $NetBSD: _setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */
/*
@@ -101,6 +101,5 @@ ENTRY(_longjmp)
/* validation failed, die die die. */
botch:
- bl PIC_SYM(_C_LABEL(longjmperror), PLT)
- bl PIC_SYM(_C_LABEL(abort), PLT)
+ bl PIC_SYM(_libc_abort, PLT)
b . - 8 /* Cannot get here */
diff --git a/lib/libc/arch/arm/gen/setjmp.S b/lib/libc/arch/arm/gen/setjmp.S
index d63012b7705..239a49d475c 100644
--- a/lib/libc/arch/arm/gen/setjmp.S
+++ b/lib/libc/arch/arm/gen/setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: setjmp.S,v 1.3 2015/09/13 07:36:58 guenther Exp $ */
+/* $OpenBSD: setjmp.S,v 1.4 2016/05/23 00:18:57 guenther Exp $ */
/* $NetBSD: setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */
/*
@@ -130,6 +130,5 @@ ENTRY(longjmp)
/* validation failed, die die die. */
botch:
- bl PIC_SYM(_C_LABEL(longjmperror), PLT)
- bl PIC_SYM(_C_LABEL(abort), PLT)
+ bl PIC_SYM(_libc_abort, PLT)
b . - 8 /* Cannot get here */
diff --git a/lib/libc/arch/m88k/gen/_setjmp.S b/lib/libc/arch/m88k/gen/_setjmp.S
index 8c7d306bc34..f443ee3785b 100644
--- a/lib/libc/arch/m88k/gen/_setjmp.S
+++ b/lib/libc/arch/m88k/gen/_setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: _setjmp.S,v 1.12 2013/01/20 17:59:52 miod Exp $ */
+/* $OpenBSD: _setjmp.S,v 1.13 2016/05/23 00:18:57 guenther Exp $ */
/*-
* Copyright (c) 2002 Steve Murphree, Jr.
* All rights reserved.
@@ -116,11 +116,9 @@ ENTRY(_longjmp)
2: subu %r31,%r31,16 /* get a temporary stack */
st %r1,%r31,0 /* save r1 on stack (return address) */
#ifdef __PIC__
- bsr _C_LABEL(longjmperror)#plt
- bsr _C_LABEL(abort)#plt /* NO RETURN */
+ bsr _libc_abort#plt /* NO RETURN */
#else
- bsr _C_LABEL(longjmperror)
- bsr _C_LABEL(abort) /* NO RETURN */
+ bsr _libc_abort /* NO RETURN */
#endif
ld %r1,%r31,0 /* restore r1 from stack */
jmp.n %r1 /* this should not happen but we are prepared */
diff --git a/lib/libc/arch/m88k/gen/setjmp.S b/lib/libc/arch/m88k/gen/setjmp.S
index 60a0309859a..28dd10e4f7a 100644
--- a/lib/libc/arch/m88k/gen/setjmp.S
+++ b/lib/libc/arch/m88k/gen/setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: setjmp.S,v 1.14 2015/09/13 07:36:58 guenther Exp $ */
+/* $OpenBSD: setjmp.S,v 1.15 2016/05/23 00:18:57 guenther Exp $ */
/*-
* Copyright (c) 2002 Steve Murphree, Jr.
* All rights reserved.
@@ -136,11 +136,9 @@ ENTRY(longjmp)
2: subu %r31,%r31,16 /* get a temporary stack */
st %r1,%r31,0 /* save r1 on stack (return address) */
#ifdef __PIC__
- bsr _C_LABEL(longjmperror)#plt
- bsr _C_LABEL(abort)#plt /* NO RETURN */
+ bsr _libc_abort#plt /* NO RETURN */
#else
- bsr _C_LABEL(longjmperror)
- bsr _C_LABEL(abort) /* NO RETURN */
+ bsr _libc_abort /* NO RETURN */
#endif
ld %r1,%r31,0 /* restore r1 from stack */
jmp.n %r1 /* this should not happen but we are prepared */
diff --git a/lib/libc/arch/m88k/gen/sigsetjmp.S b/lib/libc/arch/m88k/gen/sigsetjmp.S
index 342b79e5e55..97130701587 100644
--- a/lib/libc/arch/m88k/gen/sigsetjmp.S
+++ b/lib/libc/arch/m88k/gen/sigsetjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigsetjmp.S,v 1.15 2015/09/13 07:36:58 guenther Exp $ */
+/* $OpenBSD: sigsetjmp.S,v 1.16 2016/05/23 00:18:57 guenther Exp $ */
/*-
* Copyright (c) 2002 Steve Murphree, Jr.
* All rights reserved.
@@ -145,11 +145,9 @@ ENTRY(siglongjmp)
2: subu %r31,%r31,16 /* get a temporary stack */
st %r1,%r31,0 /* save r1 on stack (return address) */
#ifdef __PIC__
- bsr _C_LABEL(longjmperror)#plt
- bsr _C_LABEL(abort)#plt /* NO RETURN */
+ bsr _libc_abort#plt /* NO RETURN */
#else
- bsr _C_LABEL(longjmperror)
- bsr _C_LABEL(abort) /* NO RETURN */
+ bsr _libc_abort /* NO RETURN */
#endif
ld %r1,%r31,0 /* restore r1 from stack */
jmp.n %r1 /* this should not happen but we are prepared */
diff --git a/lib/libc/arch/mips64/gen/_setjmp.S b/lib/libc/arch/mips64/gen/_setjmp.S
index beabc9347d5..5797c97aac7 100644
--- a/lib/libc/arch/mips64/gen/_setjmp.S
+++ b/lib/libc/arch/mips64/gen/_setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: _setjmp.S,v 1.5 2016/05/08 21:50:58 guenther Exp $ */
+/* $OpenBSD: _setjmp.S,v 1.6 2016/05/23 00:18:57 guenther Exp $ */
/*
* Copyright (c) 2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -157,8 +157,6 @@ LEAF(_longjmp, FRAMESZ)
move v0, a1
botch:
- jal longjmperror
- nop
jal _libc_abort
nop
RESTORE_GP64
diff --git a/lib/libc/arch/mips64/gen/setjmp.S b/lib/libc/arch/mips64/gen/setjmp.S
index dbe02d7bcad..36f1128c74b 100644
--- a/lib/libc/arch/mips64/gen/setjmp.S
+++ b/lib/libc/arch/mips64/gen/setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: setjmp.S,v 1.9 2016/05/08 21:50:58 guenther Exp $ */
+/* $OpenBSD: setjmp.S,v 1.10 2016/05/23 00:18:57 guenther Exp $ */
/*
* Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -172,8 +172,6 @@ LEAF(longjmp, FRAMESZ)
move v0, a4
botch:
- jal longjmperror
- nop
jal _libc_abort
nop
RESTORE_GP64
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index b7a9d843be9..8a2fd384747 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.73 2016/03/30 06:38:41 jmc Exp $
+# $OpenBSD: Makefile.inc,v 1.74 2016/05/23 00:18:56 guenther Exp $
# gen sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/gen ${LIBCSRCDIR}/gen
@@ -18,7 +18,7 @@ SRCS+= alarm.c assert.c auth_subr.c authenticate.c \
nlist.c nftw.c opendir.c pause.c popen.c posix_spawn.c psignal.c \
pw_dup.c pwcache.c raise.c readdir.c readdir_r.c readpassphrase.c \
rewinddir.c scandir.c seekdir.c setdomainname.c sethostname.c \
- setprogname.c setjmperr.c setmode.c setproctitle.c shm_open.c \
+ setprogname.c setmode.c setproctitle.c shm_open.c \
siginterrupt.c siglist.c signal.c signame.c \
sigsetops.c sleep.c statvfs.c strtofflags.c sysconf.c \
syslog.c syslog_r.c telldir.c time.c times.c \
diff --git a/lib/libc/gen/setjmp.3 b/lib/libc/gen/setjmp.3
index e276617e200..966ddbef241 100644
--- a/lib/libc/gen/setjmp.3
+++ b/lib/libc/gen/setjmp.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: setjmp.3,v 1.24 2013/07/17 05:42:11 schwarze Exp $
+.\" $OpenBSD: setjmp.3,v 1.25 2016/05/23 00:18:56 guenther Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: July 17 2013 $
+.Dd $Mdocdate: May 23 2016 $
.Dt SETJMP 3
.Os
.Sh NAME
@@ -40,8 +40,7 @@
.Nm setjmp ,
.Nm longjmp ,
.Nm _setjmp ,
-.Nm _longjmp ,
-.Nm longjmperror
+.Nm _longjmp
.Nd non-local jumps
.Sh SYNOPSIS
.In setjmp.h
@@ -57,8 +56,6 @@
.Fn _setjmp "jmp_buf env"
.Ft void
.Fn _longjmp "jmp_buf env" "int val"
-.Ft void
-.Fn longjmperror void
.Sh DESCRIPTION
The
.Fn sigsetjmp ,
@@ -127,7 +124,7 @@ The
function pairs save and restore the signal mask while the
.Fn _setjmp Ns / Ns Fn _longjmp
function pairs save and restore only the register set and the stack (see
-.Xr sigmask 3 ) .
+.Xr sigprocmask 2 ) .
.Pp
The
.Fn sigsetjmp Ns / Ns Fn siglongjmp
@@ -157,30 +154,8 @@ is called with a zero-value
The
.Fn sigsetjmp Ns / Ns Fn siglongjmp
interfaces are preferred for maximum portability.
-.Sh ERRORS
-If the contents of the
-.Fa env
-are corrupted or correspond to an environment that has already returned,
-the
-.Fn longjmp
-routine calls the routine
-.Xr longjmperror 3 .
-If
-.Fn longjmperror
-returns, the program is aborted (see
-.Xr abort 3 ) .
-The default version of
-.Fn longjmperror
-prints the message
-.Dq Li longjmp botch
-to standard error and returns.
-User programs wishing to exit more gracefully should write their own
-versions of
-.Fn longjmperror .
.Sh SEE ALSO
-.Xr sigaction 2 ,
-.Xr sigaltstack 2 ,
-.Xr signal 3
+.Xr sigprocmask 2
.Sh STANDARDS
The
.Fn setjmp
diff --git a/lib/libc/gen/setjmperr.c b/lib/libc/gen/setjmperr.c
deleted file mode 100644
index 9a06cdc5f65..00000000000
--- a/lib/libc/gen/setjmperr.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $OpenBSD: setjmperr.c,v 1.5 2005/08/08 08:05:34 espie Exp $ */
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * This routine is called from longjmp() when an error occurs.
- * Programs that wish to exit gracefully from this error may
- * write their own versions.
- * If this routine returns, the program is aborted.
- */
-
-#include <setjmp.h>
-#include <unistd.h>
-
-void
-longjmperror(void)
-{
-#define ERRMSG "longjmp botch.\n"
- (void)write(STDERR_FILENO, ERRMSG, sizeof(ERRMSG) - 1);
-}