From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753098AbbADXhm (ORCPT ); Sun, 4 Jan 2015 18:37:42 -0500 Received: from helcar.apana.org.au ([209.40.204.226]:40668 "EHLO helcar.apana.org.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752813AbbADXhl (ORCPT ); Sun, 4 Jan 2015 18:37:41 -0500 Date: Mon, 5 Jan 2015 10:36:37 +1100 From: Herbert Xu To: Giel van Schijndel Cc: linux-kernel@vger.kernel.org, "David S. Miller" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "maintainer:X86 ARCHITECTURE..." , Greg Kroah-Hartman , Steve French , Rahul Bedarkar , Thomas Pugliese , Randy Dunlap , Julia Lawall , "open list:CRYPTO API" , "open list:CERTIFIED WIRELES..." , "open list:COMMON INTERNET F..." , "moderated list:COMMON INTERNET F..." , Daniel Borkmann Subject: Re: [PATCH] Use memzero_explicit to clear local buffers Message-ID: <20150104233637.GA20757@gondor.apana.org.au> References: <1420394744-20268-1-git-send-email-me@mortis.eu> <20150104213538.GA19906@gondor.apana.org.au> <20150104224909.GB4806@salidar.dom.custoft.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150104224909.GB4806@salidar.dom.custoft.eu> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 04, 2015 at 11:49:09PM +0100, Giel van Schijndel wrote: > > > sctx does not point to stack memory so this is bogus. > > > > Only stack memory cleared just before it goes out of scope needs > > memzero_explicit. > > Is that because the compiler can't safely optimize memset(0) away for a > variable with greater-than-local scope? Exactly. memzero_explicit is not a marker for sensitive data. Its only purpose is to prevent the compiler from optimising away zeroing that occurs at the end of a scope. Daniel, we should add a comment so that people stop sending bogus patches with memzero_explicit. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt