Skip to content

Commit 11afbff

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
Pablo Neira Ayuso says: ==================== Netfilter updates for net-next The following patchset contains Netfilter updates for your net-next tree, mostly from Florian Westphal to sort out the lack of sufficient validation in x_tables and connlabel preparation patches to add nf_tables support. They are: 1) Ensure we don't go over the ruleset blob boundaries in mark_source_chains(). 2) Validate that target jumps land on an existing xt_entry. This extra sanitization comes with a performance penalty when loading the ruleset. 3) Introduce xt_check_entry_offsets() and use it from {arp,ip,ip6}tables. 4) Get rid of the smallish check_entry() functions in {arp,ip,ip6}tables. 5) Make sure the minimal possible target size in x_tables. 6) Similar to raspberrypi#3, add xt_compat_check_entry_offsets() for compat code. 7) Check that standard target size is valid. 8) More sanitization to ensure that the target_offset field is correct. 9) Add xt_check_entry_match() to validate that matches are well-formed. 10-12) Three patch to reduce the number of parameters in translate_compat_table() for {arp,ip,ip6}tables by using a container structure. 13) No need to return value from xt_compat_match_from_user(), so make it void. 14) Consolidate translate_table() so it can be used by compat code too. 15) Remove obsolete check for compat code, so we keep consistent with what was already removed in the native layout code (back in 2007). 16) Get rid of target jump validation from mark_source_chains(), obsoleted by raspberrypi#2. 17) Introduce xt_copy_counters_from_user() to consolidate counter copying, and use it from {arp,ip,ip6}tables. 18,22) Get rid of unnecessary explicit inlining in ctnetlink for dump functions. 19) Move nf_connlabel_match() to xt_connlabel. 20) Skip event notification if connlabel did not change. 21) Update of nf_connlabels_get() to make the upcoming nft connlabel support easier. 23) Remove spinlock to read protocol state field in conntrack. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 8d9ea16 + a163f2c commit 11afbff

13 files changed

Lines changed: 591 additions & 818 deletions

File tree

‎include/linux/netfilter/x_tables.h‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,18 @@ void xt_unregister_match(struct xt_match *target);
242242
int xt_register_matches(struct xt_match *match, unsigned int n);
243243
void xt_unregister_matches(struct xt_match *match, unsigned int n);
244244

245+
int xt_check_entry_offsets(const void *base, const char *elems,
246+
unsigned int target_offset,
247+
unsigned int next_offset);
248+
245249
int xt_check_match(struct xt_mtchk_param *, unsigned int size, u_int8_t proto,
246250
bool inv_proto);
247251
int xt_check_target(struct xt_tgchk_param *, unsigned int size, u_int8_t proto,
248252
bool inv_proto);
249253

254+
void *xt_copy_counters_from_user(const void __user *user, unsigned int len,
255+
struct xt_counters_info *info, bool compat);
256+
250257
struct xt_table *xt_register_table(struct net *net,
251258
const struct xt_table *table,
252259
struct xt_table_info *bootstrap,
@@ -480,7 +487,7 @@ void xt_compat_init_offsets(u_int8_t af, unsigned int number);
480487
int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
481488

482489
int xt_compat_match_offset(const struct xt_match *match);
483-
int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
490+
void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
484491
unsigned int *size);
485492
int xt_compat_match_to_user(const struct xt_entry_match *m,
486493
void __user **dstptr, unsigned int *size);
@@ -490,6 +497,9 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
490497
unsigned int *size);
491498
int xt_compat_target_to_user(const struct xt_entry_target *t,
492499
void __user **dstptr, unsigned int *size);
500+
int xt_compat_check_entry_offsets(const void *base, const char *elems,
501+
unsigned int target_offset,
502+
unsigned int next_offset);
493503

494504
#endif /* CONFIG_COMPAT */
495505
#endif /* _X_TABLES_H */

‎include/net/netfilter/nf_conntrack_labels.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ static inline struct nf_conn_labels *nf_ct_labels_ext_add(struct nf_conn *ct)
4545
#endif
4646
}
4747

48-
bool nf_connlabel_match(const struct nf_conn *ct, u16 bit);
4948
int nf_connlabel_set(struct nf_conn *ct, u16 bit);
5049

5150
int nf_connlabels_replace(struct nf_conn *ct,
@@ -54,11 +53,11 @@ int nf_connlabels_replace(struct nf_conn *ct,
5453
#ifdef CONFIG_NF_CONNTRACK_LABELS
5554
int nf_conntrack_labels_init(void);
5655
void nf_conntrack_labels_fini(void);
57-
int nf_connlabels_get(struct net *net, unsigned int n_bits);
56+
int nf_connlabels_get(struct net *net, unsigned int bit);
5857
void nf_connlabels_put(struct net *net);
5958
#else
6059
static inline int nf_conntrack_labels_init(void) { return 0; }
6160
static inline void nf_conntrack_labels_fini(void) {}
62-
static inline int nf_connlabels_get(struct net *net, unsigned int n_bits) { return 0; }
61+
static inline int nf_connlabels_get(struct net *net, unsigned int bit) { return 0; }
6362
static inline void nf_connlabels_put(struct net *net) {}
6463
#endif

0 commit comments

Comments
 (0)