Skip to content

Commit d683e86

Browse files
authored
[MEDIUM] Patch pytorch for CVE-2025-2953 (#13642)
1 parent faff69a commit d683e86

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

SPECS/pytorch/CVE-2025-2953.patch

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From 9f61c215128adce56200d0bf30992e791725e4ad Mon Sep 17 00:00:00 2001
2+
From: archana25-ms <[email protected]>
3+
Date: Tue, 6 May 2025 20:12:29 +0000
4+
Subject: [PATCH] Patch pytorch for CVE-2025-2953
5+
Upstream Patch Reference: https://github.com/pytorch/pytorch/commit/6f327128a99debfb2312ee256523ad6b62f763d6
6+
7+
---
8+
aten/src/ATen/native/mkldnn/Utils.cpp | 1 +
9+
test/test_mkldnn.py | 7 +++++++
10+
2 files changed, 8 insertions(+)
11+
12+
diff --git a/aten/src/ATen/native/mkldnn/Utils.cpp b/aten/src/ATen/native/mkldnn/Utils.cpp
13+
index 400eb916..e240a2d2 100644
14+
--- a/aten/src/ATen/native/mkldnn/Utils.cpp
15+
+++ b/aten/src/ATen/native/mkldnn/Utils.cpp
16+
@@ -19,6 +19,7 @@ std::vector<int64_t> pool_output_sizes(
17+
output_size[1] = input_size[1];
18+
19+
for (const auto i : c10::irange(2, input_size.size())) {
20+
+ TORCH_CHECK_VALUE(stride[i -2] > 0, "Strides must be positive!");
21+
output_size[i] = pooling_output_shape_pad_lr<int64_t>(
22+
input_size[i],
23+
kernel_size[i - 2],
24+
diff --git a/test/test_mkldnn.py b/test/test_mkldnn.py
25+
index 7c39d36e..cf599c70 100644
26+
--- a/test/test_mkldnn.py
27+
+++ b/test/test_mkldnn.py
28+
@@ -1588,6 +1588,13 @@ class TestMkldnn(TestCase):
29+
cn2.sum().backward(retain_graph=True)
30+
self.assertEqual(c1.grad, c2.grad, rtol=rtol, atol=atol)
31+
32+
+ def test_mkldnn_error_on_zero_stride(self, device):
33+
+ # Regression test for https://github.com/pytorch/pytorch/issues/149274
34+
+ x = torch.rand(1, 2, 3, 3).to_mkldnn()
35+
+ with self.assertRaises(ValueError):
36+
+ torch.mkldnn_max_pool2d(x, kernel_size=3, stride=0)
37+
+
38+
+
39+
40+
if __name__ == '__main__':
41+
run_tests()
42+
--
43+
2.45.3
44+

SPECS/pytorch/pytorch.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration.
33
Name: pytorch
44
Version: 2.0.0
5-
Release: 8%{?dist}
5+
Release: 9%{?dist}
66
License: BSD-3-Clause
77
Vendor: Microsoft Corporation
88
Distribution: Mariner
@@ -19,6 +19,7 @@ Patch4: CVE-2024-27318.patch
1919
Patch5: CVE-2022-1941.patch
2020
Patch6: CVE-2025-32434.patch
2121
Patch7: CVE-2025-3730.patch
22+
Patch8: CVE-2025-2953.patch
2223

2324
BuildRequires: cmake
2425
BuildRequires: gcc
@@ -91,6 +92,9 @@ cp -arf docs %{buildroot}/%{_pkgdocdir}
9192
%{_docdir}/*
9293

9394
%changelog
95+
* Tue Apr 29 2025 Archana Shettigar <[email protected]> - 2.0.0-9
96+
- Patch CVE-2025-2953
97+
9498
* Wed Apr 23 2025 Kanishk Bansal <[email protected]> - 2.0.0-8
9599
- Patch CVE-2025-32434, CVE-2025-3730
96100

0 commit comments

Comments
 (0)