* net/netfilter/nft_synproxy.c:51:40: sparse: sparse: cast to non-scalar
@ 2026-03-08 12:21 kernel test robot
2026-03-08 19:15 ` Fernando Fernandez Mancera
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-03-08 12:21 UTC (permalink / raw)
To: Fernando Fernandez Mancera; +Cc: oe-kbuild-all, linux-kernel, Florian Westphal
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c23719abc3308df7ed3ad35650ad211fb2d2003d
commit: 36a3200575642846a96436d503d46544533bb943 netfilter: nft_synproxy: avoid possible data-race on update operation
date: 9 weeks ago
config: alpha-randconfig-r132-20260308 (https://download.01.org/0day-ci/archive/20260308/202603082002.ACHbGTsI-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 8.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260308/202603082002.ACHbGTsI-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/202603082002.ACHbGTsI-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> net/netfilter/nft_synproxy.c:51:40: sparse: sparse: cast to non-scalar
>> net/netfilter/nft_synproxy.c:51:40: sparse: sparse: cast from non-scalar
net/netfilter/nft_synproxy.c:82:40: sparse: sparse: cast to non-scalar
net/netfilter/nft_synproxy.c:82:40: sparse: sparse: cast from non-scalar
vim +51 net/netfilter/nft_synproxy.c
43
44 static void nft_synproxy_eval_v4(const struct nft_synproxy *priv,
45 struct nft_regs *regs,
46 const struct nft_pktinfo *pkt,
47 const struct tcphdr *tcp,
48 struct tcphdr *_tcph,
49 struct synproxy_options *opts)
50 {
> 51 struct nf_synproxy_info info = READ_ONCE(priv->info);
52 struct net *net = nft_net(pkt);
53 struct synproxy_net *snet = synproxy_pernet(net);
54 struct sk_buff *skb = pkt->skb;
55
56 if (tcp->syn) {
57 /* Initial SYN from client */
58 nft_synproxy_tcp_options(opts, tcp, snet, &info, priv);
59 synproxy_send_client_synack(net, skb, tcp, opts);
60 consume_skb(skb);
61 regs->verdict.code = NF_STOLEN;
62 } else if (tcp->ack) {
63 /* ACK from client */
64 if (synproxy_recv_client_ack(net, skb, tcp, opts,
65 ntohl(tcp->seq))) {
66 consume_skb(skb);
67 regs->verdict.code = NF_STOLEN;
68 } else {
69 regs->verdict.code = NF_DROP;
70 }
71 }
72 }
73
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: net/netfilter/nft_synproxy.c:51:40: sparse: sparse: cast to non-scalar
2026-03-08 12:21 net/netfilter/nft_synproxy.c:51:40: sparse: sparse: cast to non-scalar kernel test robot
@ 2026-03-08 19:15 ` Fernando Fernandez Mancera
2026-03-09 21:46 ` Florian Westphal
0 siblings, 1 reply; 3+ messages in thread
From: Fernando Fernandez Mancera @ 2026-03-08 19:15 UTC (permalink / raw)
To: kernel test robot; +Cc: oe-kbuild-all, linux-kernel, Florian Westphal
On 3/8/26 1:21 PM, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: c23719abc3308df7ed3ad35650ad211fb2d2003d
> commit: 36a3200575642846a96436d503d46544533bb943 netfilter: nft_synproxy: avoid possible data-race on update operation
> date: 9 weeks ago
> config: alpha-randconfig-r132-20260308 (https://download.01.org/0day-ci/archive/20260308/202603082002.ACHbGTsI-lkp@intel.com/config)
> compiler: alpha-linux-gcc (GCC) 8.5.0
> sparse: v0.6.5-rc1
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260308/202603082002.ACHbGTsI-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/202603082002.ACHbGTsI-lkp@intel.com/
>
> sparse warnings: (new ones prefixed by >>)
>>> net/netfilter/nft_synproxy.c:51:40: sparse: sparse: cast to non-scalar
>>> net/netfilter/nft_synproxy.c:51:40: sparse: sparse: cast from non-scalar
> net/netfilter/nft_synproxy.c:82:40: sparse: sparse: cast to non-scalar
> net/netfilter/nft_synproxy.c:82:40: sparse: sparse: cast from non-scalar
>
Hi,
Is this a false positive? nf_synproxy_info struct is smaller than the
word size and therefore READ_ONCE() should be fine. I guess I can use
READ_ONCE() for every struct field.
What do you think Florian?
Thanks,
Fernando.
> vim +51 net/netfilter/nft_synproxy.c
>
> 43
> 44 static void nft_synproxy_eval_v4(const struct nft_synproxy *priv,
> 45 struct nft_regs *regs,
> 46 const struct nft_pktinfo *pkt,
> 47 const struct tcphdr *tcp,
> 48 struct tcphdr *_tcph,
> 49 struct synproxy_options *opts)
> 50 {
> > 51 struct nf_synproxy_info info = READ_ONCE(priv->info);
> 52 struct net *net = nft_net(pkt);
> 53 struct synproxy_net *snet = synproxy_pernet(net);
> 54 struct sk_buff *skb = pkt->skb;
> 55
> 56 if (tcp->syn) {
> 57 /* Initial SYN from client */
> 58 nft_synproxy_tcp_options(opts, tcp, snet, &info, priv);
> 59 synproxy_send_client_synack(net, skb, tcp, opts);
> 60 consume_skb(skb);
> 61 regs->verdict.code = NF_STOLEN;
> 62 } else if (tcp->ack) {
> 63 /* ACK from client */
> 64 if (synproxy_recv_client_ack(net, skb, tcp, opts,
> 65 ntohl(tcp->seq))) {
> 66 consume_skb(skb);
> 67 regs->verdict.code = NF_STOLEN;
> 68 } else {
> 69 regs->verdict.code = NF_DROP;
> 70 }
> 71 }
> 72 }
> 73
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: net/netfilter/nft_synproxy.c:51:40: sparse: sparse: cast to non-scalar
2026-03-08 19:15 ` Fernando Fernandez Mancera
@ 2026-03-09 21:46 ` Florian Westphal
0 siblings, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2026-03-09 21:46 UTC (permalink / raw)
To: Fernando Fernandez Mancera; +Cc: kernel test robot, oe-kbuild-all, linux-kernel
Fernando Fernandez Mancera <fmancera@suse.de> wrote:
> Hi,
>
> Is this a false positive? nf_synproxy_info struct is smaller than the
> word size and therefore READ_ONCE() should be fine. I guess I can use
> READ_ONCE() for every struct field.
>
> What do you think Florian?
We shouldn't do per-field accesses here, but one, single READ so
the datapath sees all new fields or the old ones, and no mix of the
two (albeit that would be harmless here).
Can you experiment with a cast to u32 to get rid if the warning?
That said, we have so many sparse warnings that getting rid of this
warning isn't high-prio, I think the code is fine as-is.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-09 21:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-08 12:21 net/netfilter/nft_synproxy.c:51:40: sparse: sparse: cast to non-scalar kernel test robot
2026-03-08 19:15 ` Fernando Fernandez Mancera
2026-03-09 21:46 ` Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox