Message ID | 20170601.233329.698047529665811283.davem@davemloft.net |
---|---|
State | Not Applicable |
Delegated to: | David Miller |
Headers | show |
On 6/1/17 10:33 PM, David Miller wrote: > From: Eric Sandeen <sandeen@sandeen.net> > Date: Thu, 1 Jun 2017 21:10:50 -0500 > >> On ARM, there was a gcc bug causing similar results - I /think/ >> it was https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293 >> >> "programs could fail sporadically with this if an interrupt happens at >> the wrong instant in time and data was written onto the current stack." >> >> https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02292.html >> >> Maybe totally unrelated; if not, hope it helps. :) > > Wow, that looks exactly like what the bug is: Sweet. \o/ -Eric -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/lib/libcrc32c.c b/lib/libcrc32c.c index 74a54b7..bf831e2 100644 --- a/lib/libcrc32c.c +++ b/lib/libcrc32c.c @@ -43,7 +43,7 @@ static struct crypto_shash *tfm; u32 crc32c(u32 crc, const void *address, unsigned int length) { SHASH_DESC_ON_STACK(shash, tfm); - u32 *ctx = (u32 *)shash_desc_ctx(shash); + u32 ret, *ctx = (u32 *)shash_desc_ctx(shash); int err; shash->tfm = tfm; @@ -53,7 +53,9 @@ u32 crc32c(u32 crc, const void *address, unsigned int length) err = crypto_shash_update(shash, address, length); BUG_ON(err); - return *ctx; + ret = *ctx; + barrier(); + return ret; } EXPORT_SYMBOL(crc32c);