Commits/
merge fix-cve-2026-85977-openEuler-24.03-LTS-SP4 into openEuler-24.03-LTS-SP4
2 file(s) changed+125-1
Abackport-CVE-2026-85977.patch+117-0
@@ -0,0 +1,117 @@
1+From ccc1acf867d88dc0bdbe58568f621607d44977f5 Mon Sep 17 00:00:00 2001
2+From: Olga Kornievskaia <okorniev@redhat.com>
3+Date: Sat, 12 Sep 2026 15:15:01 -0400
4+Subject: [PATCH] libtirpc: limit XDR decode node count
5+ 
6+xdr_pmaplist(), xdr_rpcblist_ptr() and xdr_rpcb_entry_list_ptr()
7+decode linked lists with no upper bound on element count. A malicious
8+server can stream arbitrarily many list nodes, forcing unbounded heap
9+allocation in any client that decodes the response (rpcinfo,
10+rpcb_getmaps() callers).
11+ 
12+Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
13+Signed-off-by: Steve Dickson <steved@redhat.com>
14+Reference: https://github.com/linux-nfs/libtirpc/commit/ccc1acf867d88dc0bdbe58568f621607d44977f5.patch
15+Conflict: adapted 2 file(s): src/pmap_prot2.c, src/rpcb_prot.c
16+ 
17+---
18+ src/pmap_prot2.c | 9 ++++++++-
19+ src/rpcb_prot.c | 16 ++++++++++++++++
20+ 2 files changed, 24 insertions(+), 1 deletion(-)
21+ 
22+diff --git a/src/pmap_prot2.c b/src/pmap_prot2.c
23+index 5583ff0..76babc8 100644
24+--- a/src/pmap_prot2.c
25++++ b/src/pmap_prot2.c
26+@@ -39,6 +39,8 @@
27+ #include <rpc/xdr.h>
28+ #include <rpc/pmap_prot.h>
29+
30++/* Cap decoded list length to prevent memory exhaustion from malicious data */
31++#define PMAPLIST_DECODE_MAX_NODES 1024
32+
33+ /*
34+ * What is going on with linked lists? (!)
35+@@ -89,7 +91,7 @@ xdr_pmaplist(xdrs, rp)
36+ * xdr_bool when the direction is XDR_DECODE.
37+ */
38+ bool_t more_elements;
39+- int freeing;
40++ int freeing, node_count = 0;
41+ struct pmaplist **next = NULL; /* pacify gcc */
42+
43+ assert(xdrs != NULL);
44+@@ -103,6 +105,11 @@ xdr_pmaplist(xdrs, rp)
45+ return (FALSE);
46+ if (! more_elements)
47+ return (TRUE); /* we are done */
48++ if (xdrs->x_op == XDR_DECODE &&
49++ ++node_count > PMAPLIST_DECODE_MAX_NODES) {
50++ return (FALSE);
51++ }
52++
53+ /*
54+ * the unfortunate side effect of non-recursion is that in
55+ * the case of freeing we must remember the next object
56+diff --git a/src/rpcb_prot.c b/src/rpcb_prot.c
57+index a923c8e..a0ea925 100644
58+--- a/src/rpcb_prot.c
59++++ b/src/rpcb_prot.c
60+@@ -89,6 +89,9 @@ xdr_rpcb(xdrs, objp)
61+ * serialize the rpcb elements.
62+ */
63+
64++/* Cap decoded list length to prevent memory exhaustion from malicious data */
65++#define RPCBLIST_DECODE_MAX_NODES 1024
66++
67+ bool_t
68+ xdr_rpcblist_ptr(xdrs, rp)
69+ XDR *xdrs;
70+@@ -101,6 +104,7 @@ xdr_rpcblist_ptr(xdrs, rp)
71+ */
72+ bool_t more_elements;
73+ int freeing = (xdrs->x_op == XDR_FREE);
74++ int node_count = 0;
75+ rpcblist_ptr next;
76+ rpcblist_ptr next_copy;
77+
78+@@ -113,6 +117,10 @@ xdr_rpcblist_ptr(xdrs, rp)
79+ if (! more_elements) {
80+ return (TRUE); /* we are done */
81+ }
82++ if (xdrs->x_op == XDR_DECODE &&
83++ ++node_count > RPCBLIST_DECODE_MAX_NODES) {
84++ return (FALSE);
85++ }
86+ /*
87+ * the unfortunate side effect of non-recursion is that in
88+ * the case of freeing we must remember the next object
89+@@ -178,6 +186,9 @@ xdr_rpcb_entry(xdrs, objp)
90+ return (TRUE);
91+ }
92+
93++/* Cap decoded list length to prevent memory exhaustion from malicious data */
94++#define RPCB_ENTRY_LIST_DECODE_MAX_NODES 1024
95++
96+ bool_t
97+ xdr_rpcb_entry_list_ptr(xdrs, rp)
98+ XDR *xdrs;
99+@@ -190,6 +201,7 @@ xdr_rpcb_entry_list_ptr(xdrs, rp)
100+ */
101+ bool_t more_elements;
102+ int freeing = (xdrs->x_op == XDR_FREE);
103++ int node_count = 0;
104+ rpcb_entry_list_ptr next;
105+ rpcb_entry_list_ptr next_copy;
106+
107+@@ -202,6 +214,10 @@ xdr_rpcb_entry_list_ptr(xdrs, rp)
108+ if (! more_elements) {
109+ return (TRUE); /* we are done */
110+ }
111++ if (xdrs->x_op == XDR_DECODE &&
112++ ++node_count > RPCB_ENTRY_LIST_DECODE_MAX_NODES) {
113++ return (FALSE);
114++ }
115+ /*
116+ * the unfortunate side effect of non-recursion is that in
117+ * the case of freeing we must remember the next object
Mlibtirpc.spec+8-1

Comments