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 RFC v2] tpm: tpm_vtpm_proxy: do not reference kernel memory as user memory
Date: Wed, 31 May 2023 20:17:49 +0300 [thread overview]
Message-ID: <83c010a7b8821309a023e41efbabb7e96f156eec.camel@kernel.org> (raw)
In-Reply-To: <b2657b55-355d-80cb-23cc-d11825f64ad1@linux.ibm.com>
On Tue, 2023-05-30 at 13:45 -0400, Stefan Berger wrote:
>
> On 5/29/23 22:01, Jarkko Sakkinen wrote:
> > From: Jarkko Sakkinen <jarkko.sakkinen@tuni.fi>
> >
>
> > - rc = copy_to_user(buf, proxy_dev->buffer, len);
> > + if (buf)
> > + rc = copy_to_user(buf, proxy_dev->buffer, len);
> > +
>
> Looking through other drivers it seems buf is always expected to be a valid non-NULL pointer on file_operations.read().
>
>
> https://elixir.bootlin.com/linux/latest/source/arch/x86/mm/tlb.c#L1279 simple_read_from_buffer will pass the pointer to the user buffer along and it ('to') ends up in copy_to_user(to, ...);
>
>
> Same here: https://elixir.bootlin.com/linux/latest/source/security/integrity/ima/ima_fs.c#L41
It is good to mention here that IMA uses __user tagged pointers
correctly, and it does not really compare to the vtpm driver code
by any possible means. So let's not add illegit comparison points.
BR, Jarkko
next prev parent reply other threads:[~2023-05-31 17:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 2:01 [PATCH RFC v2] tpm: tpm_vtpm_proxy: do not reference kernel memory as user memory Jarkko Sakkinen
2023-05-30 17:36 ` Stefan Berger
2023-05-30 17:45 ` Stefan Berger
2023-05-31 7:47 ` David Laight
2023-05-31 17:17 ` Jarkko Sakkinen [this message]
2023-05-31 17:20 ` Stefan Berger
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=83c010a7b8821309a023e41efbabb7e96f156eec.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