netfilter: conntrack: make all extensions 8-byte alignned
authorFlorian Westphal <fw@strlen.de>
Thu, 20 Jan 2022 12:06:59 +0000 (13:06 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 4 Feb 2022 05:30:28 +0000 (06:30 +0100)
All extensions except one need 8 byte alignment, so just make that the
default.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 files changed:
include/net/netfilter/nf_conntrack_extend.h
net/netfilter/nf_conntrack_acct.c
net/netfilter/nf_conntrack_ecache.c
net/netfilter/nf_conntrack_extend.c
net/netfilter/nf_conntrack_helper.c
net/netfilter/nf_conntrack_labels.c
net/netfilter/nf_conntrack_seqadj.c
net/netfilter/nf_conntrack_timeout.c
net/netfilter/nf_conntrack_timestamp.c
net/netfilter/nf_nat_core.c
net/netfilter/nf_synproxy_core.c
net/sched/act_ct.c

index c7515d8..705a448 100644 (file)
@@ -49,7 +49,7 @@ enum nf_ct_ext_id {
 struct nf_ct_ext {
        u8 offset[NF_CT_EXT_NUM];
        u8 len;
-       char data[];
+       char data[] __aligned(8);
 };
 
 static inline bool __nf_ct_ext_exist(const struct nf_ct_ext *ext, u8 id)
@@ -83,10 +83,7 @@ struct nf_ct_ext_type {
        void (*destroy)(struct nf_conn *ct);
 
        enum nf_ct_ext_id id;
-
-       /* Length and min alignment. */
        u8 len;
-       u8 align;
 };
 
 int nf_ct_extend_register(const struct nf_ct_ext_type *type);
index 91bc8df..c9b20b8 100644 (file)
@@ -24,7 +24,6 @@ MODULE_PARM_DESC(acct, "Enable connection tracking flow accounting.");
 
 static const struct nf_ct_ext_type acct_extend = {
        .len    = sizeof(struct nf_conn_acct),
-       .align  = __alignof__(struct nf_conn_acct),
        .id     = NF_CT_EXT_ACCT,
 };
 
index 41768ff..1cf2c8c 100644 (file)
@@ -306,7 +306,6 @@ static int nf_ct_events __read_mostly = NF_CT_EVENTS_DEFAULT;
 
 static const struct nf_ct_ext_type event_extend = {
        .len    = sizeof(struct nf_conntrack_ecache),
-       .align  = __alignof__(struct nf_conntrack_ecache),
        .id     = NF_CT_EXT_ECACHE,
 };
 
index 3dbe232..c62f477 100644 (file)
@@ -65,7 +65,7 @@ void *nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
                return NULL;
        }
 
-       newoff = ALIGN(oldlen, t->align);
+       newoff = ALIGN(oldlen, __alignof__(struct nf_ct_ext));
        newlen = newoff + t->len;
        rcu_read_unlock();
 
index ae4488a..e8f6a38 100644 (file)
@@ -552,7 +552,6 @@ EXPORT_SYMBOL_GPL(nf_nat_helper_unregister);
 
 static const struct nf_ct_ext_type helper_extend = {
        .len    = sizeof(struct nf_conn_help),
-       .align  = __alignof__(struct nf_conn_help),
        .id     = NF_CT_EXT_HELPER,
 };
 
index 5227925..6323358 100644 (file)
@@ -81,7 +81,6 @@ EXPORT_SYMBOL_GPL(nf_connlabels_put);
 
 static const struct nf_ct_ext_type labels_extend = {
        .len    = sizeof(struct nf_conn_labels),
-       .align  = __alignof__(struct nf_conn_labels),
        .id     = NF_CT_EXT_LABELS,
 };
 
index 3066449..b13b3a8 100644 (file)
@@ -235,7 +235,6 @@ EXPORT_SYMBOL_GPL(nf_ct_seq_offset);
 
 static const struct nf_ct_ext_type nf_ct_seqadj_extend = {
        .len    = sizeof(struct nf_conn_seqadj),
-       .align  = __alignof__(struct nf_conn_seqadj),
        .id     = NF_CT_EXT_SEQADJ,
 };
 
index 14387e0..816fe68 100644 (file)
@@ -137,7 +137,6 @@ EXPORT_SYMBOL_GPL(nf_ct_destroy_timeout);
 
 static const struct nf_ct_ext_type timeout_extend = {
        .len    = sizeof(struct nf_conn_timeout),
-       .align  = __alignof__(struct nf_conn_timeout),
        .id     = NF_CT_EXT_TIMEOUT,
 };
 
index f656d39..81878d9 100644 (file)
@@ -21,7 +21,6 @@ MODULE_PARM_DESC(tstamp, "Enable connection tracking flow timestamping.");
 
 static const struct nf_ct_ext_type tstamp_extend = {
        .len    = sizeof(struct nf_conn_tstamp),
-       .align  = __alignof__(struct nf_conn_tstamp),
        .id     = NF_CT_EXT_TSTAMP,
 };
 
index 2d06a66..d0000f6 100644 (file)
@@ -877,7 +877,6 @@ static void nf_nat_cleanup_conntrack(struct nf_conn *ct)
 
 static struct nf_ct_ext_type nat_extend __read_mostly = {
        .len            = sizeof(struct nf_conn_nat),
-       .align          = __alignof__(struct nf_conn_nat),
        .destroy        = nf_nat_cleanup_conntrack,
        .id             = NF_CT_EXT_NAT,
 };
index 2dfc5da..d5c1e93 100644 (file)
@@ -238,7 +238,6 @@ synproxy_tstamp_adjust(struct sk_buff *skb, unsigned int protoff,
 
 static struct nf_ct_ext_type nf_ct_synproxy_extend __read_mostly = {
        .len            = sizeof(struct nf_conn_synproxy),
-       .align          = __alignof__(struct nf_conn_synproxy),
        .id             = NF_CT_EXT_SYNPROXY,
 };
 
index f99247f..78ccd16 100644 (file)
@@ -59,7 +59,6 @@ static const struct rhashtable_params zones_params = {
 
 static struct nf_ct_ext_type act_ct_extend __read_mostly = {
        .len            = sizeof(struct nf_conn_act_ct_ext),
-       .align          = __alignof__(struct nf_conn_act_ct_ext),
        .id             = NF_CT_EXT_ACT_CT,
 };