Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Segmentation fault Error when script exists #2

Copy link
Copy link
@jamesliu668

Description

@jamesliu668
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.