mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 12:35:52 +02:00
Anna says:
> KASAN reports [...] a slab-out-of-bounds in gss_krb5_checksum(),
> and it can cause my client to panic when running cthon basic
> tests with krb5p.
> Running faddr2line gives me:
>
> gss_krb5_checksum+0x4b6/0x630:
> ahash_request_free at
> /home/anna/Programs/linux-nfs.git/./include/crypto/hash.h:619
> (inlined by) gss_krb5_checksum at
> /home/anna/Programs/linux-nfs.git/net/sunrpc/auth_gss/gss_krb5_crypto.c:358
My diagnosis is that the memcpy() at the end of gss_krb5_checksum()
reads past the end of the buffer containing the checksum data
because the callers have ignored gss_krb5_checksum()'s API contract:
* Caller provides the truncation length of the output token (h) in
* cksumout.len.
Instead they provide the fixed length of the hmac buffer. This
length happens to be larger than the value returned by
crypto_ahash_digestsize().
Change these errant callers to work like krb5_etm_{en,de}crypt().
As a defensive measure, bound the length of the byte copy at the
end of gss_krb5_checksum().
Kunit sez:
Testing complete. Ran 68 tests: passed: 68
Elapsed time: 81.680s total, 5.875s configuring, 75.610s building, 0.103s running
Reported-by: Anna Schumaker <schumaker.anna@gmail.com>
Fixes:
|
||
|---|---|---|
| .. | ||
| auth_gss_internal.h | ||
| auth_gss.c | ||
| gss_generic_token.c | ||
| gss_krb5_crypto.c | ||
| gss_krb5_internal.h | ||
| gss_krb5_keys.c | ||
| gss_krb5_mech.c | ||
| gss_krb5_seal.c | ||
| gss_krb5_seqnum.c | ||
| gss_krb5_test.c | ||
| gss_krb5_unseal.c | ||
| gss_krb5_wrap.c | ||
| gss_mech_switch.c | ||
| gss_rpc_upcall.c | ||
| gss_rpc_upcall.h | ||
| gss_rpc_xdr.c | ||
| gss_rpc_xdr.h | ||
| Makefile | ||
| svcauth_gss.c | ||
| trace.c | ||