-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
When I run the python file below, it will throw following error after python exist:
Segmentation fault (core dumped)
Here is my source code:
# -*- coding: utf-8 -*-
import json
import sys
filter = None
defaction = 0
try:
import seccomp
except ImportError:
# pip3 install pyseccomp -i https://mirrors.aliyun.com/pypi/simple
import pyseccomp as seccomp
finally:
# respond with EPERM: operation not permitted so users can tell
# they're being blocked from doing something
defaction = seccomp.ERRNO(seccomp.errno.EPERM)
filter = seccomp.SyscallFilter(seccomp.ERRNO(seccomp.errno.EPERM))
# allow `write`ing to two already-opened files stdout and stderr
filter.add_rule(
seccomp.ALLOW, "write", seccomp.Arg(0, seccomp.EQ, sys.stdout.fileno())
)
filter.add_rule(
seccomp.ALLOW, "write", seccomp.Arg(0, seccomp.EQ, sys.stderr.fileno())
)
# load the filter in the kernel
filter.load()
from typing import Dict, Any
Args = Dict[str, Any]
def main(args:Args) -> dict:
return {
"result": args["input"] + args["input"]
}
# decode and prepare input dict
inputs_obj = {'input': '1'}
# execute main function
output_obj = main(inputs_obj)
# convert output to json and print
output_json = json.dumps(output_obj, indent=4, ensure_ascii=False)
print(output_json)
My env is ubuntu 22, python3.10.
Thx
Metadata
Metadata
Assignees
Labels
No labels