Date: Wed, 31 Jan 2018 17:58:00 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328631 - in head/lib/libc: i386/gen powerpc/gen powerpc64/gen Message-ID: <201801311758.w0VHw0NT035135@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801311758.w0VHw0NT035135>