From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 5 02:31:50 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0989A106566C; Wed, 5 Sep 2012 02:31:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 74C578FC0A; Wed, 5 Sep 2012 02:31:48 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q852Vl0v027080; Wed, 5 Sep 2012 05:31:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q852VZnG049753; Wed, 5 Sep 2012 05:31:35 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q852VZq0049752; Wed, 5 Sep 2012 05:31:35 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 5 Sep 2012 05:31:35 +0300 From: Konstantin Belousov To: Dimitry Andric Message-ID: <20120905023135.GB33100@deviant.kiev.zoral.com.ua> References: <53c5133d8fac4f4353eda0add82e2234@viper-webmail.viper.enta.net> <504677AB.8040908@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="iKZcyocDyhoWQlc5" Content-Disposition: inline In-Reply-To: <504677AB.8040908@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Eitan Adler , freebsd-hackers@freebsd.org, freebsd-ports@freebsd.org, Jake Smith Subject: Re: Building with WITH_DEBUG (-g) in make.conf X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2012 02:31:50 -0000 --iKZcyocDyhoWQlc5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 04, 2012 at 11:50:35PM +0200, Dimitry Andric wrote: > On 2012-09-04 17:53, Eitan Adler wrote: > >On 4 September 2012 05:26, Jake Smith wrote: > ... > >>It got me thinking, is there any reason why it would be a bad idea to= =20 > >>build > >>all my ports with debug symbols from now on? > > > >>Are there any performance hits > > > >Yes. Code size grows and the flags may enable internal > >debugging in the program itself. >=20 > There's a difference between just using '-g', which should never change > the behaviour of the program at runtime, and adding -DDEBUG or similar > flags on the command line, which may or may not enable extra code, or > even cause totally different code paths. >=20 > What is not different, is that both -g and other debugging options will > generally cause compiling and linking to take longer, since these stages > will have to process the additional debug information. >=20 >=20 > >>or security risks with this? > > > >no. >=20 > You cannot know in general. If debug options enable a different code > path, you might as well get a security problem with it for free. :) >=20 > I have seen many debug printf's which could easily be exploited for > buffer overruns, etc. >=20 > However, only using '-g' should make no difference, indeed. To nitpick, this is not true if you have code that explicitely tries to use dwarf information from the resulting binary. Think e.g. libunwind which can be configured to use .debug sections. --iKZcyocDyhoWQlc5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlBGuYYACgkQC3+MBN1Mb4jJEgCgioTPiVnbFIvxbwW0d/vCLEW9 M0QAmwWdixjyhUs/ulSNPo7OT7J+gHzi =Az3L -----END PGP SIGNATURE----- --iKZcyocDyhoWQlc5--