All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Ferrieux <alexandre.ferrieux@gmail.com>
To: Matthew Wilcox <willy@infradead.org>,
	Alexandre Ferrieux <alexandre.ferrieux@gmail.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: RFC: chasing all idr_remove() misses
Date: Mon, 18 Nov 2024 12:33:07 +0100	[thread overview]
Message-ID: <d4e75e41-cbea-4c24-82f7-6b9f85f66bd3@orange.com> (raw)
In-Reply-To: <Zzqq2ypY0JKrwlMb@casper.infradead.org>

On 18/11/2024 03:47, Matthew Wilcox wrote:
> On Sun, Nov 17, 2024 at 04:07:43PM +0100, Alexandre Ferrieux wrote:
>> On 16/11/2024 20:43, Dan Carpenter wrote:
>> >
>> > On Sat, Nov 16, 2024 at 06:45:37PM +0100, Alexandre Ferrieux wrote:
>> >>
>> >>   73af53d82076 net: sched: cls_u32: Fix u32's systematic failure to free IDR
>> >>                entries for hnodes.
>> >>
>> >> So, unless we have reasons to think cls_u32 was the only place where two ID
>> >> encodings might lend themselves to confusion, I'm wondering if it wouldn't
>> >> make sense to chase the issue more systematically
>> >>
>> > Matthew Wilcox maintains IDR so it's really up to him.  I don't think adding
>> > a WARN_ON_ONCE() in idr_remove() for NULL returns is a bad idea but we could
>> > hide it behind a #if DEBUG_IDR or something and try run syzkaller on it first.
>> 
>> Thanks Dan. Now, I'm not familiar with the syzbot feeding process, can you help
>> me out ? Is the next step to:
>> 
>>  (a) invent the new debug flag (e.g. "DEBUG_IDR") then post a patch using it;
>> wait for its acceptation and merge ; then contact syzbot operators to add it in
>> (some of) its builds
>> 
>>  (b) use some existing wide-range debug flag so that syzbot will automagically
>> test IDR once the patch is merged
>> 
>>  (c) wait for you or Matthew to handle all of this
> 
> IDR is deprecated.  I'm not excited about patches that make it better.
> IDR users should be converted to use the XArray API.

Well, the problem is more about chasing a bad usage pattern than an API's
limitations. Indeed, doing the same grep for Xarray shows that, out of 434
(naked) call sites of xa_erase() in the kernel, 307 fail to check the result.

So, independently from the IDR->XArray transition (which may still take some
time), it looks like there's a Damocles sword over a possibly huge number of
areas, and that would handily be grabbed by a syzbot scan, with a ridiculous
time investment: just add #ifdef ... WARN_ON_ONCE() ...#endif on the "return
NULL" path of both idr_remove() and xa_erase().

Again, I'm not asking to do this on production kernels. All I'm asking is the
detailed procedure to let the "established" fuzzers exercise that, as using
syzkaller locally on my limited hardware is not an serious option.



  reply	other threads:[~2024-11-18 11:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16 17:45 RFC: chasing all idr_remove() misses Alexandre Ferrieux
2024-11-16 19:43 ` Dan Carpenter
2024-11-17 15:07   ` Alexandre Ferrieux
2024-11-18  2:47     ` Matthew Wilcox
2024-11-18 11:33       ` Alexandre Ferrieux [this message]
2024-11-20 14:43         ` Alexandre Ferrieux
  -- strict thread matches above, loose matches on Subject: below --
2024-11-10 17:28 [PATCH net v7] net: sched: cls_u32: Fix u32's systematic failure to free IDR entries for hnodes Alexandre Ferrieux
2024-11-13  5:00 ` patchwork-bot+netdevbpf
2024-11-14 18:24   ` RFC: chasing all idr_remove() misses Alexandre Ferrieux
2024-11-19  3:51     ` Cong Wang
2024-11-19  3:57       ` Cong Wang
2024-11-19  6:46       ` Alexandre Ferrieux
2024-11-22 21:32         ` Cong Wang

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=d4e75e41-cbea-4c24-82f7-6b9f85f66bd3@orange.com \
    --to=alexandre.ferrieux@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.