netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	edumazet@google.com
Subject: Re: [PATCH net 1/6] netfilter: nf_tables: report use refcount overflow
Date: Thu, 06 Jul 2023 11:01:42 +0200	[thread overview]
Message-ID: <8c98394f6d399b4e725521f8d9fe9788f7fe3784.camel@redhat.com> (raw)
In-Reply-To: <20230705230406.52201-2-pablo@netfilter.org>

On Thu, 2023-07-06 at 01:04 +0200, Pablo Neira Ayuso wrote:
> Overflow use refcount checks are not complete.
> 
> Add helper function to deal with object reference counter tracking.
> Report -EMFILE in case UINT_MAX is reached.
> 
> nft_use_dec() splats in case that reference counter underflows,
> which should not ever happen.

For the records, I also once had the need for an non atomic reference
counters implementing sanity checks on underflows/overflows. I resorted
to use plain refcount_t, since the atomic op overhead was not
noticeable in my use-case.

[not blocking this series, just thinking aloud] I'm wondering if a
generic, non-atomic refcounter infra could be useful?

Cheers,

Paolo


  reply	other threads:[~2023-07-06  9:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 23:04 [PATCH net 0/6] Netfilter fixes for net Pablo Neira Ayuso
2023-07-05 23:04 ` [PATCH net 1/6] netfilter: nf_tables: report use refcount overflow Pablo Neira Ayuso
2023-07-06  9:01   ` Paolo Abeni [this message]
2023-07-06  9:20   ` patchwork-bot+netdevbpf
2023-07-05 23:04 ` [PATCH net 2/6] netfilter: conntrack: gre: don't set assured flag for clash entries Pablo Neira Ayuso
2023-07-05 23:04 ` [PATCH net 3/6] netfilter: conntrack: Avoid nf_ct_helper_hash uses after free Pablo Neira Ayuso
2023-07-05 23:04 ` [PATCH net 4/6] netfilter: conntrack: don't fold port numbers into addresses before hashing Pablo Neira Ayuso
2023-07-05 23:04 ` [PATCH net 5/6] netfilter: nf_tables: do not ignore genmask when looking up chain by id Pablo Neira Ayuso
2023-07-05 23:04 ` [PATCH net 6/6] netfilter: nf_tables: prevent OOB access in nft_byteorder_eval Pablo Neira Ayuso

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=8c98394f6d399b4e725521f8d9fe9788f7fe3784.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /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).