About This Document

This document discusses the reasons behind the next-generation sbrsh and plans for its implementation.

Glossary

Target binary

The program which is executed with the help of sbrsh

Client

Program which is used to issue the command execution (sbrsh), run on the host system

Daemon

Program which processes requests to execute commands (sbrshd), run on the target system

Host system

Computer which runs the client (the Scratchbox host, typically i386 architecture)

Target system

Computer which runs the daemon (the slow embedded device, ARM or such architecture)

Unidirectional execution

Binary running on the host system can execute a target binary on the target device, but not vice versa

Bidirectional execution

Target binary running on the target device can execute a host binary

Open file descriptor

File descriptor that is provided by the process which executes the target binary, to be used for IPC

Writable file-backed mmap

Memory-mapped portion of a file that is writable

Background

Current status

Vision

Ideas

Possible Implementation Techniques

Signal and generic open file descriptor support should be straightforward to add even to the current implementation.

LD_PRELOAD

Override all I/O-related (and other necessary) C-library functions and redirect I/O to the host system. This approach is similar to LD_PRELOAD-based userspace filesystems.

Pros

Cons

ptrace

Execute the target binary in a strace-like fashion. Syscalls are trapped and redirected to the host system. Writable file-backed mmaps might be possible to implement by trapping SEGV signal and decoding the instruction.

[http://iki.fi/timo.savola/repos/?r=ptrace-test;a=tree Prototype]

Pros

Cons

Coda

Replace NFS mounts in the chroot using custom virtual filesystem which redirects I/O to the host system through the sbrsh communication channel.

Pros

Cons

FUSE

Same idea as with Coda. FUSE is planned to be used anyway in [http://freedesktop.org/wiki/Software_2fsbox2 "Scratchbox2"].

Pros

Cons

Kernel module

All of this could obviously be implemented by a custom kernel, but the implementation is potentially complex and requires constant maintenance.

FUSE on the host system

Writable file-backed mmaps could be implemented in co-operation with any other approach if the file is accessed through a custom virtual filesystem at the host system. The file would be copied to the target system for as long as it is being mapped by target binaries.

Pros

Cons

Implementation Requirements

Proposed Approach

ptrace seems like the most robust and generic approach to implement most requirements. Writable file-backed mmaps could be implemented with the help of FUSE on the host system.

Prestudy

Other Ideas

Sbrsh2 (last edited 2007-04-15 16:57:44 by a88-115-73-217)