From owner-svn-src-head@freebsd.org Wed Jan 31 17:58:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2BB8ED995C; Wed, 31 Jan 2018 17:58:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6130070CE1; Wed, 31 Jan 2018 17:58:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C2D62936C; Wed, 31 Jan 2018 17:58:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VHw0CA035139; Wed, 31 Jan 2018 17:58:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VHw0NT035135; Wed, 31 Jan 2018 17:58:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801311758.w0VHw0NT035135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 31 Jan 2018 17:58:00 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/lib/libc: i386/gen powerpc/gen powerpc64/gen X-SVN-Commit-Revision: 328631 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 17:58:00 -0000 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 */