From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753283AbZGaVQU (ORCPT ); Fri, 31 Jul 2009 17:16:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753246AbZGaVQU (ORCPT ); Fri, 31 Jul 2009 17:16:20 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:47919 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753208AbZGaVQT (ORCPT ); Fri, 31 Jul 2009 17:16:19 -0400 Date: Fri, 31 Jul 2009 14:15:48 -0700 (PDT) From: Linus Torvalds X-X-Sender: torvalds@localhost.localdomain To: Ulrich Drepper cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: Re: [PATCH] information leak in sigaltstack In-Reply-To: <200907311948.n6VJm5Gf010118@hs20-bc2-1.build.redhat.com> Message-ID: References: <200907311948.n6VJm5Gf010118@hs20-bc2-1.build.redhat.com> User-Agent: Alpine 2.01 (LFD 1184 2008-12-16) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 31 Jul 2009, Ulrich Drepper wrote: > > The following patch should fix the issue. Hmm. Is there any reason not to do an unconditional memset(), and then expect gcc to avoid the unnecessary stores? I realize gcc may not do that, but we could always _hope_. Also, is there really any reason to believe that the only hole can be after ss_flags, and that it's only the case when ss_flags is in the middle? Quite frankly, as far as I can tell, you could have an "int ss_flags" at the _end_ of the structure too, and have the same issue (padding out to the alignment of the struct). For an example of that "'int ss_flags' at the end" look at MIPS. Now, you'd end up with a memset() in that case (since it certainly won't match the offsetof), but my point is, the conditional really looks very arbitrary and rather strange. I'd rather see it unconditional, even if it costs three unnecessary writes or whatever. Linus