You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From ca9418a3e0b73a4f317225ad90c47f095ad6feb6 Mon Sep 17 00:00:00 2001
From: Joy Allen <persisttao@gmail.com>
Date: Tue, 5 Dec 2023 15:57:01 +0800
Subject: [PATCH] Consider negative syscall nr as NotExist error
C libseccomp may return negative pseudo syscall nr. In this case,
the syscall does not exist.
Signed-off-by: Joy Allen <persisttao@gmail.com>
---
seccomp.go | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/seccomp.go b/seccomp.go
index b707c43..54b6aac 100644
--- a/seccomp.go
+++ b/seccomp.go
@@ -495,7 +495,9 @@ func GetSyscallFromName(name string) (ScmpSyscall, error) {
defer C.free(unsafe.Pointer(cString))
result := C.seccomp_syscall_resolve_name(cString)
- if result == scmpError {
+ // C libseccomp may return negative pseudo syscall nr on NotExist.
+ // Just checking scmpError is not sufficient here
+ if result < 0 {
return 0, ErrSyscallDoesNotExist
}
--
2.25.1
The text was updated successfully, but these errors were encountered:
GetSyscallFromName
in seccomp.go may returns negative syscall nr without error. It is not reasonable since syscall can not be negative.Test case:
Fix:
The text was updated successfully, but these errors were encountered: