Re: [GIT PULL] smb3 client fixes
From: Linus Torvalds
Date: Fri Mar 06 2026 - 19:22:17 EST
On Fri, 6 Mar 2026 at 14:04, Steve French <smfrench@xxxxxxxxx> wrote:
>
> - Security fix
Bah. I had to look this up - I don't think it's an actual security
issue, just a (good) cleanup.
Yes, yes, the old code did "memcmp" instead of "crypto_memneq". And
yes, it's in theory timing-sensitive.
But the two compares were of size 8 and 16, and at least clang
generates a constant-time comparison for that anyway (I bet gcc does
too):
This is the 16-byte case:
movq (%rdi), %rax
movq 8(%rdi), %rcx
xorq (%rsi), %rax
xorq 8(%rsi), %rcx
orq %rax, %rcx
je ...
and the 8-byte case is even more trivially constant-time.
And I'm sure that you can get the compiler to generate garbage that is
timing-sensitive by enabling some debug options that make code quality
much worse, but my point is that as an explanation for the pull
request, that "security fix" was just not a great explanation
regardless.
I'd argue that half of the other fixes were *more* relevant for
security than this one. An oops is a bigger security issue than some
purely theoretical timing attack that is almost certainly not
practical even *if* that code had done the mindless byte-at-a-time
comparison.
Linus