From: David Miller <davem@davemloft.net>
To: dcaratti@redhat.com
Cc: xiyou.wangcong@gmail.com, vladbu@mellanox.com, jhs@mojatatu.com,
jiri@resnulli.us, netdev@vger.kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net v2 00/18] net/sched: validate the control action with all the other parameters
Date: Thu, 21 Mar 2019 13:27:45 -0700 (PDT) [thread overview]
Message-ID: <20190321.132745.2003844220688083052.davem@davemloft.net> (raw)
In-Reply-To: <cover.1553085663.git.dcaratti@redhat.com>
From: Davide Caratti <dcaratti@redhat.com>
Date: Wed, 20 Mar 2019 14:59:58 +0100
> currently, the kernel checks for bad values of the control action in
> tcf_action_init_1(), after a successful call to the action's init()
> function. When the control action is 'goto chain', this causes two
> undesired behaviors:
>
> 1. "misconfigured action after replace that causes kernel crash":
> if users replace a valid TC action with another one having invalid
> control action, all the new configuration data (including the bad
> control action) are applied successfully, even if the kernel returned
> an error. As a consequence, it's possible to trigger a NULL pointer
> dereference in the traffic path of every TC action (1), replacing the
> control action with 'goto chain x', when chain <x> doesn't exist.
>
> 2. "refcount leak that makes kmemleak complain"
> when a valid 'goto chain' action is overwritten with another action,
> the kernel forgets to decrease refcounts in the chain.
>
> The above problems can be fixed if we validate the control action in each
> action's init() function, the same way as we are already doing for all the
> other configuration parameters.
> Now that chains can be released after an action is replaced, we need to
> care about concurrent access of 'goto_chain' pointer: ensure we access it
> through RCU, like we did with most action-specific configuration parameters.
>
> - Patch 1 removes the wrong checks and provides functions that can be
> used to properly validate control actions in individual actions
> - Patch 2 to 16 fix individual actions, and add TDC selftest code to
> verify the correct behavior (2)
> - Patch 17 and 18 fix concurrent access issues on 'goto_chain', that can be
> observed after the chain refcount leak is fixed.
Series applied, thanks.
next prev parent reply other threads:[~2019-03-21 20:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-20 13:59 [PATCH net v2 00/18] net/sched: validate the control action with all the other parameters Davide Caratti
2019-03-20 13:59 ` [PATCH net v2 01/18] net/sched: prepare TC actions to properly validate the control action Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 02/18] net/sched: act_bpf: validate the control action inside init() Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 03/18] net/sched: act_csum: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 04/18] net/sched: act_gact: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 05/18] net/sched: act_ife: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 06/18] net/sched: act_mirred: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 07/18] net/sched: act_connmark: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 08/18] net/sched: act_nat: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 09/18] net/sched: act_pedit: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 10/18] net/sched: act_police: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 11/18] net/sched: act_sample: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 12/18] net/sched: act_simple: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 13/18] net/sched: act_skbedit: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 14/18] net/sched: act_skbmod: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 15/18] net/sched: act_tunnel_key: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 16/18] net/sched: act_vlan: " Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 17/18] net/sched: don't dereference a->goto_chain to read the chain index Davide Caratti
2019-03-20 14:00 ` [PATCH net v2 18/18] net/sched: let actions use RCU to access 'goto_chain' Davide Caratti
2019-03-20 19:36 ` [PATCH net v2 00/18] net/sched: validate the control action with all the other parameters David Miller
2019-03-21 20:27 ` David Miller [this message]
2019-03-22 2:17 ` Cong Wang
2019-03-22 3:03 ` Cong Wang
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=20190321.132745.2003844220688083052.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vladbu@mellanox.com \
--cc=xiyou.wangcong@gmail.com \
/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).