From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754291AbcHWPia (ORCPT ); Tue, 23 Aug 2016 11:38:30 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:36606 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753899AbcHWPhC (ORCPT ); Tue, 23 Aug 2016 11:37:02 -0400 Message-ID: <1471966619.14381.21.camel@edumazet-glaptop3.roam.corp.google.com> Subject: Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() From: Eric Dumazet To: Joe Perches Cc: Luis Henriques , Avijit Kanti Das , "David S . Miller" , Ben Hutchings , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 23 Aug 2016 08:36:59 -0700 In-Reply-To: <1471964716.3746.103.camel@perches.com> References: <1471959668-18209-1-git-send-email-luis.henriques@canonical.com> <1471959668-18209-2-git-send-email-luis.henriques@canonical.com> <1471962096.14381.15.camel@edumazet-glaptop3.roam.corp.google.com> <1471964716.3746.103.camel@perches.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2016-08-23 at 08:05 -0700, Joe Perches wrote: > A compiler does not have a standards based requirement to > initialize arbitrary padding bytes. > > I believe gcc always does zero all padding anyway. I would not worry for kernel code, because the amount of scrutiny there will be enough to 'fix potential bugs' [1], but a lot of user land code would suffer from various bugs as well that might sit there forever. [1] Also, most call sites in the kernel are using same call stack, so the offset of '1-7 leaked bytes' vs kernel stack is constant, making exploits quite challenging. Even if the current standards are lazy (are they, I did not check ?), security needs would call for a sane compiler behavior and changing the standards accordingly.