The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/imgact.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-3-Clause
    3  *
    4  * Copyright (c) 1993, David Greenman
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. Neither the name of the University nor the names of its contributors
   16  *    may be used to endorse or promote products derived from this software
   17  *    without specific prior written permission.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29  * SUCH DAMAGE.
   30  *
   31  * $FreeBSD: stable/12/sys/sys/imgact.h 345067 2019-03-12 16:33:44Z kib $
   32  */
   33 
   34 #ifndef _SYS_IMGACT_H_
   35 #define _SYS_IMGACT_H_
   36 
   37 #include <sys/_uio.h>
   38 
   39 #include <vm/vm.h>
   40 
   41 #define MAXSHELLCMDLEN  PAGE_SIZE
   42 
   43 struct ucred;
   44 
   45 struct image_args {
   46         char *buf;              /* pointer to string buffer */
   47         void *bufkva;           /* cookie for string buffer KVA */
   48         char *begin_argv;       /* beginning of argv in buf */
   49         char *begin_envv;       /* beginning of envv in buf */
   50         char *endp;             /* current `end' pointer of arg & env strings */
   51         char *fname;            /* pointer to filename of executable (system space) */
   52         char *fname_buf;        /* pointer to optional malloc(M_TEMP) buffer */
   53         int stringspace;        /* space left in arg & env buffer */
   54         int argc;               /* count of argument strings */
   55         int envc;               /* count of environment strings */
   56         int fd;                 /* file descriptor of the executable */
   57         struct filedesc *fdp;   /* new file descriptor table */
   58 };
   59 
   60 struct image_params {
   61         struct proc *proc;      /* our process struct */
   62         struct label *execlabel;        /* optional exec label */
   63         struct vnode *vp;       /* pointer to vnode of file to exec */
   64         struct vm_object *object;       /* The vm object for this vp */
   65         struct vattr *attr;     /* attributes of file */
   66         const char *image_header; /* head of file to exec */
   67         unsigned long entry_addr; /* entry address of target executable */
   68         unsigned long reloc_base; /* load address of image */
   69         char vmspace_destroyed; /* flag - we've blown away original vm space */
   70 #define IMGACT_SHELL    0x1
   71 #define IMGACT_BINMISC  0x2
   72         unsigned char interpreted;      /* mask of interpreters that have run */
   73         char opened;            /* flag - we have opened executable vnode */
   74         char *interpreter_name; /* name of the interpreter */
   75         void *auxargs;          /* ELF Auxinfo structure pointer */
   76         struct sf_buf *firstpage;       /* first page that we mapped */
   77         unsigned long ps_strings; /* PS_STRINGS for BSD/OS binaries */
   78         struct image_args *args;        /* system call arguments */
   79         struct sysentvec *sysent;       /* system entry vector */
   80         char *execpath;
   81         unsigned long execpathp;
   82         char *freepath;
   83         unsigned long canary;
   84         int canarylen;
   85         unsigned long pagesizes;
   86         int pagesizeslen;
   87         vm_prot_t stack_prot;
   88         u_long stack_sz;
   89         struct ucred *newcred;          /* new credentials if changing */
   90         bool credential_setid;          /* true if becoming setid */
   91         u_int map_flags;
   92 };
   93 
   94 #ifdef _KERNEL
   95 struct sysentvec;
   96 struct thread;
   97 struct vmspace;
   98 
   99 int     exec_alloc_args(struct image_args *);
  100 int     exec_check_permissions(struct image_params *);
  101 register_t *exec_copyout_strings(struct image_params *);
  102 void    exec_free_args(struct image_args *);
  103 int     exec_new_vmspace(struct image_params *, struct sysentvec *);
  104 void    exec_setregs(struct thread *, struct image_params *, u_long);
  105 int     exec_shell_imgact(struct image_params *);
  106 int     exec_copyin_args(struct image_args *, char *, enum uio_seg,
  107         char **, char **);
  108 int     exec_copyin_data_fds(struct thread *, struct image_args *, const void *,
  109         size_t, const int *, size_t);
  110 int     pre_execve(struct thread *td, struct vmspace **oldvmspace);
  111 void    post_execve(struct thread *td, int error, struct vmspace *oldvmspace);
  112 #endif
  113 
  114 #endif /* !_SYS_IMGACT_H_ */

Cache object: ae0bed91f874330947382c58ecd0984c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.