inet_frag: Limit ABI change in 4.9.51
authorBen Hutchings <ben@decadent.org.uk>
Mon, 25 Sep 2017 23:03:33 +0000 (00:03 +0100)
committerYves-Alexis Perez <corsac@debian.org>
Fri, 9 Feb 2018 12:58:52 +0000 (12:58 +0000)
Commit fb452a1aa3fd 'Revert "net: use lib/percpu_counter API for
fragmentation mem accounting"' changed the type of inet_frag::mem
from struct percpu_counter to atomic_t.  There are few modules
that actually depend on this, but struct inet_frag is embedded in
various other structures that end up affecting symbol versions
for a huge number of networking APIs.

So add padding to keep the structure size unchanged, hide the type
change from genksyms, and rename a key inet_frag function so that
those modules that actually depend on the type of inet_frag::mem do
see an ABI change.

Gbp-Pq: Topic debian
Gbp-Pq: Name inet_frag-limit-abi-change-in-4.9.51.patch

include/net/inet_frag.h

index 634d19203e7d136682f0f3caf15070046433b4be..ac6f5b167c830280affbbc3b9ab1b745fc59ac83 100644 (file)
@@ -1,9 +1,22 @@
 #ifndef __NET_FRAG_H__
 #define __NET_FRAG_H__
 
+#include <linux/percpu_counter.h>
+
 struct netns_frags {
+       /*
+        * bwh: This change is hidden from genksyms, but we still make
+        * sure to avoid an ABI mismatch for the modules that access
+        * it (see comment below).
+        */
+#ifndef __GENKSYMS__
        /* Keep atomic mem on separate cachelines in structs that include it */
        atomic_t                mem ____cacheline_aligned_in_smp;
+       char                    pad[sizeof(struct percpu_counter) -
+                                   sizeof(atomic_t)];
+#else
+       struct percpu_counter   mem ____cacheline_aligned_in_smp;
+#endif
        /* sysctls */
        int                     timeout;
        int                     high_thresh;
@@ -107,6 +120,14 @@ static inline void inet_frags_init_net(struct netns_frags *nf)
 {
        atomic_set(&nf->mem, 0);
 }
+/*
+ * bwh: All modules accessing inet_frag::mem through the inline
+ * functions below also call inet_frags_exit_net().  Change the
+ * function name together with that field's type, so that all loaded
+ * code agrees on whether the type is atomic_t or struct
+ * percpu_counter.
+ */
+#define inet_frags_exit_net inet_frags_exit_net_atomic
 void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f);
 
 void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);