From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753154AbcKOS05 (ORCPT ); Tue, 15 Nov 2016 13:26:57 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:56252 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbcKOS0y (ORCPT ); Tue, 15 Nov 2016 13:26:54 -0500 Date: Tue, 15 Nov 2016 19:27:04 +0100 From: Greg KH To: Kees Cook Cc: LKML , Michael Ellerman Subject: Re: [PATCH] lkdtm: Prevent the compiler from optimising lkdtm_CORRUPT_STACK() Message-ID: <20161115182704.GA29239@kroah.com> References: <1479193352-486-1-git-send-email-mpe@ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 15, 2016 at 09:27:47AM -0800, Kees Cook wrote: > On Mon, Nov 14, 2016 at 11:02 PM, Michael Ellerman wrote: > > At least on powerpc with GCC 6, the compiler is smart enough to optimise > > lkdtm_CORRUPT_STACK() into an empty function that just returns. > > Sneaky. Thanks! > > > If we print the buffer after we've written to it that prevents the > > compiler from optimising away data and the memset(). > > > > Signed-off-by: Michael Ellerman > > Acked-by: Kees Cook > > Greg, can you add this to the drivers/misc? Now added, thanks. greg k-h