segfault at 0 ip 00007fe70ae4e3b2 sp 00007fe70884fb70 error 4 in liblxcfs.so[7fe70ae46000+f000]
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxcfs (Ubuntu) |
Fix Released
|
Undecided
|
Christian Brauner | ||
Bionic |
Fix Released
|
Undecided
|
Kellen Renshaw | ||
Focal |
Fix Released
|
Undecided
|
Unassigned | ||
Jammy |
Fix Released
|
Undecided
|
Unassigned | ||
Kinetic |
Fix Released
|
Undecided
|
Christian Brauner |
Bug Description
SRU template
[Impact]
* lxcfs on Bionic will segfault if there are no non-directory files in a cgroup. This necessitates restarting running containers.
[Test Plan]
* Install lxcfs on an Ubuntu Bionic machine. "sudo apt install lxcfs"
* Open 3 terminals to the machine, each with a root prompt.
* Prepare a mount directory in terminal 1:
mkdir /mnt/lxcfs
* In terminal 1, execute:
while true ; do mkdir /sys/fs/
* In terminal 2, execute:
lxcfs -p /tmp/lxcfs.pid /mnt/lxcfs
* In terminal 3, execute:
while true; do ls /mnt/lxcfs/
* Segfault should not occur with patched version.
[Where problems could occur]
* Correcting the null pointer dereference could allow previously undetected bugs masked by the segfault to be encountered.
[Other Info]
* Proposed fix is upstream since version 3.0.4 with no negative impacts.
* Proposed fix is a minimal cherry-pick of the fix, without other functional changes.
###
Original bug text
###
Hi,
lxcfs crashed earlier today requiring us to restart a bunch of LXC containers. I'm not able to upload using apport-bug but here's the attached crash report.
I commented on https:/
| Dec 8 06:25:03 orlo kernel: [25247258.665022] lxcfs[3871]: segfault at 0 ip 00007fe70ae4e3b2 sp 00007fe70884fb70 error 4 in liblxcfs.
| Dec 8 06:25:09 orlo systemd[1]: lxcfs.service: Main process exited, code=killed, status=11/SEGV
| Dec 8 06:25:09 orlo systemd[1]: lxcfs.service: Unit entered failed state.
| Dec 8 06:25:09 orlo systemd[1]: lxcfs.service: Failed with result 'signal'.
| Dec 8 06:25:10 orlo systemd[1]: lxcfs.service: Service hold-off time over, scheduling restart.
| Dec 8 06:25:10 orlo lxcfs[10839]: hierarchies:
| Dec 8 06:25:10 orlo lxcfs[10839]: 0: fd: 5: perf_event
| Dec 8 06:25:10 orlo lxcfs[10839]: 1: fd: 6: blkio
| Dec 8 06:25:10 orlo lxcfs[10839]: 2: fd: 7: freezer
| Dec 8 06:25:10 orlo lxcfs[10839]: 3: fd: 8: devices
| Dec 8 06:25:10 orlo lxcfs[10839]: 4: fd: 9: cpuset
| Dec 8 06:25:10 orlo lxcfs[10839]: 5: fd: 10: cpu,cpuacct
| Dec 8 06:25:10 orlo lxcfs[10839]: 6: fd: 11: pids
| Dec 8 06:25:10 orlo lxcfs[10839]: 7: fd: 12: memory
| Dec 8 06:25:10 orlo lxcfs[10839]: 8: fd: 13: net_cls,net_prio
| Dec 8 06:25:10 orlo lxcfs[10839]: 9: fd: 14: hugetlb
| Dec 8 06:25:10 orlo lxcfs[10839]: 10: fd: 15: name=systemd
So now after restarting it, the containers are showing this:
| Error: /proc must be mounted
| To mount /proc at boot you need an /etc/fstab line like:
| proc /proc proc defaults
| In the meantime, run "mount proc /proc -t proc"
Package version:
| ubuntu@orlo:~$ cfs
| lxcfs:
| Installed: 2.0.8-0ubuntu1~
| Candidate: 2.0.8-0ubuntu1~
| Version table:
| 3.0.2-0ubuntu1~
| 100 http://
| *** 2.0.8-0ubuntu1~
| 500 http://
| 100 /var/lib/
| 2.0.0-0ubuntu2 500
| 500 http://
Changed in lxcfs (Ubuntu): | |
status: | In Progress → Fix Released |
Changed in lxcfs (Ubuntu Jammy): | |
status: | New → Fix Released |
Changed in lxcfs (Ubuntu Focal): | |
status: | New → Fix Released |
Changed in lxcfs (Ubuntu Bionic): | |
status: | New → In Progress |
assignee: | nobody → Kellen Renshaw (krenshaw) |
description: | updated |
description: | updated |
tags: | added: patch |
tags: |
added: verification-done removed: verification-needed |
Trace:
Program terminated with signal SIGSEGV, Segmentation fault. 0x7fe70b850ce0 <fill_dir>, offset=<optimized out>, fi=<optimized out>) 0x7fe70b850ce0 <fill_dir>, offset=<optimized out>, fi=<optimized out>)
proc_readdir = <optimized out> 0x7fe70b850ce0 <fill_dir>, offset=0, fi=0x7fe70884fc80) at lxcfs.c:504 0x7fe650024170 "/cgroup/ name=systemd/ lxc/juju- c5f7d5- 1-lxd-1/ user.slice/ user-113. slice/session- 463849. scope", buf=0x7fe690003610, 0x7fe70b850ce0 <fill_dir>, off=0, fi=0x7fe70884fc80) at fuse.c:2044
__mutex = 0x5c0b63bf, __nwaiters = 918218053, __broadcast_seq = 0}, v\\\000\ 000\000\ 000E\345\ 272\066\ 000\000\ 000", name=systemd/ lxc/juju- c5f7d5- 1-lxd-1/ user.slice/ user-113. slice/session- 463849. scope" 4ad0, ino=3274299, size=4096, off=0, llfi=<optimized out>) at fuse.c:3528 c:1390 e3160, buf=0x7fe70884ff00, ch=<optimized out>) at fuse_lowlevel. c:2442
#0 0x00007fe70ae4e3b2 in cg_readdir (path=<optimized out>, buf=0x7fe690003610, filler=
at bindings.c:1793
1793 bindings.c: No such file or directory.
[Current thread is 1 (Thread 0x7fe708850700 (LWP 3871))]
(gdb) bt full
#0 0x00007fe70ae4e3b2 in cg_readdir (path=<optimized out>, buf=0x7fe690003610, filler=
at bindings.c:1793
d = 0x7fe690000940
list = 0x0
i = 0
ret = <optimized out>
nextcg = 0x0
fc = 0x7fe6500240d0
clist = 0x0
__func__ = "cg_readdir"
initpid = <optimized out>
#1 0x000055cfc579a411 in do_proc_readdir (fi=<optimized out>, offset=<optimized out>, filler=<optimized out>, buf=<optimized out>, path=<optimized out>)
at lxcfs.c:307
error = <optimized out>
#2 lxcfs_readdir (path=<optimized out>, buf=0x7fe690003610, filler=
No locals.
#3 0x00007fe70b856232 in fuse_fs_readdir (fs=0x55cfc69e2fd0,
path=
filler=
No locals.
#4 0x00007fe70b8563bc in readdir_fill (fi=0x7fe70884fc80, dh=0x7fe690003610, off=0, size=4096, ino=3274299, req=0x7fe650024ad0, f=0x55cfc69e2aa0)
at fuse.c:3502
d = {id = 472446402651, cond = {__data = {__lock = 0, __futex = 0, __total_seq = 0, __wakeup_seq = 532575944823, __woken_seq = 0,
__size = '\000' <repeats 16 times>, "w\000\000\000|", '\000' <repeats 11 times>, "\277c\
__align = 0}, finished = 1544250303}
path = 0x7fe650024170 "/cgroup/
err = <optimized out>
#5 fuse_lib_readdir (req=0x7fe65002
err = 0
f = 0x55cfc69e2aa0
fi = {flags = 0, fh_old = 140628235127104, writepage = 0, direct_io = 0, keep_cache = 0, flush = 0, nonseekable = 0, flock_release = 0, padding = 0,
fh = 140628235127104, lock_owner = 0}
dh = 0x7fe690003610
#6 0x00007fe70b85d0f6 in do_readdir (req=<optimized out>, nodeid=<optimized out>, inarg=<optimized out>) at fuse_lowlevel.
arg = <optimized out>
fi = {flags = 0, fh_old = 140628235138576, writepage = 0, direct_io = 0, keep_cache = 0, flush = 0, nonseekable = 0, flock_release = 0, padding = 0,
fh = 140628235138576, lock_owner = 0}
#7 0x00007fe70b85e679 in fuse_ll_process_buf (data=0x55cfc69
f = 0x55cfc69e3160
bufv = {count = 1, idx = 0, off = 0, buf = {{size = 80, flags = (unknown: 0), mem = ...