Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error opening executable -13 #35

Open
dzygann opened this issue Nov 30, 2021 · 5 comments
Open

Error opening executable -13 #35

dzygann opened this issue Nov 30, 2021 · 5 comments

Comments

@dzygann
Copy link

dzygann commented Nov 30, 2021

Hi

I got the following error, if I try to run the gsc container:

-----------------------------------------------------------------------------------------------------------------------
Gramine detected the following insecure configurations:

  - loader.insecure__use_cmdline_argv = true   (forwarding command-line args from untrusted host to the app)

Gramine will continue application execution, but this configuration must not be used in production!
-----------------------------------------------------------------------------------------------------------------------

[P1:T1:] error: Error opening executable /hashgraph: -13
[P1:T1:] error: Error during shim_init() in init_important_handles (-13)

This is my dockerfile:

From ubuntu:20.04

RUN apt-get update \
    && apt-get install -y libssl-dev \
        openssl


COPY ./hashgraph /hashgraph

WORKDIR /hashgraph

ENTRYPOINT ["./hashgraph"]

The user permission of the executable:

-rwxrwxr-x  1 developer developer 8364240 Nov 25 17:19 hashgraph*

What I'm doing wrong?

@dimakuv
Copy link
Contributor

dimakuv commented Nov 30, 2021

What is this hashgraph app? GSC actually expects applications to be installed inside the Docker image, not just copy-pasted.

In particular, in GSC this line fails:

&& which {{binary}} | xargs ln -s || true

As you can imagine, performing a which hashgraph command returns "nothing". I don't think this is a bug in GSC -- Docker images typically don't have ./<app> (non-installed executables) entrypoints.

In other words, please find a way to install this hashgraph application. In the worst case, if it is a stand-alone simple program, you can just do something like this:

RUN cp ./hashgraph /usr/local/bin

This is like a tiny install script in Ubuntu.

@dzygann
Copy link
Author

dzygann commented Dec 1, 2021

Hi @dimakuv

Hashgraph is considered a strong and more efficient alternative to current block-chain technology. Here's a link to the repository: Hashgraph

I tried to copy the hashgraph executable, but the application still fails.

Error Message:

[P1:T1:] error: Error opening executable /hashgraph: -13
[P1:T1:] error: Error during shim_init() in init_important_handles (-13)

Updated Dockerfile:

From ubuntu:20.04

RUN apt-get update -y && apt-get install -y \
        openssl

RUN mkdir hashgraph

COPY hashgraph /hashgraph

WORKDIR /hashgraph

RUN cp hashgraph /usr/local/bin/

ENTRYPOINT ["hashgraph"]

CMD ["node0/settings.yaml"]

Check gsc-container, if the which command points to the right location

developer@OptiPlex-3070:~/workspaces/enclaive/gsc$   docker run -it --entrypoint /bin/bash gsc-ubuntu20.04-hashgraph 
root@115f93002e6e:/hashgraph# ll
total 10528
drwxr-xr-x 1 root root    4096 Dec  1 22:47 ./
drwxr-xr-x 1 root root    4096 Dec  1 22:53 ../
-rwxrwxr-x 1 root root 8364240 Nov 25 16:19 hashgraph*
// + other files
root@115f93002e6e:/hashgraph# cd /usr/local/bin/
root@115f93002e6e:/usr/local/bin# ll | grep hash
-rwxr-xr-x 1 root root 8364240 Dec  1 22:47 hashgraph*
root@115f93002e6e:/usr/local/bin# which hashgraph
/usr/local/bin/hashgraph
root@115f93002e6e:/usr/local/bin# 

gsc-manifest

sgx.enclave_size = "16G"
sgx.thread_num = 32
sys.stack.size = "2M"

loader.pal_internal_mem_size = "128M"

It seems something is still wrong with my setup.

@dimakuv
Copy link
Contributor

dimakuv commented Dec 2, 2021

Ah, that's because you have hashgraph/ (as a directory) under the root dir, and GSC tries to create a link to the executable (hashgraph -> /usr/local/bin/hashgraph) under the root dir. So GSC fails to create a link, because a file-system object (directory) with this name already exists.

Try to rename the hashgraph/ directory (inside the Docker image) to something else, like hashgraph-dir/.

In general, I would ask the Hashgraph devs to provide a proper installation procedure for this application. Otherwise you'll basically re-implement the installation script for them. (As I already mentioned, GSC really expects a proper installation of the app inside the Docker image.)

@dzygann
Copy link
Author

dzygann commented Dec 2, 2021

Hi @dimakuv

Try to rename the hashgraph/ directory (inside the Docker image) to something else, like hashgraph-dir/.

this did the trick! Now it runs into the next issue :D I will open a new ticket for that one.

Thank you very much!

@dimakuv
Copy link
Contributor

dimakuv commented Dec 2, 2021

@aneessahib @veenasai2 Do you think we need to do something in GSC codebase about such scenarios?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants