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]
Message-ID: <CAJL1qvE7Tpv0vmg6yRz7+Xh2T3rpqUvHshazK-N_6w2P-iv1hw@mail.gmail.com>
Date:   Thu, 1 Sep 2016 12:28:40 +0300
From:   Hadar Hen Zion <hadarh@....mellanox.co.il>
To:     Eric Dumazet <edumazet@...gle.com>
Cc:     Hadar Hen Zion <hadarh@...lanox.com>,
        "David S. Miller" <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>, Jiri Pirko <jiri@...lanox.com>,
        Jiri Benc <jbenc@...hat.com>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Shmulik Ladkani <shmulik.ladkani@...il.com>,
        Tom Herbert <tom@...bertland.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Or Gerlitz <ogerlitz@...lanox.com>,
        Amir Vadai <amirva@...lanox.com>, Amir Vadai <amir@...ai.me>
Subject: Re: [PATCH net-next V4 4/4] net/sched: Introduce act_tunnel_key

On Wed, Aug 31, 2016 at 9:39 PM, Eric Dumazet <edumazet@...gle.com> wrote:
> On Wed, Aug 31, 2016 at 5:46 AM, Hadar Hen Zion <hadarh@...lanox.com> wrote:
>>
>> From: Amir Vadai <amir@...ai.me>
>>
>> This action could be used before redirecting packets to a shared tunnel
>> device, or when redirecting packets arriving from a such a device.
>>
>>
>> +
>> +struct tcf_tunnel_key_params {
>> +       struct rcu_head         rcu;
>> +       int                     tcft_action;
>
> Also add " int action;"
>
> (see why later)
>
>> +       struct metadata_dst     *tcft_enc_metadata;
>> +};
>> +
>
>
>
>> +
>> +static int tunnel_key_act(struct sk_buff *skb, const struct tc_action *a,
>> +                         struct tcf_result *res)
>> +{
>> +       struct tcf_tunnel_key *t = to_tunnel_key(a);
>> +       struct tcf_tunnel_key_params *params;
>> +       int action;
>> +
>> +       rcu_read_lock();
>> +
>> +       params = rcu_dereference(t->params);
>> +
>> +       tcf_lastuse_update(&t->tcf_tm);
>> +       bstats_cpu_update(this_cpu_ptr(t->common.cpu_bstats), skb);
>> +       action = t->tcf_action;
>
> Ideally, you should read param->action instead of t->tcf_action to be
> completely clean.

As you suggested above, I can do it by adding "int action" to struct
tcf_tunnel_key_paramse.
But, it means that act_tunnel_key would have a different behavior than
all the other actions and even though
"struct tc_action" has a designated parameters to store this action we
won't use it.
So it won't be completely clean...

Do you think we have a cleaner way to protect it?

>
>> +
>> +       switch (params->tcft_action) {
>> +       case TCA_TUNNEL_KEY_ACT_RELEASE:
>> +               skb_dst_drop(skb);
>> +               break;
>> +       case TCA_TUNNEL_KEY_ACT_SET:
>> +               skb_dst_drop(skb);
>> +               skb_dst_set(skb, dst_clone(&params->tcft_enc_metadata->dst));
>> +               break;
>> +       default:
>> +               WARN_ONCE(1, "Bad tunnel_key action.\n");
>> +               break;
>> +       }
>> +
>> +       rcu_read_unlock();
>> +
>> +       return action;
>> +}
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ