Netdev Archive on lore.kernel.org
 help / color / Atom feed
From: "Jonathan Lemon" <jonathan.lemon@gmail.com>
To: "Jesper Dangaard Brouer" <brouer@redhat.com>
Cc: netdev@vger.kernel.org, ilias.apalodimas@linaro.org, kernel-team@fb.com
Subject: Re: [RFC PATCH 1/1] page_pool: do not release pool until inflight == 0.
Date: Mon, 11 Nov 2019 08:16:17 -0800
Message-ID: <ED29D781-92F0-494B-A28E-BB6319FC3FF7@gmail.com> (raw)
In-Reply-To: <20191111102104.1ac9620d@carbon>



On 11 Nov 2019, at 1:21, Jesper Dangaard Brouer wrote:

> On Sun, 10 Nov 2019 22:20:38 -0800
> Jonathan Lemon <jonathan.lemon@gmail.com> wrote:
>
>> diff --git a/net/core/xdp.c b/net/core/xdp.c
>> index 20781ad5f9c3..e334fad0a6b8 100644
>> --- a/net/core/xdp.c
>> +++ b/net/core/xdp.c
>> @@ -70,25 +70,47 @@ static void __xdp_mem_allocator_rcu_free(struct 
>> rcu_head *rcu)
>>
>>  	xa = container_of(rcu, struct xdp_mem_allocator, rcu);
>>
>> -	/* Allocator have indicated safe to remove before this is called */
>> -	if (xa->mem.type == MEM_TYPE_PAGE_POOL)
>> -		page_pool_free(xa->page_pool);
>> -
>>  	/* Allow this ID to be reused */
>>  	ida_simple_remove(&mem_id_pool, xa->mem.id);
>>
>> -	/* Poison memory */
>> -	xa->mem.id = 0xFFFF;
>> -	xa->mem.type = 0xF0F0;
>> -	xa->allocator = (void *)0xDEAD9001;
>> -
>>  	kfree(xa);
>>  }
>
> Can you PLEASE leave the memory poisonings that I have added alone.
> Removing these are irrelevant for current patch. You clearly don't 
> like
> this approach, but I've also clearly told that I disagree.  I'm the
> maintainer of this code and I prefer letting them stay. I'm the one
> that signed up for dealing with hard to find bugs in the code.

As you're the maintainer, I'll put this back.  However, I strongly
feel that this is poor practice; detecting use-after-free in cases
like this should be the job of the page and memory allocator; not
kmemleak (which detects lost memory), but page poisoning and redzone
support.

If this is really useful, it should specifically be under DEBUG
support, rather than in the mainline code.  It's not a performance
issue - just more techdebt, from my POV.
-- 
Jonathan

  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11  6:20 [RFC PATCH 0/1] Change page_pool timeout handling Jonathan Lemon
2019-11-11  6:20 ` [RFC PATCH 1/1] page_pool: do not release pool until inflight == 0 Jonathan Lemon
2019-11-11  9:21   ` Jesper Dangaard Brouer
2019-11-11 16:16     ` Jonathan Lemon [this message]
2019-11-11 11:47   ` Jesper Dangaard Brouer
2019-11-11 14:04     ` Ilias Apalodimas
2019-11-12  6:00     ` Jonathan Lemon

Reply instructions:

You may reply publically 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=ED29D781-92F0-494B-A28E-BB6319FC3FF7@gmail.com \
    --to=jonathan.lemon@gmail.com \
    --cc=brouer@redhat.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.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

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git