Closed calvin2021y closed 7 months ago
strace free
execve("/usr/bin/free", ["free"], 0x7ffd83d2cc60 /* 6 vars */) = 0
arch_prctl(ARCH_SET_FS, 0x7fba88549b48) = 0
set_tid_address(0x7fba88549fb0) = 14
brk(NULL) = 0x55d90470a000
brk(0x55d90470c000) = 0x55d90470c000
mmap(0x55d90470a000, 4096, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x55d90470a000
mprotect(0x7fba88546000, 4096, PROT_READ) = 0
mprotect(0x55d903f77000, 16384, PROT_READ) = 0
getuid() = 0
ioctl(1, TIOCGWINSZ, {ws_row=84, ws_col=260, ws_xpixel=32712, ws_ypixel=0}) = 0
writev(1, [{iov_base=" total used "..., iov_len=79}, {iov_base="\n", iov_len=1}], 2 total used free shared buff/cache available
) = 80
sysinfo({uptime=9457, loads=[288, 1216, 0], totalram=33480413184, freeram=29366726656, sharedram=3907584, bufferram=3055616, totalswap=0, freeswap=0, procs=538, totalhigh=0, freehigh=0, mem_unit=1}) = 0
open("/proc/meminfo", O_RDONLY|O_LARGEFILE) = 3
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fba884b2000
read(3, "MemTotal: 262144 kB\nMemF"..., 1024) = 1024
lseek(3, -296, SEEK_CUR) = 728
close(3) = 0
munmap(0x7fba884b2000, 4096) = 0
writev(1, [{iov_base="Mem: 32695716 4012812 "..., iov_len=79}, {iov_base="\n", iov_len=1}], 2Mem: 32695716 4012812 28678444 3816 4460 260840
) = 80
writev(1, [{iov_base="Swap: 0 0 "..., iov_len=43}, {iov_base="\n", iov_len=1}], 2Swap: 0 0 0
) = 44
exit_group(0) = ?
+++ exited with 0 +++
cat /proc/meminfo
MemTotal: 262144 kB
MemFree: 260004 kB
MemAvailable: 261484 kB
Buffers: 0 kB
Cached: 1480 kB
SwapCached: 0 kB
Active: 1008 kB
Inactive: 692 kB
Active(anon): 4 kB
Inactive(anon): 220 kB
Active(file): 1004 kB
Inactive(file): 472 kB
Unevictable: 0 kB
Mlocked: 3876 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Zswap: 0 kB
Zswapped: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 224 kB
Mapped: 0 kB
Shmem: 0 kB
KReclaimable: 55152 kB
Slab: 0 kB
SReclaimable: 0 kB
SUnreclaim: 0 kB
KernelStack: 8832 kB
PageTables: 11448 kB
SecPageTables: 0 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 16216784 kB
Committed_AS: 2532532 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 622824 kB
VmallocChunk: 0 kB
Percpu: 12544 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
FileHugePages: 0 kB
FilePmdMapped: 0 kB
HugePages_Total: 128
HugePages_Free: 125
HugePages_Rsvd: 61
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 262144 kB
DirectMap4k: 382748 kB
DirectMap2M: 7837696 kB
DirectMap1G: 25165824 kB
strace uptime
execve("/usr/bin/uptime", ["uptime"], 0x7ffd87973410 /* 6 vars */) = 0
arch_prctl(ARCH_SET_FS, 0x7f740351eb48) = 0
set_tid_address(0x7f740351efb0) = 18
brk(NULL) = 0x55600e20f000
brk(0x55600e211000) = 0x55600e211000
mmap(0x55600e20f000, 4096, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x55600e20f000
mprotect(0x7f740351b000, 4096, PROT_READ) = 0
mprotect(0x55600d815000, 16384, PROT_READ) = 0
getuid() = 0
sysinfo({uptime=9482, loads=[128, 1056, 0], totalram=33480413184, freeram=29366468608, sharedram=3907584, bufferram=3055616, totalswap=0, freeswap=0, procs=539, totalhigh=0, freehigh=0, mem_unit=1}) = 0
open("/etc/localtime", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/run/utmps/.utmpd-socket"}, 110) = -1 ENOENT (No such file or directory)
close(3) = 0
ioctl(1, TIOCGWINSZ, {ws_row=84, ws_col=260, ws_xpixel=32712, ws_ypixel=0}) = 0
writev(1, [{iov_base=" 13:14:48 up 2:38, 0 users, l"..., iov_len=61}, {iov_base="\n", iov_len=1}], 2 13:14:48 up 2:38, 0 users, load average: 0.00, 0.01, 0.00
) = 62
exit_group(0) = ?
+++ exited with 0 +++
As you can tell from your strace output, the tools in Alpine no longer access the proc files, instead relying on the sysinfo system call.
LXCFS as the name implies, is a filesystem which goes over /proc, it does not perform syscall interception.
Incus does support system call interception for our containers to deal with such cases.
test ubuntu work:
lscpu seems always show host cpus.
test alpine work:
Is there some options missing to make alpine image work ?