jcs's openbsd hax
openbsd

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@

guenther fbe95b35 9b021daa

+23 -108
+1 -2
include/setjmp.h
··· 1 - /* $OpenBSD: setjmp.h,v 1.6 2012/09/26 00:09:48 brad Exp $ */ 1 + /* $OpenBSD: setjmp.h,v 1.7 2016/05/23 00:18:56 guenther Exp $ */ 2 2 /* $NetBSD: setjmp.h,v 1.11 1994/12/20 10:35:44 cgd Exp $ */ 3 3 4 4 /*- ··· 61 61 #if __BSD_VISIBLE || __XPG_VISIBLE 62 62 __returns_twice int _setjmp(jmp_buf); 63 63 __dead void _longjmp(jmp_buf, int); 64 - void longjmperror(void); 65 64 #endif /* __BSD_VISIBLE || __XPG_VISIBLE */ 66 65 __END_DECLS 67 66
-1
lib/libc/Symbols.list
··· 676 676 login_getclass 677 677 login_getstyle 678 678 longjmp 679 - longjmperror 680 679 modf 681 680 nftw 682 681 nice
+2 -3
lib/libc/arch/arm/gen/_setjmp.S
··· 1 - /* $OpenBSD: _setjmp.S,v 1.2 2004/02/01 05:40:52 drahn Exp $ */ 1 + /* $OpenBSD: _setjmp.S,v 1.3 2016/05/23 00:18:57 guenther Exp $ */ 2 2 /* $NetBSD: _setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */ 3 3 4 4 /* ··· 101 101 102 102 /* validation failed, die die die. */ 103 103 botch: 104 - bl PIC_SYM(_C_LABEL(longjmperror), PLT) 105 - bl PIC_SYM(_C_LABEL(abort), PLT) 104 + bl PIC_SYM(_libc_abort, PLT) 106 105 b . - 8 /* Cannot get here */
+2 -3
lib/libc/arch/arm/gen/setjmp.S
··· 1 - /* $OpenBSD: setjmp.S,v 1.3 2015/09/13 07:36:58 guenther Exp $ */ 1 + /* $OpenBSD: setjmp.S,v 1.4 2016/05/23 00:18:57 guenther Exp $ */ 2 2 /* $NetBSD: setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */ 3 3 4 4 /* ··· 130 130 131 131 /* validation failed, die die die. */ 132 132 botch: 133 - bl PIC_SYM(_C_LABEL(longjmperror), PLT) 134 - bl PIC_SYM(_C_LABEL(abort), PLT) 133 + bl PIC_SYM(_libc_abort, PLT) 135 134 b . - 8 /* Cannot get here */
+3 -5
lib/libc/arch/m88k/gen/_setjmp.S
··· 1 - /* $OpenBSD: _setjmp.S,v 1.12 2013/01/20 17:59:52 miod Exp $ */ 1 + /* $OpenBSD: _setjmp.S,v 1.13 2016/05/23 00:18:57 guenther Exp $ */ 2 2 /*- 3 3 * Copyright (c) 2002 Steve Murphree, Jr. 4 4 * All rights reserved. ··· 116 116 2: subu %r31,%r31,16 /* get a temporary stack */ 117 117 st %r1,%r31,0 /* save r1 on stack (return address) */ 118 118 #ifdef __PIC__ 119 - bsr _C_LABEL(longjmperror)#plt 120 - bsr _C_LABEL(abort)#plt /* NO RETURN */ 119 + bsr _libc_abort#plt /* NO RETURN */ 121 120 #else 122 - bsr _C_LABEL(longjmperror) 123 - bsr _C_LABEL(abort) /* NO RETURN */ 121 + bsr _libc_abort /* NO RETURN */ 124 122 #endif 125 123 ld %r1,%r31,0 /* restore r1 from stack */ 126 124 jmp.n %r1 /* this should not happen but we are prepared */
+3 -5
lib/libc/arch/m88k/gen/setjmp.S
··· 1 - /* $OpenBSD: setjmp.S,v 1.14 2015/09/13 07:36:58 guenther Exp $ */ 1 + /* $OpenBSD: setjmp.S,v 1.15 2016/05/23 00:18:57 guenther Exp $ */ 2 2 /*- 3 3 * Copyright (c) 2002 Steve Murphree, Jr. 4 4 * All rights reserved. ··· 136 136 2: subu %r31,%r31,16 /* get a temporary stack */ 137 137 st %r1,%r31,0 /* save r1 on stack (return address) */ 138 138 #ifdef __PIC__ 139 - bsr _C_LABEL(longjmperror)#plt 140 - bsr _C_LABEL(abort)#plt /* NO RETURN */ 139 + bsr _libc_abort#plt /* NO RETURN */ 141 140 #else 142 - bsr _C_LABEL(longjmperror) 143 - bsr _C_LABEL(abort) /* NO RETURN */ 141 + bsr _libc_abort /* NO RETURN */ 144 142 #endif 145 143 ld %r1,%r31,0 /* restore r1 from stack */ 146 144 jmp.n %r1 /* this should not happen but we are prepared */
+3 -5
lib/libc/arch/m88k/gen/sigsetjmp.S
··· 1 - /* $OpenBSD: sigsetjmp.S,v 1.15 2015/09/13 07:36:58 guenther Exp $ */ 1 + /* $OpenBSD: sigsetjmp.S,v 1.16 2016/05/23 00:18:57 guenther Exp $ */ 2 2 /*- 3 3 * Copyright (c) 2002 Steve Murphree, Jr. 4 4 * All rights reserved. ··· 145 145 2: subu %r31,%r31,16 /* get a temporary stack */ 146 146 st %r1,%r31,0 /* save r1 on stack (return address) */ 147 147 #ifdef __PIC__ 148 - bsr _C_LABEL(longjmperror)#plt 149 - bsr _C_LABEL(abort)#plt /* NO RETURN */ 148 + bsr _libc_abort#plt /* NO RETURN */ 150 149 #else 151 - bsr _C_LABEL(longjmperror) 152 - bsr _C_LABEL(abort) /* NO RETURN */ 150 + bsr _libc_abort /* NO RETURN */ 153 151 #endif 154 152 ld %r1,%r31,0 /* restore r1 from stack */ 155 153 jmp.n %r1 /* this should not happen but we are prepared */
+1 -3
lib/libc/arch/mips64/gen/_setjmp.S
··· 1 - /* $OpenBSD: _setjmp.S,v 1.5 2016/05/08 21:50:58 guenther Exp $ */ 1 + /* $OpenBSD: _setjmp.S,v 1.6 2016/05/23 00:18:57 guenther Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 2002 Opsycon AB (www.opsycon.se / www.opsycon.com) ··· 157 157 move v0, a1 158 158 159 159 botch: 160 - jal longjmperror 161 - nop 162 160 jal _libc_abort 163 161 nop 164 162 RESTORE_GP64
+1 -3
lib/libc/arch/mips64/gen/setjmp.S
··· 1 - /* $OpenBSD: setjmp.S,v 1.9 2016/05/08 21:50:58 guenther Exp $ */ 1 + /* $OpenBSD: setjmp.S,v 1.10 2016/05/23 00:18:57 guenther Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com) ··· 172 172 move v0, a4 173 173 174 174 botch: 175 - jal longjmperror 176 - nop 177 175 jal _libc_abort 178 176 nop 179 177 RESTORE_GP64
+2 -2
lib/libc/gen/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.73 2016/03/30 06:38:41 jmc Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.74 2016/05/23 00:18:56 guenther Exp $ 2 2 3 3 # gen sources 4 4 .PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/gen ${LIBCSRCDIR}/gen ··· 18 18 nlist.c nftw.c opendir.c pause.c popen.c posix_spawn.c psignal.c \ 19 19 pw_dup.c pwcache.c raise.c readdir.c readdir_r.c readpassphrase.c \ 20 20 rewinddir.c scandir.c seekdir.c setdomainname.c sethostname.c \ 21 - setprogname.c setjmperr.c setmode.c setproctitle.c shm_open.c \ 21 + setprogname.c setmode.c setproctitle.c shm_open.c \ 22 22 siginterrupt.c siglist.c signal.c signame.c \ 23 23 sigsetops.c sleep.c statvfs.c strtofflags.c sysconf.c \ 24 24 syslog.c syslog_r.c telldir.c time.c times.c \
+5 -30
lib/libc/gen/setjmp.3
··· 1 - .\" $OpenBSD: setjmp.3,v 1.24 2013/07/17 05:42:11 schwarze Exp $ 1 + .\" $OpenBSD: setjmp.3,v 1.25 2016/05/23 00:18:56 guenther Exp $ 2 2 .\" 3 3 .\" Copyright (c) 1990, 1991, 1993 4 4 .\" The Regents of the University of California. All rights reserved. ··· 31 31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 32 .\" SUCH DAMAGE. 33 33 .\" 34 - .Dd $Mdocdate: July 17 2013 $ 34 + .Dd $Mdocdate: May 23 2016 $ 35 35 .Dt SETJMP 3 36 36 .Os 37 37 .Sh NAME ··· 40 40 .Nm setjmp , 41 41 .Nm longjmp , 42 42 .Nm _setjmp , 43 - .Nm _longjmp , 44 - .Nm longjmperror 43 + .Nm _longjmp 45 44 .Nd non-local jumps 46 45 .Sh SYNOPSIS 47 46 .In setjmp.h ··· 57 56 .Fn _setjmp "jmp_buf env" 58 57 .Ft void 59 58 .Fn _longjmp "jmp_buf env" "int val" 60 - .Ft void 61 - .Fn longjmperror void 62 59 .Sh DESCRIPTION 63 60 The 64 61 .Fn sigsetjmp , ··· 127 124 function pairs save and restore the signal mask while the 128 125 .Fn _setjmp Ns / Ns Fn _longjmp 129 126 function pairs save and restore only the register set and the stack (see 130 - .Xr sigmask 3 ) . 127 + .Xr sigprocmask 2 ) . 131 128 .Pp 132 129 The 133 130 .Fn sigsetjmp Ns / Ns Fn siglongjmp ··· 157 154 The 158 155 .Fn sigsetjmp Ns / Ns Fn siglongjmp 159 156 interfaces are preferred for maximum portability. 160 - .Sh ERRORS 161 - If the contents of the 162 - .Fa env 163 - are corrupted or correspond to an environment that has already returned, 164 - the 165 - .Fn longjmp 166 - routine calls the routine 167 - .Xr longjmperror 3 . 168 - If 169 - .Fn longjmperror 170 - returns, the program is aborted (see 171 - .Xr abort 3 ) . 172 - The default version of 173 - .Fn longjmperror 174 - prints the message 175 - .Dq Li longjmp botch 176 - to standard error and returns. 177 - User programs wishing to exit more gracefully should write their own 178 - versions of 179 - .Fn longjmperror . 180 157 .Sh SEE ALSO 181 - .Xr sigaction 2 , 182 - .Xr sigaltstack 2 , 183 - .Xr signal 3 158 + .Xr sigprocmask 2 184 159 .Sh STANDARDS 185 160 The 186 161 .Fn setjmp
-46
lib/libc/gen/setjmperr.c
··· 1 - /* $OpenBSD: setjmperr.c,v 1.5 2005/08/08 08:05:34 espie Exp $ */ 2 - /* 3 - * Copyright (c) 1980, 1993 4 - * The Regents of the University of California. All rights reserved. 5 - * 6 - * Redistribution and use in source and binary forms, with or without 7 - * modification, are permitted provided that the following conditions 8 - * are met: 9 - * 1. Redistributions of source code must retain the above copyright 10 - * notice, this list of conditions and the following disclaimer. 11 - * 2. Redistributions in binary form must reproduce the above copyright 12 - * notice, this list of conditions and the following disclaimer in the 13 - * documentation and/or other materials provided with the distribution. 14 - * 3. Neither the name of the University nor the names of its contributors 15 - * may be used to endorse or promote products derived from this software 16 - * without specific prior written permission. 17 - * 18 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 - * SUCH DAMAGE. 29 - */ 30 - 31 - /* 32 - * This routine is called from longjmp() when an error occurs. 33 - * Programs that wish to exit gracefully from this error may 34 - * write their own versions. 35 - * If this routine returns, the program is aborted. 36 - */ 37 - 38 - #include <setjmp.h> 39 - #include <unistd.h> 40 - 41 - void 42 - longjmperror(void) 43 - { 44 - #define ERRMSG "longjmp botch.\n" 45 - (void)write(STDERR_FILENO, ERRMSG, sizeof(ERRMSG) - 1); 46 - }