linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>,
	Tadeusz Struk <tadeusz.struk@intel.com>
Cc: "Mantas Mikulėnas" <grawity@gmail.com>,
	linux-integrity@vger.kernel.org,
	"Tadeusz Struk" <tadeusz.struk@intel.com>
Subject: Re: Kernel 5.0 regression in /dev/tpm0 access
Date: Mon, 11 Mar 2019 15:09:08 +0200	[thread overview]
Message-ID: <20190311130908.GA7264@linux.intel.com> (raw)
In-Reply-To: <1552171467.3442.13.camel@HansenPartnership.com>

On Sat, Mar 09, 2019 at 02:44:27PM -0800, James Bottomley wrote:
> OK, so the polled sequence should be 
> 
> write()
> poll()
> read()
> 
> So I think this condition in tpm_common_poll is the problem:
> 
> 	if (!priv->response_read || priv->response_length)
> 		mask = EPOLLIN | EPOLLRDNORM;

Tadeusz, why on earth the code does not lock buffer_mutex?? Just noticed
when I checked the function in question. It is an awful bug alone.

Maybe I'm missing something but that is the root cause for this mess
i.e. race condition with tpm_common_write().

I'm sorry for not noticing that during the review process :-( So
obviously wrong...

/Jarkko

  reply	other threads:[~2019-03-11 13:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-09 20:48 Kernel 5.0 regression in /dev/tpm0 access Mantas Mikulėnas
2019-03-09 22:01 ` James Bottomley
2019-03-09 22:44   ` James Bottomley
2019-03-11 13:09     ` Jarkko Sakkinen [this message]
2019-03-12 22:42       ` Tadeusz Struk
2019-03-12 22:50         ` James Bottomley
2019-03-13 14:00           ` Jarkko Sakkinen
2019-03-13 13:59         ` Jarkko Sakkinen
2019-03-17 13:22           ` Jarkko Sakkinen
2019-03-18 15:50             ` Tadeusz Struk
2019-03-20  9:58               ` Jarkko Sakkinen

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=20190311130908.GA7264@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=grawity@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=tadeusz.struk@intel.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;
as well as URLs for NNTP newsgroup(s).