public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Convert all IPv4 and IPv6 multicast memberships
@ 2019-09-25  7:03 Sebastian Huber
  0 siblings, 0 replies; only message in thread
From: Sebastian Huber @ 2019-09-25  7:03 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d41e144869ca8f89fb42692b0858a2310c1df407

commit d41e144869ca8f89fb42692b0858a2310c1df407
Author: hselasky <hselasky@FreeBSD.org>
Date:   Tue Jun 25 11:54:41 2019 +0000

    Convert all IPv4 and IPv6 multicast memberships
    
    into using a STAILQ instead of a linear array.
    
    The multicast memberships for the inpcb structure are protected by a
    non-sleepable lock, INP_WLOCK(), which needs to be dropped when
    calling the underlying possibly sleeping if_ioctl() method. When using
    a linear array to keep track of multicast memberships, the computed
    memory location of the multicast filter may suddenly change, due to
    concurrent insertion or removal of elements in the linear array. This
    in turn leads to various invalid memory access issues and kernel
    panics.
    
    To avoid this problem, put all multicast memberships on a STAILQ based
    list. Then the memory location of the IPv4 and IPv6 multicast filters
    become fixed during their lifetime and use after free and memory leak
    issues are easier to track, for example by: vmstat -m | grep multi
    
    All list manipulation has been factored into inline functions
    including some macros, to easily allow for a future hash-list
    implementation, if needed.
    
    This patch has been tested by pho@ .
    
    Differential Revision: https://reviews.freebsd.org/D20080
    Reviewed by:	markj @
    MFC after:	1 week
    Sponsored by:	Mellanox Technologies

Diff:
---
 newlib/libc/sys/rtems/include/netinet/in.h   | 6 +-----
 newlib/libc/sys/rtems/include/netinet6/in6.h | 7 ++-----
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/netinet/in.h b/newlib/libc/sys/rtems/include/netinet/in.h
index 11f3262..727cc88 100644
--- a/newlib/libc/sys/rtems/include/netinet/in.h
+++ b/newlib/libc/sys/rtems/include/netinet/in.h
@@ -505,13 +505,9 @@ __END_DECLS
 #define	IP_DEFAULT_MULTICAST_LOOP 1	/* normally hear sends if a member  */
 
 /*
- * The imo_membership vector for each socket is now dynamically allocated at
- * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
- * according to a power-of-two increment.
+ * Limit for IPv4 multicast memberships
  */
-#define	IP_MIN_MEMBERSHIPS	31
 #define	IP_MAX_MEMBERSHIPS	4095
-#define	IP_MAX_SOURCE_FILTER	1024	/* XXX to be unused */
 
 /*
  * Default resource limits for IPv4 multicast source filtering.
diff --git a/newlib/libc/sys/rtems/include/netinet6/in6.h b/newlib/libc/sys/rtems/include/netinet6/in6.h
index c936cfe..a9c7cbc 100644
--- a/newlib/libc/sys/rtems/include/netinet6/in6.h
+++ b/newlib/libc/sys/rtems/include/netinet6/in6.h
@@ -60,7 +60,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)in.h	8.3 (Berkeley) 1/3/94
- * $FreeBSD: head/sys/netinet6/in6.h 337783 2018-08-14 17:27:41Z jtl $
+ * $FreeBSD: head/sys/netinet6/in6.h 349369 2019-06-25 11:54:41Z hselasky $
  */
 
 #ifndef __KAME_NETINET_IN_H_INCLUDED_
@@ -395,11 +395,8 @@ struct route_in6 {
 #define IPV6_DEFAULT_MULTICAST_LOOP 1	/* normally hear sends if a member */
 
 /*
- * The im6o_membership vector for each socket is now dynamically allocated at
- * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
- * according to a power-of-two increment.
+ * Limit for IPv6 multicast memberships
  */
-#define	IPV6_MIN_MEMBERSHIPS	31
 #define	IPV6_MAX_MEMBERSHIPS	4095
 
 /*


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-25  7:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-25  7:03 [newlib-cygwin] Convert all IPv4 and IPv6 multicast memberships Sebastian Huber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).