Date: Mon, 10 Dec 2018 11:44:26 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 233907] Memory leakage in opencrypto for gcm algorithm Message-ID: <bug-233907-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D233907 Bug ID: 233907 Summary: Memory leakage in opencrypto for gcm algorithm Product: Base System Version: 11.2-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: olegyankovic@gmail.com Opencrypto subsystem has memory leakage when gcm algorithm is used. To make sure the bug exist it's enough to monitor memory usage through "vmstat -m | grep crypto" while opening and freeing new sessions for gcm (the auth part = of gcm: CRYPTO_AES_256_NIST_GMAC). Memory is allocated at swcr_newsession function: 929 case CRYPTO_AES_256_NIST_GMAC: 930 axf =3D &auth_hash_nist_gmac_aes_256; 931 auth4common: 932 len =3D cri->cri_klen / 8; 933 if (len !=3D 16 && len !=3D 24 && len !=3D = 32) { 934 swcr_freesession_locked(dev, i); 935 rw_runlock(&swcr_sessions_lock); 936 return EINVAL; 937 } 938=20=20=20=20=20 939 (*swd)->sw_ictx =3D malloc(axf->ctxsize, M_CRYPTO_DATA, 940 M_NOWAIT); and not released in swcr_freesession_locked function. I think it's enough to make something like this in swcr_freesession_locked: 1055 case CRYPTO_MD5: 1056 case CRYPTO_SHA1: case CRYPTO_AES_128_NIST_GMAC: case CRYPTO_AES_192_NIST_GMAC: case CRYPTO_AES_256_NIST_GMAC: 1057 axf =3D swd->sw_axf; 1058=20=20=20=20 1059 if (swd->sw_ictx) 1060 free(swd->sw_ictx, M_CRYPTO_DATA); 1061 break; --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-233907-227>