diff --git a/0001-virarptable-Properly-calculate-rtattr-length.patch b/0001-virarptable-Properly-calculate-rtattr-length.patch new file mode 100644 index 0000000..1293b36 --- /dev/null +++ b/0001-virarptable-Properly-calculate-rtattr-length.patch @@ -0,0 +1,29 @@ +From: Martin Kletzander +Date: Fri, 16 Aug 2024 13:56:51 +0200 +Subject: [PATCH] virarptable: Properly calculate rtattr length +Content-type: text/plain + +Use convenience macro which does almost the same thing we were doing, +but also pads out the payload length to a multiple of NLMSG_ALIGNTO (4) +bytes. + +Signed-off-by: Martin Kletzander +Reviewed-by: Laine Stump +--- + src/util/virarptable.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/util/virarptable.c b/src/util/virarptable.c +index 299dddd664..d8e41c5a86 100644 +--- a/src/util/virarptable.c ++++ b/src/util/virarptable.c +@@ -102,8 +102,7 @@ virArpTableGet(void) + return table; + + VIR_WARNINGS_NO_CAST_ALIGN +- parse_rtattr(tb, NDA_MAX, NDA_RTA(r), +- nh->nlmsg_len - NLMSG_LENGTH(sizeof(*r))); ++ parse_rtattr(tb, NDA_MAX, NDA_RTA(r), NLMSG_PAYLOAD(nh, sizeof(*r))); + VIR_WARNINGS_RESET + + if (tb[NDA_DST] == NULL || tb[NDA_LLADDR] == NULL) diff --git a/0002-virarptable-Fix-check-for-message-length.patch b/0002-virarptable-Fix-check-for-message-length.patch new file mode 100644 index 0000000..8976ef5 --- /dev/null +++ b/0002-virarptable-Fix-check-for-message-length.patch @@ -0,0 +1,34 @@ +From: Martin Kletzander +Date: Fri, 16 Aug 2024 13:59:15 +0200 +Subject: [PATCH] virarptable: Fix check for message length +Content-type: text/plain + +The previous check was all wrong since it calculated the how long would +the netlink message be if the netlink header was the payload and then +subtracted that from the whole message length, a variable that was not +used later in the code. This check can fail if there are no additional +payloads, struct rtattr in particular, which we are parsing later, +however the RTA_OK macro would've caught that anyway. + +Signed-off-by: Martin Kletzander +Reviewed-by: Laine Stump +--- + src/util/virarptable.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/util/virarptable.c b/src/util/virarptable.c +index d8e41c5a86..45ee76766f 100644 +--- a/src/util/virarptable.c ++++ b/src/util/virarptable.c +@@ -81,10 +81,9 @@ virArpTableGet(void) + for (; NLMSG_OK(nh, msglen); nh = NLMSG_NEXT(nh, msglen)) { + VIR_WARNINGS_RESET + struct ndmsg *r = NLMSG_DATA(nh); +- int len = nh->nlmsg_len; + void *addr; + +- if ((len -= NLMSG_LENGTH(sizeof(*nh))) < 0) { ++ if (nh->nlmsg_len < NLMSG_SPACE(sizeof(*r))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("wrong nlmsg len")); + goto cleanup; diff --git a/0003-virarptable-End-parsing-earlier-in-case-of-NLMSG_DON.patch b/0003-virarptable-End-parsing-earlier-in-case-of-NLMSG_DON.patch new file mode 100644 index 0000000..bd43677 --- /dev/null +++ b/0003-virarptable-End-parsing-earlier-in-case-of-NLMSG_DON.patch @@ -0,0 +1,46 @@ +From: Martin Kletzander +Date: Fri, 16 Aug 2024 14:02:48 +0200 +Subject: [PATCH] virarptable: End parsing earlier in case of NLMSG_DONE +Content-type: text/plain + +Check for the last multipart message right as the first thing. The +presumption probably was that the last message might still contain a +payload we want to parse. However that cannot be true since that would +have to be a type RTM_NEWNEIGH. This was not caught because older +kernels were note sending NLMSG_DONE and probably relied on the fact +that the parsing just stops after all the messages are walked through, +which the NLMSG_OK macro successfully did. + +Resolves: https://issues.redhat.com/browse/RHEL-52449 +Resolves: https://bugzilla.redhat.com/2302245 +Fixes: a176d67cdfaf5b8237a7e3a80d8be0e6bdf2d8fd +Signed-off-by: Martin Kletzander +Reviewed-by: Laine Stump +--- + src/util/virarptable.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/util/virarptable.c b/src/util/virarptable.c +index 45ee76766f..20d11f97b0 100644 +--- a/src/util/virarptable.c ++++ b/src/util/virarptable.c +@@ -83,6 +83,9 @@ virArpTableGet(void) + struct ndmsg *r = NLMSG_DATA(nh); + void *addr; + ++ if (nh->nlmsg_type == NLMSG_DONE) ++ break; ++ + if (nh->nlmsg_len < NLMSG_SPACE(sizeof(*r))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("wrong nlmsg len")); +@@ -97,9 +100,6 @@ virArpTableGet(void) + (!(r->ndm_state == NUD_STALE || r->ndm_state == NUD_REACHABLE))) + continue; + +- if (nh->nlmsg_type == NLMSG_DONE) +- return table; +- + VIR_WARNINGS_NO_CAST_ALIGN + parse_rtattr(tb, NDA_MAX, NDA_RTA(r), NLMSG_PAYLOAD(nh, sizeof(*r))); + VIR_WARNINGS_RESET diff --git a/libvirt.spec b/libvirt.spec index f631243..47b3ade 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -289,7 +289,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 10.6.0 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -298,6 +298,11 @@ URL: https://libvirt.org/ %endif Source: https://download.libvirt.org/%{?mainturl}libvirt-%{version}.tar.xz +# Fix `virsh domifaddr --source=arp` on kernel 6.10 (bz #2302245) +Patch0001: 0001-virarptable-Properly-calculate-rtattr-length.patch +Patch0002: 0002-virarptable-Fix-check-for-message-length.patch +Patch0003: 0003-virarptable-End-parsing-earlier-in-case-of-NLMSG_DON.patch + Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} Requires: libvirt-daemon-config-nwfilter = %{version}-%{release} @@ -2622,6 +2627,9 @@ exit 0 %changelog +* Tue Aug 27 2024 Cole Robinson - 10.6.0-2 +- Fix `virsh domifaddr --source=arp` on kernel 6.10 (bz #2302245) + * Tue Aug 06 2024 Cole Robinson - 10.6.0-1 - Update to version 10.6.0