From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Jesper Dangaard Brouer <brouer@redhat.com>,
bpf@vger.kernel.org
Cc: lkp@intel.com, kbuild-all@lists.01.org,
Jesper Dangaard Brouer <brouer@redhat.com>,
netdev@vger.kernel.org, Daniel Borkmann <borkmann@iogearbox.net>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
maze@google.com, lmb@cloudflare.com, shaun@tigera.io,
Lorenzo Bianconi <lorenzo@kernel.org>,
marek@cloudflare.com
Subject: Re: [PATCH bpf-next V4 2/5] bpf: bpf_fib_lookup return MTU value as output when looked up
Date: Wed, 28 Oct 2020 15:49:42 +0300 [thread overview]
Message-ID: <20201028124942.GE1042@kadam> (raw)
In-Reply-To: <160381601522.1435097.11103677488984953095.stgit@firesoul>
[-- Attachment #1: Type: text/plain, Size: 10543 bytes --]
Hi Jesper,
url: https://github.com/0day-ci/linux/commits/Jesper-Dangaard-Brouer/bpf-New-approach-for-BPF-MTU-handling/20201028-002919
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master
config: i386-randconfig-m021-20201026 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
net/core/filter.c:5395 bpf_ipv4_fib_lookup() error: uninitialized symbol 'mtu'.
vim +/mtu +5395 net/core/filter.c
87f5fc7e48dd317 David Ahern 2018-05-09 5281 static int bpf_ipv4_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
4f74fede40df8db David Ahern 2018-05-21 5282 u32 flags, bool check_mtu)
87f5fc7e48dd317 David Ahern 2018-05-09 5283 {
eba618abacade71 David Ahern 2019-04-02 5284 struct fib_nh_common *nhc;
87f5fc7e48dd317 David Ahern 2018-05-09 5285 struct in_device *in_dev;
87f5fc7e48dd317 David Ahern 2018-05-09 5286 struct neighbour *neigh;
87f5fc7e48dd317 David Ahern 2018-05-09 5287 struct net_device *dev;
87f5fc7e48dd317 David Ahern 2018-05-09 5288 struct fib_result res;
87f5fc7e48dd317 David Ahern 2018-05-09 5289 struct flowi4 fl4;
87f5fc7e48dd317 David Ahern 2018-05-09 5290 int err;
4f74fede40df8db David Ahern 2018-05-21 5291 u32 mtu;
^^^^^^^^
87f5fc7e48dd317 David Ahern 2018-05-09 5292
87f5fc7e48dd317 David Ahern 2018-05-09 5293 dev = dev_get_by_index_rcu(net, params->ifindex);
87f5fc7e48dd317 David Ahern 2018-05-09 5294 if (unlikely(!dev))
87f5fc7e48dd317 David Ahern 2018-05-09 5295 return -ENODEV;
87f5fc7e48dd317 David Ahern 2018-05-09 5296
87f5fc7e48dd317 David Ahern 2018-05-09 5297 /* verify forwarding is enabled on this interface */
87f5fc7e48dd317 David Ahern 2018-05-09 5298 in_dev = __in_dev_get_rcu(dev);
87f5fc7e48dd317 David Ahern 2018-05-09 5299 if (unlikely(!in_dev || !IN_DEV_FORWARD(in_dev)))
4c79579b44b1876 David Ahern 2018-06-26 5300 return BPF_FIB_LKUP_RET_FWD_DISABLED;
87f5fc7e48dd317 David Ahern 2018-05-09 5301
87f5fc7e48dd317 David Ahern 2018-05-09 5302 if (flags & BPF_FIB_LOOKUP_OUTPUT) {
87f5fc7e48dd317 David Ahern 2018-05-09 5303 fl4.flowi4_iif = 1;
87f5fc7e48dd317 David Ahern 2018-05-09 5304 fl4.flowi4_oif = params->ifindex;
87f5fc7e48dd317 David Ahern 2018-05-09 5305 } else {
87f5fc7e48dd317 David Ahern 2018-05-09 5306 fl4.flowi4_iif = params->ifindex;
87f5fc7e48dd317 David Ahern 2018-05-09 5307 fl4.flowi4_oif = 0;
87f5fc7e48dd317 David Ahern 2018-05-09 5308 }
87f5fc7e48dd317 David Ahern 2018-05-09 5309 fl4.flowi4_tos = params->tos & IPTOS_RT_MASK;
87f5fc7e48dd317 David Ahern 2018-05-09 5310 fl4.flowi4_scope = RT_SCOPE_UNIVERSE;
87f5fc7e48dd317 David Ahern 2018-05-09 5311 fl4.flowi4_flags = 0;
87f5fc7e48dd317 David Ahern 2018-05-09 5312
87f5fc7e48dd317 David Ahern 2018-05-09 5313 fl4.flowi4_proto = params->l4_protocol;
87f5fc7e48dd317 David Ahern 2018-05-09 5314 fl4.daddr = params->ipv4_dst;
87f5fc7e48dd317 David Ahern 2018-05-09 5315 fl4.saddr = params->ipv4_src;
87f5fc7e48dd317 David Ahern 2018-05-09 5316 fl4.fl4_sport = params->sport;
87f5fc7e48dd317 David Ahern 2018-05-09 5317 fl4.fl4_dport = params->dport;
1869e226a7b3ef7 David Ahern 2020-09-13 5318 fl4.flowi4_multipath_hash = 0;
87f5fc7e48dd317 David Ahern 2018-05-09 5319
87f5fc7e48dd317 David Ahern 2018-05-09 5320 if (flags & BPF_FIB_LOOKUP_DIRECT) {
87f5fc7e48dd317 David Ahern 2018-05-09 5321 u32 tbid = l3mdev_fib_table_rcu(dev) ? : RT_TABLE_MAIN;
87f5fc7e48dd317 David Ahern 2018-05-09 5322 struct fib_table *tb;
87f5fc7e48dd317 David Ahern 2018-05-09 5323
87f5fc7e48dd317 David Ahern 2018-05-09 5324 tb = fib_get_table(net, tbid);
87f5fc7e48dd317 David Ahern 2018-05-09 5325 if (unlikely(!tb))
4c79579b44b1876 David Ahern 2018-06-26 5326 return BPF_FIB_LKUP_RET_NOT_FWDED;
87f5fc7e48dd317 David Ahern 2018-05-09 5327
87f5fc7e48dd317 David Ahern 2018-05-09 5328 err = fib_table_lookup(tb, &fl4, &res, FIB_LOOKUP_NOREF);
87f5fc7e48dd317 David Ahern 2018-05-09 5329 } else {
87f5fc7e48dd317 David Ahern 2018-05-09 5330 fl4.flowi4_mark = 0;
87f5fc7e48dd317 David Ahern 2018-05-09 5331 fl4.flowi4_secid = 0;
87f5fc7e48dd317 David Ahern 2018-05-09 5332 fl4.flowi4_tun_key.tun_id = 0;
87f5fc7e48dd317 David Ahern 2018-05-09 5333 fl4.flowi4_uid = sock_net_uid(net, NULL);
87f5fc7e48dd317 David Ahern 2018-05-09 5334
87f5fc7e48dd317 David Ahern 2018-05-09 5335 err = fib_lookup(net, &fl4, &res, FIB_LOOKUP_NOREF);
87f5fc7e48dd317 David Ahern 2018-05-09 5336 }
87f5fc7e48dd317 David Ahern 2018-05-09 5337
4c79579b44b1876 David Ahern 2018-06-26 5338 if (err) {
4c79579b44b1876 David Ahern 2018-06-26 5339 /* map fib lookup errors to RTN_ type */
4c79579b44b1876 David Ahern 2018-06-26 5340 if (err == -EINVAL)
4c79579b44b1876 David Ahern 2018-06-26 5341 return BPF_FIB_LKUP_RET_BLACKHOLE;
4c79579b44b1876 David Ahern 2018-06-26 5342 if (err == -EHOSTUNREACH)
4c79579b44b1876 David Ahern 2018-06-26 5343 return BPF_FIB_LKUP_RET_UNREACHABLE;
4c79579b44b1876 David Ahern 2018-06-26 5344 if (err == -EACCES)
4c79579b44b1876 David Ahern 2018-06-26 5345 return BPF_FIB_LKUP_RET_PROHIBIT;
4c79579b44b1876 David Ahern 2018-06-26 5346
4c79579b44b1876 David Ahern 2018-06-26 5347 return BPF_FIB_LKUP_RET_NOT_FWDED;
4c79579b44b1876 David Ahern 2018-06-26 5348 }
4c79579b44b1876 David Ahern 2018-06-26 5349
4c79579b44b1876 David Ahern 2018-06-26 5350 if (res.type != RTN_UNICAST)
4c79579b44b1876 David Ahern 2018-06-26 5351 return BPF_FIB_LKUP_RET_NOT_FWDED;
87f5fc7e48dd317 David Ahern 2018-05-09 5352
5481d73f81549e2 David Ahern 2019-06-03 5353 if (fib_info_num_path(res.fi) > 1)
87f5fc7e48dd317 David Ahern 2018-05-09 5354 fib_select_path(net, &res, &fl4, NULL);
87f5fc7e48dd317 David Ahern 2018-05-09 5355
4f74fede40df8db David Ahern 2018-05-21 5356 if (check_mtu) {
4f74fede40df8db David Ahern 2018-05-21 5357 mtu = ip_mtu_from_fib_result(&res, params->ipv4_dst);
88ffc2c2e37ebb3 Jesper Dangaard Brouer 2020-10-27 5358 if (params->tot_len > mtu) {
88ffc2c2e37ebb3 Jesper Dangaard Brouer 2020-10-27 5359 params->mtu = mtu; /* union with tot_len */
4c79579b44b1876 David Ahern 2018-06-26 5360 return BPF_FIB_LKUP_RET_FRAG_NEEDED;
4f74fede40df8db David Ahern 2018-05-21 5361 }
88ffc2c2e37ebb3 Jesper Dangaard Brouer 2020-10-27 5362 }
"mtu" not initialized on else path.
4f74fede40df8db David Ahern 2018-05-21 5363
eba618abacade71 David Ahern 2019-04-02 5364 nhc = res.nhc;
87f5fc7e48dd317 David Ahern 2018-05-09 5365
87f5fc7e48dd317 David Ahern 2018-05-09 5366 /* do not handle lwt encaps right now */
eba618abacade71 David Ahern 2019-04-02 5367 if (nhc->nhc_lwtstate)
4c79579b44b1876 David Ahern 2018-06-26 5368 return BPF_FIB_LKUP_RET_UNSUPP_LWT;
87f5fc7e48dd317 David Ahern 2018-05-09 5369
eba618abacade71 David Ahern 2019-04-02 5370 dev = nhc->nhc_dev;
87f5fc7e48dd317 David Ahern 2018-05-09 5371
87f5fc7e48dd317 David Ahern 2018-05-09 5372 params->rt_metric = res.fi->fib_priority;
d1c362e1dd68a42 Toke Høiland-Jørgensen 2020-10-09 5373 params->ifindex = dev->ifindex;
87f5fc7e48dd317 David Ahern 2018-05-09 5374
87f5fc7e48dd317 David Ahern 2018-05-09 5375 /* xdp and cls_bpf programs are run in RCU-bh so
87f5fc7e48dd317 David Ahern 2018-05-09 5376 * rcu_read_lock_bh is not needed here
87f5fc7e48dd317 David Ahern 2018-05-09 5377 */
6f5f68d05ec0f64 David Ahern 2019-04-05 5378 if (likely(nhc->nhc_gw_family != AF_INET6)) {
6f5f68d05ec0f64 David Ahern 2019-04-05 5379 if (nhc->nhc_gw_family)
6f5f68d05ec0f64 David Ahern 2019-04-05 5380 params->ipv4_dst = nhc->nhc_gw.ipv4;
6f5f68d05ec0f64 David Ahern 2019-04-05 5381
6f5f68d05ec0f64 David Ahern 2019-04-05 5382 neigh = __ipv4_neigh_lookup_noref(dev,
6f5f68d05ec0f64 David Ahern 2019-04-05 5383 (__force u32)params->ipv4_dst);
6f5f68d05ec0f64 David Ahern 2019-04-05 5384 } else {
6f5f68d05ec0f64 David Ahern 2019-04-05 5385 struct in6_addr *dst = (struct in6_addr *)params->ipv6_dst;
6f5f68d05ec0f64 David Ahern 2019-04-05 5386
6f5f68d05ec0f64 David Ahern 2019-04-05 5387 params->family = AF_INET6;
6f5f68d05ec0f64 David Ahern 2019-04-05 5388 *dst = nhc->nhc_gw.ipv6;
6f5f68d05ec0f64 David Ahern 2019-04-05 5389 neigh = __ipv6_neigh_lookup_noref_stub(dev, dst);
6f5f68d05ec0f64 David Ahern 2019-04-05 5390 }
6f5f68d05ec0f64 David Ahern 2019-04-05 5391
4c79579b44b1876 David Ahern 2018-06-26 5392 if (!neigh)
4c79579b44b1876 David Ahern 2018-06-26 5393 return BPF_FIB_LKUP_RET_NO_NEIGH;
87f5fc7e48dd317 David Ahern 2018-05-09 5394
88ffc2c2e37ebb3 Jesper Dangaard Brouer 2020-10-27 @5395 return bpf_fib_set_fwd_params(params, neigh, dev, mtu);
^^^
Uninitialized variable warning.
87f5fc7e48dd317 David Ahern 2018-05-09 5396 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39749 bytes --]
next prev parent reply other threads:[~2020-10-28 21:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 16:26 [PATCH bpf-next V4 0/5] bpf: New approach for BPF MTU handling Jesper Dangaard Brouer
2020-10-27 16:26 ` [PATCH bpf-next V4 1/5] bpf: Remove MTU check in __bpf_skb_max_len Jesper Dangaard Brouer
2020-10-30 19:24 ` John Fastabend
2020-10-27 16:26 ` [PATCH bpf-next V4 2/5] bpf: bpf_fib_lookup return MTU value as output when looked up Jesper Dangaard Brouer
2020-10-27 17:15 ` David Ahern
2020-10-30 17:01 ` Jesper Dangaard Brouer
2020-10-28 12:49 ` Dan Carpenter [this message]
2020-10-30 14:35 ` Jesper Dangaard Brouer
2020-10-27 16:27 ` [PATCH bpf-next V4 3/5] bpf: add BPF-helper for MTU checking Jesper Dangaard Brouer
2020-10-27 16:27 ` [PATCH bpf-next V4 4/5] bpf: drop MTU check when doing TC-BPF redirect to ingress Jesper Dangaard Brouer
2020-10-27 16:27 ` [PATCH bpf-next V4 5/5] bpf: make it possible to identify BPF redirected SKBs Jesper Dangaard Brouer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201028124942.GE1042@kadam \
--to=dan.carpenter@oracle.com \
--cc=alexei.starovoitov@gmail.com \
--cc=borkmann@iogearbox.net \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=lkp@intel.com \
--cc=lmb@cloudflare.com \
--cc=lorenzo@kernel.org \
--cc=marek@cloudflare.com \
--cc=maze@google.com \
--cc=netdev@vger.kernel.org \
--cc=shaun@tigera.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).