lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 7 Aug 2020 11:16:13 -0400
From:   Jamal Hadi Salim <jhs@...atatu.com>
To:     Cong Wang <xiyou.wangcong@...il.com>, Jiri Pirko <jiri@...nulli.us>
Cc:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: rcu build on bug


Made this small change:

------
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index ec945294626a..75d43ed10cd8 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -22,7 +22,7 @@
  #include <net/pkt_cls.h>
  #include <net/sch_generic.h>

-#define HTSIZE 256
+#define HTSIZE 4096

  struct fw_head {
         u32                     mask;
---------

Generated compile errors as follows:

------------
   DESCEND  objtool
   CALL    scripts/atomic/check-atomics.sh
   CALL    scripts/checksyscalls.sh
   CHK     include/generated/compile.h
   CC      net/sched/cls_fw.o
In file included from ./include/linux/export.h:43:0,
                  from ./include/linux/linkage.h:7,
                  from ./include/linux/kernel.h:8,
                  from ./include/linux/list.h:9,
                  from ./include/linux/module.h:12,
                  from net/sched/cls_fw.c:13:
net/sched/cls_fw.c: In function ‘fw_destroy’:
./include/linux/compiler.h:392:38: error: call to 
‘__compiletime_assert_415’ declared with attribute error: BUILD_BUG_ON 
failed: !__is_kfree_rcu_offset(__builtin_offsetof(typeof(*(head)), rcu))
   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
                                       ^
./include/linux/compiler.h:373:4: note: in definition of macro 
‘__compiletime_assert’
     prefix ## suffix();    \
     ^~~~~~
./include/linux/compiler.h:392:2: note: in expansion of macro 
‘_compiletime_assert’
   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
   ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro 
‘compiletime_assert’
  #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                      ^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:50:2: note: in expansion of macro 
‘BUILD_BUG_ON_MSG’
   BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
   ^~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:840:3: note: in expansion of macro ‘BUILD_BUG_ON’
    BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); \
    ^~~~~~~~~~~~
./include/linux/rcupdate.h:875:3: note: in expansion of macro ‘__kfree_rcu’
    __kfree_rcu(&((___p)->rhf), offsetof(typeof(*(ptr)), rhf)); \
    ^~~~~~~~~~~
net/sched/cls_fw.c:151:2: note: in expansion of macro ‘kfree_rcu’
   kfree_rcu(head, rcu);
   ^~~~~~~~~
scripts/Makefile.build:280: recipe for target 'net/sched/cls_fw.o' failed
make[2]: *** [net/sched/cls_fw.o] Error 1
scripts/Makefile.build:497: recipe for target 'net/sched' failed
make[1]: *** [net/sched] Error 2
Makefile:1771: recipe for target 'net' failed
make: *** [net] Error 2
make: *** Waiting for unfinished jobs....

----------------

Gets fixed if i reduce the hash buckets of course.
Looking at include/linux/rcupdate.h I see:

------
/*
  * Does the specified offset indicate that the corresponding rcu_head
  * structure can be handled by kfree_rcu()?
  */
#define __is_kfree_rcu_offset(offset) ((offset) < 4096)

------

I am guessing the hash table got too large.
Smells like hard coded expectation?

How to fix?

cheers,
jamal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ