[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190321.132745.2003844220688083052.davem@davemloft.net>
Date: Thu, 21 Mar 2019 13:27:45 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: dcaratti@...hat.com
Cc: xiyou.wangcong@...il.com, vladbu@...lanox.com, jhs@...atatu.com,
jiri@...nulli.us, netdev@...r.kernel.org, pabeni@...hat.com
Subject: Re: [PATCH net v2 00/18] net/sched: validate the control action
with all the other parameters
From: Davide Caratti <dcaratti@...hat.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.
Powered by blists - more mailing lists