From owner-freebsd-threads@FreeBSD.ORG Mon Sep 19 12:51:22 2011 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29C811065672 for ; Mon, 19 Sep 2011 12:51:22 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 01B198FC18 for ; Mon, 19 Sep 2011 12:51:22 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id ADBC046B46; Mon, 19 Sep 2011 08:51:21 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3A0328A02F; Mon, 19 Sep 2011 08:51:21 -0400 (EDT) From: John Baldwin To: freebsd-threads@freebsd.org, Michael Pounov Date: Mon, 19 Sep 2011 08:43:27 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110617; KDE/4.5.5; amd64; ; ) References: <201109171150.p8HBo8lZ071542@freefall.freebsd.org> In-Reply-To: <201109171150.p8HBo8lZ071542@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201109190843.27576.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 19 Sep 2011 08:51:21 -0400 (EDT) Cc: Subject: Re: threads/160708: Bypass process stack quota :) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 12:51:22 -0000 On Saturday, September 17, 2011 7:50:08 am Michael Pounov wrote: > The following reply was made to PR threads/160708; it has been noted by GNATS. > > From: Michael Pounov > To: freebsd-gnats-submit@freebsd.org > Cc: > Subject: Re: threads/160708: Bypass process stack quota :) > Date: Sat, 17 Sep 2011 14:26:11 +0300 > > Hmm, you no so right Peter. > > Yes I can move esp pointer in any other address, but please > start program and see address of allocated memory for every thread. > All this allocations is made in upper memory called stack. > > Try same alloca() in main program thread and you see how > system terminate program if you going over stack limit. It's not very practical to apply this limit to multithreaded apps. Would you want it to be a global limit (i.e. all stacks summed together must be <= limit) or a per-thread limit (i.e. each thread's stack must be <= limit). Also, given that RLIMIT_DATA is now obsolete (since malloc() defaults to using MAP_ANON with mmap() rather than sbrk()), using RLIMIT_AS is probably the right thing if you are trying to prevent local DOS. -- John Baldwin