Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion dmoj/cptbox/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
_SYSCALL_INDICIES[PTBOX_ABI_ARM64] = 5

FREEBSD = sys.platform.startswith('freebsd')
BAD_SECCOMP = sys.platform == 'linux' and tuple(map(int, os.uname().release.partition('-')[0].split('.'))) < (4, 8)
BAD_SECCOMP = is_bad_seccomp()

_address_bits = {
PTBOX_ABI_X86: 32,
Expand Down Expand Up @@ -424,3 +424,17 @@ def unsafe_communicate(self, input: Optional[bytes] = None) -> Tuple[bytes, byte

def can_debug(abi: int) -> bool:
return abi in SUPPORTED_ABIS

def is_bad_seccomp() -> bool:
try:
version_parts = os.uname().release.partition('-')[0].split('.')
clean_parts = []
for part in version_parts:
clean_part = ''.join(c for c in part if c.isdigit())
if clean_part:
clean_parts.append(int(clean_part))
return sys.platform == 'linux' and tuple(clean_parts) < (4, 8)
except (ValueError, IndexError):
# Default to assuming bad seccomp if we can't parse
return True

Comment thread
AntennaeVY marked this conversation as resolved.
Outdated