From: Eric Biggers <ebiggers@kernel.org>
To: Laveesh Bansal <laveeshb@laveeshbansal.com>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
"Theodore Y. Ts'o" <tytso@mit.edu>,
Jaegeuk Kim <jaegeuk@kernel.org>,
syzbot+20d60aafd9a0d1f2a380@syzkaller.appspotmail.com,
linux-block@vger.kernel.org, linux-fscrypt@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] blk-crypto: use a NOIO scope while holding profile->lock
Date: Fri, 27 Nov 2026 10:48:12 -0800 [thread overview]
Message-ID: <20261127184812.GC1974@quark> (raw)
In-Reply-To: <20261125081417.77674-1-laveeshb@laveeshbansal.com>
On Wed, Nov 25, 2026 at 12:14:17AM -0800, Laveesh Bansal wrote:
> Setting a key in blk-crypto-fallback can deadlock on profile->lock.
> blk_crypto_get_keyslot() holds it across keyslot_program, whose setkey
> allocates with GFP_KERNEL (Adiantum); direct reclaim can evict an fscrypt
> inode, and blk_crypto_evict_key() then takes profile->lock again. syzbot
> reports it as an fs_reclaim vs profile->lock cycle. Since
> commit 5acc6f649a68 ("fscrypt: Always use blk-crypto for contents on
> block-based filesystems") hitting it no longer needs -o inlinecrypt.
>
> Enter a NOIO scope in blk_crypto_hw_enter() and leave it in
> blk_crypto_hw_exit(), so allocations made under the lock, by the
> fallback or a hardware driver, can't recurse into I/O or fs reclaim.
> blk_crypto_reprogram_all_keys() takes the lock directly, so it gets the
> same scope.
>
> Fixes: 488f6682c832 ("block: blk-crypto-fallback for Inline Encryption")
> Cc: stable@vger.kernel.org
> Reported-by: syzbot+20d60aafd9a0d1f2a380@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/r/6a9b25c3.b5d4176b.238c3e.0004.GAE@google.com
> Suggested-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Laveesh Bansal <laveeshb@laveeshbansal.com>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
- Eric
WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Laveesh Bansal <laveeshb@laveeshbansal.com>
Cc: Jens Axboe <axboe@kernel.dk>, "Theodore Y. Ts'o" <tytso@mit.edu>,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-block@vger.kernel.org, linux-fscrypt@vger.kernel.org,
linux-crypto@vger.kernel.org, Jaegeuk Kim <jaegeuk@kernel.org>,
Christoph Hellwig <hch@lst.de>,
syzbot+20d60aafd9a0d1f2a380@syzkaller.appspotmail.com
Subject: Re: [f2fs-dev] [PATCH v3] blk-crypto: use a NOIO scope while holding profile->lock
Date: Fri, 27 Nov 2026 10:48:12 -0800 [thread overview]
Message-ID: <20261127184812.GC1974@quark> (raw)
In-Reply-To: <20261125081417.77674-1-laveeshb@laveeshbansal.com>
On Wed, Nov 25, 2026 at 12:14:17AM -0800, Laveesh Bansal wrote:
> Setting a key in blk-crypto-fallback can deadlock on profile->lock.
> blk_crypto_get_keyslot() holds it across keyslot_program, whose setkey
> allocates with GFP_KERNEL (Adiantum); direct reclaim can evict an fscrypt
> inode, and blk_crypto_evict_key() then takes profile->lock again. syzbot
> reports it as an fs_reclaim vs profile->lock cycle. Since
> commit 5acc6f649a68 ("fscrypt: Always use blk-crypto for contents on
> block-based filesystems") hitting it no longer needs -o inlinecrypt.
>
> Enter a NOIO scope in blk_crypto_hw_enter() and leave it in
> blk_crypto_hw_exit(), so allocations made under the lock, by the
> fallback or a hardware driver, can't recurse into I/O or fs reclaim.
> blk_crypto_reprogram_all_keys() takes the lock directly, so it gets the
> same scope.
>
> Fixes: 488f6682c832 ("block: blk-crypto-fallback for Inline Encryption")
> Cc: stable@vger.kernel.org
> Reported-by: syzbot+20d60aafd9a0d1f2a380@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/r/6a9b25c3.b5d4176b.238c3e.0004.GAE@google.com
> Suggested-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Laveesh Bansal <laveeshb@laveeshbansal.com>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
- Eric
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2026-11-27 18:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 8:14 [PATCH v3] blk-crypto: use a NOIO scope while holding profile->lock Laveesh Bansal
2026-11-25 8:14 ` [f2fs-dev] " Laveesh Bansal
2026-11-27 18:48 ` Eric Biggers [this message]
2026-11-27 18:48 ` Eric Biggers via Linux-f2fs-devel
2026-11-30 8:18 ` Christoph Hellwig
2026-11-30 8:18 ` [f2fs-dev] " Christoph Hellwig
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=20261127184812.GC1974@quark \
--to=ebiggers@kernel.org \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=jaegeuk@kernel.org \
--cc=laveeshb@laveeshbansal.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+20d60aafd9a0d1f2a380@syzkaller.appspotmail.com \
--cc=tytso@mit.edu \
/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.