Module Name: src
Committed By: joerg
Date: Mon Nov 16 08:44:21 UTC 2009
Modified Files:
src/sys/compat/linux/common: linux_ipc.c
Log Message:
Make sure to never leak padding space before copyout or copyin
uninitialized fields by explicitly using memset in the conversion
routines.
To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/compat/linux/common/linux_ipc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/compat/linux/common/linux_ipc.c
diff -u src/sys/compat/linux/common/linux_ipc.c:1.53 src/sys/compat/linux/common/linux_ipc.c:1.54
--- src/sys/compat/linux/common/linux_ipc.c:1.53 Thu Apr 23 17:40:57 2009
+++ src/sys/compat/linux/common/linux_ipc.c Mon Nov 16 08:44:19 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ipc.c,v 1.53 2009/04/23 17:40:57 njoly Exp $ */
+/* $NetBSD: linux_ipc.c,v 1.54 2009/11/16 08:44:19 joerg Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.53 2009/04/23 17:40:57 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.54 2009/11/16 08:44:19 joerg Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -306,6 +306,7 @@
linux_to_bsd_msqid_ds(struct linux_msqid_ds *lmp, struct msqid_ds *bmp)
{
+ memset(bmp, 0, sizeof(*bmp));
linux_to_bsd_ipc_perm(&lmp->l_msg_perm, &bmp->msg_perm);
bmp->_msg_first = lmp->l_msg_first;
bmp->_msg_last = lmp->l_msg_last;
@@ -322,6 +323,8 @@
void
linux_to_bsd_msqid64_ds(struct linux_msqid64_ds *lmp, struct msqid_ds *bmp)
{
+
+ memset(bmp, 0, sizeof(*bmp));
linux_to_bsd_ipc64_perm(&lmp->l_msg_perm, &bmp->msg_perm);
bmp->msg_stime = lmp->l_msg_stime;
bmp->msg_rtime = lmp->l_msg_rtime;
@@ -337,6 +340,7 @@
bsd_to_linux_msqid_ds(struct msqid_ds *bmp, struct linux_msqid_ds *lmp)
{
+ memset(lmp, 0, sizeof(*lmp));
bsd_to_linux_ipc_perm(&bmp->msg_perm, &lmp->l_msg_perm);
lmp->l_msg_first = bmp->_msg_first;
lmp->l_msg_last = bmp->_msg_last;
@@ -353,6 +357,8 @@
void
bsd_to_linux_msqid64_ds(struct msqid_ds *bmp, struct linux_msqid64_ds *lmp)
{
+
+ memset(lmp, 0, sizeof(*lmp));
bsd_to_linux_ipc64_perm(&bmp->msg_perm, &lmp->l_msg_perm);
lmp->l_msg_stime = bmp->msg_stime;
lmp->l_msg_rtime = bmp->msg_rtime;