From: Jarkko Sakkinen <jarkko@kernel.org>
To: Stefan Berger <stefanb@linux.ibm.com>, linux-integrity@vger.kernel.org
Cc: Jason Gunthorpe <jgg@nvidia.com>,
Alejandro Cabrera <alejandro.cabreraaldaya@tuni.fi>,
Jarkko Sakkinen <jarkko.sakkinen@tuni.fi>,
stable@vger.kernel.org,
Stefan Berger <stefanb@linux.vnet.ibm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tpm: factor out the user space mm from tpm_vtpm_set_locality()
Date: Wed, 31 May 2023 19:45:22 +0300 [thread overview]
Message-ID: <f07c0d348ec293dee1f8fe25583ee30ea21971f0.camel@kernel.org> (raw)
In-Reply-To: <324df0fa5ad1f0508c5f62c25dd1f8d297d78813.camel@kernel.org>
On Wed, 2023-05-31 at 19:32 +0300, Jarkko Sakkinen wrote:
> On Wed, 2023-05-31 at 11:20 -0400, Stefan Berger wrote:
> >
> > On 5/30/23 16:50, Jarkko Sakkinen wrote:
> > > From: Jarkko Sakkinen <jarkko.sakkinen@tuni.fi>
> > >
> > > vtpm_proxy_fops_set_locality() causes kernel buffers to be passed to
> > > copy_from_user() and copy_to_user().
> >
> > And what is the problem with that? Is it not working?
>
> It is API contract and also clearly documented in the kernel documentation.
>
> This should be obvious even if you have've consulted that documentation because
> both functions have 'user' suffix, and also the pointer is __user tagged.
>
> To make things worse it is architecture specific. I'm worried that it will
> break in one of the 23 microarchitectures. Have you actually ever checked it
> does not?
>
> I'm not also an expert of how all the possible CPUs in the world empower
> Linux to further restrict the move between different memory spaces. I'm
> quite sure that this does conflict neither with SMAP or SMEP on x86
> (because I know x86 pretty well), but who knows what they add in the
> future to the microarchitecture.
>
> > > Factor out the crippled code away with help of an internal API for
> > > managing struct proxy_dev instances.
> >
> > What is crippled code?
>
> Code that behaves badly, i.e. does not meat the expectations. Illegit use of
> in-kernel functions easily fits to the definition of crippled code.
>
> Bad API behavior put aside, it is very inefficient implementation because it
> unnecessarily recurses tpm_transmit(), which makes extending the driver to
> any direction so much involved process, but we don't really need this as a
> rationale.
>
> This needs to be fixed in a way or another. That is dictated by the API
> cotract so for that I do not really even need feedback because it is
> force majeure. I'm cool with alternatives or suggestions to the current
> fact, so please focus on that instead of asking question that kernel
> documentation provides you already all the answers.
I have to add that it has not been too critical because afaik tpm_vtpm_proxy
is for the most part for development use, and less of so production. This is
just to say that overally we've been happy with the driver in its use cases
but any snippet of code always has an expiration date.
BR, Jarkko
next prev parent reply other threads:[~2023-05-31 16:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 20:50 [PATCH] tpm: factor out the user space mm from tpm_vtpm_set_locality() Jarkko Sakkinen
2023-05-30 21:49 ` Jarkko Sakkinen
2023-05-31 15:20 ` Stefan Berger
2023-05-31 16:32 ` Jarkko Sakkinen
2023-05-31 16:45 ` Jarkko Sakkinen [this message]
2023-05-31 17:01 ` Stefan Berger
2023-06-08 13:14 ` Jarkko Sakkinen
2023-06-08 15:10 ` Stefan Berger
2023-06-08 18:59 ` Jarkko Sakkinen
2023-05-31 15:53 ` Jerry Snitselaar
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=f07c0d348ec293dee1f8fe25583ee30ea21971f0.camel@kernel.org \
--to=jarkko@kernel.org \
--cc=alejandro.cabreraaldaya@tuni.fi \
--cc=jarkko.sakkinen@tuni.fi \
--cc=jgg@nvidia.com \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=stefanb@linux.ibm.com \
--cc=stefanb@linux.vnet.ibm.com \
/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