From mboxrd@z Thu Jan 1 00:00:00 1970
From: =?ISO-8859-1?Q?P=E1draig_Brady?=
Date: Wed, 24 Nov 2010 10:44:50 +0000
Subject: Re: [PATCH v2] fs: select: fix information leak to userspace
Message-Id: <4CECECA2.6070301@draigBrady.com>
List-Id:
References: <1289421483-23907-1-git-send-email-segooon@gmail.com> <20101112120834.33062900.akpm@linux-foundation.org> <8D90F8B2-EA29-4EB9-9807-294CE0D5523B@dilger.ca> <20101114092533.GB5323@albatros> <20101114180643.593d19ac.akpm@linux-foundation.org> <1289848341.2607.125.camel@edumazet-laptop> <20101123140111.GA3816@hack> <4CEBD37E.5060107@bfs.de> <203E1F2A-2D04-4B7F-8D1B-9DC24522CB5E@dilger.ca>
In-Reply-To: <203E1F2A-2D04-4B7F-8D1B-9DC24522CB5E@dilger.ca>
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
To: Andreas Dilger
Cc: wharms@bfs.de, =?ISO-8859-1?Q?Am=E9rico_Wang?= , Eric Dumazet , Andrew Morton , Vasiliy Kulikov , kernel-janitors@vger.kernel.org, Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jakub Jelinek
On 23/11/10 18:02, Andreas Dilger wrote:
> On 2010-11-23, at 07:45, walter harms wrote:
>> Maybe we can convince the gcc people to make 0 padding default. That wil=
l not solve the problems for other compilers but when they claim "works lik=
e gcc" we can press then to support this also. I can imagine that this will=
close some other subtle leaks also.
>=20
> It makes the most sense to tackle this at the GCC level, since the added =
overhead of doing memset(0) on the whole struct may be non-trivial for comm=
only-used and/or large structures. Since GCC is already explicitly zeroing=
the _used_ fields in the struct, it can much more easily determine whether=
there is padding in the structure, and zero those few bytes as needed.
Zero padding structs is part of C90. Details here:
http://www.pixelbeat.org/programming/gcc/auto_init.html
gcc doesn't zero pad when _all_ elements are specified.
So perhaps just:
- struct timespec rts;
- struct timeval rtv;
+ struct timespec rts =3D {0,};
+ struct timeval rtv =3D {0,};
One could also move the rtv declaration
to the scope where it's used.
cheers,
P=E1draig.
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From mboxrd@z Thu Jan 1 00:00:00 1970
Return-Path:
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1753416Ab0KXKqI (ORCPT );
Wed, 24 Nov 2010 05:46:08 -0500
Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]:19722 "HELO
mail1.slb.deg.dub.stisp.net" rhost-flags-OK-OK-OK-OK)
by vger.kernel.org with SMTP id S1753181Ab0KXKqG (ORCPT
);
Wed, 24 Nov 2010 05:46:06 -0500
Message-ID: <4CECECA2.6070301@draigBrady.com>
Date: Wed, 24 Nov 2010 10:44:50 +0000
From: =?ISO-8859-1?Q?P=E1draig_Brady?=
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3
MIME-Version: 1.0
To: Andreas Dilger
CC: wharms@bfs.de, =?ISO-8859-1?Q?Am=E9rico_Wang?= ,
Eric Dumazet ,
Andrew Morton ,
Vasiliy Kulikov , kernel-janitors@vger.kernel.org,
Alexander Viro ,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Jakub Jelinek
Subject: Re: [PATCH v2] fs: select: fix information leak to userspace
References: <1289421483-23907-1-git-send-email-segooon@gmail.com> <20101112120834.33062900.akpm@linux-foundation.org> <8D90F8B2-EA29-4EB9-9807-294CE0D5523B@dilger.ca> <20101114092533.GB5323@albatros> <20101114180643.593d19ac.akpm@linux-foundation.org> <1289848341.2607.125.camel@edumazet-laptop> <20101123140111.GA3816@hack> <4CEBD37E.5060107@bfs.de> <203E1F2A-2D04-4B7F-8D1B-9DC24522CB5E@dilger.ca>
In-Reply-To: <203E1F2A-2D04-4B7F-8D1B-9DC24522CB5E@dilger.ca>
X-Enigmail-Version: 1.0.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Sender: linux-kernel-owner@vger.kernel.org
List-ID:
X-Mailing-List: linux-kernel@vger.kernel.org
On 23/11/10 18:02, Andreas Dilger wrote:
> On 2010-11-23, at 07:45, walter harms wrote:
>> Maybe we can convince the gcc people to make 0 padding default. That will not solve the problems for other compilers but when they claim "works like gcc" we can press then to support this also. I can imagine that this will close some other subtle leaks also.
>
> It makes the most sense to tackle this at the GCC level, since the added overhead of doing memset(0) on the whole struct may be non-trivial for commonly-used and/or large structures. Since GCC is already explicitly zeroing the _used_ fields in the struct, it can much more easily determine whether there is padding in the structure, and zero those few bytes as needed.
Zero padding structs is part of C90. Details here:
http://www.pixelbeat.org/programming/gcc/auto_init.html
gcc doesn't zero pad when _all_ elements are specified.
So perhaps just:
- struct timespec rts;
- struct timeval rtv;
+ struct timespec rts = {0,};
+ struct timeval rtv = {0,};
One could also move the rtv declaration
to the scope where it's used.
cheers,
Pádraig.
From mboxrd@z Thu Jan 1 00:00:00 1970
From: =?ISO-8859-1?Q?P=E1draig_Brady?=
Subject: Re: [PATCH v2] fs: select: fix information leak to userspace
Date: Wed, 24 Nov 2010 10:44:50 +0000
Message-ID: <4CECECA2.6070301@draigBrady.com>
References: <1289421483-23907-1-git-send-email-segooon@gmail.com> <20101112120834.33062900.akpm@linux-foundation.org> <8D90F8B2-EA29-4EB9-9807-294CE0D5523B@dilger.ca> <20101114092533.GB5323@albatros> <20101114180643.593d19ac.akpm@linux-foundation.org> <1289848341.2607.125.camel@edumazet-laptop> <20101123140111.GA3816@hack> <4CEBD37E.5060107@bfs.de> <203E1F2A-2D04-4B7F-8D1B-9DC24522CB5E@dilger.ca>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE
Cc: wharms@bfs.de,
=?ISO-8859-1?Q?Am=E9rico_Wang?= ,
Eric Dumazet ,
Andrew Morton ,
Vasiliy Kulikov ,
kernel-janitors@vger.kernel.org,
Alexander Viro ,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Jakub Jelinek
To: Andreas Dilger
Return-path:
Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]:7777 "HELO
mail1.slb.deg.dub.stisp.net" rhost-flags-OK-OK-OK-OK)
by vger.kernel.org with SMTP id S1753155Ab0KXKqG (ORCPT
);
Wed, 24 Nov 2010 05:46:06 -0500
In-Reply-To: <203E1F2A-2D04-4B7F-8D1B-9DC24522CB5E@dilger.ca>
Sender: linux-fsdevel-owner@vger.kernel.org
List-ID:
On 23/11/10 18:02, Andreas Dilger wrote:
> On 2010-11-23, at 07:45, walter harms wrote:
>> Maybe we can convince the gcc people to make 0 padding default. That=
will not solve the problems for other compilers but when they claim "w=
orks like gcc" we can press then to support this also. I can imagine th=
at this will close some other subtle leaks also.
>=20
> It makes the most sense to tackle this at the GCC level, since the ad=
ded overhead of doing memset(0) on the whole struct may be non-trivial =
for commonly-used and/or large structures. Since GCC is already explic=
itly zeroing the _used_ fields in the struct, it can much more easily d=
etermine whether there is padding in the structure, and zero those few =
bytes as needed.
Zero padding structs is part of C90. Details here:
http://www.pixelbeat.org/programming/gcc/auto_init.html
gcc doesn't zero pad when _all_ elements are specified.
So perhaps just:
- struct timespec rts;
- struct timeval rtv;
+ struct timespec rts =3D {0,};
+ struct timeval rtv =3D {0,};
One could also move the rtv declaration
to the scope where it's used.
cheers,
P=E1draig.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel=
" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html