From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 8 13:54:53 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6215B106566B for ; Mon, 8 Mar 2010 13:54:53 +0000 (UTC) (envelope-from aduane@juniper.net) Received: from exprod7og108.obsmtp.com (exprod7og108.obsmtp.com [64.18.2.169]) by mx1.freebsd.org (Postfix) with ESMTP id A4DF48FC12 for ; Mon, 8 Mar 2010 13:54:50 +0000 (UTC) Received: from source ([66.129.224.36]) (using TLSv1) by exprod7ob108.postini.com ([64.18.6.12]) with SMTP ID DSNKS5UBqXABf2i0/1Rw2nvJ9RHjfDw3fiuK@postini.com; Mon, 08 Mar 2010 05:54:52 PST Received: from p-emfe01-wf.jnpr.net (172.28.145.24) by P-EMHUB03-HQ.jnpr.net (172.24.192.37) with Microsoft SMTP Server (TLS) id 8.1.393.1; Mon, 8 Mar 2010 05:54:41 -0800 Received: from EMBX01-WF.jnpr.net ([fe80::1914:3299:33d9:e43b]) by p-emfe01-wf.jnpr.net ([fe80::d0d1:653d:5b91:a123%11]) with mapi; Mon, 8 Mar 2010 08:54:40 -0500 From: Andrew Duane To: Patrick Lamaiziere , "freebsd-hackers@freebsd.org" Date: Mon, 8 Mar 2010 08:54:40 -0500 Thread-Topic: Dead store elimination in the kernel? Thread-Index: Acq+T1nVG/2BwBHRTH6zXJMtxV08IgAd1Rug Message-ID: References: <20100307232146.6b57f610@davenulle.org> In-Reply-To: <20100307232146.6b57f610@davenulle.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: Subject: RE: Dead store elimination in the kernel? 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: Mon, 08 Mar 2010 13:54:53 -0000 owner-freebsd-hackers@freebsd.org wrote: > Hello, >=20 > I'm asking if FreeBSD is safe regarding dead store elimination made > by gcc?=20 >=20 > By example, in crypto drivers, sensitive datas are cleared by a > bzero() after use to avoid potential leakages. But the bzero() by > itself is useless, is it removed by gcc? >=20 > Thanks, regards. > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to > "freebsd-hackers-unsubscribe@freebsd.org" I would think the "correct" way to handle this is to make sure all appropri= ate items are declared volatile. This would eliminate dead store eliminatio= n, as the compiler can tell they are not dead. Unfortunately, the history of drivers (or any code) correctly using volatil= e declarations is intermittent at best. /Andrew