From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: "Jan Dąbroś" <jsd@semihalf.com>,
linux-integrity@vger.kernel.org, peterhuewe@gmx.de, jgg@ziepe.ca,
gregkh@linuxfoundation.org, arnd@arndb.de, rrangel@chromium.org,
timvp@google.com, apronin@google.com, mw@semihalf.com,
upstream@semihalf.com, "Vlastimil Babka" <vbabka@suse.cz>
Subject: Re: [PATCH v2 1/3] char: tpm: Protect tpm_pm_suspend with locks
Date: Mon, 28 Nov 2022 18:04:21 +0100 [thread overview]
Message-ID: <Y4TqFR71MitDHEEH@zx2c4.com> (raw)
In-Reply-To: <Y2kzzf6XAy5SwJva@kernel.org>
Hi Jarkko,
On Mon, Nov 07, 2022 at 06:35:25PM +0200, Jarkko Sakkinen wrote:
> On Mon, Nov 07, 2022 at 09:45:41AM +0100, Jan Dąbroś wrote:
> > niedz., 6 lis 2022 o 20:49 Jarkko Sakkinen <jarkko@kernel.org> napisał(a):
> > >
> > > On Thu, Nov 03, 2022 at 03:54:48PM +0100, Jan Dabros wrote:
> > > > Currently tpm transactions are executed unconditionally in
> > > > tpm_pm_suspend() function, what may lead to races with other tpm
> > > > accessors in the system.
> > > >
> > > > Add proper locking mechanisms by calling tpm_try_get_ops() which is a
> > > > wrapper on tpm_chip_start().
> > > >
> > > > Signed-off-by: Jan Dabros <jsd@semihalf.com>
> > >
> > > AFAIK processes are freezed before suspend callbacks are called, and
> > > the callbacks are called sequentially. I have no idea what is meant
> > > by "TPM accessor" here.
> >
> > User space processes are freezed before suspend, but kernel threads
> > are not freezable by default. In my particular case it was a hwrng
> > thread started from drivers/char/hw_random/core.c - I was referring to
> > it as "TPM accessor". For sure I should be more precise in a commit
> > msg.
>
> OK, great.
>
> >
> > > Please describe the concurrency scenario in the commit message where the
> > > race could happen, if it is hard to reproduce, and add an appropriate fixes
> > > tag.
> >
> > I will describe my scenario in more detail in the next version.
> > Regarding the "fixes" tag - I'm not too familiar with it, but looking
> > at the kernel submission guide, "fixes" should be used either when
> > there was a particular commit in the past which introduced the bug or
> > if a patch fixes an already logged bug entry (so that one can paste
> > URL). In my case both are not applicable, so please advise what
> > exactly I should put after this tag?
>
> It is
>
> Fixed: <12 character prefix of the hash> ("short summary")
>
> It should point out to the commit, which introduced the issue/bug.
Somebody just reported a bug to me in hwrng stuff, which I traced down
to this lack of tpm_try_get_ops(), and then I coded up the exact same
patch as Jan's here, saw it fixed the problem, and then realized it was
already submitted in that exact form.
Because of some recent hwrng changes, this bug will be triggered more
often than it was before.
So, even though Jan hasn't submitted a v+1, do you think you could take
this 1/3 commit, fix up the commit message or whatever you need there,
and get this in for 6.1-rc8? It's an important fix.
Thanks,
Jason
next prev parent reply other threads:[~2022-11-28 17:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 14:54 [PATCH v2 0/3] char: tpm: Adjust cr50_i2c locking mechanism Jan Dabros
2022-11-03 14:54 ` [PATCH v2 1/3] char: tpm: Protect tpm_pm_suspend with locks Jan Dabros
2022-11-06 19:48 ` Jarkko Sakkinen
2022-11-07 8:45 ` Jan Dąbroś
2022-11-07 16:35 ` Jarkko Sakkinen
2022-11-28 17:04 ` Jason A. Donenfeld [this message]
2022-11-28 17:07 ` Jason A. Donenfeld
2022-11-28 19:46 ` Vlastimil Babka
2022-11-28 19:55 ` Jason A. Donenfeld
2022-11-28 17:11 ` Vlastimil Babka
2022-11-03 14:54 ` [PATCH v2 2/3] char: tpm: cr50: Use generic request/relinquish locality ops Jan Dabros
2022-11-07 9:20 ` Jarkko Sakkinen
2022-11-07 9:41 ` Jan Dąbroś
2022-11-18 14:09 ` Guenter Roeck
2022-11-03 14:54 ` [PATCH v2 3/3] char: tpm: cr50: Move i2c locking to " Jan Dabros
2022-11-07 9:22 ` Jarkko Sakkinen
2022-11-07 9:47 ` Jan Dąbroś
2022-11-07 16:35 ` 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=Y4TqFR71MitDHEEH@zx2c4.com \
--to=jason@zx2c4.com \
--cc=apronin@google.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=jsd@semihalf.com \
--cc=linux-integrity@vger.kernel.org \
--cc=mw@semihalf.com \
--cc=peterhuewe@gmx.de \
--cc=rrangel@chromium.org \
--cc=timvp@google.com \
--cc=upstream@semihalf.com \
--cc=vbabka@suse.cz \
/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).