tpm2: fix GCC 15 stringop-overflow error in MakeIv#588
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe ChangesIV Buffer Volatility
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)src/tpm2/TPMCmd/tpm/src/crypt/AlgorithmTests.csrc/tpm2/TPMCmd/tpm/src/crypt/AlgorithmTests.c:10:10: fatal error: 'Tpm.h' file not found ... [truncated 733 characters] ... ib/infer/facebook-clang-plugins/clang/install/lib/clang/18/include" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This was reported by NixOS/nixpkgs#528643 |
7da3d42 to
7c31c13
Compare
When compiling with GCC 15 using `CFLAGS=-march=x86-64-v4`, the compiler's
aggressively optimized vectorizer triggers a false-positive
-Wstringop-overflow error. Because x86-64-v4 enables wide AVX-512 registers,
the compiler misinterprets the loop unrolling and warns that a 64-byte
vector write is overflowing the destination buffer:
```
tpm2/TPMCmd/tpm/src/crypt/AlgorithmTests.c:158:17: error:
writing 64 bytes into a region of size 15 [-Werror=stringop-overflow=]
158 | *iv = i;
```
This fixes the warning by marking the `iv` output pointer parameter as
`volatile`. This inhibits the over-aggressive loop vectorization on this
specific buffer, silencing the compiler error without changing the
underlying logic.
Signed-off-by: Arthur Gautier <arthur.gautier@arista.com>
7c31c13 to
b35faee
Compare
fix NixOS#528643 stefanberger/libtpms#588 Co-Authored-By: Arthur Gautier <arthur.gautier@arista.com>
fix NixOS#528643 stefanberger/libtpms#588 Co-Authored-By: Arthur Gautier <arthur.gautier@arista.com>
fix NixOS#528643 stefanberger/libtpms#588 Co-Authored-By: Arthur Gautier <arthur.gautier@arista.com> Not-cherry-picked-because: vendoring patch is required as `26.05` using tag `v0.10.2` as src, and the file being patched has been moved during `v0.10.2` and the PR's base: NixOS#528643 (comment)
|
I will admit I don't understand the test failure, patch doesn't touch a piece swtpm relies upon. Could that be a fluke? (can we retry?) |
The timeouts that occurred are strange but unrelated to this patch. I will merge it soon. Thanks! |
When compiling with GCC 15 using
CFLAGS=-march=x86-64-v4, the compiler's aggressively optimized vectorizer triggers a false-positive -Wstringop-overflow error. Because x86-64-v4 enables wide AVX-512 registers, the compiler misinterprets the loop unrolling and warns that a 64-byte vector write is overflowing the destination buffer:This fixes the warning by marking the
ivoutput pointer parameter asvolatile. This inhibits the over-aggressive loop vectorization on this specific buffer, silencing the compiler error without changing the underlying logic.Summary by CodeRabbit
No user-visible changes