Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc Mark exect(3) obsolete and bind it to plain execve(...



details:   https://anonhg.NetBSD.org/src/rev/cb65786ef6a5
branches:  trunk
changeset: 821472:cb65786ef6a5
user:      kamil <kamil%NetBSD.org@localhost>
date:      Tue Feb 07 19:29:39 2017 +0000

description:
Mark exect(3) obsolete and bind it to plain execve(2) on all platforms

The original exect(2) from BSD4.2 was enabling bit for tracing
(single-step mode) and calling execve(2). The purpose of it was to generate
a signal for a tracer once the application will change its image to a new
program.

This approach no longer works as:
 - exect(2) traces (single-steps) libc and it requires hundreds or
   thousands steps before entering a new image
 - it's vax and x86 specific code
 - this functionality has been moved to the kernel - once a process is
   traced it will generate SIGTRAP with si_code TRAP_EXEC and route it to
   its debugger
 - the side effects and unportability make this interface unusable
 - there are no known users of this interface
 - it apparently never worked better since day0 of NetBSD ("day0 bug")

Users are requested to move to other execve(2) variants. Calling current
execve(2) as it is the most similar behavior to this one from BSD4.2.

Discussed several times on mailing lists and in PR/51700.

Add warning to exect(3) telling about marking this function obsolete.

This function is prepared to be removed in next libc major bump.

Sponsored by <The NetBSD Foundation>

diffstat:

 lib/libc/arch/aarch64/sys/exect.S   |  36 -------------------------
 lib/libc/arch/alpha/sys/exect.S     |  35 ------------------------
 lib/libc/arch/arm/sys/exect.S       |  36 -------------------------
 lib/libc/arch/hppa/sys/exect.S      |  40 ----------------------------
 lib/libc/arch/i386/sys/exect.S      |  51 ------------------------------------
 lib/libc/arch/ia64/sys/exect.S      |  12 --------
 lib/libc/arch/m68k/sys/exect.S      |  50 -----------------------------------
 lib/libc/arch/mips/sys/exect.S      |  52 -------------------------------------
 lib/libc/arch/or1k/sys/exect.S      |   5 ---
 lib/libc/arch/powerpc/sys/exect.S   |   5 ---
 lib/libc/arch/powerpc64/sys/exect.S |   5 ---
 lib/libc/arch/riscv/sys/exect.S     |   9 ------
 lib/libc/arch/sh3/sys/exect.S       |  44 -------------------------------
 lib/libc/arch/sparc/sys/exect.S     |  52 -------------------------------------
 lib/libc/arch/sparc64/sys/exect.S   |  52 -------------------------------------
 lib/libc/arch/vax/sys/exect.S       |  42 -----------------------------
 lib/libc/arch/x86_64/sys/exect.S    |  51 ------------------------------------
 lib/libc/gen/Makefile.inc           |   4 +-
 lib/libc/gen/exect.c                |  43 ++++++++++++++++++++++++++++++
 lib/libc/sys/Lint_exect.c           |  18 ------------
 lib/libc/sys/Makefile.inc           |   6 ++--
 21 files changed, 48 insertions(+), 600 deletions(-)

diffs (truncated from 757 to 300 lines):

diff -r 692ac07db0f8 -r cb65786ef6a5 lib/libc/arch/aarch64/sys/exect.S
--- a/lib/libc/arch/aarch64/sys/exect.S Tue Feb 07 16:49:40 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/* $NetBSD: exect.S,v 1.1 2014/08/10 05:47:37 matt Exp $       */
-
-/*-
- * Copyright (c) 1990 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.
- *
- *     from: @(#)exect.s       5.1 (Berkeley) 4/23/90
- */
-
-#include "SYS.h"
-
-PSEUDO(exect,execve)
diff -r 692ac07db0f8 -r cb65786ef6a5 lib/libc/arch/alpha/sys/exect.S
--- a/lib/libc/arch/alpha/sys/exect.S   Tue Feb 07 16:49:40 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/* $NetBSD: exect.S,v 1.3 2000/06/14 06:49:03 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- * 
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- * 
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
- * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- * 
- * Carnegie Mellon requests users of this software to return to
- *
- *  Software Distribution Coordinator  or  Software.Distribution%CS.CMU.EDU@localhost
- *  School of Computer Science
- *  Carnegie Mellon University
- *  Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include "SYS.h"
-
-LEAF(exect, 3)
-       CALLSYS_ERROR(execve)
-       RET
-END(exect)
diff -r 692ac07db0f8 -r cb65786ef6a5 lib/libc/arch/arm/sys/exect.S
--- a/lib/libc/arch/arm/sys/exect.S     Tue Feb 07 16:49:40 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*     $NetBSD: exect.S,v 1.4 2003/08/07 16:42:04 agc Exp $    */
-
-/*-
- * Copyright (c) 1990 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.
- *
- *     from: @(#)exect.s       5.1 (Berkeley) 4/23/90
- */
-
-#include "SYS.h"
-
-PSEUDO(exect,execve)
diff -r 692ac07db0f8 -r cb65786ef6a5 lib/libc/arch/hppa/sys/exect.S
--- a/lib/libc/arch/hppa/sys/exect.S    Tue Feb 07 16:49:40 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*     $NetBSD: exect.S,v 1.2 2009/11/03 05:07:25 snj Exp $    */
-
-/*     $OpenBSD: exect.S,v 1.5 2001/03/29 01:43:52 mickey Exp $        */
-
-/*
- * Copyright (c) 1999 Michael Shalayeff
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR OR HIS RELATIVES 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 MIND, 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.
- */
-
-#include "SYS.h"
-
-#if defined(LIBC_SCCS) && !defined(lint)
-       RCSID("$NetBSD: exect.S,v 1.2 2009/11/03 05:07:25 snj Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-/* we do no tracing yet */
-PSEUDO(exect,execve)
-
-       .end
diff -r 692ac07db0f8 -r cb65786ef6a5 lib/libc/arch/i386/sys/exect.S
--- a/lib/libc/arch/i386/sys/exect.S    Tue Feb 07 16:49:40 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*     $NetBSD: exect.S,v 1.15 2014/05/23 02:34:19 uebayasi Exp $      */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- *
- *     from: @(#)exect.s       5.1 (Berkeley) 4/23/90
- */
-
-#include <machine/asm.h>
-#if defined(SYSLIBC_SCCS) && !defined(lint)
-       RCSID("$NetBSD: exect.S,v 1.15 2014/05/23 02:34:19 uebayasi Exp $")
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-#include <machine/psl.h>
-
-ENTRY(exect)
-       pushfl
-       orb     $(PSL_T>>8),1(%esp)
-       popfl
-       SYSTRAP(execve)
-       jmp     CERROR
-END(exect)
diff -r 692ac07db0f8 -r cb65786ef6a5 lib/libc/arch/ia64/sys/exect.S
--- a/lib/libc/arch/ia64/sys/exect.S    Tue Feb 07 16:49:40 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-/* $NetBSD: exect.S,v 1.2 2016/12/10 21:19:15 scole Exp $ */
-       
-/* XXX:         Stub */
-
-#include <machine/asm.h>
-
-#include "SYS.h"
-
-ENTRY(exect, 3)
-       // XXX break into debugger in ski
-       break.i 1
-END(exect)     
diff -r 692ac07db0f8 -r cb65786ef6a5 lib/libc/arch/m68k/sys/exect.S
--- a/lib/libc/arch/m68k/sys/exect.S    Tue Feb 07 16:49:40 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*     $NetBSD: exect.S,v 1.8 2013/07/16 22:20:35 matt Exp $   */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * 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.
- */
-
-#include "SYS.h"
-#include <machine/psl.h>
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-       RCSID("from: @(#)exect.s        5.1 (Berkeley) 5/12/90")
-#else
-       RCSID("$NetBSD: exect.S,v 1.8 2013/07/16 22:20:35 matt Exp $")
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-ENTRY(exect)
-       SYSTRAP(execve)
-       jbra    CERROR          /* exect(file, argv, env) */
-END(exect)
diff -r 692ac07db0f8 -r cb65786ef6a5 lib/libc/arch/mips/sys/exect.S
--- a/lib/libc/arch/mips/sys/exect.S    Tue Feb 07 16:49:40 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*     $NetBSD: exect.S,v 1.10 2009/12/14 01:07:42 matt Exp $  */
-/*-
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *



Home | Main Index | Thread Index | Old Index