From: Eric Sandeen <sandeen@sandeen.net>
To: David Miller <davem@davemloft.net>, matorola@gmail.com
Cc: sparclinux@vger.kernel.org, linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [sparc64] crc32c misbehave
Date: Wed, 31 May 2017 11:19:20 -0500 [thread overview]
Message-ID: <ccdf645b-e22f-ef71-53df-993cc45869c0@sandeen.net> (raw)
In-Reply-To: <20170531.115335.213691069712156732.davem@davemloft.net>
On 5/31/17 10:53 AM, David Miller wrote:
> From: Anatoly Pugachev <matorola@gmail.com>
> Date: Wed, 31 May 2017 14:56:52 +0300
>
>> While debugging occasional crc32c checksum errors with xfs disk reads on
>> sparc64 (T5 [sun4v] 3.6 GHz CPU ldom, debian unstable/sid), Eric have found
>> that crc32c sometimes returns wrong checksum for data. Eric made a simple
>> test kernel module (included), which produce the following results on my
>> sparc64 machines:
cc: linux-xfs, because this problem cropped up on xfs/sparc.
-Eric
> I don't think that crc32c() is thread safe because of the way it is
> implemented with a shared TFM crypto object allocated once at boot
> time.
>
> I think you are seeing the corruption any time an interrupt comes in
> on the same cpu as your test module is running on and does a crc32c()
> calculation, corrupting the context key value being used by your
> invocation.
>
> At least that's my guess, I could have misread how the key is stored
> and managed around operations.
>
> Can you try something like disabling cpu IRQs around the crc32c() function
> in lib/libcrc32c.c? Something like:
>
> u32 retval;
>
> local_irq_disable();
>
> shash->tfm = tfm;
> shash->flags = 0;
> *ctx = crc;
>
> err = crypto_shash_update(shash, address, length);
> BUG_ON(err);
>
> retval = *ctx;
>
> local_irq_enable();
>
> return retval;
>
> Thanks.
>
next parent reply other threads:[~2017-05-31 16:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CADxRZqzgaL4ew6PVek3WBsdwo6GcT0ORx=7h+6p0V3NAr8qF+w@mail.gmail.com>
[not found] ` <CADxRZqzNTB1n0g1r_2rLsjifHpJ+_x1WPxNOSqEcHbi74jHi5w@mail.gmail.com>
[not found] ` <20170531.115335.213691069712156732.davem@davemloft.net>
2017-05-31 16:19 ` Eric Sandeen [this message]
2017-05-31 16:31 ` [sparc64] crc32c misbehave Eric Sandeen
2017-05-31 16:49 ` David Miller
2017-06-01 21:44 ` David Miller
2017-06-02 1:57 ` David Miller
2017-06-02 2:10 ` Eric Sandeen
2017-06-02 3:33 ` David Miller
2017-06-02 3:34 ` Eric Sandeen
2017-06-06 19:05 ` David Miller
2017-06-06 19:09 ` Eric Sandeen
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=ccdf645b-e22f-ef71-53df-993cc45869c0@sandeen.net \
--to=sandeen@sandeen.net \
--cc=davem@davemloft.net \
--cc=linux-xfs@vger.kernel.org \
--cc=matorola@gmail.com \
--cc=sparclinux@vger.kernel.org \
/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).