All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 00/13] cls_u32 cleanups and fixes.
@ 2018-09-09  1:31 Al Viro
  2018-09-09  1:31 ` [PATCH net 01/13] net: sched: cls_u32: fix hnode refcounting Al Viro
                   ` (14 more replies)
  0 siblings, 15 replies; 35+ messages in thread
From: Al Viro @ 2018-09-09  1:31 UTC (permalink / raw)
  To: netdev; +Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko

From: Al Viro <viro@zeniv.linux.org.uk>

A series of net/sched/cls_u32.c cleanups and fixes:
	1) fix hnode refcounting.  Refcounting for tc_u_hnode is broken;
it's not hard to trigger oopsen (including one inside an interrupt handler,
with resulting panic) as well as memory corruption.  Definitely -stable
fodder.
	2) mark root hnode explicitly.  Consistent errors on attempts to
delete root hnodes.  Less serious than 1/13.
	3) disallow linking to root hnode.  Prohibit creating links to
root hnodes; not critical (nothing actually breaks if we do allow those),
but gets rid of surprising cases.
	4) make sure that divisor is a power of 2.  Missing validation -
divisor is documented as power of 2, but that's not actually enforced.
Results are moderately bogus (i.e. the kernel doesn't break), but rather
surprising.

Those are fixes, or at least can be argued to be such.  The rest are pure
cleanups:
	5) get rid of unused argument of u32_destroy_key()
	6) get rid of tc_u_knode ->tp
	7) get rid of tc_u_common ->rcu
Eliminate some unused fields.
	8) clean tc_u_common hashtable.
Hash lookups are best done with minimum of calculations per chain
element - comparing the field in each candidate with f(key) where
f() is actually a pure function is not nice, especially when
compiler doesn't see f() as such...  Better calculate f(key) once,
especially since we need its value to choose the hash chain in
the first place.
	9) pass tc_u_common to u32_set_parms() instead of tc_u_hnode
	10) the tp_c argument of u32_set_parms() is always tp->data
	11) get rid of hnode ->tp_c and tp_c argument of u32_set_parms()
Massage that ends with getting rid of a redundant field.
	12) keep track of knodes count in tc_u_common
	13) simplify the hell out u32_delete() emptiness check
Checking if a filter needs to be killed after u32_delete() can be
done much easier - the test is equivalent to "filter doesn't
have ->data shared with anyone else and it has no knodes left
in it" and keeping track of the number of knodes is trivial.

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2018-09-12 11:18 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-09  1:31 [PATCH net 00/13] cls_u32 cleanups and fixes Al Viro
2018-09-09  1:31 ` [PATCH net 01/13] net: sched: cls_u32: fix hnode refcounting Al Viro
2018-09-09 11:37   ` Jamal Hadi Salim
2018-09-09 11:37     ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 02/13] net: sched: cls_u32: mark root hnode explicitly Al Viro
2018-09-09 11:39   ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 03/13] net: sched: cls_u32: disallow linking to root hnode Al Viro
2018-09-09 11:39   ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 04/13] net: sched: cls_u32: make sure that divisor is a power of 2 Al Viro
2018-09-09 11:41   ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 05/13] net: sched: cls_u32: get rid of unused argument of u32_destroy_key() Al Viro
2018-09-09 11:41   ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 06/13] net: sched: cls_u32: get rid of tc_u_knode ->tp Al Viro
2018-09-09 11:43   ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 07/13] net: sched: cls_u32: get rid of tc_u_common ->rcu Al Viro
2018-09-09 11:45   ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 08/13] net: sched: cls_u32: clean tc_u_common hashtable Al Viro
2018-09-09 11:47   ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 09/13] net: sched: cls_u32: pass tc_u_common to u32_set_parms() instead of tc_u_hnode Al Viro
2018-09-09 11:52   ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 10/13] net: sched: cls_u32: the tp_c argument of u32_set_parms() is always tp->data Al Viro
2018-09-09 12:48   ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 11/13] net: sched: cls_u32: get rid of hnode ->tp_c and tp_c argument of u32_set_parms() Al Viro
2018-09-09 12:49   ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 12/13] net: sched: cls_u32: keep track of knodes count in tc_u_common Al Viro
2018-09-09 12:50   ` Jamal Hadi Salim
2018-09-09  1:31 ` [PATCH net 13/13] net: sched: cls_u32: simplify the hell out u32_delete() emptiness check Al Viro
2018-09-09 12:51   ` Jamal Hadi Salim
2018-09-09 12:58 ` [PATCH net 00/13] cls_u32 cleanups and fixes Jamal Hadi Salim
2018-09-09 14:15   ` Al Viro
2018-09-09 15:48     ` Al Viro
2018-09-10 12:25       ` Offloaded u32 classifier tables WAS (Re: " Jamal Hadi Salim
2018-09-10 12:31         ` Jamal Hadi Salim
2018-09-10 11:30     ` Jamal Hadi Salim
2018-09-12  6:15 ` David Miller

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.