Message ID | 20231005115022.12902-1-xiaolinkui@126.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | netfilter: ipset: wait for xt_recseq on all cpus | expand |
xiaolinkui <xiaolinkui@126.com> wrote: > crash> struct seqcount_t ffff8003fff3bf88 > struct seqcount_t { > sequence = 804411271 > } > > The seqcount of CPU7 is odd, xt_replace_table should have waited, but it > didn't. Likely missing backport of 175e476b8cdf ("netfilter: x_tables: Use correct memory barriers.")?
Hi xiaolinkui,
kernel test robot noticed the following build errors:
[auto build test ERROR on netfilter-nf/main]
[also build test ERROR on nf-next/master horms-ipvs/master linus/master v6.6-rc6 next-20231016]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/xiaolinkui/netfilter-ipset-wait-for-xt_recseq-on-all-cpus/20231005-234042
base: git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git main
patch link: https://lore.kernel.org/r/20231005115022.12902-1-xiaolinkui%40126.com
patch subject: [PATCH] netfilter: ipset: wait for xt_recseq on all cpus
config: x86_64-buildonly-randconfig-006-20231016 (https://download.01.org/0day-ci/archive/20231016/202310161625.GDDBP8SZ-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231016/202310161625.GDDBP8SZ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310161625.GDDBP8SZ-lkp@intel.com/
All errors (new ones prefixed by >>):
ld: vmlinux.o: in function `wait_xt_recseq':
>> ip_set_core.c:(.text+0x1c561ac): undefined reference to `xt_recseq'
Hi xiaolinkui, kernel test robot noticed the following build errors: [auto build test ERROR on netfilter-nf/main] [also build test ERROR on nf-next/master horms-ipvs/master linus/master v6.6-rc6 next-20231016] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/xiaolinkui/netfilter-ipset-wait-for-xt_recseq-on-all-cpus/20231005-234042 base: git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git main patch link: https://lore.kernel.org/r/20231005115022.12902-1-xiaolinkui%40126.com patch subject: [PATCH] netfilter: ipset: wait for xt_recseq on all cpus config: i386-randconfig-016-20231016 (https://download.01.org/0day-ci/archive/20231016/202310161728.mW3lt1Jl-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231016/202310161728.mW3lt1Jl-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202310161728.mW3lt1Jl-lkp@intel.com/ All errors (new ones prefixed by >>): ld: net/netfilter/ipset/ip_set_core.o: in function `wait_xt_recseq': >> net/netfilter/ipset/ip_set_core.c:1194: undefined reference to `xt_recseq' vim +1194 net/netfilter/ipset/ip_set_core.c 1187 1188 static void wait_xt_recseq(void) 1189 { 1190 unsigned int cpu; 1191 1192 /* wait for even xt_recseq on all cpus */ 1193 for_each_possible_cpu(cpu) { > 1194 seqcount_t *s = &per_cpu(xt_recseq, cpu); 1195 u32 seq = raw_read_seqcount(s); 1196 1197 if (seq & 1) { 1198 do { 1199 cond_resched(); 1200 cpu_relax(); 1201 } while (seq == raw_read_seqcount(s)); 1202 } 1203 } 1204 } 1205
Hello, Besides the broken patch, the description simply cannot be true: "Before destroying the ipset, take a check on sequence to ensure that the ip_set_test operation of this ipset has been completed." Set can only be destroyed when there is no iptables rule (match/target) which refers to it. If this condition is not true, then the real reason must be fixed. How can one reproduce the issue? Best regards, Jozsef On Mon, 16 Oct 2023, kernel test robot wrote: > Hi xiaolinkui, > > kernel test robot noticed the following build errors: > > [auto build test ERROR on netfilter-nf/main] > [also build test ERROR on nf-next/master horms-ipvs/master linus/master v6.6-rc6 next-20231016] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/xiaolinkui/netfilter-ipset-wait-for-xt_recseq-on-all-cpus/20231005-234042 > base: git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git main > patch link: https://lore.kernel.org/r/20231005115022.12902-1-xiaolinkui%40126.com > patch subject: [PATCH] netfilter: ipset: wait for xt_recseq on all cpus > config: x86_64-buildonly-randconfig-006-20231016 (https://download.01.org/0day-ci/archive/20231016/202310161625.GDDBP8SZ-lkp@intel.com/config) > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231016/202310161625.GDDBP8SZ-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202310161625.GDDBP8SZ-lkp@intel.com/ > > All errors (new ones prefixed by >>): > > ld: vmlinux.o: in function `wait_xt_recseq': > >> ip_set_core.c:(.text+0x1c561ac): undefined reference to `xt_recseq' > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki >
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index 46f4f47e29e4..53561176162f 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c @@ -1187,6 +1187,24 @@ ip_set_destroy_set(struct ip_set *set) kfree(set); } +static void wait_xt_recseq(void) +{ + unsigned int cpu; + + /* wait for even xt_recseq on all cpus */ + for_each_possible_cpu(cpu) { + seqcount_t *s = &per_cpu(xt_recseq, cpu); + u32 seq = raw_read_seqcount(s); + + if (seq & 1) { + do { + cond_resched(); + cpu_relax(); + } while (seq == raw_read_seqcount(s)); + } + } +} + static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr * const attr[]) { @@ -1225,6 +1243,7 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, for (i = 0; i < inst->ip_set_max; i++) { s = ip_set(inst, i); if (s) { + wait_xt_recseq(); ip_set(inst, i) = NULL; ip_set_destroy_set(s); } @@ -1243,6 +1262,7 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, ret = -IPSET_ERR_BUSY; goto out; } + wait_xt_recseq(); ip_set(inst, i) = NULL; read_unlock_bh(&ip_set_ref_lock);