Skip to contentSkip to conversation

Regression check for unlink fail issue after successful mknod

PATCH Superseded Wei Gao via ltp 2 participants 3 messages Aug 14, 2023 – Aug 30, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Regression check for unlink fail issue after successful mknod

Write a regression test once making unix_bind() undo mknod on failure patchset is merged.

Kernel patch detail:
git describe --contains c0c3b8d380a8f54c75786d41f6f9efbe761dac6c v5.14-rc1119^286
git log -p c0c3b8d380a8f54c75786d41f6f9efbe761dac6c commit c0c3b8d380a8f54c75786d41f6f9efbe761dac6c
Author: Al Viro [email protected]
Date: Sat Jun 19 03:50:32 2021 +0000
unix_bind_bsd(): unlink if we fail after successful mknod

---
 testcases/kernel/syscalls/bind/bind03.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/bind/bind03.c +6 -1
index 37a040b29..12285acb9 100644
@@ -43,8 +43,13 @@ static void run(void)
 	 * locks the socket and does all the checks and the node is not removed
 	 * in the error path. For now we will unlink the node here so that the
 	 * test works fine when the run() function is executed in a loop.
+	 * From v5.14-rc1 the kernel has fix above issue.
 	 */
-	unlink(SNAME_B);
+	if (tst_kvercmp(5, 14, 0) >= 0) {
+		TST_EXP_FAIL(unlink(SNAME_B), ENOENT,"check exist of SNAME_B");
+	} else {
+		unlink(SNAME_B);
+	}
 }
 
 static void setup(void)
Signature · 5 lines
2.35.3


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

PATCH v2 1/1 Regression check for unlink fail issue after successful mknod

Write a regression test once making unix_bind() undo mknod on failure patchset is merged.

Kernel patch detail:
git describe --contains c0c3b8d380a8f54c75786d41f6f9efbe761dac6c v5.14-rc1119^286
git log -p c0c3b8d380a8f54c75786d41f6f9efbe761dac6c commit c0c3b8d380a8f54c75786d41f6f9efbe761dac6c
Author: Al Viro [email protected]
Date: Sat Jun 19 03:50:32 2021 +0000
unix_bind_bsd(): unlink if we fail after successful mknod

---
 testcases/kernel/syscalls/bind/bind03.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/bind/bind03.c +5 -1
index 37a040b29..8c95cd799 100644
@@ -43,8 +43,12 @@ static void run(void)
 	 * locks the socket and does all the checks and the node is not removed
 	 * in the error path. For now we will unlink the node here so that the
 	 * test works fine when the run() function is executed in a loop.
+	 * From v5.14-rc1 the kernel has fix above issue.
 	 */
-	unlink(SNAME_B);
+	if (tst_kvercmp(5, 14, 0) >= 0)
+		TST_EXP_FAIL(unlink(SNAME_B), ENOENT, "check exist of SNAME_B");
+	else
+		unlink(SNAME_B);
 }
 
 static void setup(void)
Signature · 5 lines
2.35.3


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

Hello,

Quoted 21 lines · Wei Gao via ltp

Write a regression test once making unix_bind() undo mknod on failure patchset is merged.

Kernel patch detail:
git describe --contains c0c3b8d380a8f54c75786d41f6f9efbe761dac6c v5.14-rc1119^286
git log -p c0c3b8d380a8f54c75786d41f6f9efbe761dac6c commit c0c3b8d380a8f54c75786d41f6f9efbe761dac6c
Author: Al Viro [email protected]
Date: Sat Jun 19 03:50:32 2021 +0000
unix_bind_bsd(): unlink if we fail after successful mknod

---
 testcases/kernel/syscalls/bind/bind03.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/bind/bind03.c +0 -0
index 37a040b29..8c95cd799 100644

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

Quoted 4 lines
testcases/kernel/syscalls/bind/bind03.c +1 -0
@@ -43,8 +43,12 @@ static void run(void)
 	 * locks the socket and does all the checks and the node is not removed
 	 * in the error path. For now we will unlink the node here so that the
 	 * test works fine when the run() function is executed in a loop.
+	 * From v5.14-rc1 the kernel has fix above issue.

Usually we don't work around kernel bugs, so really the workaround should be removed for all versions. However because the workaround was already accepted, it's a less serious bug and you are removing it on a subset of kernels, I will just merge it.

Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp