netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/4] net/sched: forbid 'goto_chain' on fallback actions
@ 2018-10-20 21:33 Davide Caratti
  2018-10-20 21:33 ` [PATCH net 1/4] net/sched: act_gact: disallow 'goto chain' on fallback control action Davide Caratti
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Davide Caratti @ 2018-10-20 21:33 UTC (permalink / raw)
  To: Jiri Pirko, Cong Wang, Jamal Hadi Salim, David S. Miller, netdev

the following command:

 # tc actions add action police rate 1mbit burst 1k conform-exceed \
 > pass / goto chain 42

generates a NULL pointer dereference when packets exceed the configured
rate. Similarly, the following command:

 # tc actions add action pass random determ goto chain 42 2

makes the kernel crash with NULL dereference when the first packet does
not match the 'pass' action.

gact and police allow users to specify a fallback control action, that is
stored in the action private data. 'goto chain x' never worked for these
cases, since a->goto_chain handle was never initialized. There is only one
goto_chain handle per TC action, and it is designed to be non-NULL only if
tcf_action contains a 'goto chain' command. So, let's forbid 'goto chain'
on fallback actions.

Patch 1/4 and 2/4 change the .init() functions of police and gact, to let
them return an error when users try to set 'goto chain x' in the fallback
action. Patch 3/4 and 4/4 add TDC selftest coverage to this new behavior. 

Davide Caratti (4):
  net/sched: act_gact: disallow 'goto chain' on fallback control action
  net/sched: act_police: disallow 'goto chain' on fallback control
    action
  tc-tests: test denial of 'goto chain' on 'random' traffic in gact.json
  tc-tests: test denial of 'goto chain' for exceed traffic in
    police.json

 net/sched/act_gact.c                          |  5 ++++
 net/sched/act_police.c                        | 12 ++++++++--
 .../tc-testing/tc-tests/actions/gact.json     | 24 +++++++++++++++++++
 .../tc-testing/tc-tests/actions/police.json   | 24 +++++++++++++++++++
 4 files changed, 63 insertions(+), 2 deletions(-)

-- 
2.17.1

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

end of thread, other threads:[~2018-10-23 11:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-20 21:33 [PATCH net 0/4] net/sched: forbid 'goto_chain' on fallback actions Davide Caratti
2018-10-20 21:33 ` [PATCH net 1/4] net/sched: act_gact: disallow 'goto chain' on fallback control action Davide Caratti
2018-10-22 16:22   ` Cong Wang
2018-10-22 20:55   ` Jiri Pirko
2018-10-20 21:33 ` [PATCH net 2/4] net/sched: act_police: " Davide Caratti
2018-10-22 16:23   ` Cong Wang
2018-10-22 20:57   ` Jiri Pirko
2018-10-20 21:33 ` [PATCH net 3/4] tc-tests: test denial of 'goto chain' on 'random' traffic in gact.json Davide Caratti
2018-10-20 21:33 ` [PATCH net 4/4] tc-tests: test denial of 'goto chain' for exceed traffic in police.json Davide Caratti
2018-10-22 18:39 ` [PATCH net 0/4] net/sched: forbid 'goto_chain' on fallback actions Jamal Hadi Salim
2018-10-23  2:43 ` David Miller

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).