BACKPORT: xtables: extend matches and targets with .usersize
In matches and targets that define a kernel-only tail to their xt_match and xt_target data structs, add a field .usersize that specifies up to where data is to be shared with userspace. Performed a search for comment "Used internally by the kernel" to find relevant matches and targets. Manually inspected the structs to derive a valid offsetof. Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Bug: 120612905 Change-Id: I95d774345851f638ad7fcaeea8b65ba40abe0b6d (cherry picked from commit ec23189049651b16dc2ffab35a4371dc1f491aca) [hridya: resolved minor conflicts in various files] Signed-off-by: Hridya Valsaraju <hridya@google.com>
This commit is contained in:
committed by
Hridya Valsaraju
parent
472d60ed77
commit
8476df741c
@@ -105,6 +105,7 @@ static struct xt_match ebt_limit_mt_reg __read_mostly = {
|
||||
.match = ebt_limit_mt,
|
||||
.checkentry = ebt_limit_mt_check,
|
||||
.matchsize = sizeof(struct ebt_limit_info),
|
||||
.usersize = offsetof(struct ebt_limit_info, prev),
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compatsize = sizeof(struct ebt_compat_limit_info),
|
||||
#endif
|
||||
|
||||
@@ -478,6 +478,7 @@ static struct xt_target clusterip_tg_reg __read_mostly = {
|
||||
.checkentry = clusterip_tg_check,
|
||||
.destroy = clusterip_tg_destroy,
|
||||
.targetsize = sizeof(struct ipt_clusterip_tgt_info),
|
||||
.usersize = offsetof(struct ipt_clusterip_tgt_info, config),
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compatsize = sizeof(struct compat_ipt_clusterip_tgt_info),
|
||||
#endif /* CONFIG_COMPAT */
|
||||
|
||||
@@ -112,6 +112,7 @@ static struct xt_target ip6t_npt_target_reg[] __read_mostly = {
|
||||
.table = "mangle",
|
||||
.target = ip6t_snpt_tg,
|
||||
.targetsize = sizeof(struct ip6t_npt_tginfo),
|
||||
.usersize = offsetof(struct ip6t_npt_tginfo, adjustment),
|
||||
.checkentry = ip6t_npt_checkentry,
|
||||
.family = NFPROTO_IPV6,
|
||||
.hooks = (1 << NF_INET_LOCAL_IN) |
|
||||
@@ -123,6 +124,7 @@ static struct xt_target ip6t_npt_target_reg[] __read_mostly = {
|
||||
.table = "mangle",
|
||||
.target = ip6t_dnpt_tg,
|
||||
.targetsize = sizeof(struct ip6t_npt_tginfo),
|
||||
.usersize = offsetof(struct ip6t_npt_tginfo, adjustment),
|
||||
.checkentry = ip6t_npt_checkentry,
|
||||
.family = NFPROTO_IPV6,
|
||||
.hooks = (1 << NF_INET_PRE_ROUTING) |
|
||||
|
||||
@@ -380,6 +380,7 @@ static struct xt_target xt_ct_tg_reg[] __read_mostly = {
|
||||
.name = "CT",
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.targetsize = sizeof(struct xt_ct_target_info),
|
||||
.usersize = offsetof(struct xt_ct_target_info, ct),
|
||||
.checkentry = xt_ct_tg_check_v0,
|
||||
.destroy = xt_ct_tg_destroy_v0,
|
||||
.target = xt_ct_target_v0,
|
||||
@@ -391,6 +392,7 @@ static struct xt_target xt_ct_tg_reg[] __read_mostly = {
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.revision = 1,
|
||||
.targetsize = sizeof(struct xt_ct_target_info_v1),
|
||||
.usersize = offsetof(struct xt_ct_target_info, ct),
|
||||
.checkentry = xt_ct_tg_check_v1,
|
||||
.destroy = xt_ct_tg_destroy_v1,
|
||||
.target = xt_ct_target_v1,
|
||||
@@ -402,6 +404,7 @@ static struct xt_target xt_ct_tg_reg[] __read_mostly = {
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.revision = 2,
|
||||
.targetsize = sizeof(struct xt_ct_target_info_v1),
|
||||
.usersize = offsetof(struct xt_ct_target_info, ct),
|
||||
.checkentry = xt_ct_tg_check_v2,
|
||||
.destroy = xt_ct_tg_destroy_v1,
|
||||
.target = xt_ct_target_v1,
|
||||
|
||||
@@ -178,6 +178,7 @@ static struct xt_target xt_rateest_tg_reg __read_mostly = {
|
||||
.checkentry = xt_rateest_tg_checkentry,
|
||||
.destroy = xt_rateest_tg_destroy,
|
||||
.targetsize = sizeof(struct xt_rateest_target_info),
|
||||
.usersize = offsetof(struct xt_rateest_target_info, est),
|
||||
.me = THIS_MODULE,
|
||||
};
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ static struct xt_target tee_tg_reg[] __read_mostly = {
|
||||
.family = NFPROTO_IPV4,
|
||||
.target = tee_tg4,
|
||||
.targetsize = sizeof(struct xt_tee_tginfo),
|
||||
.usersize = offsetof(struct xt_tee_tginfo, priv),
|
||||
.checkentry = tee_tg_check,
|
||||
.destroy = tee_tg_destroy,
|
||||
.me = THIS_MODULE,
|
||||
@@ -138,6 +139,7 @@ static struct xt_target tee_tg_reg[] __read_mostly = {
|
||||
.family = NFPROTO_IPV6,
|
||||
.target = tee_tg6,
|
||||
.targetsize = sizeof(struct xt_tee_tginfo),
|
||||
.usersize = offsetof(struct xt_tee_tginfo, priv),
|
||||
.checkentry = tee_tg_check,
|
||||
.destroy = tee_tg_destroy,
|
||||
.me = THIS_MODULE,
|
||||
|
||||
@@ -60,6 +60,7 @@ static struct xt_match bpf_mt_reg __read_mostly = {
|
||||
.match = bpf_mt,
|
||||
.destroy = bpf_mt_destroy,
|
||||
.matchsize = sizeof(struct xt_bpf_info),
|
||||
.usersize = offsetof(struct xt_bpf_info, filter),
|
||||
.me = THIS_MODULE,
|
||||
};
|
||||
|
||||
|
||||
@@ -437,6 +437,7 @@ static struct xt_match connlimit_mt_reg __read_mostly = {
|
||||
.checkentry = connlimit_mt_check,
|
||||
.match = connlimit_mt,
|
||||
.matchsize = sizeof(struct xt_connlimit_info),
|
||||
.usersize = offsetof(struct xt_connlimit_info, data),
|
||||
.destroy = connlimit_mt_destroy,
|
||||
.me = THIS_MODULE,
|
||||
};
|
||||
|
||||
@@ -726,6 +726,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = {
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = hashlimit_mt,
|
||||
.matchsize = sizeof(struct xt_hashlimit_mtinfo1),
|
||||
.usersize = offsetof(struct xt_hashlimit_mtinfo1, hinfo),
|
||||
.checkentry = hashlimit_mt_check,
|
||||
.destroy = hashlimit_mt_destroy,
|
||||
.me = THIS_MODULE,
|
||||
@@ -737,6 +738,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = {
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = hashlimit_mt,
|
||||
.matchsize = sizeof(struct xt_hashlimit_mtinfo1),
|
||||
.usersize = offsetof(struct xt_hashlimit_mtinfo1, hinfo),
|
||||
.checkentry = hashlimit_mt_check,
|
||||
.destroy = hashlimit_mt_destroy,
|
||||
.me = THIS_MODULE,
|
||||
|
||||
@@ -192,6 +192,8 @@ static struct xt_match limit_mt_reg __read_mostly = {
|
||||
.compatsize = sizeof(struct compat_xt_rateinfo),
|
||||
.compat_from_user = limit_mt_compat_from_user,
|
||||
.compat_to_user = limit_mt_compat_to_user,
|
||||
#else
|
||||
.usersize = offsetof(struct xt_rateinfo, prev),
|
||||
#endif
|
||||
.me = THIS_MODULE,
|
||||
};
|
||||
|
||||
@@ -73,6 +73,7 @@ static struct xt_match quota_mt_reg __read_mostly = {
|
||||
.checkentry = quota_mt_check,
|
||||
.destroy = quota_mt_destroy,
|
||||
.matchsize = sizeof(struct xt_quota_info),
|
||||
.usersize = offsetof(struct xt_quota_info, master),
|
||||
.me = THIS_MODULE,
|
||||
};
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ static struct xt_match xt_rateest_mt_reg __read_mostly = {
|
||||
.checkentry = xt_rateest_mt_checkentry,
|
||||
.destroy = xt_rateest_mt_destroy,
|
||||
.matchsize = sizeof(struct xt_rateest_match_info),
|
||||
.usersize = offsetof(struct xt_rateest_match_info, est1),
|
||||
.me = THIS_MODULE,
|
||||
};
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ static struct xt_match xt_string_mt_reg __read_mostly = {
|
||||
.match = string_mt,
|
||||
.destroy = string_mt_destroy,
|
||||
.matchsize = sizeof(struct xt_string_info),
|
||||
.usersize = offsetof(struct xt_string_info, config),
|
||||
.me = THIS_MODULE,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user