gramineproject / graphene

Graphene / Graphene-SGX - a library OS for Linux multi-process applications, with Intel SGX support
https://grapheneproject.io
GNU Lesser General Public License v3.0
765 stars 262 forks source link

Function not implemented (src/ip.cpp:563) in testing GSC container #2692

Closed ntk97 closed 2 years ago

ntk97 commented 2 years ago

Function not implemented (src/ip.cpp:563) in testing GSC container

Trying to the integrate Avalon with Graphene, while testing the GSC build container with simple client without Avalon.

Steps to reproduce

Build the avalon-python worker base image by following below steps

Content of graphene-sgx.yaml in the path avalon/tc/graphene/python_worker/compose/graphene-sgx.yaml is mentioned below

version: '3.5'

services:
  process-work-order:
    image: gsc-avalon-python-worker-dev
    devices:
      - "dev/sgx_enclave:/dev/sgx_enclave"

Content of modified python manifest file in the pathgraphene/Tools/gsc/test/ubuntu18.04-python3.manifest is mentioned below

sgx.enclave_size = "256M"
sgx.thread_num = 8
sgx.allow_file_creation = 1
sgx.file_check_policy = "allow_all_but_log"

# the below three lines are for testing internal GSC logic (they must be skipped); note that
# the dummy3 line is skipped by GSC because it contains an illegal "=" inside filename

# sgx.allowed_files.dummy1 = "file:commented-out-with-space"
#sgx.allowed_files.dummy2 = "file:commented-out"
# sgx.allowed_files.dummy3 = "file:weird=file"

# the below files may differ from Docker container to Docker container, so they are marked as
# allowed (this may be insecure if untrusted host maliciously modified these files!)
# sgx.allowed_files.etchostname = "file:/etc/hostname"
# sgx.allowed_files.etchosts    = "file:/etc/hosts"
# sgx.allowed_files.etcresolv   = "file:/etc/resolv.conf"

sgx.allowed_files = [
  "file:/usr/local/lib/python3.9/",
  "file:/home/python_worker/bash", # for getdents test
  "file:/etc/hostname",
  "file:/etc/hosts",
  "file:/etc/resolv.conf",
  "file:/root/.python_history-00001.tmp",
  "file:/tmp"
]
dimakuv commented 2 years ago

During execution of docker command for testing Graphene GSC without Avalon, throws Function not implemented (src/ip.cpp:563) . Unable to locate the file src/ip.cpp file.

Sorry but this is not a Graphene problem. You should be asking Avalon people what this src/ip.cpp file could be.

Anyways, quick googling lead me to this: https://github.com/zeromq/libzmq/blob/5d8d857540323e2d85c64a7edde1ad5280cad04b/src/ip.cpp#L563. This feels like a right hit, so probably Avalon uses libzmq (ZeroMQ, https://github.com/zeromq/libzmq).

Looking at that code, we see this system call executing: https://github.com/zeromq/libzmq/blob/5d8d857540323e2d85c64a7edde1ad5280cad04b/src/ip.cpp#L561. This is eventfd(), which is disable in Graphene by default. See https://gramine.readthedocs.io/en/latest/manifest-syntax.html#allowing-eventfd.

So you can try to add this line to your manifest file:

sys.insecure__allow_eventfd = true
ntk97 commented 2 years ago

Enabling theeventfd() by adding sys.insecure__allow_eventfd = true in manifest resolved the issue.