From: Eric Biggers <ebiggers3@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Richard Weinberger <richard@nod.at>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
linux-fscrypt@vger.kernel.org, David Gstir <david@sigma-star.at>
Subject: Re: fscrypt request_module() deadlock
Date: Tue, 18 Jul 2017 16:17:47 -0700 [thread overview]
Message-ID: <20170718231747.GA51535@gmail.com> (raw)
In-Reply-To: <20170718061351.GD4764@gondor.apana.org.au>
On Tue, Jul 18, 2017 at 02:13:51PM +0800, Herbert Xu wrote:
> On Fri, Jun 30, 2017 at 05:27:34PM +0200, Richard Weinberger wrote:
> > Hi!
> >
> > David and I faced a deadlock with switch_root when fscrypt was in use.
> > When /sbin/modprobe is encrypted using fscrypt and no other kernel component
> > requested an AES cipher before, first access to an encrypted file will trigger the
> > module_request() function, which will execute usermode helper /sbin/modprobe.
> > Is /sbin/modprobe also encrypted the kernel will deadlock because executing
> > it will again enter the module_request() path...
> >
> > As workaround we currently do something like "ls /new_root > /dev/null" in our
> > initramfs to make request_module() happen before we change the root directory
> > to /new_root.
> >
> > While this workaround is legit we think that this could be handled better.
> > Is there a way to request these ciphers before first usage? Herbert?
> > e.g. such that the filesystem can request them upon mount time.
> >
> > Btw: This happens even when AES modules are builtins.
>
> I think you're running into the problem because of templates, where
> the first instantiation will always be preceded by a request_module.
>
> We should be able to fix this by doing two template probes instead
> of one. So instead of the current order:
>
> 1. Look up registered algorithms.
> 2. Request module.
> 3. Find templates (may request module).
>
> We can do
>
> 1. Look up registered algorithms.
> 2. Find templates without loading modules.
> 3. Request module.
> 4. Find templates (may request module).
>
While that should solve the problem, isn't it possible to actually have a module
which supplies an algorithm like "xts(aes)"? In that case it wouldn't be
desirable to instantiate the generic "xts" template.
Eric
next prev parent reply other threads:[~2017-07-18 23:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-30 15:27 fscrypt request_module() deadlock Richard Weinberger
2017-07-18 6:13 ` Herbert Xu
2017-07-18 23:17 ` Eric Biggers [this message]
2017-07-19 4:58 ` Herbert Xu
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=20170718231747.GA51535@gmail.com \
--to=ebiggers3@gmail.com \
--cc=david@sigma-star.at \
--cc=herbert@gondor.apana.org.au \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard@nod.at \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).