From owner-svn-src-head@freebsd.org Wed Feb 20 14:41:02 2019 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 75F2714F5F0E; Wed, 20 Feb 2019 14:41:02 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [IPv6:2a01:4f8:d12:604::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id EF27B83BCE; Wed, 20 Feb 2019 14:41:01 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (eg.sd.rdtc.ru [IPv6:2a03:3100:c:13:0:0:0:5]) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id x1KEenbR051781 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Feb 2019 15:40:52 +0100 (CET) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: markj@FreeBSD.org Received: from [10.58.0.4] (dadv@[10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id x1KEemeQ053013 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 20 Feb 2019 21:40:48 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: svn commit: r344305 - head/sys/geom To: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201902192122.x1JLMMPM012400@repo.freebsd.org> From: Eugene Grosbein Message-ID: <002a35c7-3dda-05e5-7768-3e1606871018@grosbein.net> Date: Wed, 20 Feb 2019 21:40:45 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <201902192122.x1JLMMPM012400@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,LOCAL_FROM,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Report: * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -0.0 SPF_PASS SPF: sender matches SPF record * 2.6 LOCAL_FROM From my domains X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on hz.grosbein.net X-Rspamd-Queue-Id: EF27B83BCE X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 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, 20 Feb 2019 14:41:02 -0000 20.02.2019 4:22, Mark Johnston wrote: > Author: markj > Date: Tue Feb 19 21:22:22 2019 > New Revision: 344305 > URL: https://svnweb.freebsd.org/changeset/base/344305 > > Log: > Impose a limit on the number of GEOM_CTL arguments. > > Otherwise a privileged user can trigger a memory allocation of > unbounded size, or an integer overflow in the subsequent > geom_alloc_copyin() call, leading to out-of-bounds accesses. > > Hard-code a large limit to circumvent this problem. > > admbug: 854 > Reported by: Anonymous of the Shellphish Grill Team > Reviewed by: ae > MFC after: 1 week > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D19251 > > Modified: > head/sys/geom/geom_ctl.c > > Modified: head/sys/geom/geom_ctl.c > ============================================================================== > --- head/sys/geom/geom_ctl.c Tue Feb 19 21:20:50 2019 (r344304) > +++ head/sys/geom/geom_ctl.c Tue Feb 19 21:22:22 2019 (r344305) > @@ -139,6 +139,12 @@ gctl_copyin(struct gctl_req *req) > char *p; > u_int i; > > + if (req->narg > 2048) { > + gctl_error(req, "too many arguments"); > + req->arg = NULL; > + return; > + } > + Could you replace magic constant 2048 with #define symbol, please? Something like GEOM_ARG_MAX in sys/sys/limits.h or similar.