`CHECK` fail in `Conv2DBackpropInput` in TensorFlow
Description
TensorFlow is an open source platform for machine learning. When Conv2DBackpropInput receives empty out_backprop inputs (e.g. [3, 1, 0, 1]), the current CPU/GPU kernels CHECK fail (one with dnnl, the other with cudnn). This can be used to trigger a denial of service attack. We have patched the issue in GitHub commit 27a65a43cf763897fecfa5cdb5cc653fc5dd0346. The fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1, TensorFlow 2.8.1, and TensorFlow 2.7.2, as these are also affected and still in supported range. There are no known workarounds for this issue.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
tensorflowPyPI | < 2.7.2 | 2.7.2 |
tensorflowPyPI | >= 2.8.0, < 2.8.1 | 2.8.1 |
tensorflowPyPI | >= 2.9.0, < 2.9.1 | 2.9.1 |
tensorflow-cpuPyPI | < 2.7.2 | 2.7.2 |
tensorflow-cpuPyPI | >= 2.8.0, < 2.8.1 | 2.8.1 |
tensorflow-cpuPyPI | >= 2.9.0, < 2.9.1 | 2.9.1 |
tensorflow-gpuPyPI | < 2.7.2 | 2.7.2 |
tensorflow-gpuPyPI | >= 2.8.0, < 2.8.1 | 2.8.1 |
tensorflow-gpuPyPI | >= 2.9.0, < 2.9.1 | 2.9.1 |
Affected products
1- Range: < 2.7.2
Patches
127a65a43cf76Fix GPU/CPU Conv2DBackpropInputOp check error.
2 files changed · +36 −0
tensorflow/core/kernels/conv_grad_input_ops.h+19 −0 modified@@ -37,6 +37,7 @@ limitations under the License. #include "tensorflow/core/kernels/conv_2d.h" #include "tensorflow/core/kernels/conv_grad_ops.h" #include "tensorflow/core/kernels/conv_grad_shape_utils.h" +#include "tensorflow/core/kernels/fill_functor.h" #ifdef TENSORFLOW_USE_LIBXSMM_CONVOLUTIONS #include "tensorflow/core/kernels/xsmm_conv2d.h" #endif @@ -436,6 +437,15 @@ class Conv2DBackpropInputOp : public OpKernel { return; } + // If shapes are valid but `out_backprop` is empty, in_backprop should be + // set to all zeros. Otherwise, cudnn/dnnl fail with an empty input. + if (out_backprop.NumElements() == 0) { + functor::SetZeroFunctor<Device, T> set_zero; + set_zero(context->eigen_device<Device>(), + in_backprop->template flat<T>()); + return; + } + // For now we take the stride from the second and third dimensions only (we // do not support striding on the batch or depth dimension). const int stride_rows = GetTensorDim(strides_, data_format_, 'H'); @@ -554,6 +564,15 @@ class Conv2DCustomBackpropInputOp : public OpKernel { return; } + // If shapes are valid but `out_backprop` is empty, in_backprop should be + // set to all zeros. Otherwise, cudnn/dnnl fail with an empty input. + if (out_backprop.NumElements() == 0) { + functor::SetZeroFunctor<Device, T> set_zero; + set_zero(context->eigen_device<Device>(), + in_backprop->template flat<T>()); + return; + } + // TODO(ezhulenev): Remove custom kernel and move XSMM support to // LaunchConv2DBackpropInputOp functor. #if defined TENSORFLOW_USE_LIBXSMM_CONVOLUTIONS && \
tensorflow/python/kernel_tests/nn_ops/conv_ops_test.py+17 −0 modified@@ -1103,6 +1103,23 @@ def testConv2DInputSizesContainsOnlySpatialDimensionsBackpropInput(self): use_gpu=use_gpu, err=1e-5) + @test_util.run_in_graph_and_eager_modes + @test_util.disable_xla("b/239598470") + def testConv2DBackpropInputDegenerateBackpropInput(self): + input_sizes = [3, 1, 1, 2] + expected_output = np.zeros(input_sizes).flatten() + for (data_format, use_gpu) in GetTestConfigs(): + self._RunAndVerifyBackpropInput( + input_sizes=input_sizes, + filter_sizes=[1, 3, 2, 3], + output_sizes=[3, 1, 0, 3], + strides=[1, 2], + padding="VALID", + expected=expected_output, + data_format=data_format, + use_gpu=use_gpu, + err=1e-5) + # Testing for backprops def _RunAndVerifyBackpropFilter(self, input_sizes,
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-37jf-mjv6-xfqwghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-35999ghsaADVISORY
- github.com/tensorflow/tensorflow/commit/27a65a43cf763897fecfa5cdb5cc653fc5dd0346ghsax_refsource_MISCWEB
- github.com/tensorflow/tensorflow/releases/tag/v2.10.0ghsaWEB
- github.com/tensorflow/tensorflow/security/advisories/GHSA-37jf-mjv6-xfqwghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.