From owner-freebsd-current Mon Apr 3 1:43:36 2000 Delivered-To: freebsd-current@freebsd.org Received: from hcshh.hcs.de (hcshh.hcs.de [194.123.40.1]) by hub.freebsd.org (Postfix) with SMTP id 5DBAA37B5AE for ; Mon, 3 Apr 2000 01:43:32 -0700 (PDT) (envelope-from hm@hcs.de) Received: from hcswork.hcs.de([192.76.124.5]) (2723 bytes) by hcshh.hcs.de via sendmail with P:smtp/R:inet_hosts/T:smtp (sender: ) id for ; Mon, 3 Apr 2000 10:43:20 +0200 (CEST) (Smail-3.2.0.104 1998-Nov-20 #1 built 1998-Dec-11) Received: by hcswork.hcs.de (Postfix, from userid 200) id 6A6DC483D; Mon, 3 Apr 2000 10:43:30 +0200 (METDST) Subject: Re: MLEN and crashes In-Reply-To: from Bruce Evans at "Apr 2, 0 09:56:55 pm" To: bde@zeta.org.au (Bruce Evans) Date: Mon, 3 Apr 2000 10:43:30 +0200 (METDST) Cc: garyj@muc.de, freebsd-current@FreeBSD.ORG Reply-To: hm@hcs.de Organization: HCS Hanseatischer Computerservice GmbH X-Mailer: ELM [version 2.4ME+ PL39 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1834 Message-Id: <20000403084330.6A6DC483D@hcswork.hcs.de> From: hm@hcs.de (Hellmuth Michaelis) Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG From the keyboard of Bruce Evans: > It's just a bug to allocate big structs on the kernel stack. Please specify "big"! :-) I wonder how too "big" can be detected. The code in question is perfectly valid syntactically and semantically correct C-code. If a piece of code being considered buggy depends on the size of some externally defined "thing" (like the kernel stack size in this case) something - IMHO - is not in a good condition. Perhaps a sentence like "It's just a bug to allocate structs on the kernel stack" (note the missing "big") has to be put in style. Or a macro like (this is just a cheap shoot in the dark) void kernel_subr(void) { ALLOCATE_STRUCT_ON_STACK(struct bigstruct bigstr); .... could be created to check for potentially stack overflow at compile time and/or runtime and people are forced in style(9) to use it. > 512 bytes is probably too big for i386's now. The effective kernel stack > size was shrunk by about 2K by the sigset_t changes, so there is only > about 5K of kernel stack. Then isn't it time to make the kernel stack larger ? Please don't misunderstand. I can fully accept accecpt and acknowledge what you write (i've converted the piece of code in question to malloc'ing its data already), i'm just a bit concerned because its so perfectly legal and common to allocate a struct on the stack that i fear just that i and probably other don't think about it if it were not made absolutely clear and possibly enforced somehow to never do this in kernel land. hellmuth -- Hellmuth Michaelis Tel +49 40 55 97 47-70 HCS Hanseatischer Computerservice GmbH Fax +49 40 55 97 47-77 Oldesloer Strasse 97-99 Mail hm [at] hcs.de D-22457 Hamburg WWW http://www.hcs.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message