From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 26 14:26:10 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5EAC9648; Sun, 26 Oct 2014 14:26:10 +0000 (UTC) Received: from mail-wg0-x22d.google.com (mail-wg0-x22d.google.com [IPv6:2a00:1450:400c:c00::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B129FD7B; Sun, 26 Oct 2014 14:26:09 +0000 (UTC) Received: by mail-wg0-f45.google.com with SMTP id l18so3901322wgh.28 for ; Sun, 26 Oct 2014 07:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=7OhqeKtSH1FvoZeOsEcvqDZ/RJ6x1DGMAJs4Ec9jeLk=; b=a7JUzTbWHjIVsjqqxHwEl+nnXpOhaM2vVLOM5sldhX/ZOeiAflNKdiNeRg2ljxfctN 6wsX03urQsQrHtzZRSgA00dTs9e+RfaCGZEJBR2NN+XUC+ztRafuCqrrwoqROV6r7jsx +07/WixAWiqN3m1/puwUMV4KMqJhVOtxH+CmBGToBjAsVSsDt8pkJyJ4s/i9HqNWf2v1 4El2eU1s81/nvwYiPrnoZ/rc3ZLfn9fGvaUdyC3f1+CsA/STCWON674WHjSauEO5JGgW ZYBiRKWvNbL7JCgNDwKyEtQ2iMVioxlxw38dGDdvoz1e/BLGZQC6aTUuRTrAgEsw3gso cGPw== X-Received: by 10.180.104.229 with SMTP id gh5mr15257887wib.42.1414333567934; Sun, 26 Oct 2014 07:26:07 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id fu5sm12174095wjb.26.2014.10.26.07.26.06 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 26 Oct 2014 07:26:07 -0700 (PDT) Date: Sun, 26 Oct 2014 15:26:04 +0100 From: Mateusz Guzik To: Tiwei Bie Subject: Re: Questions with 'MPASS(ngrp <= ngroups_max)' assertion in kern_setgroups() Message-ID: <20141026142604.GA30512@dft-labs.eu> Mail-Followup-To: Mateusz Guzik , Tiwei Bie , mjg@freebsd.org, freebsd-hackers@freebsd.org References: <1414331221-29048-1-git-send-email-btw@mail.ustc.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1414331221-29048-1-git-send-email-btw@mail.ustc.edu.cn> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers@freebsd.org, mjg@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 14:26:10 -0000 On Sun, Oct 26, 2014 at 09:47:01PM +0800, Tiwei Bie wrote: > Hello, Mateusz! > > The check in kern_setgroups's callers is: > > if (gidsetsize > ngroups_max + 1) > return (EINVAL); > > So, gidsetsize could be (ngroups_max + 1). And under this condition, the assertion > > MPASS(ngrp <= ngroups_max); > > in kern_setgroups() will fail. One of them should be fixed. > > Indeed, thanks. Fixed in r273691. -- Mateusz Guzik