[Lucid CVE 3/3] xfrm_user: fix info leak in copy_to_user_state()

Luis Henriques luis.henriques at canonical.com
Fri Mar 22 11:12:45 UTC 2013

From: Mathias Krause <minipli at googlemail.com>


BugLink: http://bugs.launchpad.net/bugs/1156716

The memory reserved to dump the xfrm state includes the padding bytes of
struct xfrm_usersa_info added by the compiler for alignment (7 for
amd64, 3 for i386). Add an explicit memset(0) before filling the buffer
to avoid the info leak.

Signed-off-by: Mathias Krause <minipli at googlemail.com>
Acked-by: Steffen Klassert <steffen.klassert at secunet.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit f778a636713a435d3a922c60b1622a91136560c1)

Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
 net/xfrm/xfrm_user.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 0926b00..a8d83c4 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -506,6 +506,7 @@ out:
 static void copy_to_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p)
+	memset(p, 0, sizeof(*p));
 	memcpy(&p->id, &x->id, sizeof(p->id));
 	memcpy(&p->sel, &x->sel, sizeof(p->sel));
 	memcpy(&p->lft, &x->lft, sizeof(p->lft));

More information about the kernel-team mailing list