From: Alexandre Ferrieux <alexandre.ferrieux@gmail.com>
To: Alexandre Ferrieux <alexandre.ferrieux@gmail.com>,
Matthew Wilcox <willy@infradead.org>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
kernel-janitors@vger.kernel.org
Subject: Re: RFC: chasing all idr_remove() misses
Date: Wed, 20 Nov 2024 15:43:23 +0100 [thread overview]
Message-ID: <e9035219-4f16-4d27-bc8d-31f720c52e00@orange.com> (raw)
In-Reply-To: <d4e75e41-cbea-4c24-82f7-6b9f85f66bd3@orange.com>
On 18/11/2024 12:33, Alexandre Ferrieux wrote:
> On 18/11/2024 03:47, Matthew Wilcox wrote:
>>
>> 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.
Reading up on syzbot documentation, I can see that the recommended idiom for
such cases is #if IS_ENABLED(CONFIG_DEBUG_AID_FOR_SYZBOT):
>> https://github.com/google/syzkaller/blob/master/docs/syzbot.md says:
>
> However, syzbot kernel config always includes CONFIG_DEBUG_AID_FOR_SYZBOT=y
> setting, which is not normally present in kernel. What was used for
> particularly elusive bugs in the past is temporary merging some additional
> debugging code into linux-next under this config setting (e.g. more debug
> checks and/or debug output) and waiting for new crash reports from syzbot
So, if I submitted a patch doing WARN_ON_ONCE(..==NULL) under this flag in all
naked idr_remove() and xa_erase() call sites, with suitable macro decoration to
keep readability, would it stand a chance to be committed ?
next prev parent reply other threads:[~2024-11-20 14:43 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
2024-11-20 14:43 ` Alexandre Ferrieux [this message]
-- 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=e9035219-4f16-4d27-bc8d-31f720c52e00@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.