Skip to contentSkip to conversation

syscalls/bind03: fix ret code behavior for v4.4 backport

PATCH New Rafael David Tinoco 2 participants 3 messages Nov 7, 2018 – Nov 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/bind03: fix ret code behavior for v4.4 backport

Recently added test bind03 has a corner case for bind(2). Because mainline patch 0fb44559ffd6 ("af_unix: move unix_mknod() out of bindlock") got backported to kernel v4.4 as commit 0492a033fb71, the corner case must be adapted to correct running kernel version.

---
 testcases/kernel/syscalls/bind/bind03.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/bind/bind03.c +3 -3
index 955a69dd2..f35e4786f 100644
@@ -46,11 +46,11 @@ void run(void)
 	}
 
 	/*
-	 * The behavious diverse according to kernel version
-	 * for v4.10 or later, the expected error is EADDRINUSE,
+	 * The behavior diverse according to kernel version
+	 * for v4.4.47~3 or later, the expected error is EADDRINUSE,
 	 * otherwise EINVAL.
 	 */
-	if (tst_kvercmp(4, 10, 0) < 0) {
+	if (tst_kvercmp(4, 4, 48) < 0) {
 		if (errno != EINVAL) {
 			tst_res(TFAIL | TERRNO, "expected EINVAL");
 			return;
Signature · 1 line
2.19.1
#1 lore raw

PATCH 1/1 syscalls/bind03: fix ret code behavior for v4.4 backport

Hi Rafael,

Quoted 4 lines

Recently added test bind03 has a corner case for bind(2). Because mainline patch 0fb44559ffd6 ("af_unix: move unix_mknod() out of bindlock") got backported to kernel v4.4 as commit 0492a033fb71, the corner case must be adapted to correct running kernel version.

...

testcases/kernel/syscalls/bind/bind03.c void run(void) · line 56

Quoted 12 lines
testcases/kernel/syscalls/bind/bind03.c +3 -3
 	/*
-	 * The behavious diverse according to kernel version
-	 * for v4.10 or later, the expected error is EADDRINUSE,
+	 * The behavior diverse according to kernel version
+	 * for v4.4.47~3 or later, the expected error is EADDRINUSE,
 	 * otherwise EINVAL.
 	 */
-	if (tst_kvercmp(4, 10, 0) < 0) {
+	if (tst_kvercmp(4, 4, 48) < 0) {
 		if (errno != EINVAL) {
 			tst_res(TFAIL | TERRNO, "expected EINVAL");
 			return;

I think this is a wrong approach as there are versions between v4.4 and 4.10 without this patch. IMHO we should accept both EINVAL and EADDRINUSE or accept Junchi's solution [1].

Kind regards,
Petr

[1] https://patchwork.ozlabs.org/patch/968371/

#2 lore raw

PATCH 1/1 syscalls/bind03: fix ret code behavior for v4.4 backport

Quoted 8 lines · Petr Vorel

Hi Rafael,

Quoted 4 lines

Recently added test bind03 has a corner case for bind(2). Because mainline patch 0fb44559ffd6 ("af_unix: move unix_mknod() out of bindlock") got backported to kernel v4.4 as commit 0492a033fb71, the corner case must be adapted to correct running kernel version.

...

Quoted 16 lines

testcases/kernel/syscalls/bind/bind03.c void run(void) · line 56

Quoted 12 lines

/*

testcases/kernel/syscalls/bind/bind03.c +3 -3
-	 * The behavious diverse according to kernel version
-	 * for v4.10 or later, the expected error is EADDRINUSE,
+	 * The behavior diverse according to kernel version
+	 * for v4.4.47~3 or later, the expected error is EADDRINUSE,
  	 * otherwise EINVAL.
  	 */
-	if (tst_kvercmp(4, 10, 0) < 0) {
+	if (tst_kvercmp(4, 4, 48) < 0) {
  		if (errno != EINVAL) {
  			tst_res(TFAIL | TERRNO, "expected EINVAL");
  			return;

I think this is a wrong approach as there are versions between v4.4 and 4.10 without this patch. IMHO we should accept both EINVAL and EADDRINUSE or accept Junchi's solution [1].

Sure, makes sense! +1.

Signature · 2 lines
Rafael D. Tinoco
Linaro Kernel Validation