Hello Jen,
First, hanks for your response, it does help me to have a better understanding of how sandboxes work.
Unfortunately, I was unable to run the cm
command in the shell page.
There is my adef files:
sandboxed: true
start: auto
processes:
{
envVars:
{
HOME="/"
}
run:
{
(lighttpd -m /modlibs/ -D -f /cfg/lighttpd.conf )
}
maxCoreDumpFileBytes: 512K maxFileBytes: 512K
}
version: 1.0.0
maxFileSystemBytes: 512K
bundles:
{
file:
{
[x] binaries/lighttpd /usr/local/bin/
}
dir:
{
binaries/lib /modlibs
pages /pages
cfg /cfg
}
}
requires:
{
dir: { /proc / // needed by `app` script, and for listing running processes
/bin /
/sbin /
/usr/lib /usr/
/usr/bin /usr/
/usr/include /usr/
/legato/systems/current/bin /legato/systems/current/
/legato/systems/current/lib /legato/systems/current/
/legato/systems/current/apps /legato/systems/current/
}
device:
{
[rw] /dev/null /dev/null
[r] /dev/urandom /dev/urandom
[r] /dev/random /dev/random
}
configTree:
{
[r] system
}
file:
{
/lib/libutil.so.1 /lib/libutil.so.1
/etc/nsswitch.conf /etc/nsswitch.conf
/lib/libnss_compat.so.2 /lib/libnss_compat.so.2
/lib/libnsl.so.1 /lib/libnsl.so.1
/lib/libproc-3.2.8.so /lib/libproc-3.2.8.so
/etc/passwd /etc/passwd // needed by python to lookup user
/lib/libcrypto.so.1.0.0 /lib/libcrypto.so.1.0.0
/legato/systems/current/version /legato/systems/current/version
/legato/systems/current/status /legato/systems/current/status
/legato/systems/current/apps/MuxTools/read-only/bin/mux /usr/bin/mux
/legato/systems/current/apps/MuxTools/read-only/lib/libComponent_mux.so /usr/lib/libComponent_mux.so
/legato/systems/current/apps/tools/read-only/bin/cm /usr/bin/cm
/legato/systems/current/apps/tools/read-only/lib/libComponent_cm.so /usr/lib/libComponent_cm.so
}
}
bindings:
{
*.le_cfg -> <root>.le_cfg
*.le_update -> <root>.le_update
*.le_tool -> <root>.le_tools
*.le_appInfo -> <root>.le_appInfo
*.muxCtrlService -> <root>.muxCtrlService
*.le_gnss -> <root>.le_gnss
*.le_adc -> <root>.le_adc
*.mux -> <root>.mux
*.cm -> <root>.cm
}
As you can see I added the files using the requires: { file: { ... } }
directives, and then I added the needed APIs in the binding
section. With this configuration it doesn’t work either. (I had almost the same before). Maybe I’m missing something…
There is where the permission denied
is fired in the strace -f -p
output:
[pid 3108] uname({sys="Linux", node="swi-mdm9x15", ...}) = 0
[pid 3108] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f3e000
[pid 3108] access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
[pid 3108] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/tls/v7l/neon/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/tls/v7l/neon/vfp", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/tls/v7l/neon/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/tls/v7l/neon", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/tls/v7l/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/tls/v7l/vfp", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/tls/v7l/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/tls/v7l", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/tls/neon/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/tls/neon/vfp", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/tls/neon/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/tls/neon", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/tls/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/tls/vfp", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/tls", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/v7l/neon/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/v7l/neon/vfp", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/v7l/neon/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/v7l/neon", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/v7l/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/v7l/vfp", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/v7l/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/v7l", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/neon/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/neon/vfp", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/neon/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/neon", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/lib/vfp", 0xbed6f290) = -1 ENOENT (No such file or directory)
[pid 3108] open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid 3108] read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\10{\231A4\0\0\0"..., 512) = 512
[pid 3108] fstat64(3, {st_mode=S_IFREG|0755, st_size=1226668, ...}) = 0
[pid 3108] mmap2(0x41980000, 1259976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x41980000
[pid 3108] mprotect(0x41aa6000, 32768, PROT_NONE) = 0
[pid 3108] mmap2(0x41aae000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x126000) = 0x41aae000
[pid 3108] mmap2(0x41ab2000, 6600, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x41ab2000
[pid 3108] close(3) = 0
[pid 3108] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f3d000
[pid 3108] set_tls(0xb6f3d4c0, 0xb6f3dba8, 0x41978050, 0xb6f3d4c0, 0x41978050) = 0
[pid 3108] mprotect(0x41aae000, 8192, PROT_READ) = 0
[pid 3108] mprotect(0x41977000, 4096, PROT_READ) = 0
[pid 3108] getuid32() = 1016
[pid 3108] stat64("/etc/busybox.conf", 0xbed6f8d8) = -1 ENOENT (No such file or directory)
[pid 3108] getgid32() = 1016
[pid 3108] setgid32(1016) = 0
[pid 3108] setuid32(1016) = 0
[pid 3108] brk(0) = 0xa7000
[pid 3108] brk(0xc8000) = 0xc8000
[pid 3108] getpid() = 3108
[pid 3108] rt_sigaction(SIGCHLD, {SIG_DFL, [CHLD], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
[pid 3108] rt_sigaction(SIGHUP, {SIG_DFL, [HUP], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
[pid 3108] getppid() = 3096
[pid 3108] getcwd("/pages", 4096) = 7
[pid 3108] rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0
[pid 3108] rt_sigaction(SIGINT, {0x32fc4, ~[RTMIN RT_1], 0x4000000 /* SA_??? */}, NULL, 8) = 0
[pid 3108] rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0
[pid 3108] rt_sigaction(SIGQUIT, {SIG_IGN, ~[RTMIN RT_1], 0x4000000 /* SA_??? */}, NULL, 8) = 0
[pid 3108] rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0
[pid 3108] rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], 0x4000000 /* SA_??? */}, NULL, 8) = 0
[pid 3108] fcntl64(2, F_DUPFD, 10) = 10
[pid 3108] dup2(1, 2) = 2
[pid 3108] stat64("/sbin/cm", 0xbed6f4c8) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/usr/sbin/cm", 0xbed6f4c8) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/bin/cm", 0xbed6f4c8) = -1 ENOENT (No such file or directory)
[pid 3108] stat64("/usr/bin/cm", 0xbed6f4c8) = -1 EACCES (Permission denied)
[pid 3108] write(2, "sh: ", 4) = 4
[pid 3108] write(2, "cm: Permission denied", 21) = 21
[pid 3108] write(2, "\n", 1) = 1
[pid 3108] dup2(10, 2) = 2
[pid 3108] close(10) = 0
[pid 3108] exit_group(127) = ?
[pid 3108] +++ exited with 127 +++
[pid 3096] <... read resumed> "sh: ", 4096) = 4
[pid 3096] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3108, si_status=127, si_utime=0, si_stime=2} ---
Then when I did a sdir list
there was not WAINTING CLIENTS…
Did I miss something ?
Cheers,
Reunan