From owner-freebsd-hackers@FreeBSD.ORG Sat Sep 18 10:21:47 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4CCB516A4CE for ; Sat, 18 Sep 2004 10:21:47 +0000 (GMT) Received: from vsmtp3.tin.it (vsmtp3alice.tin.it [212.216.176.143]) by mx1.FreeBSD.org (Postfix) with ESMTP id C60A143D31 for ; Sat, 18 Sep 2004 10:21:46 +0000 (GMT) (envelope-from gerarra@tin.it) Received: from ims3a.cp.tin.it (192.168.70.103) by vsmtp3.tin.it (7.0.027) id 414B175C00040907 for freebsd-hackers@freebsd.org; Sat, 18 Sep 2004 12:21:46 +0200 Received: from [192.168.70.181] by ims3a.cp.tin.it with HTTP; Sat, 18 Sep 2004 12:21:46 +0200 Date: Sat, 18 Sep 2004 12:21:46 +0200 Message-ID: <4146316C0000A1E3@ims3a.cp.tin.it> In-Reply-To: <20040918090227.GX30151@darkness.comp.waw.pl> From: gerarra@tin.it To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable Subject: Re: FreeBSD Kernel buffer overflow X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2004 10:21:47 -0000 >-- Messaggio originale -- >Date: Sat, 18 Sep 2004 11:02:27 +0200 >From: Pawel Jakub Dawidek >To: Giorgos Keramidas >Cc: freebsd-hackers@freebsd.org >Cc: gerarra@tin.it >Subject: Re: FreeBSD Kernel buffer overflow > > >On Fri, Sep 17, 2004 at 12:37:12PM +0300, Giorgos Keramidas wrote: >+> % +#ifdef INVARIANTS >+> % + KASSERT(0 <=3D narg && narg <=3D 8, ("invalid number of sys= call >args")); >+> % +#endif > >Maybe: >KASSERT(0 <=3D narg && narg <=3D sizeof(args) / sizeof(args[0]), > ("invalid number of syscall args")); > >So if we decide to increase/decrease it someday, we don't have to rememb= er >about this KASSERT(). Maybe better: #define ARGS_MAGIC 8 ... int args[ARGS_MAGIC]; .... #ifdef INVARIANTS KASSERT(0 <=3D narg && narg <=3D ARGS_MAGIC, ("invalid number of syscall = args")); #endif (preprocession work) rookie