[BACK]Return to kern_exec.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / kern

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/kern/kern_exec.c between version 1.280 and 1.280.4.4

version 1.280, 2008/10/21 20:52:11 version 1.280.4.4, 2015/11/07 20:43:23
Line 236  const struct emul emul_netbsd = {
Line 236  const struct emul emul_netbsd = {
         startlwp,          startlwp,
 };  };
   
 #ifdef LKM  
 /*  /*
  * Exec lock. Used to control access to execsw[] structures.   * Exec lock. Used to control access to execsw[] structures.
  * This must not be static so that netbsd32 can access it, too.   * This must not be static so that netbsd32 can access it, too.
  */   */
 krwlock_t exec_lock;  krwlock_t exec_lock;
   
   #ifdef LKM
 static void link_es(struct execsw_entry **, const struct execsw *);  static void link_es(struct execsw_entry **, const struct execsw *);
 #endif /* LKM */  #endif /* LKM */
   
Line 498  execve1(struct lwp *l, const char *path,
Line 498  execve1(struct lwp *l, const char *path,
         ksiginfoq_t             kq;          ksiginfoq_t             kq;
         char                    *pathbuf;          char                    *pathbuf;
         size_t                  pathbuflen;          size_t                  pathbuflen;
           uid_t                   uid;
   
         p = l->l_proc;          p = l->l_proc;
   
Line 517  execve1(struct lwp *l, const char *path,
Line 518  execve1(struct lwp *l, const char *path,
          * to call exec in order to do something useful.           * to call exec in order to do something useful.
          */           */
   
         if ((p->p_flag & PK_SUGID) &&          if ((p->p_flag & PK_SUGID) && (uid = kauth_cred_getuid(l->l_cred)) != 0
             chgproccnt(kauth_cred_getuid(l->l_cred), 0) >              && chgproccnt(uid, 0) > p->p_rlimit[RLIMIT_NPROC].rlim_cur)
             p->p_rlimit[RLIMIT_NPROC].rlim_cur)  
                 return EAGAIN;                  return EAGAIN;
   
         oldlwpflags = l->l_flag & (LW_SA | LW_SA_UPCALL);          oldlwpflags = l->l_flag & (LW_SA | LW_SA_UPCALL);
Line 572  execve1(struct lwp *l, const char *path,
Line 572  execve1(struct lwp *l, const char *path,
         pack.ep_esch = NULL;          pack.ep_esch = NULL;
         pack.ep_pax_flags = 0;          pack.ep_pax_flags = 0;
   
 #ifdef LKM  
         rw_enter(&exec_lock, RW_READER);          rw_enter(&exec_lock, RW_READER);
 #endif  
   
         /* see if we can run it. */          /* see if we can run it. */
         if ((error = check_exec(l, &pack)) != 0) {          if ((error = check_exec(l, &pack)) != 0) {
Line 755  execve1(struct lwp *l, const char *path,
Line 753  execve1(struct lwp *l, const char *path,
         vm->vm_daddr = (void*)pack.ep_daddr;          vm->vm_daddr = (void*)pack.ep_daddr;
         vm->vm_dsize = btoc(pack.ep_dsize);          vm->vm_dsize = btoc(pack.ep_dsize);
         vm->vm_ssize = btoc(pack.ep_ssize);          vm->vm_ssize = btoc(pack.ep_ssize);
           vm->vm_issize = 0;
         vm->vm_maxsaddr = (void *)pack.ep_maxsaddr;          vm->vm_maxsaddr = (void *)pack.ep_maxsaddr;
         vm->vm_minsaddr = (void *)pack.ep_minsaddr;          vm->vm_minsaddr = (void *)pack.ep_minsaddr;
   
Line 1091  execve1(struct lwp *l, const char *path,
Line 1090  execve1(struct lwp *l, const char *path,
   
         /* Allow new references from the debugger/procfs. */          /* Allow new references from the debugger/procfs. */
         rw_exit(&p->p_reflock);          rw_exit(&p->p_reflock);
 #ifdef LKM  
         rw_exit(&exec_lock);          rw_exit(&exec_lock);
 #endif  
   
         mutex_enter(proc_lock);          mutex_enter(proc_lock);
   
Line 1107  execve1(struct lwp *l, const char *path,
Line 1104  execve1(struct lwp *l, const char *path,
         if (p->p_sflag & PS_STOPEXEC) {          if (p->p_sflag & PS_STOPEXEC) {
                 KERNEL_UNLOCK_ALL(l, &l->l_biglocks);                  KERNEL_UNLOCK_ALL(l, &l->l_biglocks);
                 p->p_pptr->p_nstopchild++;                  p->p_pptr->p_nstopchild++;
                 p->p_pptr->p_waited = 0;                  p->p_waited = 0;
                 mutex_enter(p->p_lock);                  mutex_enter(p->p_lock);
                 ksiginfo_queue_init(&kq);                  ksiginfo_queue_init(&kq);
                 sigclearall(p, &contsigmask, &kq);                  sigclearall(p, &contsigmask, &kq);
Line 1149  execve1(struct lwp *l, const char *path,
Line 1146  execve1(struct lwp *l, const char *path,
         if (pack.ep_interp != NULL)          if (pack.ep_interp != NULL)
                 vrele(pack.ep_interp);                  vrele(pack.ep_interp);
   
 #ifdef LKM  
         rw_exit(&exec_lock);          rw_exit(&exec_lock);
 #endif  
   
  clrflg:   clrflg:
         lwp_lock(l);          lwp_lock(l);
Line 1165  execve1(struct lwp *l, const char *path,
Line 1160  execve1(struct lwp *l, const char *path,
  exec_abort:   exec_abort:
         PNBUF_PUT(pathbuf);          PNBUF_PUT(pathbuf);
         rw_exit(&p->p_reflock);          rw_exit(&p->p_reflock);
 #ifdef LKM  
         rw_exit(&exec_lock);          rw_exit(&exec_lock);
 #endif  
   
         /*          /*
          * the old process doesn't exist anymore.  exit gracefully.           * the old process doesn't exist anymore.  exit gracefully.
Line 1577  exec_init(int init_boot)
Line 1570  exec_init(int init_boot)
         nexecs = nexecs_builtin;          nexecs = nexecs_builtin;
         execsw = kmem_alloc(nexecs * sizeof(struct execsw *), KM_SLEEP);          execsw = kmem_alloc(nexecs * sizeof(struct execsw *), KM_SLEEP);
   
           rw_init(&exec_lock);
         pool_init(&exec_pool, NCARGS, 0, 0, PR_NOALIGN|PR_NOTOUCH,          pool_init(&exec_pool, NCARGS, 0, 0, PR_NOALIGN|PR_NOTOUCH,
             "execargs", &exec_palloc, IPL_NONE);              "execargs", &exec_palloc, IPL_NONE);
         pool_sethardlimit(&exec_pool, maxexec, "should not happen", 0);          pool_sethardlimit(&exec_pool, maxexec, "should not happen", 0);

Legend:
Removed from v.1.280  
changed lines
  Added in v.1.280.4.4

CVSweb <webmaster@jp.NetBSD.org>