Skip to content

Commit

Permalink
NOISSUE - Fix Algo Path (#216)
Browse files Browse the repository at this point in the history
* fix(algorithm): fix running binary algorithm

This is the error
```
"algorithm": executable file not found in $PATH
```

* fix(algorithm): get absolute filepath for all algorithms

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* fix(lint): fix linting errors

* refactor: simplify algorithm filename

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

---------

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
  • Loading branch information
rodneyosodo authored Aug 26, 2024
1 parent bdbeb4e commit 01c502e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 17 deletions.
8 changes: 7 additions & 1 deletion agent/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"log/slog"
"os"
"path/filepath"
"slices"

"github.com/google/go-sev-guest/client"
Expand Down Expand Up @@ -118,7 +119,12 @@ func (as *agentService) Algo(ctx context.Context, algo Algorithm) error {
return ErrHashMismatch
}

f, err := os.Create("algorithm")
currentDir, err := os.Getwd()
if err != nil {
return fmt.Errorf("error getting current directory: %v", err)
}

f, err := os.Create(filepath.Join(currentDir, "algorithm"))
if err != nil {
return fmt.Errorf("error creating algorithm file: %v", err)
}
Expand Down
4 changes: 3 additions & 1 deletion hal/linux/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Hardware Abstraction Layer (HAL) for Confidential Computing
Cocos HAL for Linux is framework for building custom in-enclave Linux distribution.

Cocos HAL for Linux is framework for building custom in-enclave Linux distribution.

## Usage

HAL uses [Buildroot](https://buildroot.org/)'s [_External Tree_ mechanism](https://buildroot.org/downloads/manual/manual.html#outside-br-custom) for building custom distro:

```bash
Expand Down
2 changes: 1 addition & 1 deletion hal/linux/board/cocos/linux.config
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ CONFIG_PREEMPT=n
CONFIG_PREEMPT_DYNAMIC=n
CONFIG_DEBUG_PREEMPT=n
CONFIG_CGROUP_MISC=y
CONFIG_X86_CPUID=y
CONFIG_X86_CPUID=y
17 changes: 8 additions & 9 deletions hal/linux/configs/cocos_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ BR2_PACKAGE_HOST_QEMU=y
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y

# Docker
BR2_PACKAGE_LIBSECCOMP_ARCH_SUPPORTS=y
BR2_PACKAGE_LIBSECCOMP=y
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_DOCKER_CLI=y
BR2_PACKAGE_DOCKER_COMPOSE=y
BR2_PACKAGE_DOCKER_ENGINE=y
BR2_PACKAGE_CONTAINERD=y
BR2_PACKAGE_LIBSECCOMP_ARCH_SUPPORTS=y
BR2_PACKAGE_LIBSECCOMP=y
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_DOCKER_CLI=y
BR2_PACKAGE_DOCKER_COMPOSE=y
BR2_PACKAGE_DOCKER_ENGINE=y
BR2_PACKAGE_CONTAINERD=y
BR2_PACKAGE_RUNC=y
BR2_PACKAGE_IPTABLES=y

Expand All @@ -61,7 +61,7 @@ BR2_PACKAGE_PYTHON_PIP=y
BR2_PACKAGE_BZIP2=y
BR2_PACKAGE_XZ=y
BR2_PACKAGE_ZIP=y
BR2_PACKAGE_PYTHON3_ZLIB=y
BR2_PACKAGE_PYTHON3_ZLIB=y
BR2_PACKAGE_PYTHON3_XZ=y
BR2_PACKAGE_PYTHON3_BZIP2=y
BR2_INSTALL_LIBSTDCPP=y
Expand All @@ -71,4 +71,3 @@ BR2_TOOLCHAIN_BUILDROOT_LIBSTDCPP=y
BR2_PACKAGE_GCC=y
BR2_PACKAGE_GCC_TARGET=y
BR2_PACKAGE_LIBSTDCPP=y

2 changes: 1 addition & 1 deletion hal/linux/external.mk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include $(sort $(wildcard $(BR2_EXTERNAL_COCOS_PATH)/package/*/*.mk))
include $(sort $(wildcard $(BR2_EXTERNAL_COCOS_PATH)/package/*/*.mk))
6 changes: 3 additions & 3 deletions hal/linux/package/agent/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ config BR2_PACKAGE_AGENT
default y
help
Confidential Computing Agent is a state machine capable of
receiving datasets and algorithm, running computations, and
fetching the attestation report from within the
Confidential VM.
receiving datasets and algorithm, running computations, and
fetching the attestation report from within the
Confidential VM.
2 changes: 1 addition & 1 deletion hal/linux/package/agent/agent.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
AGENT_VERSION = main
AGENT_SITE = $(call github,ultravioletrs,cocos,$(AGENT_VERSION))

define AGENT_BUILD_CMDS
define AGENT_BUILD_CMDS
$(MAKE) -C $(@D) agent EMBED_ENABLED=$(AGENT_EMBED_ENABLED)
endef

Expand Down

0 comments on commit 01c502e

Please sign in to comment.