svn commit: r328631 - in head/lib/libc: i386/gen powerpc/gen powerpc64/gen

John Baldwin jhb at FreeBSD.org
Wed Jan 31 17:58:00 UTC 2018


Author: jhb
Date: Wed Jan 31 17:57:59 2018
New Revision: 328631
URL: https://svnweb.freebsd.org/changeset/base/328631

Log:
  Remove bogus checks against NCARGS.
  
  NCARGS isn't a limit on the number of arguments to pass to a function,
  but the number of bytes that can be consumed by arguments to exec.  As
  such, it is not suitable for a limit on the count of arguments passed
  to makecontext().
  
  Sponsored by:	DARPA / AFRL

Modified:
  head/lib/libc/i386/gen/makecontext.c
  head/lib/libc/powerpc/gen/makecontext.c
  head/lib/libc/powerpc64/gen/makecontext.c

Modified: head/lib/libc/i386/gen/makecontext.c
==============================================================================
--- head/lib/libc/i386/gen/makecontext.c	Wed Jan 31 17:56:36 2018	(r328630)
+++ head/lib/libc/i386/gen/makecontext.c	Wed Jan 31 17:57:59 2018	(r328631)
@@ -85,7 +85,7 @@ __makecontext(ucontext_t *ucp, void (*start)(void), in
 		ucp->uc_mcontext.mc_len = 0;
 	}
 	/* XXX - Do we want to sanity check argc? */
-	else if ((argc < 0) || (argc > NCARGS)) {
+	else if (argc < 0) {
 		ucp->uc_mcontext.mc_len = 0;
 	}
 	/* Make sure the context is valid. */

Modified: head/lib/libc/powerpc/gen/makecontext.c
==============================================================================
--- head/lib/libc/powerpc/gen/makecontext.c	Wed Jan 31 17:56:36 2018	(r328630)
+++ head/lib/libc/powerpc/gen/makecontext.c	Wed Jan 31 17:57:59 2018	(r328631)
@@ -66,7 +66,7 @@ __makecontext(ucontext_t *ucp, void (*start)(void), in
 	int i, regargs, stackargs;
 
 	/* Sanity checks */
-	if ((ucp == NULL) || (argc < 0) || (argc > NCARGS)
+	if ((ucp == NULL) || (argc < 0)
 	    || (ucp->uc_stack.ss_sp == NULL)
 	    || (ucp->uc_stack.ss_size < MINSIGSTKSZ)) {
 		/* invalidate context */

Modified: head/lib/libc/powerpc64/gen/makecontext.c
==============================================================================
--- head/lib/libc/powerpc64/gen/makecontext.c	Wed Jan 31 17:56:36 2018	(r328630)
+++ head/lib/libc/powerpc64/gen/makecontext.c	Wed Jan 31 17:57:59 2018	(r328631)
@@ -66,7 +66,7 @@ __makecontext(ucontext_t *ucp, void (*start)(void), in
 	int i, regargs, stackargs;
 
 	/* Sanity checks */
-	if ((ucp == NULL) || (argc < 0) || (argc > NCARGS)
+	if ((ucp == NULL) || (argc < 0)
 	    || (ucp->uc_stack.ss_sp == NULL)
 	    || (ucp->uc_stack.ss_size < MINSIGSTKSZ)) {
 		/* invalidate context */


More information about the svn-src-head mailing list