Skip to contentSkip to conversation

accept02: Join the multicast group on lo

PATCH In review Anders Roxell 4 participants 6 messages Sep 28 – Sep 30

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 accept02: Join the multicast group on lo

The test joins the multicast group with interface 0. Then the kernel needs a route to 224.0.0.0 to find a device. When we only have lo, like in a QEMU guest with no network, there is no such route and the test breaks:

accept02.c:52: TBROK: setsockopt(3, 0, 42, ...) failed: ENODEV (19)

All traffic in the test goes over 127.0.0.1, so join the group on lo.

---
 testcases/kernel/syscalls/accept/accept02.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/accept/accept02.c +2 -1
index 17056625e933..09a1c35e2591 100644
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <sys/socket.h>
 #include "tst_test.h"
+#include "tst_netdevice.h"
 #include "tst_safe_net.h"
 #include "tst_safe_pthread.h"
 
@@ -112,7 +113,7 @@ static void setup(void)
 	client_addr = tst_alloc(sizeof(*client_addr));
 	mc_group = tst_alloc(sizeof(*mc_group));
 
-	mc_group->gr_interface = 0;
+	mc_group->gr_interface = NETDEV_INDEX_BY_NAME("lo");
 	mc_group_addr = (struct sockaddr_in *) &mc_group->gr_group;
 	mc_group_addr->sin_family = AF_INET;
 	inet_aton(MULTICASTIP, &mc_group_addr->sin_addr);
Signature · 5 lines
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Anders,

Quoted 1 line · Anders Roxell

accept02: Join the multicast group on lo

Verdict - Reviewed

---
Note:

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#2 lore raw
In reply to Anders Roxell

Hi Anders, all,

Quoted 27 lines

The test joins the multicast group with interface 0. Then the kernel needs a route to 224.0.0.0 to find a device. When we only have lo, like in a QEMU guest with no network, there is no such route and the test breaks:

accept02.c:52: TBROK: setsockopt(3, 0, 42, ...) failed: ENODEV (19)

All traffic in the test goes over 127.0.0.1, so join the group on lo.

---
 testcases/kernel/syscalls/accept/accept02.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/accept/accept02.c +1 -0
index 17056625e933..09a1c35e2591 100644
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <sys/socket.h>
 #include "tst_test.h"
+#include "tst_netdevice.h"
 #include "tst_safe_net.h"
 #include "tst_safe_pthread.h"
 

testcases/kernel/syscalls/accept/accept02.c static void setup(void) · line 116

Quoted 5 lines
testcases/kernel/syscalls/accept/accept02.c +1 -1
@@ -112,7 +113,7 @@ static void setup(void)
 	client_addr = tst_alloc(sizeof(*client_addr));
 	mc_group = tst_alloc(sizeof(*mc_group));
 
-	mc_group->gr_interface = 0;
+	mc_group->gr_interface = NETDEV_INDEX_BY_NAME("lo");

I tested that it really fixes the problem when no network and runs ok. But I'm not 100% sure that it did not affect the CVE reproducibility. Therefore I do not add my TBT.

Kind regards,
Petr

Quoted 3 lines
testcases/kernel/syscalls/accept/accept02.c +0 -0
 	mc_group_addr = (struct sockaddr_in *) &mc_group->gr_group;
 	mc_group_addr->sin_family = AF_INET;
 	inet_aton(MULTICASTIP, &mc_group_addr->sin_addr);
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
Quoted 32 lines

Hi Anders, all,

Quoted 29 lines

The test joins the multicast group with interface 0. Then the kernel needs a route to 224.0.0.0 to find a device. When we only have lo, like in a QEMU guest with no network, there is no such route and the test breaks:

accept02.c:52: TBROK: setsockopt(3, 0, 42, ...) failed: ENODEV (19)

All traffic in the test goes over 127.0.0.1, so join the group on lo.

---
 testcases/kernel/syscalls/accept/accept02.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/accept/accept02.c +1 -0
index 17056625e933..09a1c35e2591 100644
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <sys/socket.h>
 #include "tst_test.h"
+#include "tst_netdevice.h"
 #include "tst_safe_net.h"
 #include "tst_safe_pthread.h"
 
@@ -112,7 +113,7 @@ static void setup(void)
 	client_addr = tst_alloc(sizeof(*client_addr));
 	mc_group = tst_alloc(sizeof(*mc_group));
Quoted 8 lines

testcases/kernel/syscalls/accept/accept02.c static void setup(void) · line 116

Quoted 2 lines
testcases/kernel/syscalls/accept/accept02.c +1 -1
-	mc_group->gr_interface = 0;
+	mc_group->gr_interface = NETDEV_INDEX_BY_NAME("lo");

I tested that it really fixes the problem when no network and runs ok. But I'm not 100% sure that it did not affect the CVE reproducibility. Therefore I do not add my TBT.

And unfortunately this should be really verified if the change does not affect reproducibility. Hopefully Martin will get time for that soon, but this will for sure will not make it into the release planned for today.

Kind regards,
Petr

Quoted 2 lines

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by Tested-by on v1 1/1
#4 lore raw
In reply to Anders Roxell

Hi,
I've tested the patch on affected kernel v4.4 and the bug is still reproducible. Let's merge it.

Quoted 35 lines · Anders Roxell

The test joins the multicast group with interface 0. Then the kernel needs a route to 224.0.0.0 to find a device. When we only have lo, like in a QEMU guest with no network, there is no such route and the test breaks:

   accept02.c:52: TBROK: setsockopt(3, 0, 42, ...) failed: ENODEV (19)

All traffic in the test goes over 127.0.0.1, so join the group on lo.

---
  testcases/kernel/syscalls/accept/accept02.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/accept/accept02.c +2 -1
index 17056625e933..09a1c35e2591 100644
@@ -22,6 +22,7 @@
  #include <errno.h>
  #include <sys/socket.h>
  #include "tst_test.h"
+#include "tst_netdevice.h"
  #include "tst_safe_net.h"
  #include "tst_safe_pthread.h"
 
@@ -112,7 +113,7 @@ static void setup(void)
  	client_addr = tst_alloc(sizeof(*client_addr));
  	mc_group = tst_alloc(sizeof(*mc_group));
 
-	mc_group->gr_interface = 0;
+	mc_group->gr_interface = NETDEV_INDEX_BY_NAME("lo");
  	mc_group_addr = (struct sockaddr_in *) &mc_group->gr_group;
  	mc_group_addr->sin_family = AF_INET;
  	inet_aton(MULTICASTIP, &mc_group_addr->sin_addr);
Signature · 10 lines
Martin Doucha   [email protected]
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

Hi all,

Quoted 3 lines

Hi,
I've tested the patch on affected kernel v4.4 and the bug is still reproducible. Let's merge it.

Martin, thanks a lot, we really appreciate your effort to test last minutes before the release => this one made it into the release (merged).

Anders, thanks for fixing this.

Kind regards,
Petr

Quoted 2 lines
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp