lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120711.012745.2202204429130083377.davem@davemloft.net>
Date:	Wed, 11 Jul 2012 01:27:45 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	dan.carpenter@...cle.com
Cc:	kuznet@....inr.ac.ru, jmorris@...ei.org, yoshfuji@...ux-ipv6.org,
	kaber@...sh.net, netdev@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [patch -next] net: writes past the end of the struct

From: Dan Carpenter <dan.carpenter@...cle.com>
Date: Wed, 11 Jul 2012 09:32:14 +0300

> There are a couple places that try to set part of the struct to 0 by
> doing:
> 
>     memset(&rt->rt6i_table, 0, sizeof(*rt) - sizeof(struct dst_entry));
> 
> It assumes that the first element is a dst_entry and the second element
> is ->rt6_table.  The problem is we changed the struct in 97cac0821a
> ('ipv6: Store route neighbour in rt6_info struct.') and we aren't
> clearing rt->n but instead we're writing past the end of the array.
> 
> I've changed it to:
>     memset(&rt->n, 0, sizeof(*rt) - offsetof(struct rt6_info, n));
> 
> The memset in ip6_dst_alloc() was ok but I changed it to use offsetof()
> as a cleanup.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>

Steffen Klassert had patches to do this more nicely, using "dst + 1"
as the pointer calculation, which therefore works no matter what
elements we add to struct rt6_info after the dst_entry.

I asked him to fix some things, he did too much casting, but he never
respun his patch set.  I definitely prefer this gets fixed his way.

http://patchwork.ozlabs.org/patch/169391/
http://patchwork.ozlabs.org/patch/169395/
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ