From: Samuel Thibault Subject: Re: [PATCH][RFC] _chk_fail and _chk canaries for minios and newlib Date: Mon, 9 Mar 2009 19:13:17 +0100 Message-ID: <20090309181317.GR15127@const.bordeaux.inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "George S. Coker, II" Cc: xen-devel List-Id: xen-devel@lists.xenproject.org Hello, George S. Coker, II, le Mon 09 Mar 2009 13:08:04 -0500, a =E9crit : > This patch implements a minios version of the stack_chk_fail from glibc= . > fprintf_chk and sprintf_chk functions have been added to newlib. Cool! That'd be useful indeed. I'm however wondering whether your patch is enough for the stack protection: in my memory, gcc assumes that the glibc is used, and on e.g. i386, it uses gs:(0x14) for the stack canary (see a disassembly of a program compiled with -fstack-protector-all, there's a mov %gs:0x14,%eax lying in functions), and as a result we need to define a proper gs in MiniOS that follows glibc's tcbhead_t. The fortified printfs should be fine. Samuel