CVE-2026-74671: ima: fix out-of-bounds read in xattr_verify()
In the Linux kernel, the following vulnerability has been resolved:
ima: fix out-of-bounds read in xattrverify()
The digest-length check in xattrverify() mixes int and sizet:
if (xattrlen - sizeof(xattrvalue->type) - hashstart >= iint->imahash->length)
sizeof() yields sizet, so the usual arithmetic conversions promote the whole left-hand side to unsigned 64-bit before the subtraction runs. For a truncated xattr this underflows instead of going negative: a 1-byte IMAXATTRDIGESTNG xattr (xattrlen == 1, hashstart == 1) turns "1 - 1 - 1" into SIZEMAX, which is trivially >= imahash->length. The check then passes and the following memcmp() reads iint->imahash->length bytes starting past the end of the buffer vfsgetxattralloc() allocated for it.
Nothing upstream clamps xattrlen back into a safe range first: imagethashalgo() only special-cases xattrlen < 2 to pick a default algorithm, and evmverifyxattr() returns INTEGRITYUNKNOWN rather than failing when no HMAC key is loaded, so a truncated security.ima value reaches the length check as-is.
Rewrite the comparison so every operand stays a signed int and no implicit conversion to sizet can occur.