Segfault on strings tensors with mistmatched dimensions in TensorFlow
Description
TensorFlow is an end-to-end open source platform for machine learning. In affected versions under certain conditions, Go code can trigger a segfault in string deallocation. For string tensors, C.TF_TString_Dealloc is called during garbage collection within a finalizer function. However, tensor structure isn't checked until encoding to avoid a performance penalty. The current method for dealloc assumes that encoding succeeded, but segfaults when a string tensor is garbage collected whose encoding failed (e.g., due to mismatched dimensions). To fix this, the call to set the finalizer function is deferred until NewTensor returns and, if encoding failed for a string tensor, deallocs are determined based on bytes written. We have patched the issue in GitHub commit 8721ba96e5760c229217b594f6d2ba332beedf22. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, which is the other affected version.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
tensorflowPyPI | >= 2.5.0rc0, < 2.5.1 | 2.5.1 |
tensorflow-cpuPyPI | >= 2.5.0rc0, < 2.5.1 | 2.5.1 |
tensorflow-gpuPyPI | >= 2.5.0rc0, < 2.5.1 | 2.5.1 |
Affected products
17- osv-coords16 versionspkg:bitnami/tensorflowpkg:pypi/tensorflowpkg:pypi/tensorflow-cpupkg:pypi/tensorflow-gpupkg:rpm/opensuse/bazel3.7&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/bazel-skylib1.0.3&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/tensorflow2_2_6_0-gnu-hpc&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/tensorflow2_2_6_0-gnu-openmpi2-hpc&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/tensorflow2&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/tensorflow2-lite&distro=openSUSE%20Leap%2015.3pkg:rpm/suse/bazel3.7&distro=SUSE%20Package%20Hub%2015%20SP3pkg:rpm/suse/bazel-skylib1.0.3&distro=SUSE%20Package%20Hub%2015%20SP3pkg:rpm/suse/tensorflow2_2_6_0-gnu-hpc&distro=SUSE%20Package%20Hub%2015%20SP3pkg:rpm/suse/tensorflow2_2_6_0-gnu-openmpi2-hpc&distro=SUSE%20Package%20Hub%2015%20SP3pkg:rpm/suse/tensorflow2&distro=SUSE%20Package%20Hub%2015%20SP3pkg:rpm/suse/tensorflow2-lite&distro=SUSE%20Package%20Hub%2015%20SP3
>= 2.5.0, < 2.6.0+ 15 more
- (no CPE)range: >= 2.5.0, < 2.6.0
- (no CPE)range: >= 2.5.0rc0, < 2.5.1
- (no CPE)range: >= 2.5.0rc0, < 2.5.1
- (no CPE)range: >= 2.5.0rc0, < 2.5.1
- (no CPE)range: < 3.7.2-bp153.4.1
- (no CPE)range: < 1.0.3-bp153.2.1
- (no CPE)range: < 2.6.0-bp153.2.3.1
- (no CPE)range: < 2.6.0-bp153.2.3.1
- (no CPE)range: < 2.6.0-bp153.2.3.1
- (no CPE)range: < 2.6.0-bp153.2.3.1
- (no CPE)range: < 3.7.2-bp153.4.1
- (no CPE)range: < 1.0.3-bp153.2.1
- (no CPE)range: < 2.6.0-bp153.2.3.1
- (no CPE)range: < 2.6.0-bp153.2.3.1
- (no CPE)range: < 2.6.0-bp153.2.3.1
- (no CPE)range: < 2.6.0-bp153.2.3.1
- Range: >= 2.5.0, < 2.5.1
Patches
Vulnerability mechanics
References
8- github.com/advisories/GHSA-cmgw-8vpc-rc59ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2021-37692ghsaADVISORY
- github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-605.yamlghsaWEB
- github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-803.yamlghsaWEB
- github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-314.yamlghsaWEB
- github.com/tensorflow/tensorflow/commit/8721ba96e5760c229217b594f6d2ba332beedf22ghsax_refsource_MISCWEB
- github.com/tensorflow/tensorflow/pull/50508ghsax_refsource_MISCWEB
- github.com/tensorflow/tensorflow/security/advisories/GHSA-cmgw-8vpc-rc59ghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.