Skip to contentSkip to conversation

fanotify22: Make 'dev' the last debugfs argument for musl compat

PATCH In review Florian Schmaus via ltp 1 participant 6 messages Jul 11, 2025 – Jul 22, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fanotify22: Make 'dev' the last debugfs argument for musl compat

The debugfs(8) man page specifies that the device to operate on should be the last argument. So instead of

debugfs -w /dev/loop2 -R "sif internal_dir/bad_dir mode 0xff"

the correct command line invocation would be

debugfs -w -R "sif internal_dir/bad_dir mode 0xff" /dev/loop2

The former works on glibc-based systems, due to glibc's optind handling. However, it breaks on musl-based systems, where the fanotify22 test will hang because debugfs is awaiting user input.

---
 testcases/kernel/syscalls/fanotify/fanotify22.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/fanotify/fanotify22.c +1 -1
index 20c7a6aca243..357e74dbc702 100644
@@ -61,7 +61,7 @@ static void trigger_fs_abort(void)
  static void do_debugfs_request(const char *dev, char *request)
 {
-	const char *const cmd[] = {"debugfs", "-w", dev, "-R", request, NULL};
+	const char *const cmd[] = {"debugfs", "-w", "-R", request, dev, NULL};
  	SAFE_CMD(cmd, NULL, NULL);
 }
Signature · 5 lines
2.49.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw
Quoted 33 lines · Florian Schmaus via ltp

The debugfs(8) man page specifies that the device to operate on should be the last argument. So instead of

debugfs -w /dev/loop2 -R "sif internal_dir/bad_dir mode 0xff"

the correct command line invocation would be

debugfs -w -R "sif internal_dir/bad_dir mode 0xff" /dev/loop2

The former works on glibc-based systems, due to glibc's optind handling. However, it breaks on musl-based systems, where the fanotify22 test will hang because debugfs is awaiting user input.

---
 testcases/kernel/syscalls/fanotify/fanotify22.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/fanotify/fanotify22.c +1 -1
index 20c7a6aca243..357e74dbc702 100644
@@ -61,7 +61,7 @@ static void trigger_fs_abort(void)
  static void do_debugfs_request(const char *dev, char *request)
 {
-	const char *const cmd[] = {"debugfs", "-w", dev, "-R", request, NULL};
+	const char *const cmd[] = {"debugfs", "-w", "-R", request, dev, NULL};
  	SAFE_CMD(cmd, NULL, NULL);
 }
Signature · 1 line
2.49.1

Thanks for your patch.

CI give following error, i think diff header has format issue need fixed. BTW you another patch seems has same issue.

error: git diff header lacks filename information when removing 1 leading pathname component (line 6)
hint: Use 'git am --show-current-patch=diff' to see the failed patch

CI link:
https://github.com/linux-test-project/ltp/actions/runs/16225674227/job/45816963576

Quoted 3 lines
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
Quoted 21 lines · Wei Gao

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Quoted 18 lines · Florian Schmaus via ltp

The debugfs(8) man page specifies that the device to operate on should be the last argument. So instead of

debugfs -w /dev/loop2 -R "sif internal_dir/bad_dir mode 0xff"

the correct command line invocation would be

debugfs -w -R "sif internal_dir/bad_dir mode 0xff" /dev/loop2

The former works on glibc-based systems, due to glibc's optind handling. However, it breaks on musl-based systems, where the fanotify22 test will hang because debugfs is awaiting user input.

---
  testcases/kernel/syscalls/fanotify/fanotify22.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 13 lines
testcases/kernel/syscalls/fanotify/fanotify22.c +1 -2
index 20c7a6aca243..357e74dbc702 100644
@@ -61,7 +61,7 @@ static void trigger_fs_abort(void)
   static void do_debugfs_request(const char *dev, char *request)
  {
-     const char *const cmd[] = {"debugfs", "-w", dev, "-R", request, NULL};
+     const char *const cmd[] = {"debugfs", "-w", "-R", request, dev, NULL};
       SAFE_CMD(cmd, NULL, NULL);
  }
--
Quoted 2 lines

2.49.1

Thanks for your patch.

Thanks for your response.

Quoted 6 lines

CI give following error, i think diff header has format issue need fixed. BTW you another patch seems has same issue.

error: git diff header lacks filename information when removing 1 leading pathname component (line 6)
hint: Use 'git am --show-current-patch=diff' to see the failed patch

You are right. Something added an additional line break along the way to you. The "diff --git a/testcases/…" should be one line instead of two.

I'll try to fix the mail setup and resend. Sorry for the inconvenience.

- Florian

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

PATCH 1/1 fanotify22: Make 'dev' the last debugfs argument for musl compat

In reply to Wei Gao via ltp

The debugfs(8) man page specifies that the device to operate on should be the last argument. So instead of

debugfs -w /dev/loop2 -R "sif internal_dir/bad_dir mode 0xff"

the correct command line invocation would be

debugfs -w -R "sif internal_dir/bad_dir mode 0xff" /dev/loop2

The former works on glibc-based systems, due to glibc's optind handling. However, it breaks on musl-based systems, where the fanotify22 test will hang because debugfs is awaiting user input.

---
 testcases/kernel/syscalls/fanotify/fanotify22.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/fanotify/fanotify22.c +1 -1
index 20c7a6aca243..357e74dbc702 100644
@@ -61,7 +61,7 @@ static void trigger_fs_abort(void)
 
 static void do_debugfs_request(const char *dev, char *request)
 {
-	const char *const cmd[] = {"debugfs", "-w", dev, "-R", request, NULL};
+	const char *const cmd[] = {"debugfs", "-w", "-R", request, dev, NULL};
 
 	SAFE_CMD(cmd, NULL, NULL);
 }
Signature · 5 lines
2.49.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author Reviewed-by Wei Gao on v1 1/1
#4 lore raw
Quoted 33 lines · Florian Schmaus via ltp

The debugfs(8) man page specifies that the device to operate on should be the last argument. So instead of

debugfs -w /dev/loop2 -R "sif internal_dir/bad_dir mode 0xff"

the correct command line invocation would be

debugfs -w -R "sif internal_dir/bad_dir mode 0xff" /dev/loop2

The former works on glibc-based systems, due to glibc's optind handling. However, it breaks on musl-based systems, where the fanotify22 test will hang because debugfs is awaiting user input.

---
 testcases/kernel/syscalls/fanotify/fanotify22.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/fanotify/fanotify22.c +1 -1
index 20c7a6aca243..357e74dbc702 100644
@@ -61,7 +61,7 @@ static void trigger_fs_abort(void)
 
 static void do_debugfs_request(const char *dev, char *request)
 {
-	const char *const cmd[] = {"debugfs", "-w", dev, "-R", request, NULL};
+	const char *const cmd[] = {"debugfs", "-w", "-R", request, dev, NULL};
 
 	SAFE_CMD(cmd, NULL, NULL);
 }
Signature · 1 line
2.49.1

Thanks.

Quoted 4 lines
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author Reviewed-by Andrea Cervesato on v1 1/1
#5 lore raw
In reply to Florian Schmaus via ltp

Hi!

Quoted 23 lines · Florian Schmaus via ltp

The debugfs(8) man page specifies that the device to operate on should be the last argument. So instead of

debugfs -w /dev/loop2 -R "sif internal_dir/bad_dir mode 0xff"

the correct command line invocation would be

debugfs -w -R "sif internal_dir/bad_dir mode 0xff" /dev/loop2

The former works on glibc-based systems, due to glibc's optind handling. However, it breaks on musl-based systems, where the fanotify22 test will hang because debugfs is awaiting user input.

---
  testcases/kernel/syscalls/fanotify/fanotify22.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/fanotify/fanotify22.c +0 -0
index 20c7a6aca243..357e74dbc702 100644

testcases/kernel/syscalls/fanotify/fanotify22.c static void trigger_fs_abort(void) · line 67

Quoted 8 lines
testcases/kernel/syscalls/fanotify/fanotify22.c +1 -1
@@ -61,7 +61,7 @@ static void trigger_fs_abort(void)
 
  static void do_debugfs_request(const char *dev, char *request)
  {
-	const char *const cmd[] = {"debugfs", "-w", dev, "-R", request, NULL};
+	const char *const cmd[] = {"debugfs", "-w", "-R", request, dev, NULL};
 
  	SAFE_CMD(cmd, NULL, NULL);
  }

I tested fanotify22 with buildroot using musl and the bug is indeed present. This patch is correctly fixing the test, so I will merge it.

Thanks!

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