Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2001 20:31:06 -0500
From:      John De Boskey <jwd@bsdwins.com>
To:        Arch List <freebsd-arch@FreeBSD.ORG>
Subject:   Re: Comments on kern/32106 (MAXSHELLCMDLEN increase)
Message-ID:  <20011126203106.A450@bsdwins.com>
In-Reply-To: <20011125183344.A1257@FreeBSD.org>; from jwd@FreeBSD.ORG on Sun, Nov 25, 2001 at 06:33:45PM -0800
References:  <20011125183344.A1257@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

3 small patches can be found at:

http://people.freebsd.org/~jwd/execve/execve.patch

and are included below. Please let me know if you see
any major problems.

-John


Index: sys/sys/imgact.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/imgact.h,v
retrieving revision 1.24
diff -u -r1.24 imgact.h
--- sys/sys/imgact.h	26 Sep 2000 05:09:15 -0000	1.24
+++ sys/sys/imgact.h	27 Nov 2001 01:16:43 -0000
@@ -36,7 +36,7 @@
 #ifndef _SYS_IMGACT_H_
 #define	_SYS_IMGACT_H_
 
-#define MAXSHELLCMDLEN	64
+#define MAXSHELLCMDLEN	128
 
 struct image_params {
 	struct proc *proc;	/* our process struct */
Index: sys/kern/imgact_shell.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/imgact_shell.c,v
retrieving revision 1.22
diff -u -r1.22 imgact_shell.c
--- sys/kern/imgact_shell.c	26 Apr 2000 20:58:39 -0000	1.22
+++ sys/kern/imgact_shell.c	26 Nov 2001 23:52:46 -0000
@@ -74,7 +74,7 @@
 	 */
 	for (ihp = &image_header[2]; *ihp != '\n' && *ihp != '#'; ++ihp) {
 		if (ihp >= &image_header[MAXSHELLCMDLEN])
-			return(ENOEXEC);
+			return(ENAMETOOLONG);
 	}
 	line_endp = ihp;
 
Index: lib/libc/sys/execve.2
===================================================================
RCS file: /home/ncvs/src/lib/libc/sys/execve.2,v
retrieving revision 1.29
diff -u -r1.29 execve.2
--- lib/libc/sys/execve.2	26 Oct 2001 17:38:20 -0000	1.29
+++ lib/libc/sys/execve.2	27 Nov 2001 00:17:22 -0000
@@ -210,6 +210,9 @@
 .It Bq Er ENAMETOOLONG
 A component of a pathname exceeded 255 characters,
 or an entire path name exceeded 1023 characters.
+.It Bq Er ENAMETOOLONG
+When invoking an interpreted script, the interpreter name
+exceeds MAXSHELLCMDLEN characters.
 .It Bq Er ENOENT
 The new process file does not exist.
 .It Bq Er ELOOP


----- John W. De Boskey's Original Message -----
> http://www.FreeBSD.org/cgi/query-pr.cgi?pr=kern/32106
> 
> This pr seems particulary straight forward. However, I believe
> the real problem lies in libc/gen/exec.c and it's handling
> of the ENOEXEC errno being returned from exec_shell_imgact().
> ENOEXEC as a return code appears to be overloaded.
> 
> A quick review of the code leads me to believe that
> exec_shell_imgact() could/should return E2BIG which
> is handled correctly in execvp() by dropping through
> to the done label and returning -1 (ie: the interpreter
> path is too big).
> 
> As to the pr submitters original request, I do not see
> any earth shattering reasons why MAXSHELLCMDLEN can't
> be increased (if only to 128 and not 512).
> 
> Comments?
> 
> -john
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-arch" in the body of the message

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011126203106.A450>