* [PATCH v2] ipc: initialize structure memory to zero for shmctl
@ 2010-10-07 2:18 Kees Cook
2010-10-07 2:55 ` [stable] " Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2010-10-07 2:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Al Viro, Andrew Morton, Jiri Slaby, David S. Miller, stable
The old shm interface will leak a few bytes of stack contents. Explicitly
initialize the structure to zero-fill the untouched fields, using memset
instead of C99-style in case there are ever holes in the structure.
Signed-off-by: Kees Cook <kees.cook@canonical.com>
---
ipc/shm.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/ipc/shm.c b/ipc/shm.c
index 52ed77e..f943b1e 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -473,6 +473,7 @@ static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_
{
struct shmid_ds out;
+ memset(&out, 0, sizeof(out));
ipc64_perm_to_ipc_perm(&in->shm_perm, &out.shm_perm);
out.shm_segsz = in->shm_segsz;
out.shm_atime = in->shm_atime;
@@ -524,6 +525,7 @@ static inline unsigned long copy_shminfo_to_user(void __user *buf, struct shminf
{
struct shminfo out;
+ memset(&out, 0, sizeof(out));
if(in->shmmax > INT_MAX)
out.shmmax = INT_MAX;
else
--
1.7.1
--
Kees Cook
Ubuntu Security Team
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [stable] [PATCH v2] ipc: initialize structure memory to zero for shmctl
2010-10-07 2:18 [PATCH v2] ipc: initialize structure memory to zero for shmctl Kees Cook
@ 2010-10-07 2:55 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2010-10-07 2:55 UTC (permalink / raw)
To: Kees Cook
Cc: linux-kernel, stable, Andrew Morton, Jiri Slaby, Al Viro,
David S. Miller
On Wed, Oct 06, 2010 at 07:18:36PM -0700, Kees Cook wrote:
> The old shm interface will leak a few bytes of stack contents. Explicitly
> initialize the structure to zero-fill the untouched fields, using memset
> instead of C99-style in case there are ever holes in the structure.
>
> Signed-off-by: Kees Cook <kees.cook@canonical.com>
> ---
If you wish to have a patch included in the stable series, please read
Documentation/stable_kernel_rules.txt which state that adding a:
Cc: stable <stable@kernel.org>
to the signed-off-by: area will cause it to be automagically included
when the patch gets into Linus's tree. Otherwise it just causes a lot
of extra work for me to dig around and watch out for it in the future.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-07 2:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-07 2:18 [PATCH v2] ipc: initialize structure memory to zero for shmctl Kees Cook
2010-10-07 2:55 ` [stable] " Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox