Skip to contentSkip to conversation

dovetail: Account for invalid syscall number

PATCH Applied Jan Kiszka 2 participants 5 messages Aug 26, 2024 – Sep 3, 2024

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 dovetail: Account for invalid syscall number

From: Jan Kiszka <[email protected]>

At least on x86, the kernel may have decided to invalidate the syscall number while processing it. Avoid that we process this -1 as legacy syscall.

This was a long-pending issue in the whole dovetail series, now revealed by running auditd on one of the test systems. Syscall auditing was eventually catching an unbalanced tracing, caused by a premature syscall exit due to this bug.

---
 kernel/dovetail.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dovetail.c +1 -1
index 08c649d6e9d9..bcd49183f8eb 100644
@@ -119,7 +119,7 @@ static bool __in_oob_syscall(struct task_struct *tsk,
 	 * a PR_OOB_SYSCALL command (new/current call form).
 	 */
 	if (IS_ENABLED(CONFIG_DOVETAIL_LEGACY_SYSCALL_RANGE)) {
-		if (nr & __OOB_SYSCALL_BIT)
+		if (nr != -1 && nr & __OOB_SYSCALL_BIT)
 			return true;
 	}
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 21 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

At least on x86, the kernel may have decided to invalidate the syscall number while processing it. Avoid that we process this -1 as legacy syscall.

This was a long-pending issue in the whole dovetail series, now revealed by running auditd on one of the test systems. Syscall auditing was eventually catching an unbalanced tracing, caused by a premature syscall exit due to this bug.

---
 kernel/dovetail.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dovetail.c +0 -0
index 08c649d6e9d9..bcd49183f8eb 100644

kernel/dovetail.c static bool __in_oob_syscall(struct task_struct *tsk, · line 124

Quoted 7 lines
kernel/dovetail.c +1 -1
@@ -119,7 +119,7 @@ static bool __in_oob_syscall(struct task_struct *tsk,
 	 * a PR_OOB_SYSCALL command (new/current call form).
 	 */
 	if (IS_ENABLED(CONFIG_DOVETAIL_LEGACY_SYSCALL_RANGE)) {
-		if (nr & __OOB_SYSCALL_BIT)
+		if (nr != -1 && nr & __OOB_SYSCALL_BIT)
 			return true;
 	}

Merged into v6.1.y-dovetail-rebase, v6.6.y-dovetail-rebase, v6.10-dovetail-rebase and the upcoming v6.11-dovetail-rebase.

Thanks,

Signature · 1 line
Philippe.
author
#2 lore raw
Quoted 18 lines · Philippe Gerum
Quoted 16 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

At least on x86, the kernel may have decided to invalidate the syscall number while processing it. Avoid that we process this -1 as legacy syscall.

This was a long-pending issue in the whole dovetail series, now revealed by running auditd on one of the test systems. Syscall auditing was eventually catching an unbalanced tracing, caused by a premature syscall exit due to this bug.

---
 kernel/dovetail.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

kernel/dovetail.c static bool __in_oob_syscall(struct task_struct *tsk, · line 124

Quoted 12 lines
kernel/dovetail.c +1 -1
index 08c649d6e9d9..bcd49183f8eb 100644
@@ -119,7 +119,7 @@ static bool __in_oob_syscall(struct task_struct *tsk,
 	 * a PR_OOB_SYSCALL command (new/current call form).
 	 */
 	if (IS_ENABLED(CONFIG_DOVETAIL_LEGACY_SYSCALL_RANGE)) {
-		if (nr & __OOB_SYSCALL_BIT)
+		if (nr != -1 && nr & __OOB_SYSCALL_BIT)
 			return true;
 	}

Merged into v6.1.y-dovetail-rebase, v6.6.y-dovetail-rebase, v6.10-dovetail-rebase and the upcoming v6.11-dovetail-rebase.

Thanks - but not yet pushed, I suppose.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#3 lore raw
Quoted 36 lines · Jan Kiszka
Quoted 18 lines · Philippe Gerum
Quoted 16 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

At least on x86, the kernel may have decided to invalidate the syscall number while processing it. Avoid that we process this -1 as legacy syscall.

This was a long-pending issue in the whole dovetail series, now revealed by running auditd on one of the test systems. Syscall auditing was eventually catching an unbalanced tracing, caused by a premature syscall exit due to this bug.

---
 kernel/dovetail.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

kernel/dovetail.c static bool __in_oob_syscall(struct task_struct *tsk, · line 124

Quoted 12 lines
kernel/dovetail.c +1 -1
index 08c649d6e9d9..bcd49183f8eb 100644
@@ -119,7 +119,7 @@ static bool __in_oob_syscall(struct task_struct *tsk,
 	 * a PR_OOB_SYSCALL command (new/current call form).
 	 */
 	if (IS_ENABLED(CONFIG_DOVETAIL_LEGACY_SYSCALL_RANGE)) {
-		if (nr & __OOB_SYSCALL_BIT)
+		if (nr != -1 && nr & __OOB_SYSCALL_BIT)
 			return true;
 	}

Merged into v6.1.y-dovetail-rebase, v6.6.y-dovetail-rebase, v6.10-dovetail-rebase and the upcoming v6.11-dovetail-rebase.

Quoted 2 lines

Thanks - but not yet pushed, I suppose.

No, not yet. Something looks strange with one of my tests. Not sure that it's related though, just playing safe.

Signature · 1 line
Philippe.
author
#4 lore raw
Quoted 38 lines · Philippe Gerum
Quoted 36 lines · Jan Kiszka
Quoted 34 lines · Philippe Gerum
Quoted 21 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

At least on x86, the kernel may have decided to invalidate the syscall number while processing it. Avoid that we process this -1 as legacy syscall.

This was a long-pending issue in the whole dovetail series, now revealed by running auditd on one of the test systems. Syscall auditing was eventually catching an unbalanced tracing, caused by a premature syscall exit due to this bug.

---
 kernel/dovetail.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dovetail.c +0 -0
index 08c649d6e9d9..bcd49183f8eb 100644

kernel/dovetail.c static bool __in_oob_syscall(struct task_struct *tsk, · line 124

Quoted 7 lines
kernel/dovetail.c +1 -1
@@ -119,7 +119,7 @@ static bool __in_oob_syscall(struct task_struct *tsk,
 	 * a PR_OOB_SYSCALL command (new/current call form).
 	 */
 	if (IS_ENABLED(CONFIG_DOVETAIL_LEGACY_SYSCALL_RANGE)) {
-		if (nr & __OOB_SYSCALL_BIT)
+		if (nr != -1 && nr & __OOB_SYSCALL_BIT)
 			return true;
 	}

Merged into v6.1.y-dovetail-rebase, v6.6.y-dovetail-rebase, v6.10-dovetail-rebase and the upcoming v6.11-dovetail-rebase.

Quoted 6 lines
Quoted 2 lines

Thanks - but not yet pushed, I suppose.

No, not yet. Something looks strange with one of my tests. Not sure that it's related though, just playing safe.

OK, let us know if we can support somewhere.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center