public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: Jarkko Sakkinen <jarkko@kernel.org>, 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: Thu, 8 Jun 2023 11:10:59 -0400	[thread overview]
Message-ID: <666b8422-3e4f-3d88-1ff7-1f650dd401ce@linux.ibm.com> (raw)
In-Reply-To: <CT7AOKF4OGHA.2S5VUEAG76GYB@suppilovahvero>



On 6/8/23 09:14, Jarkko Sakkinen wrote:
> On Wed May 31, 2023 at 8:01 PM EEST, Stefan Berger wrote:
>>
>>
>
>>
>> This is swtpm picking up this command with its user buffer.
>>
>>     So, I am not sure at this point what is wrong.
>>
>>      Stefan
> 
> The answer was below but in short it is that you have a function that
> expects __user * and you don't pass user tagged memory.

There are two functions that expect user tagged memory:

static ssize_t vtpm_proxy_fops_read(struct file *filp, char __user *buf,
				    size_t count, loff_t *off)
static ssize_t vtpm_proxy_fops_write(struct file *filp, const char __user *buf,
				     size_t count, loff_t *off)

the correspond to this interface:

struct file_operations {
	struct module *owner;
	loff_t (*llseek) (struct file *, loff_t, int);
	ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
	ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);

defined here:

static const struct file_operations vtpm_proxy_fops = {
	.owner = THIS_MODULE,
	.llseek = no_llseek,
	.read = vtpm_proxy_fops_read,
	.write = vtpm_proxy_fops_write,

Conversely, I see no other function interfaces in tpm_vtpm_proxy.c where the code would be missing the __user.

Neither do I see any functions where I am passing a __user tagged buffer as parameter that shouldn't have
such a tag on it or the reverse where a plain buffer is passed and it should be a __user tagged buffer.

    Stefan

> 
> Even tho it is a bug, I think cc to stable is not necessary given that
> it is not known to blow up anything. The main problem is that we have
> code that does not work according to the expectations.
> 
> BR, Jarkko
> 
> 

  reply	other threads:[~2023-06-08 15:11 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
2023-05-31 17:01     ` Stefan Berger
2023-06-08 13:14       ` Jarkko Sakkinen
2023-06-08 15:10         ` Stefan Berger [this message]
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=666b8422-3e4f-3d88-1ff7-1f650dd401ce@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=alejandro.cabreraaldaya@tuni.fi \
    --cc=jarkko.sakkinen@tuni.fi \
    --cc=jarkko@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --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