* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
@ 2021-08-30 17:43 kernel test robot
2021-08-31 7:48 ` kernel test robot
0 siblings, 1 reply; 13+ messages in thread
From: kernel test robot @ 2021-08-30 17:43 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 16586 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210829221615.2057201-3-eric.dumazet@gmail.com>
References: <20210829221615.2057201-3-eric.dumazet@gmail.com>
TO: Eric Dumazet <eric.dumazet@gmail.com>
TO: "David S . Miller" <davem@davemloft.net>
TO: Jakub Kicinski <kuba@kernel.org>
CC: netdev <netdev@vger.kernel.org>
CC: Eric Dumazet <edumazet@google.com>
CC: Willy Tarreau <w@1wt.eu>
CC: Keyu Man <kman001@ucr.edu>
CC: David Ahern <dsahern@kernel.org>
Hi Eric,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net/master]
url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
:::::: branch date: 19 hours ago
:::::: commit date: 19 hours ago
config: x86_64-randconfig-c007-20210830 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/adf305d00ec06cb771dc960f0d7bd62d07561371
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
git checkout adf305d00ec06cb771dc960f0d7bd62d07561371
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^~~~~~~~~~~~~~~~~~~~~
net/ipv6/addrconf.c:3543:4: note: Taking false branch
if (!IS_ERR_OR_NULL(idev)) {
^
net/ipv6/addrconf.c:3577:3: note: Control jumps to the 'default' case at line 3592
switch (dev->type) {
^
net/ipv6/addrconf.c:3594:4: note: Execution continues on line 3597
break;
^
net/ipv6/addrconf.c:3597:7: note: Assuming the condition is true
if (!IS_ERR_OR_NULL(idev)) {
^~~~~~~~~~~~~~~~~~~~~
net/ipv6/addrconf.c:3597:3: note: Taking true branch
if (!IS_ERR_OR_NULL(idev)) {
^
net/ipv6/addrconf.c:3598:8: note: 'run_pending' is 0
if (run_pending)
^~~~~~~~~~~
net/ipv6/addrconf.c:3598:4: note: Taking false branch
if (run_pending)
^
net/ipv6/addrconf.c:3609:8: note: Dereference of null pointer
if (idev->cnf.mtu6 != dev->mtu &&
^~~~~~~~~~~~~~
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
15 warnings generated.
net/ipv6/sit.c:275:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(parms->name, dev->name);
^~~~~~
net/ipv6/sit.c:275:3: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(parms->name, dev->name);
^~~~~~
net/ipv6/sit.c:339:4: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = -ENOMEM;
^ ~~~~~~~
net/ipv6/sit.c:339:4: note: Value stored to 'ret' is never read
ret = -ENOMEM;
^ ~~~~~~~
net/ipv6/sit.c:1451:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(tunnel->parms.name, dev->name);
^~~~~~
net/ipv6/sit.c:1451:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(tunnel->parms.name, dev->name);
^~~~~~
net/ipv6/sit.c:1930:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(t->parms.name, sitn->fb_tunnel_dev->name);
^~~~~~
net/ipv6/sit.c:1930:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(t->parms.name, sitn->fb_tunnel_dev->name);
^~~~~~
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
14 warnings generated.
>> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
rt = rcu_dereference(fnhe->fnhe_rth_input);
^
include/linux/rcupdate.h:596:28: note: expanded from macro 'rcu_dereference'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^
include/linux/rcupdate.h:528:2: note: expanded from macro 'rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^
include/linux/rcupdate.h:389:48: note: expanded from macro '__rcu_dereference_check'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
include/asm-generic/rwonce.h:50:2: note: expanded from macro 'READ_ONCE'
__READ_ONCE(x); \
^
include/asm-generic/rwonce.h:44:24: note: expanded from macro '__READ_ONCE'
#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
^
net/ipv4/route.c:592:34: note: 'oldest' initialized to a null pointer value
struct fib_nh_exception *fnhe, *oldest = NULL;
^~~~~~
net/ipv4/route.c:594:2: note: Loop condition is true. Entering loop body
for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
^
net/ipv4/route.c:595:10: note: Assuming the condition is false
fnhe = rcu_dereference_protected(*fnhe_p,
^
include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
__rcu_dereference_protected((p), (c), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:396:19: note: expanded from macro '__rcu_dereference_protected'
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:318:8: note: expanded from macro 'RCU_LOCKDEP_WARN'
if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
^
net/ipv4/route.c:595:10: note: Left side of '&&' is false
fnhe = rcu_dereference_protected(*fnhe_p,
^
include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
__rcu_dereference_protected((p), (c), __rcu)
^
include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
^
include/linux/rcupdate.h:318:11: note: expanded from macro 'RCU_LOCKDEP_WARN'
if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
^
net/ipv4/route.c:595:10: note: Loop condition is false. Exiting loop
fnhe = rcu_dereference_protected(*fnhe_p,
^
include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
__rcu_dereference_protected((p), (c), __rcu)
^
include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
^
include/linux/rcupdate.h:316:2: note: expanded from macro 'RCU_LOCKDEP_WARN'
do { \
^
net/ipv4/route.c:597:7: note: Assuming 'fnhe' is null
if (!fnhe)
^~~~~
net/ipv4/route.c:597:3: note: Taking true branch
if (!fnhe)
^
net/ipv4/route.c:598:4: note: Execution continues on line 605
break;
^
net/ipv4/route.c:605:20: note: Passing null pointer value via 1st parameter 'fnhe'
fnhe_flush_routes(oldest);
^~~~~~
net/ipv4/route.c:605:2: note: Calling 'fnhe_flush_routes'
fnhe_flush_routes(oldest);
^~~~~~~~~~~~~~~~~~~~~~~~~
net/ipv4/route.c:575:7: note: Left side of '||' is false
rt = rcu_dereference(fnhe->fnhe_rth_input);
^
include/linux/rcupdate.h:596:28: note: expanded from macro 'rcu_dereference'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^
include/linux/rcupdate.h:528:2: note: expanded from macro 'rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^
include/linux/rcupdate.h:389:48: note: expanded from macro '__rcu_dereference_check'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
net/ipv4/route.c:575:7: note: Left side of '||' is false
rt = rcu_dereference(fnhe->fnhe_rth_input);
^
include/linux/rcupdate.h:596:28: note: expanded from macro 'rcu_dereference'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
vim +575 net/ipv4/route.c
4895c771c7f006 David S. Miller 2012-07-17 570
2ffae99d1fac27 Timo Teräs 2013-06-27 571 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
2ffae99d1fac27 Timo Teräs 2013-06-27 572 {
2ffae99d1fac27 Timo Teräs 2013-06-27 573 struct rtable *rt;
2ffae99d1fac27 Timo Teräs 2013-06-27 574
2ffae99d1fac27 Timo Teräs 2013-06-27 @575 rt = rcu_dereference(fnhe->fnhe_rth_input);
2ffae99d1fac27 Timo Teräs 2013-06-27 576 if (rt) {
2ffae99d1fac27 Timo Teräs 2013-06-27 577 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
95c47f9cf5e028 Wei Wang 2017-06-17 578 dst_dev_put(&rt->dst);
0830106c539001 Wei Wang 2017-06-17 579 dst_release(&rt->dst);
2ffae99d1fac27 Timo Teräs 2013-06-27 580 }
2ffae99d1fac27 Timo Teräs 2013-06-27 581 rt = rcu_dereference(fnhe->fnhe_rth_output);
2ffae99d1fac27 Timo Teräs 2013-06-27 582 if (rt) {
2ffae99d1fac27 Timo Teräs 2013-06-27 583 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
95c47f9cf5e028 Wei Wang 2017-06-17 584 dst_dev_put(&rt->dst);
0830106c539001 Wei Wang 2017-06-17 585 dst_release(&rt->dst);
2ffae99d1fac27 Timo Teräs 2013-06-27 586 }
2ffae99d1fac27 Timo Teräs 2013-06-27 587 }
2ffae99d1fac27 Timo Teräs 2013-06-27 588
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27600 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
2021-08-30 17:43 [PATCH net 2/2] ipv4: make exception cache less predictible kernel test robot
@ 2021-08-31 7:48 ` kernel test robot
0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2021-08-31 7:48 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski
Cc: llvm, kbuild-all, netdev, Eric Dumazet, Willy Tarreau, Keyu Man,
David Ahern
[-- Attachment #1: Type: text/plain, Size: 6438 bytes --]
Hi Eric,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net/master]
url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
:::::: branch date: 19 hours ago
:::::: commit date: 19 hours ago
config: x86_64-randconfig-c007-20210830 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/adf305d00ec06cb771dc960f0d7bd62d07561371
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
git checkout adf305d00ec06cb771dc960f0d7bd62d07561371
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
>> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
rt = rcu_dereference(fnhe->fnhe_rth_input);
^
net/ipv4/route.c:592:34: note: 'oldest' initialized to a null pointer value
struct fib_nh_exception *fnhe, *oldest = NULL;
^~~~~~
net/ipv4/route.c:594:2: note: Loop condition is true. Entering loop body
for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
^
net/ipv4/route.c:595:10: note: Assuming the condition is false
fnhe = rcu_dereference_protected(*fnhe_p,
^
include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
__rcu_dereference_protected((p), (c), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:396:19: note: expanded from macro '__rcu_dereference_protected'
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:318:8: note: expanded from macro 'RCU_LOCKDEP_WARN'
if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
^
net/ipv4/route.c:595:10: note: Left side of '&&' is false
fnhe = rcu_dereference_protected(*fnhe_p,
^
include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
__rcu_dereference_protected((p), (c), __rcu)
^
include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
^
include/linux/rcupdate.h:318:11: note: expanded from macro 'RCU_LOCKDEP_WARN'
if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
^
net/ipv4/route.c:595:10: note: Loop condition is false. Exiting loop
fnhe = rcu_dereference_protected(*fnhe_p,
^
include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
__rcu_dereference_protected((p), (c), __rcu)
^
include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
^
include/linux/rcupdate.h:316:2: note: expanded from macro 'RCU_LOCKDEP_WARN'
do { \
^
net/ipv4/route.c:597:7: note: Assuming 'fnhe' is null
if (!fnhe)
^~~~~
net/ipv4/route.c:597:3: note: Taking true branch
if (!fnhe)
^
net/ipv4/route.c:598:4: note: Execution continues on line 605
break;
^
net/ipv4/route.c:605:20: note: Passing null pointer value via 1st parameter 'fnhe'
fnhe_flush_routes(oldest);
^~~~~~
net/ipv4/route.c:605:2: note: Calling 'fnhe_flush_routes'
fnhe_flush_routes(oldest);
^~~~~~~~~~~~~~~~~~~~~~~~~
net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
rt = rcu_dereference(fnhe->fnhe_rth_input);
^
vim +575 net/ipv4/route.c
4895c771c7f006 David S. Miller 2012-07-17 570
2ffae99d1fac27 Timo Teräs 2013-06-27 571 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
2ffae99d1fac27 Timo Teräs 2013-06-27 572 {
2ffae99d1fac27 Timo Teräs 2013-06-27 573 struct rtable *rt;
2ffae99d1fac27 Timo Teräs 2013-06-27 574
2ffae99d1fac27 Timo Teräs 2013-06-27 @575 rt = rcu_dereference(fnhe->fnhe_rth_input);
2ffae99d1fac27 Timo Teräs 2013-06-27 576 if (rt) {
2ffae99d1fac27 Timo Teräs 2013-06-27 577 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
95c47f9cf5e028 Wei Wang 2017-06-17 578 dst_dev_put(&rt->dst);
0830106c539001 Wei Wang 2017-06-17 579 dst_release(&rt->dst);
2ffae99d1fac27 Timo Teräs 2013-06-27 580 }
2ffae99d1fac27 Timo Teräs 2013-06-27 581 rt = rcu_dereference(fnhe->fnhe_rth_output);
2ffae99d1fac27 Timo Teräs 2013-06-27 582 if (rt) {
2ffae99d1fac27 Timo Teräs 2013-06-27 583 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
95c47f9cf5e028 Wei Wang 2017-06-17 584 dst_dev_put(&rt->dst);
0830106c539001 Wei Wang 2017-06-17 585 dst_release(&rt->dst);
2ffae99d1fac27 Timo Teräs 2013-06-27 586 }
2ffae99d1fac27 Timo Teräs 2013-06-27 587 }
2ffae99d1fac27 Timo Teräs 2013-06-27 588
---
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: 27600 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
@ 2021-08-31 7:48 ` kernel test robot
0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2021-08-31 7:48 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6558 bytes --]
Hi Eric,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net/master]
url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
:::::: branch date: 19 hours ago
:::::: commit date: 19 hours ago
config: x86_64-randconfig-c007-20210830 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/adf305d00ec06cb771dc960f0d7bd62d07561371
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
git checkout adf305d00ec06cb771dc960f0d7bd62d07561371
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
>> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
rt = rcu_dereference(fnhe->fnhe_rth_input);
^
net/ipv4/route.c:592:34: note: 'oldest' initialized to a null pointer value
struct fib_nh_exception *fnhe, *oldest = NULL;
^~~~~~
net/ipv4/route.c:594:2: note: Loop condition is true. Entering loop body
for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
^
net/ipv4/route.c:595:10: note: Assuming the condition is false
fnhe = rcu_dereference_protected(*fnhe_p,
^
include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
__rcu_dereference_protected((p), (c), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:396:19: note: expanded from macro '__rcu_dereference_protected'
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:318:8: note: expanded from macro 'RCU_LOCKDEP_WARN'
if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
^
net/ipv4/route.c:595:10: note: Left side of '&&' is false
fnhe = rcu_dereference_protected(*fnhe_p,
^
include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
__rcu_dereference_protected((p), (c), __rcu)
^
include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
^
include/linux/rcupdate.h:318:11: note: expanded from macro 'RCU_LOCKDEP_WARN'
if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
^
net/ipv4/route.c:595:10: note: Loop condition is false. Exiting loop
fnhe = rcu_dereference_protected(*fnhe_p,
^
include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
__rcu_dereference_protected((p), (c), __rcu)
^
include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
^
include/linux/rcupdate.h:316:2: note: expanded from macro 'RCU_LOCKDEP_WARN'
do { \
^
net/ipv4/route.c:597:7: note: Assuming 'fnhe' is null
if (!fnhe)
^~~~~
net/ipv4/route.c:597:3: note: Taking true branch
if (!fnhe)
^
net/ipv4/route.c:598:4: note: Execution continues on line 605
break;
^
net/ipv4/route.c:605:20: note: Passing null pointer value via 1st parameter 'fnhe'
fnhe_flush_routes(oldest);
^~~~~~
net/ipv4/route.c:605:2: note: Calling 'fnhe_flush_routes'
fnhe_flush_routes(oldest);
^~~~~~~~~~~~~~~~~~~~~~~~~
net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
rt = rcu_dereference(fnhe->fnhe_rth_input);
^
vim +575 net/ipv4/route.c
4895c771c7f006 David S. Miller 2012-07-17 570
2ffae99d1fac27 Timo Teräs 2013-06-27 571 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
2ffae99d1fac27 Timo Teräs 2013-06-27 572 {
2ffae99d1fac27 Timo Teräs 2013-06-27 573 struct rtable *rt;
2ffae99d1fac27 Timo Teräs 2013-06-27 574
2ffae99d1fac27 Timo Teräs 2013-06-27 @575 rt = rcu_dereference(fnhe->fnhe_rth_input);
2ffae99d1fac27 Timo Teräs 2013-06-27 576 if (rt) {
2ffae99d1fac27 Timo Teräs 2013-06-27 577 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
95c47f9cf5e028 Wei Wang 2017-06-17 578 dst_dev_put(&rt->dst);
0830106c539001 Wei Wang 2017-06-17 579 dst_release(&rt->dst);
2ffae99d1fac27 Timo Teräs 2013-06-27 580 }
2ffae99d1fac27 Timo Teräs 2013-06-27 581 rt = rcu_dereference(fnhe->fnhe_rth_output);
2ffae99d1fac27 Timo Teräs 2013-06-27 582 if (rt) {
2ffae99d1fac27 Timo Teräs 2013-06-27 583 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
95c47f9cf5e028 Wei Wang 2017-06-17 584 dst_dev_put(&rt->dst);
0830106c539001 Wei Wang 2017-06-17 585 dst_release(&rt->dst);
2ffae99d1fac27 Timo Teräs 2013-06-27 586 }
2ffae99d1fac27 Timo Teräs 2013-06-27 587 }
2ffae99d1fac27 Timo Teräs 2013-06-27 588
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27600 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
2021-08-31 7:48 ` kernel test robot
(?)
@ 2021-08-31 15:13 ` Eric Dumazet
-1 siblings, 0 replies; 13+ messages in thread
From: Eric Dumazet @ 2021-08-31 15:13 UTC (permalink / raw)
To: kernel test robot
Cc: Eric Dumazet, David S . Miller, Jakub Kicinski, llvm, kbuild-all,
netdev, Willy Tarreau, Keyu Man, David Ahern
Honestly this report seems wrong to me.
Please kernel test robot, improve your automation.
The function is only called when we know there are at least 6 items in
the list, I do not think you took this into account.
On Tue, Aug 31, 2021 at 12:48 AM kernel test robot <yujie.liu@intel.com> wrote:
>
> Hi Eric,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on net/master]
>
> url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
> base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
> :::::: branch date: 19 hours ago
> :::::: commit date: 19 hours ago
> config: x86_64-randconfig-c007-20210830 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/0day-ci/linux/commit/adf305d00ec06cb771dc960f0d7bd62d07561371
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
> git checkout adf305d00ec06cb771dc960f0d7bd62d07561371
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> clang-analyzer warnings: (new ones prefixed by >>)
>
> >> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
> rt = rcu_dereference(fnhe->fnhe_rth_input);
> ^
> net/ipv4/route.c:592:34: note: 'oldest' initialized to a null pointer value
> struct fib_nh_exception *fnhe, *oldest = NULL;
> ^~~~~~
> net/ipv4/route.c:594:2: note: Loop condition is true. Entering loop body
> for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
> ^
> net/ipv4/route.c:595:10: note: Assuming the condition is false
> fnhe = rcu_dereference_protected(*fnhe_p,
> ^
> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
> __rcu_dereference_protected((p), (c), __rcu)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/rcupdate.h:396:19: note: expanded from macro '__rcu_dereference_protected'
> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
> ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/rcupdate.h:318:8: note: expanded from macro 'RCU_LOCKDEP_WARN'
> if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
> ^
> net/ipv4/route.c:595:10: note: Left side of '&&' is false
> fnhe = rcu_dereference_protected(*fnhe_p,
> ^
> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
> __rcu_dereference_protected((p), (c), __rcu)
> ^
> include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
> ^
> include/linux/rcupdate.h:318:11: note: expanded from macro 'RCU_LOCKDEP_WARN'
> if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
> ^
> net/ipv4/route.c:595:10: note: Loop condition is false. Exiting loop
> fnhe = rcu_dereference_protected(*fnhe_p,
> ^
> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
> __rcu_dereference_protected((p), (c), __rcu)
> ^
> include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
> ^
> include/linux/rcupdate.h:316:2: note: expanded from macro 'RCU_LOCKDEP_WARN'
> do { \
> ^
> net/ipv4/route.c:597:7: note: Assuming 'fnhe' is null
> if (!fnhe)
> ^~~~~
> net/ipv4/route.c:597:3: note: Taking true branch
> if (!fnhe)
> ^
> net/ipv4/route.c:598:4: note: Execution continues on line 605
> break;
> ^
> net/ipv4/route.c:605:20: note: Passing null pointer value via 1st parameter 'fnhe'
> fnhe_flush_routes(oldest);
> ^~~~~~
> net/ipv4/route.c:605:2: note: Calling 'fnhe_flush_routes'
> fnhe_flush_routes(oldest);
> ^~~~~~~~~~~~~~~~~~~~~~~~~
> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
> rt = rcu_dereference(fnhe->fnhe_rth_input);
> ^
>
> vim +575 net/ipv4/route.c
>
> 4895c771c7f006 David S. Miller 2012-07-17 570
> 2ffae99d1fac27 Timo Teräs 2013-06-27 571 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
> 2ffae99d1fac27 Timo Teräs 2013-06-27 572 {
> 2ffae99d1fac27 Timo Teräs 2013-06-27 573 struct rtable *rt;
> 2ffae99d1fac27 Timo Teräs 2013-06-27 574
> 2ffae99d1fac27 Timo Teräs 2013-06-27 @575 rt = rcu_dereference(fnhe->fnhe_rth_input);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 576 if (rt) {
> 2ffae99d1fac27 Timo Teräs 2013-06-27 577 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
> 95c47f9cf5e028 Wei Wang 2017-06-17 578 dst_dev_put(&rt->dst);
> 0830106c539001 Wei Wang 2017-06-17 579 dst_release(&rt->dst);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 580 }
> 2ffae99d1fac27 Timo Teräs 2013-06-27 581 rt = rcu_dereference(fnhe->fnhe_rth_output);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 582 if (rt) {
> 2ffae99d1fac27 Timo Teräs 2013-06-27 583 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
> 95c47f9cf5e028 Wei Wang 2017-06-17 584 dst_dev_put(&rt->dst);
> 0830106c539001 Wei Wang 2017-06-17 585 dst_release(&rt->dst);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 586 }
> 2ffae99d1fac27 Timo Teräs 2013-06-27 587 }
> 2ffae99d1fac27 Timo Teräs 2013-06-27 588
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
@ 2021-08-31 15:13 ` Eric Dumazet
0 siblings, 0 replies; 13+ messages in thread
From: Eric Dumazet @ 2021-08-31 15:13 UTC (permalink / raw)
To: kernel test robot
Cc: Eric Dumazet, David S . Miller, Jakub Kicinski, llvm, kbuild-all,
netdev, Willy Tarreau, Keyu Man, David Ahern
Honestly this report seems wrong to me.
Please kernel test robot, improve your automation.
The function is only called when we know there are at least 6 items in
the list, I do not think you took this into account.
On Tue, Aug 31, 2021 at 12:48 AM kernel test robot <yujie.liu@intel.com> wrote:
>
> Hi Eric,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on net/master]
>
> url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
> base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
> :::::: branch date: 19 hours ago
> :::::: commit date: 19 hours ago
> config: x86_64-randconfig-c007-20210830 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/0day-ci/linux/commit/adf305d00ec06cb771dc960f0d7bd62d07561371
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
> git checkout adf305d00ec06cb771dc960f0d7bd62d07561371
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> clang-analyzer warnings: (new ones prefixed by >>)
>
> >> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
> rt = rcu_dereference(fnhe->fnhe_rth_input);
> ^
> net/ipv4/route.c:592:34: note: 'oldest' initialized to a null pointer value
> struct fib_nh_exception *fnhe, *oldest = NULL;
> ^~~~~~
> net/ipv4/route.c:594:2: note: Loop condition is true. Entering loop body
> for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
> ^
> net/ipv4/route.c:595:10: note: Assuming the condition is false
> fnhe = rcu_dereference_protected(*fnhe_p,
> ^
> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
> __rcu_dereference_protected((p), (c), __rcu)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/rcupdate.h:396:19: note: expanded from macro '__rcu_dereference_protected'
> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
> ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/rcupdate.h:318:8: note: expanded from macro 'RCU_LOCKDEP_WARN'
> if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
> ^
> net/ipv4/route.c:595:10: note: Left side of '&&' is false
> fnhe = rcu_dereference_protected(*fnhe_p,
> ^
> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
> __rcu_dereference_protected((p), (c), __rcu)
> ^
> include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
> ^
> include/linux/rcupdate.h:318:11: note: expanded from macro 'RCU_LOCKDEP_WARN'
> if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
> ^
> net/ipv4/route.c:595:10: note: Loop condition is false. Exiting loop
> fnhe = rcu_dereference_protected(*fnhe_p,
> ^
> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
> __rcu_dereference_protected((p), (c), __rcu)
> ^
> include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
> ^
> include/linux/rcupdate.h:316:2: note: expanded from macro 'RCU_LOCKDEP_WARN'
> do { \
> ^
> net/ipv4/route.c:597:7: note: Assuming 'fnhe' is null
> if (!fnhe)
> ^~~~~
> net/ipv4/route.c:597:3: note: Taking true branch
> if (!fnhe)
> ^
> net/ipv4/route.c:598:4: note: Execution continues on line 605
> break;
> ^
> net/ipv4/route.c:605:20: note: Passing null pointer value via 1st parameter 'fnhe'
> fnhe_flush_routes(oldest);
> ^~~~~~
> net/ipv4/route.c:605:2: note: Calling 'fnhe_flush_routes'
> fnhe_flush_routes(oldest);
> ^~~~~~~~~~~~~~~~~~~~~~~~~
> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
> rt = rcu_dereference(fnhe->fnhe_rth_input);
> ^
>
> vim +575 net/ipv4/route.c
>
> 4895c771c7f006 David S. Miller 2012-07-17 570
> 2ffae99d1fac27 Timo Teräs 2013-06-27 571 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
> 2ffae99d1fac27 Timo Teräs 2013-06-27 572 {
> 2ffae99d1fac27 Timo Teräs 2013-06-27 573 struct rtable *rt;
> 2ffae99d1fac27 Timo Teräs 2013-06-27 574
> 2ffae99d1fac27 Timo Teräs 2013-06-27 @575 rt = rcu_dereference(fnhe->fnhe_rth_input);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 576 if (rt) {
> 2ffae99d1fac27 Timo Teräs 2013-06-27 577 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
> 95c47f9cf5e028 Wei Wang 2017-06-17 578 dst_dev_put(&rt->dst);
> 0830106c539001 Wei Wang 2017-06-17 579 dst_release(&rt->dst);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 580 }
> 2ffae99d1fac27 Timo Teräs 2013-06-27 581 rt = rcu_dereference(fnhe->fnhe_rth_output);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 582 if (rt) {
> 2ffae99d1fac27 Timo Teräs 2013-06-27 583 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
> 95c47f9cf5e028 Wei Wang 2017-06-17 584 dst_dev_put(&rt->dst);
> 0830106c539001 Wei Wang 2017-06-17 585 dst_release(&rt->dst);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 586 }
> 2ffae99d1fac27 Timo Teräs 2013-06-27 587 }
> 2ffae99d1fac27 Timo Teräs 2013-06-27 588
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
@ 2021-08-31 15:13 ` Eric Dumazet
0 siblings, 0 replies; 13+ messages in thread
From: Eric Dumazet @ 2021-08-31 15:13 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7222 bytes --]
Honestly this report seems wrong to me.
Please kernel test robot, improve your automation.
The function is only called when we know there are at least 6 items in
the list, I do not think you took this into account.
On Tue, Aug 31, 2021 at 12:48 AM kernel test robot <yujie.liu@intel.com> wrote:
>
> Hi Eric,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on net/master]
>
> url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
> base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
> :::::: branch date: 19 hours ago
> :::::: commit date: 19 hours ago
> config: x86_64-randconfig-c007-20210830 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/0day-ci/linux/commit/adf305d00ec06cb771dc960f0d7bd62d07561371
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
> git checkout adf305d00ec06cb771dc960f0d7bd62d07561371
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> clang-analyzer warnings: (new ones prefixed by >>)
>
> >> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
> rt = rcu_dereference(fnhe->fnhe_rth_input);
> ^
> net/ipv4/route.c:592:34: note: 'oldest' initialized to a null pointer value
> struct fib_nh_exception *fnhe, *oldest = NULL;
> ^~~~~~
> net/ipv4/route.c:594:2: note: Loop condition is true. Entering loop body
> for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
> ^
> net/ipv4/route.c:595:10: note: Assuming the condition is false
> fnhe = rcu_dereference_protected(*fnhe_p,
> ^
> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
> __rcu_dereference_protected((p), (c), __rcu)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/rcupdate.h:396:19: note: expanded from macro '__rcu_dereference_protected'
> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
> ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/rcupdate.h:318:8: note: expanded from macro 'RCU_LOCKDEP_WARN'
> if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
> ^
> net/ipv4/route.c:595:10: note: Left side of '&&' is false
> fnhe = rcu_dereference_protected(*fnhe_p,
> ^
> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
> __rcu_dereference_protected((p), (c), __rcu)
> ^
> include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
> ^
> include/linux/rcupdate.h:318:11: note: expanded from macro 'RCU_LOCKDEP_WARN'
> if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
> ^
> net/ipv4/route.c:595:10: note: Loop condition is false. Exiting loop
> fnhe = rcu_dereference_protected(*fnhe_p,
> ^
> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
> __rcu_dereference_protected((p), (c), __rcu)
> ^
> include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
> ^
> include/linux/rcupdate.h:316:2: note: expanded from macro 'RCU_LOCKDEP_WARN'
> do { \
> ^
> net/ipv4/route.c:597:7: note: Assuming 'fnhe' is null
> if (!fnhe)
> ^~~~~
> net/ipv4/route.c:597:3: note: Taking true branch
> if (!fnhe)
> ^
> net/ipv4/route.c:598:4: note: Execution continues on line 605
> break;
> ^
> net/ipv4/route.c:605:20: note: Passing null pointer value via 1st parameter 'fnhe'
> fnhe_flush_routes(oldest);
> ^~~~~~
> net/ipv4/route.c:605:2: note: Calling 'fnhe_flush_routes'
> fnhe_flush_routes(oldest);
> ^~~~~~~~~~~~~~~~~~~~~~~~~
> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
> rt = rcu_dereference(fnhe->fnhe_rth_input);
> ^
>
> vim +575 net/ipv4/route.c
>
> 4895c771c7f006 David S. Miller 2012-07-17 570
> 2ffae99d1fac27 Timo Teräs 2013-06-27 571 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
> 2ffae99d1fac27 Timo Teräs 2013-06-27 572 {
> 2ffae99d1fac27 Timo Teräs 2013-06-27 573 struct rtable *rt;
> 2ffae99d1fac27 Timo Teräs 2013-06-27 574
> 2ffae99d1fac27 Timo Teräs 2013-06-27 @575 rt = rcu_dereference(fnhe->fnhe_rth_input);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 576 if (rt) {
> 2ffae99d1fac27 Timo Teräs 2013-06-27 577 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
> 95c47f9cf5e028 Wei Wang 2017-06-17 578 dst_dev_put(&rt->dst);
> 0830106c539001 Wei Wang 2017-06-17 579 dst_release(&rt->dst);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 580 }
> 2ffae99d1fac27 Timo Teräs 2013-06-27 581 rt = rcu_dereference(fnhe->fnhe_rth_output);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 582 if (rt) {
> 2ffae99d1fac27 Timo Teräs 2013-06-27 583 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
> 95c47f9cf5e028 Wei Wang 2017-06-17 584 dst_dev_put(&rt->dst);
> 0830106c539001 Wei Wang 2017-06-17 585 dst_release(&rt->dst);
> 2ffae99d1fac27 Timo Teräs 2013-06-27 586 }
> 2ffae99d1fac27 Timo Teräs 2013-06-27 587 }
> 2ffae99d1fac27 Timo Teräs 2013-06-27 588
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
2021-08-31 15:13 ` Eric Dumazet
@ 2021-09-01 5:51 ` kernel test robot
-1 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2021-09-01 5:51 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, llvm, kbuild-all, netdev,
Willy Tarreau, Keyu Man, David Ahern
On 8/31/2021 11:13 PM, Eric Dumazet wrote:
> Honestly this report seems wrong to me.
>
> Please kernel test robot, improve your automation.
>
> The function is only called when we know there are at least 6 items in
> the list, I do not think you took this into account.
Oops, I got it, this function is only called when depth is greater than FNHE_RECLAIM_DEPTH.
It was our fault that we simply followed clang-analyzer's note and didn't make a thorough check.
Sorry for bothering. We'll improve the bot.
> On Tue, Aug 31, 2021 at 12:48 AM kernel test robot <yujie.liu@intel.com> wrote:
>>
>> Hi Eric,
>>
>> I love your patch! Perhaps something to improve:
>>
>> [auto build test WARNING on net/master]
>>
>> url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
>> base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
>> :::::: branch date: 19 hours ago
>> :::::: commit date: 19 hours ago
>> config: x86_64-randconfig-c007-20210830 (attached as .config)
>> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
>> reproduce (this is a W=1 build):
>> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> chmod +x ~/bin/make.cross
>> # https://github.com/0day-ci/linux/commit/adf305d00ec06cb771dc960f0d7bd62d07561371
>> git remote add linux-review https://github.com/0day-ci/linux
>> git fetch --no-tags linux-review Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
>> git checkout adf305d00ec06cb771dc960f0d7bd62d07561371
>> # save the attached .config to linux build tree
>> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>>
>> clang-analyzer warnings: (new ones prefixed by >>)
>>
>> >> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
>> rt = rcu_dereference(fnhe->fnhe_rth_input);
>> ^
>> net/ipv4/route.c:592:34: note: 'oldest' initialized to a null pointer value
>> struct fib_nh_exception *fnhe, *oldest = NULL;
>> ^~~~~~
>> net/ipv4/route.c:594:2: note: Loop condition is true. Entering loop body
>> for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
>> ^
>> net/ipv4/route.c:595:10: note: Assuming the condition is false
>> fnhe = rcu_dereference_protected(*fnhe_p,
>> ^
>> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
>> __rcu_dereference_protected((p), (c), __rcu)
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:396:19: note: expanded from macro '__rcu_dereference_protected'
>> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
>> ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:318:8: note: expanded from macro 'RCU_LOCKDEP_WARN'
>> if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
>> ^
>> net/ipv4/route.c:595:10: note: Left side of '&&' is false
>> fnhe = rcu_dereference_protected(*fnhe_p,
>> ^
>> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
>> __rcu_dereference_protected((p), (c), __rcu)
>> ^
>> include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
>> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
>> ^
>> include/linux/rcupdate.h:318:11: note: expanded from macro 'RCU_LOCKDEP_WARN'
>> if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
>> ^
>> net/ipv4/route.c:595:10: note: Loop condition is false. Exiting loop
>> fnhe = rcu_dereference_protected(*fnhe_p,
>> ^
>> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
>> __rcu_dereference_protected((p), (c), __rcu)
>> ^
>> include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
>> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
>> ^
>> include/linux/rcupdate.h:316:2: note: expanded from macro 'RCU_LOCKDEP_WARN'
>> do { \
>> ^
>> net/ipv4/route.c:597:7: note: Assuming 'fnhe' is null
>> if (!fnhe)
>> ^~~~~
>> net/ipv4/route.c:597:3: note: Taking true branch
>> if (!fnhe)
>> ^
>> net/ipv4/route.c:598:4: note: Execution continues on line 605
>> break;
>> ^
>> net/ipv4/route.c:605:20: note: Passing null pointer value via 1st parameter 'fnhe'
>> fnhe_flush_routes(oldest);
>> ^~~~~~
>> net/ipv4/route.c:605:2: note: Calling 'fnhe_flush_routes'
>> fnhe_flush_routes(oldest);
>> ^~~~~~~~~~~~~~~~~~~~~~~~~
>> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
>> rt = rcu_dereference(fnhe->fnhe_rth_input);
>> ^
>>
>> vim +575 net/ipv4/route.c
>>
>> 4895c771c7f006 David S. Miller 2012-07-17 570
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 571 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 572 {
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 573 struct rtable *rt;
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 574
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 @575 rt = rcu_dereference(fnhe->fnhe_rth_input);
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 576 if (rt) {
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 577 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
>> 95c47f9cf5e028 Wei Wang 2017-06-17 578 dst_dev_put(&rt->dst);
>> 0830106c539001 Wei Wang 2017-06-17 579 dst_release(&rt->dst);
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 580 }
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 581 rt = rcu_dereference(fnhe->fnhe_rth_output);
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 582 if (rt) {
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 583 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
>> 95c47f9cf5e028 Wei Wang 2017-06-17 584 dst_dev_put(&rt->dst);
>> 0830106c539001 Wei Wang 2017-06-17 585 dst_release(&rt->dst);
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 586 }
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 587 }
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 588
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> _______________________________________________
> kbuild-all mailing list -- kbuild-all@lists.01.org
> To unsubscribe send an email to kbuild-all-leave@lists.01.org
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
@ 2021-09-01 5:51 ` kernel test robot
0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2021-09-01 5:51 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7889 bytes --]
On 8/31/2021 11:13 PM, Eric Dumazet wrote:
> Honestly this report seems wrong to me.
>
> Please kernel test robot, improve your automation.
>
> The function is only called when we know there are at least 6 items in
> the list, I do not think you took this into account.
Oops, I got it, this function is only called when depth is greater than FNHE_RECLAIM_DEPTH.
It was our fault that we simply followed clang-analyzer's note and didn't make a thorough check.
Sorry for bothering. We'll improve the bot.
> On Tue, Aug 31, 2021 at 12:48 AM kernel test robot <yujie.liu@intel.com> wrote:
>>
>> Hi Eric,
>>
>> I love your patch! Perhaps something to improve:
>>
>> [auto build test WARNING on net/master]
>>
>> url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
>> base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
>> :::::: branch date: 19 hours ago
>> :::::: commit date: 19 hours ago
>> config: x86_64-randconfig-c007-20210830 (attached as .config)
>> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
>> reproduce (this is a W=1 build):
>> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> chmod +x ~/bin/make.cross
>> # https://github.com/0day-ci/linux/commit/adf305d00ec06cb771dc960f0d7bd62d07561371
>> git remote add linux-review https://github.com/0day-ci/linux
>> git fetch --no-tags linux-review Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
>> git checkout adf305d00ec06cb771dc960f0d7bd62d07561371
>> # save the attached .config to linux build tree
>> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>>
>> clang-analyzer warnings: (new ones prefixed by >>)
>>
>> >> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
>> rt = rcu_dereference(fnhe->fnhe_rth_input);
>> ^
>> net/ipv4/route.c:592:34: note: 'oldest' initialized to a null pointer value
>> struct fib_nh_exception *fnhe, *oldest = NULL;
>> ^~~~~~
>> net/ipv4/route.c:594:2: note: Loop condition is true. Entering loop body
>> for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
>> ^
>> net/ipv4/route.c:595:10: note: Assuming the condition is false
>> fnhe = rcu_dereference_protected(*fnhe_p,
>> ^
>> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
>> __rcu_dereference_protected((p), (c), __rcu)
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:396:19: note: expanded from macro '__rcu_dereference_protected'
>> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
>> ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:318:8: note: expanded from macro 'RCU_LOCKDEP_WARN'
>> if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
>> ^
>> net/ipv4/route.c:595:10: note: Left side of '&&' is false
>> fnhe = rcu_dereference_protected(*fnhe_p,
>> ^
>> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
>> __rcu_dereference_protected((p), (c), __rcu)
>> ^
>> include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
>> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
>> ^
>> include/linux/rcupdate.h:318:11: note: expanded from macro 'RCU_LOCKDEP_WARN'
>> if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
>> ^
>> net/ipv4/route.c:595:10: note: Loop condition is false. Exiting loop
>> fnhe = rcu_dereference_protected(*fnhe_p,
>> ^
>> include/linux/rcupdate.h:587:2: note: expanded from macro 'rcu_dereference_protected'
>> __rcu_dereference_protected((p), (c), __rcu)
>> ^
>> include/linux/rcupdate.h:396:2: note: expanded from macro '__rcu_dereference_protected'
>> RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
>> ^
>> include/linux/rcupdate.h:316:2: note: expanded from macro 'RCU_LOCKDEP_WARN'
>> do { \
>> ^
>> net/ipv4/route.c:597:7: note: Assuming 'fnhe' is null
>> if (!fnhe)
>> ^~~~~
>> net/ipv4/route.c:597:3: note: Taking true branch
>> if (!fnhe)
>> ^
>> net/ipv4/route.c:598:4: note: Execution continues on line 605
>> break;
>> ^
>> net/ipv4/route.c:605:20: note: Passing null pointer value via 1st parameter 'fnhe'
>> fnhe_flush_routes(oldest);
>> ^~~~~~
>> net/ipv4/route.c:605:2: note: Calling 'fnhe_flush_routes'
>> fnhe_flush_routes(oldest);
>> ^~~~~~~~~~~~~~~~~~~~~~~~~
>> net/ipv4/route.c:575:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
>> rt = rcu_dereference(fnhe->fnhe_rth_input);
>> ^
>>
>> vim +575 net/ipv4/route.c
>>
>> 4895c771c7f006 David S. Miller 2012-07-17 570
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 571 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 572 {
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 573 struct rtable *rt;
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 574
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 @575 rt = rcu_dereference(fnhe->fnhe_rth_input);
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 576 if (rt) {
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 577 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
>> 95c47f9cf5e028 Wei Wang 2017-06-17 578 dst_dev_put(&rt->dst);
>> 0830106c539001 Wei Wang 2017-06-17 579 dst_release(&rt->dst);
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 580 }
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 581 rt = rcu_dereference(fnhe->fnhe_rth_output);
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 582 if (rt) {
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 583 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
>> 95c47f9cf5e028 Wei Wang 2017-06-17 584 dst_dev_put(&rt->dst);
>> 0830106c539001 Wei Wang 2017-06-17 585 dst_release(&rt->dst);
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 586 }
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 587 }
>> 2ffae99d1fac27 Timo Teräs 2013-06-27 588
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
> _______________________________________________
> kbuild-all mailing list -- kbuild-all(a)lists.01.org
> To unsubscribe send an email to kbuild-all-leave(a)lists.01.org
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
2021-08-29 22:16 ` [PATCH net 2/2] ipv4: make exception cache " Eric Dumazet
2021-08-30 0:40 ` David Ahern
@ 2021-08-30 11:34 ` Dan Carpenter
1 sibling, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2021-08-30 11:34 UTC (permalink / raw)
To: kbuild, Eric Dumazet, kernel-janitors; +Cc: lkp, kbuild-all
[ I trimmed the CC list because this is probably a false positive and
netdev hates static checker warnings. - dan ]
Hi Eric,
url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
config: x86_64-randconfig-m001-20210829 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 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>
smatch warnings:
net/ipv4/route.c:606 fnhe_remove_oldest() error: potentially dereferencing uninitialized 'oldest_p'.
vim +/oldest_p +606 net/ipv4/route.c
adf305d00ec06cb Eric Dumazet 2021-08-29 589 static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash)
4895c771c7f006b David S. Miller 2012-07-17 590 {
adf305d00ec06cb Eric Dumazet 2021-08-29 591 struct fib_nh_exception __rcu **fnhe_p, **oldest_p;
adf305d00ec06cb Eric Dumazet 2021-08-29 592 struct fib_nh_exception *fnhe, *oldest = NULL;
4895c771c7f006b David S. Miller 2012-07-17 593
adf305d00ec06cb Eric Dumazet 2021-08-29 594 for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
adf305d00ec06cb Eric Dumazet 2021-08-29 595 fnhe = rcu_dereference_protected(*fnhe_p,
adf305d00ec06cb Eric Dumazet 2021-08-29 596 lockdep_is_held(&fnhe_lock));
adf305d00ec06cb Eric Dumazet 2021-08-29 597 if (!fnhe)
adf305d00ec06cb Eric Dumazet 2021-08-29 598 break;
Smatch is complaining that this could break on the first iteration
through the loop...
adf305d00ec06cb Eric Dumazet 2021-08-29 599 if (!oldest ||
adf305d00ec06cb Eric Dumazet 2021-08-29 600 time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) {
4895c771c7f006b David S. Miller 2012-07-17 601 oldest = fnhe;
adf305d00ec06cb Eric Dumazet 2021-08-29 602 oldest_p = fnhe_p;
adf305d00ec06cb Eric Dumazet 2021-08-29 603 }
4895c771c7f006b David S. Miller 2012-07-17 604 }
2ffae99d1fac272 Timo Teräs 2013-06-27 605 fnhe_flush_routes(oldest);
adf305d00ec06cb Eric Dumazet 2021-08-29 @606 *oldest_p = oldest->fnhe_next;
adf305d00ec06cb Eric Dumazet 2021-08-29 607 kfree_rcu(oldest, rcu);
4895c771c7f006b David S. Miller 2012-07-17 608 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
@ 2021-08-30 11:34 ` Dan Carpenter
0 siblings, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2021-08-30 11:34 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2562 bytes --]
[ I trimmed the CC list because this is probably a false positive and
netdev hates static checker warnings. - dan ]
Hi Eric,
url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
config: x86_64-randconfig-m001-20210829 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 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>
smatch warnings:
net/ipv4/route.c:606 fnhe_remove_oldest() error: potentially dereferencing uninitialized 'oldest_p'.
vim +/oldest_p +606 net/ipv4/route.c
adf305d00ec06cb Eric Dumazet 2021-08-29 589 static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash)
4895c771c7f006b David S. Miller 2012-07-17 590 {
adf305d00ec06cb Eric Dumazet 2021-08-29 591 struct fib_nh_exception __rcu **fnhe_p, **oldest_p;
adf305d00ec06cb Eric Dumazet 2021-08-29 592 struct fib_nh_exception *fnhe, *oldest = NULL;
4895c771c7f006b David S. Miller 2012-07-17 593
adf305d00ec06cb Eric Dumazet 2021-08-29 594 for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
adf305d00ec06cb Eric Dumazet 2021-08-29 595 fnhe = rcu_dereference_protected(*fnhe_p,
adf305d00ec06cb Eric Dumazet 2021-08-29 596 lockdep_is_held(&fnhe_lock));
adf305d00ec06cb Eric Dumazet 2021-08-29 597 if (!fnhe)
adf305d00ec06cb Eric Dumazet 2021-08-29 598 break;
Smatch is complaining that this could break on the first iteration
through the loop...
adf305d00ec06cb Eric Dumazet 2021-08-29 599 if (!oldest ||
adf305d00ec06cb Eric Dumazet 2021-08-29 600 time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) {
4895c771c7f006b David S. Miller 2012-07-17 601 oldest = fnhe;
adf305d00ec06cb Eric Dumazet 2021-08-29 602 oldest_p = fnhe_p;
adf305d00ec06cb Eric Dumazet 2021-08-29 603 }
4895c771c7f006b David S. Miller 2012-07-17 604 }
2ffae99d1fac272 Timo Teräs 2013-06-27 605 fnhe_flush_routes(oldest);
adf305d00ec06cb Eric Dumazet 2021-08-29 @606 *oldest_p = oldest->fnhe_next;
adf305d00ec06cb Eric Dumazet 2021-08-29 607 kfree_rcu(oldest, rcu);
4895c771c7f006b David S. Miller 2012-07-17 608 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
@ 2021-08-30 11:34 ` Dan Carpenter
0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2021-08-30 2:39 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 3074 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210829221615.2057201-3-eric.dumazet@gmail.com>
References: <20210829221615.2057201-3-eric.dumazet@gmail.com>
TO: Eric Dumazet <eric.dumazet@gmail.com>
TO: "David S . Miller" <davem@davemloft.net>
TO: Jakub Kicinski <kuba@kernel.org>
CC: netdev <netdev@vger.kernel.org>
CC: Eric Dumazet <edumazet@google.com>
CC: Willy Tarreau <w@1wt.eu>
CC: Keyu Man <kman001@ucr.edu>
CC: David Ahern <dsahern@kernel.org>
Hi Eric,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net/master]
url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: x86_64-randconfig-m001-20210829 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 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>
smatch warnings:
net/ipv4/route.c:606 fnhe_remove_oldest() error: potentially dereferencing uninitialized 'oldest_p'.
vim +/oldest_p +606 net/ipv4/route.c
2ffae99d1fac272 Timo Teräs 2013-06-27 588
adf305d00ec06cb Eric Dumazet 2021-08-29 589 static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash)
4895c771c7f006b David S. Miller 2012-07-17 590 {
adf305d00ec06cb Eric Dumazet 2021-08-29 591 struct fib_nh_exception __rcu **fnhe_p, **oldest_p;
adf305d00ec06cb Eric Dumazet 2021-08-29 592 struct fib_nh_exception *fnhe, *oldest = NULL;
4895c771c7f006b David S. Miller 2012-07-17 593
adf305d00ec06cb Eric Dumazet 2021-08-29 594 for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
adf305d00ec06cb Eric Dumazet 2021-08-29 595 fnhe = rcu_dereference_protected(*fnhe_p,
adf305d00ec06cb Eric Dumazet 2021-08-29 596 lockdep_is_held(&fnhe_lock));
adf305d00ec06cb Eric Dumazet 2021-08-29 597 if (!fnhe)
adf305d00ec06cb Eric Dumazet 2021-08-29 598 break;
adf305d00ec06cb Eric Dumazet 2021-08-29 599 if (!oldest ||
adf305d00ec06cb Eric Dumazet 2021-08-29 600 time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) {
4895c771c7f006b David S. Miller 2012-07-17 601 oldest = fnhe;
adf305d00ec06cb Eric Dumazet 2021-08-29 602 oldest_p = fnhe_p;
adf305d00ec06cb Eric Dumazet 2021-08-29 603 }
4895c771c7f006b David S. Miller 2012-07-17 604 }
2ffae99d1fac272 Timo Teräs 2013-06-27 605 fnhe_flush_routes(oldest);
adf305d00ec06cb Eric Dumazet 2021-08-29 @606 *oldest_p = oldest->fnhe_next;
adf305d00ec06cb Eric Dumazet 2021-08-29 607 kfree_rcu(oldest, rcu);
4895c771c7f006b David S. Miller 2012-07-17 608 }
4895c771c7f006b David S. Miller 2012-07-17 609
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39595 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
2021-08-29 22:16 ` [PATCH net 2/2] ipv4: make exception cache " Eric Dumazet
@ 2021-08-30 0:40 ` David Ahern
2021-08-30 11:34 ` Dan Carpenter
1 sibling, 0 replies; 13+ messages in thread
From: David Ahern @ 2021-08-30 0:40 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski
Cc: netdev, Eric Dumazet, Willy Tarreau, Keyu Man, David Ahern
On 8/29/21 3:16 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Even after commit 6457378fe796 ("ipv4: use siphash instead of Jenkins in
> fnhe_hashfun()"), an attacker can still use brute force to learn
> some secrets from a victim linux host.
>
> One way to defeat these attacks is to make the max depth of the hash
> table bucket a random value.
>
> Before this patch, each bucket of the hash table used to store exceptions
> could contain 6 items under attack.
>
> After the patch, each bucket would contains a random number of items,
> between 6 and 10. The attacker can no longer infer secrets.
>
> This is slightly increasing memory size used by the hash table,
> by 50% in average, we do not expect this to be a problem.
>
> This patch is more complex than the prior one (IPv6 equivalent),
> because IPv4 was reusing the oldest entry.
> Since we need to be able to evict more than one entry per
> update_or_create_fnhe() call, I had to replace
> fnhe_oldest() with fnhe_remove_oldest().
>
> Also note that we will queue extra kfree_rcu() calls under stress,
> which hopefully wont be a too big issue.
>
> Fixes: 4895c771c7f0 ("ipv4: Add FIB nexthop exceptions.")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Keyu Man <kman001@ucr.edu>
> Cc: Willy Tarreau <w@1wt.eu>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> net/ipv4/route.c | 44 +++++++++++++++++++++++++++++---------------
> 1 file changed, 29 insertions(+), 15 deletions(-)
>
Reviewed-by: David Ahern <dsahern@kernel.org>
Tested-by: David Ahern <dsahern@kernel.org>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net 2/2] ipv4: make exception cache less predictible
2021-08-29 22:16 [PATCH net 0/2] inet: make exception handling " Eric Dumazet
@ 2021-08-29 22:16 ` Eric Dumazet
2021-08-30 0:40 ` David Ahern
2021-08-30 11:34 ` Dan Carpenter
0 siblings, 2 replies; 13+ messages in thread
From: Eric Dumazet @ 2021-08-29 22:16 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski
Cc: netdev, Eric Dumazet, Eric Dumazet, Willy Tarreau, Keyu Man, David Ahern
From: Eric Dumazet <edumazet@google.com>
Even after commit 6457378fe796 ("ipv4: use siphash instead of Jenkins in
fnhe_hashfun()"), an attacker can still use brute force to learn
some secrets from a victim linux host.
One way to defeat these attacks is to make the max depth of the hash
table bucket a random value.
Before this patch, each bucket of the hash table used to store exceptions
could contain 6 items under attack.
After the patch, each bucket would contains a random number of items,
between 6 and 10. The attacker can no longer infer secrets.
This is slightly increasing memory size used by the hash table,
by 50% in average, we do not expect this to be a problem.
This patch is more complex than the prior one (IPv6 equivalent),
because IPv4 was reusing the oldest entry.
Since we need to be able to evict more than one entry per
update_or_create_fnhe() call, I had to replace
fnhe_oldest() with fnhe_remove_oldest().
Also note that we will queue extra kfree_rcu() calls under stress,
which hopefully wont be a too big issue.
Fixes: 4895c771c7f0 ("ipv4: Add FIB nexthop exceptions.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Keyu Man <kman001@ucr.edu>
Cc: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/ipv4/route.c | 44 +++++++++++++++++++++++++++++---------------
1 file changed, 29 insertions(+), 15 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a6f20ee3533554b210d27c4ab6637ca7a05b148b..225714b5efc0b9c6bcd2d58a62d4656cdc5a1cde 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -586,18 +586,25 @@ static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
}
}
-static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash)
+static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash)
{
- struct fib_nh_exception *fnhe, *oldest;
+ struct fib_nh_exception __rcu **fnhe_p, **oldest_p;
+ struct fib_nh_exception *fnhe, *oldest = NULL;
- oldest = rcu_dereference(hash->chain);
- for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe;
- fnhe = rcu_dereference(fnhe->fnhe_next)) {
- if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp))
+ for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
+ fnhe = rcu_dereference_protected(*fnhe_p,
+ lockdep_is_held(&fnhe_lock));
+ if (!fnhe)
+ break;
+ if (!oldest ||
+ time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) {
oldest = fnhe;
+ oldest_p = fnhe_p;
+ }
}
fnhe_flush_routes(oldest);
- return oldest;
+ *oldest_p = oldest->fnhe_next;
+ kfree_rcu(oldest, rcu);
}
static u32 fnhe_hashfun(__be32 daddr)
@@ -676,16 +683,21 @@ static void update_or_create_fnhe(struct fib_nh_common *nhc, __be32 daddr,
if (rt)
fill_route_from_fnhe(rt, fnhe);
} else {
- if (depth > FNHE_RECLAIM_DEPTH)
- fnhe = fnhe_oldest(hash);
- else {
- fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC);
- if (!fnhe)
- goto out_unlock;
+ /* Randomize max depth to avoid some side channels attacks. */
+ int max_depth = FNHE_RECLAIM_DEPTH +
+ prandom_u32_max(FNHE_RECLAIM_DEPTH);
- fnhe->fnhe_next = hash->chain;
- rcu_assign_pointer(hash->chain, fnhe);
+ while (depth > max_depth) {
+ fnhe_remove_oldest(hash);
+ depth--;
}
+
+ fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC);
+ if (!fnhe)
+ goto out_unlock;
+
+ fnhe->fnhe_next = hash->chain;
+
fnhe->fnhe_genid = genid;
fnhe->fnhe_daddr = daddr;
fnhe->fnhe_gw = gw;
@@ -693,6 +705,8 @@ static void update_or_create_fnhe(struct fib_nh_common *nhc, __be32 daddr,
fnhe->fnhe_mtu_locked = lock;
fnhe->fnhe_expires = max(1UL, expires);
+ rcu_assign_pointer(hash->chain, fnhe);
+
/* Exception created; mark the cached routes for the nexthop
* stale, so anyone caching it rechecks if this exception
* applies to them.
--
2.33.0.259.gc128427fd7-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2021-09-01 5:51 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30 17:43 [PATCH net 2/2] ipv4: make exception cache less predictible kernel test robot
2021-08-31 7:48 ` kernel test robot
2021-08-31 7:48 ` kernel test robot
2021-08-31 15:13 ` Eric Dumazet
2021-08-31 15:13 ` Eric Dumazet
2021-08-31 15:13 ` Eric Dumazet
2021-09-01 5:51 ` kernel test robot
2021-09-01 5:51 ` kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2021-08-29 22:16 [PATCH net 0/2] inet: make exception handling " Eric Dumazet
2021-08-29 22:16 ` [PATCH net 2/2] ipv4: make exception cache " Eric Dumazet
2021-08-30 0:40 ` David Ahern
2021-08-30 11:34 ` Dan Carpenter
2021-08-30 2:39 ` kernel test robot
2021-08-30 11:34 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.