Source-Changes archive

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

Re: CVS commit: src/sys



On Dec 26,  9:00pm, yamt%mwd.biglobe.ne.jp@localhost (YAMAMOTO Takashi) wrote:
-- Subject: Re: CVS commit: src/sys

| > Module Name:        src
| > Committed By:       christos
| > Date:               Mon Dec  3 02:06:59 UTC 2007
| > 
| > Modified Files:
| >     src/sys/kern: exec_conf.c exec_elf32.c kern_exec.c vfs_getcwd.c
| >     src/sys/sys: exec.h exec_elf.h filedesc.h
| > 
| > Log Message:
| > - add an elf aux vector entry for implementing $ORIGIN.
| > - the code to convert from a vnode to a path is commented out now until
| >   a better solution is implemented. Only absolute paths work for now
| >   (which is most of the cases).
| > 
| > requested by core
| > 
| > 
| > To generate a diff of this commit:
| > cvs rdiff -r1.93 -r1.94 src/sys/kern/exec_conf.c
| > cvs rdiff -r1.126 -r1.127 src/sys/kern/exec_elf32.c
| > cvs rdiff -r1.254 -r1.255 src/sys/kern/kern_exec.c
| > cvs rdiff -r1.38 -r1.39 src/sys/kern/vfs_getcwd.c
| > cvs rdiff -r1.117 -r1.118 src/sys/sys/exec.h
| > cvs rdiff -r1.91 -r1.92 src/sys/sys/exec_elf.h
| > cvs rdiff -r1.42 -r1.43 src/sys/sys/filedesc.h
| > 
| > Please note that diffs are not public domain; they are subject to the
| > copyright notices on the relevant files.
| 
| can you avoid the MAXPATHLEN-sized buffer on kernel stack?

You mean this one? I did not put it there; it was there before for systrace.

christos

Index: kern_exec.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_exec.c,v
retrieving revision 1.258
diff -u -u -r1.258 kern_exec.c
--- kern_exec.c 20 Dec 2007 23:03:08 -0000      1.258
+++ kern_exec.c 26 Dec 2007 15:41:27 -0000
@@ -431,7 +434,7 @@
        struct exec_vmcmd       *base_vcp;
        ksiginfo_t              ksi;
        ksiginfoq_t             kq;
-       char                    pathbuf[MAXPATHLEN];
+       char                    *pathbuf;
        size_t                  pathbuflen;
 #ifdef SYSTRACE
        int                     wassugid = ISSET(p->p_flag, PK_SUGID);
@@ -460,7 +463,8 @@
                systrace_execve0(p);
 #endif
 
-       error = copyinstr(path, pathbuf, sizeof(pathbuf), &pathbuflen);
+       pathbuf = PNBUF_GET();
+       error = copyinstr(path, pathbuf, MAXPATHLEN, &pathbuflen);
        if (error) {
                DPRINTF(("execve: copyinstr path %d", error));
                goto clrflg;
@@ -495,7 +499,8 @@
 
        /* see if we can run it. */
        if ((error = check_exec(l, &pack)) != 0) {
-               DPRINTF(("execve: check exec failed %d\n", error));
+               if (error != ENOENT)
+                       DPRINTF(("execve: check exec failed %d\n", error));
                goto freehdr;
        }
 
@@ -1027,6 +1036,7 @@
                systrace_execve1(pathbuf, p);
 #endif /* SYSTRACE */
 
+       PNBUF_PUT(pathbuf);
        return (EJUSTRETURN);
 
  bad:
@@ -1052,6 +1062,7 @@
                vrele(pack.ep_interp);
 
  clrflg:
+       PNBUF_PUT(pathbuf);
        rw_exit(&p->p_reflock);
 #ifdef LKM
        rw_exit(&exec_lock);
@@ -1060,6 +1071,7 @@
        return error;
 
  exec_abort:
+       PNBUF_PUT(pathbuf);
        rw_exit(&p->p_reflock);
 #ifdef LKM
        rw_exit(&exec_lock);



Home | Main Index | Thread Index | Old Index