[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <28a88519-d0e2-7629-9ed9-3f9c12ca024b@virtuozzo.com>
Date: Mon, 27 Feb 2023 20:50:43 +0200
From: Alexander Atanasov <alexander.atanasov@...tuozzo.com>
To: Florian Westphal <fw@...len.de>
Cc: netdev@...r.kernel.org, Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>,
Eric Dumazet <edumazet@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH] netfilter: nf_tables: always synchronize with readers
before releasing tables
On 27.02.23 18:11, Florian Westphal wrote:
> Alexander Atanasov <alexander.atanasov@...tuozzo.com> wrote:
>>> Lastly, that list_del() in __nft_release_basechain should probably
>>> be list_del_rcu()?
>>
>> I am still in process of untwisting that place but so far.
>> Simple change to list_del_rcu wouldn't help as it wouldn't in
>> __nft_release_table:
>>
>> list_del(&rule->list);
>> ctx->chain->use--;
>> nf_tables_rule_release(ctx, rule) {
>> nft_rule_expr_deactivate(ctx, rule, NFT_TRANS_RELEASE);
>> nf_tables_rule_destroy(ctx, rule) {
>> kfree(rule); <-- freed here
>> }
>> }
>>
>> List traversal would work but instead of crash it would become use after
>> free.
>> Adding synchronize_rcu() before list iterattion there will probably do, it
>> is already under commit_mutex when called from nf_tables_netdev_event.
>
> Hmm, please wait. I have to look at this in more detail.
> I don't see a race conditon in the first place.
>
> netns dismantling already does synchronize_rcu(), so I don't see how we > can have this uaf in the first place.
As i said i am still trying to figure out the basechain place,
where is that synchronize_rcu() call done?
> Do you see this with current kernels or did the splat happen with
> an older version?
It's with a bit older kernel but there is no significant difference
wrt nf_tables_api code.
I will prepare a more detailed report for you. Unfortunately there is
no reproducer.
--
Regards,
Alexander Atanasov
Powered by blists - more mailing lists