Re: [PATCH blktests] block/002: delay debugfs directory check

Shinichiro Kawasaki
2022-04-21T12:05:03Z

On Apr 21, 2022 / 16:38, Ming Lei wrote:
> On Thu, Apr 21, 2022 at 12:02:48AM +0000, Shinichiro Kawasaki wrote:
> > On Apr 20, 2022 / 23:05, Ming Lei wrote:
> > > On Wed, Apr 20, 2022 at 12:42:14PM +0000, Shinichiro Kawasaki wrote:
> > > > On Apr 20, 2022 / 17:34, Ming Lei wrote:
> > > > > On Wed, Apr 20, 2022 at 01:59:11PM +0900, Shin'ichiro Kawasaki wrote:
> > > > > > The test case block/002 checks that device removal during blktrace run
> > > > > > does not leak debugfs directory. The Linux kernel commit 0a9a25ca7843
> > > > > > ("block: let blkcg_gq grab request queue's refcnt") triggered failure of
> > > > > > the test case. The commit delayed queue release and debugfs directory
> > > > > > removal then the test case checks directory existence too early. To
> > > > > > avoid this false-positive failure, delay the directory existence check.
> > > > > >
> > > > > > Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> > > > > > ---
> > > > > > tests/block/002 | 1 +
> > > > > > 1 file changed, 1 insertion(+)
> > > > > >
> > > > > > diff --git a/tests/block/002 b/tests/block/002
> > > > > > index 9b183e7..8061c91 100755
> > > > > > --- a/tests/block/002
> > > > > > +++ b/tests/block/002
> > > > > > @@ -29,6 +29,7 @@ test() {
> > > > > > echo "debugfs directory deleted with blktrace active"
> > > > > > fi
> > > > > > { kill $!; wait; } >/dev/null 2>/dev/null
> > > > > > + sleep 0.5
> > > > > > if [[ -d /sys/kernel/debug/block/${SCSI_DEBUG_DEVICES[0]} ]]; then
> > > > > > echo "debugfs directory leaked"
> > > > > > fi
> > > > >
> > > > > Hello,
> > > > >
> > > > > Jens has merged Yu Kuai's fix[1], so I think it won't be triggered now.
> > > > >
> > > > >
> > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?h=block-5.18&id=a87c29e1a85e64b28445bb1e80505230bf2e3b4b
> > > >
> > > > Hi Ming, I applied the patch above on top of v5.18-rc3 and ran block/002.
> > > > Unfortunately, it failed with a new symptom with KASAN use-after-free [2]. I
> > > > ran block/002 with linux-block/block-5.18 branch tip with git hash a87c29e1a85e
> > > > and got the same KASAN uaf. Reverting the patch from the linux-block/block-5.18
> > > > branch, the KASAN uaf disappears (Still block/002 fails). Regarding block/002,
> > > > it looks the patch made the failure symptom worse.
> > >
> > > Hi Shinichiro,
> > >
> > > Looks Yu Kuai's patch has other problem, can you drop that patch and
> > > apply & test the attached patch?
> >
> > Sure. With the patch, kernel message is clean. But I still observe the test case
> > failure:
> >
> > block/002 (remove a device while running blktrace) [failed]
> > runtime 1.276s ... 1.241s
> > --- tests/block/002.out 2022-04-14 11:29:04.760295898 +0900
> > +++ /home/shin/blktests/results/nodev/block/002.out.bad 2022-04-21 08:40:01.776511887 +0900
> > @@ -1,2 +1,3 @@
> > Running block/002
> > +debugfs directory deleted with blktrace active
> > Test complete
>
> Hi Shinichiro,
>
> Thanks for your test, and the above issue has been addressed in the
> latest post:
>
> https://lore.kernel.org/linux-block/20220421083431.2917311-1-ming.lei@redhat.com/T/#u

Ming, I confirmed that your latest post is good, and provided Tested-by tag.
Then the change I posted for block/002 is not required. Good. Thanks again.

--
Best Regards,
Shin'ichiro Kawasaki