Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
crypto: crashes on certain architecture due to no detection for BMI instruction set extensions #18512
I am using Linux. CPU architecture is AMD64, it's i3-4000M exactly. I wrote a long string literal. The compiler crashed magically:
The existing implementation on amd64 only detects AVX2 instructions, and uses them to improve performance when the target architecture supports these instruction set extensions.
I read the manuals by AMD and Intel carefully, and confirmed that
I checked my
Therefore, unless we detect both AVX2 and BMI2, these instructions crash the running program as 'unknown instructions' on the architecture, e.g. my i3-4000M, which supports AVX2 but not support BMI2.
Attachment a part of cpuinfo
 AMD64 Architecture Programmer's Manual Volume 3: General-Purpose and System Instructions
Attachment error message when use sha1 or sha256
I searched it appears in
I wrote a quick patch for it... I hope this will be helpful for you.
@LionNatsu, we can't accept patches to the issue tracker. We need a CLA submitted, and we need the code in Gerrit for code review and because Gerrit is where our issue tracker is.
To contribute, see https://golang.org/doc/contribute.html
If you at least submit a CLA, then we could look at your code & use it.
This change uses runtime.support_bmi2 as an additional condition to examine the usability of AVX2 version algorithm, fixes the crash on the platfrom which supports AVX2 but not support BMI2. Fixes #18512 Change-Id: I408c0844ae2eb242dacf70cb9e8cec1b8f3bd941 Reviewed-on: https://go-review.googlesource.com/34851 Reviewed-by: Ian Lance Taylor <firstname.lastname@example.org> Run-TryBot: Ian Lance Taylor <email@example.com> TryBot-Result: Gobot Gobot <firstname.lastname@example.org>