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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 21 Mar 2019 19:17:15 -0700
From:   Cong Wang <xiyou.wangcong@...il.com>
To:     Davide Caratti <dcaratti@...hat.com>
Cc:     Vlad Buslov <vladbu@...lanox.com>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Jiri Pirko <jiri@...nulli.us>,
        "David S . Miller" <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net v2 00/18] net/sched: validate the control action with
 all the other parameters

On Wed, Mar 20, 2019 at 7:00 AM Davide Caratti <dcaratti@...hat.com> wrote:
> Changes since v1:
> - reword the cover letter
> - condense the extack message in case tc_action_check_ctrlact() is called
>   with invalid parameters.
> - add tcf_action_set_ctrlact() to avoid code duplication an make the
>   RCU-ification of 'goto_chain' easier.
> - fix errors in act_ife, act_simple, act_skbedit, and avoid useless 'goto
>   end' in act_connmark, thanks a lot to Vlad Buslov.
> - avoid dereferencing 'goto_chain' in tcf_gact_goto_chain_index(), so
>   we don't have to care about the grace period there.


Hmm? goto_chain is dereferenced in tcf_action_goto_chain_exec()
which is the fast path, which means you still have to care about RCU
grace period, right?


> - let actions respect the grace period when they release chains, thanks
>   to Cong Wang and Vlad Buslov.

Hmm, could you be more specific on how RCU grace period is respected
in your v2 patchset?

I looked into patch 1 and one of the rest patches (act_vlan), for me it
looks like you only updated free_tcf() since v1, but this change is effectively
nothing but removing one wrapper.

Let's look at the code in act_vlan:

222         spin_lock_bh(&v->tcf_lock);
223         goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
224         rcu_swap_protected(v->vlan_p, p, lockdep_is_held(&v->tcf_lock));
225         spin_unlock_bh(&v->tcf_lock);
226
227         if (goto_ch)
228                 tcf_chain_put_by_act(goto_ch);

So, if we are replacing an existing action, goto_ch could be still accessed
by RCU readers without taking any refcnt, so why tcf_chain_put_by_act()
is safe against RCU readers? As we already discussed, its refcnt is not
always non-zero, the target chain could be any chain.

What am I missing in your v2?

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ