]> git.proxmox.com Git - mirror_lxcfs.git/log
mirror_lxcfs.git
4 years agobindings: provide lxcfs_clone() as wrapper around lxcfs_raw_clone()
Christian Brauner [Mon, 6 Jul 2020 09:05:14 +0000 (11:05 +0200)]
bindings: provide lxcfs_clone() as wrapper around lxcfs_raw_clone()

Closes: #420.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agocgroups: replace leftover reference to legacy terms
Christian Brauner [Sun, 5 Jul 2020 08:19:53 +0000 (10:19 +0200)]
cgroups: replace leftover reference to legacy terms

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agocgroups: update terminology
Christian Brauner [Fri, 3 Jul 2020 11:24:02 +0000 (13:24 +0200)]
cgroups: update terminology

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agobindings: update terminology
Christian Brauner [Fri, 3 Jul 2020 10:51:35 +0000 (12:51 +0200)]
bindings: update terminology

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #418 from brauner/2020-06-24/fixes
Stéphane Graber [Wed, 24 Jun 2020 14:10:14 +0000 (10:10 -0400)]
Merge pull request #418 from brauner/2020-06-24/fixes

proc_fuse: provide host values when kernel does not support swap acco…

4 years agoproc_fuse: provide host values when kernel does not support swap accounting
Christian Brauner [Wed, 24 Jun 2020 11:13:25 +0000 (13:13 +0200)]
proc_fuse: provide host values when kernel does not support swap accounting

Link: https://discuss.linuxcontainers.org/t/invalid-swaptotal-in-proc-meminfo-swaptotal-0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #417 from brauner/2020-06-10/fixes
Stéphane Graber [Wed, 10 Jun 2020 14:11:37 +0000 (10:11 -0400)]
Merge pull request #417 from brauner/2020-06-10/fixes

cpuview: fixes

4 years agoproc_cpuview: cleanup cpuview_init_head()
Christian Brauner [Wed, 10 Jun 2020 08:17:22 +0000 (10:17 +0200)]
proc_cpuview: cleanup cpuview_init_head()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: cleanup cpuview_proc_stat()
Christian Brauner [Wed, 10 Jun 2020 08:11:35 +0000 (10:11 +0200)]
proc_cpuview: cleanup cpuview_proc_stat()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: fix max_cpu_count()
Christian Brauner [Wed, 10 Jun 2020 08:07:58 +0000 (10:07 +0200)]
proc_cpuview: fix max_cpu_count()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: fix exact_cpu_count()
Christian Brauner [Wed, 10 Jun 2020 08:06:36 +0000 (10:06 +0200)]
proc_cpuview: fix exact_cpu_count()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: cleanup read_cpu_cfs_param()
Christian Brauner [Wed, 10 Jun 2020 08:05:26 +0000 (10:05 +0200)]
proc_cpuview: cleanup read_cpu_cfs_param()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: cleanup add_cpu_usage()
Christian Brauner [Wed, 10 Jun 2020 08:00:16 +0000 (10:00 +0200)]
proc_cpuview: cleanup add_cpu_usage()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: clean up find_or_create_proc_stat_node()
Christian Brauner [Wed, 10 Jun 2020 07:59:01 +0000 (09:59 +0200)]
proc_cpuview: clean up find_or_create_proc_stat_node()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: clean up prune_proc_stat_list()
Christian Brauner [Wed, 10 Jun 2020 07:56:31 +0000 (09:56 +0200)]
proc_cpuview: clean up prune_proc_stat_list()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: clean up expand_proc_stat_node()
Christian Brauner [Wed, 10 Jun 2020 07:52:53 +0000 (09:52 +0200)]
proc_cpuview: clean up expand_proc_stat_node()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: use correct comment style
Christian Brauner [Wed, 10 Jun 2020 07:50:18 +0000 (09:50 +0200)]
proc_cpuview: use correct comment style

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: cleanup add_proc_stat_node()
Christian Brauner [Wed, 10 Jun 2020 07:48:55 +0000 (09:48 +0200)]
proc_cpuview: cleanup add_proc_stat_node()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: reduce variable scope in cpuview_free_head()
Christian Brauner [Wed, 10 Jun 2020 07:35:37 +0000 (09:35 +0200)]
proc_cpuview: reduce variable scope in cpuview_free_head()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: use more descriptive labels in add_proc_stat_node()
Christian Brauner [Wed, 10 Jun 2020 07:35:16 +0000 (09:35 +0200)]
proc_cpuview: use more descriptive labels in add_proc_stat_node()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_cpuview: cleanup new_proc_stat_node()
Christian Brauner [Wed, 10 Jun 2020 07:23:33 +0000 (09:23 +0200)]
proc_cpuview: cleanup new_proc_stat_node()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #416 from brauner/2020-06-09/fixes
Stéphane Graber [Tue, 9 Jun 2020 20:22:41 +0000 (16:22 -0400)]
Merge pull request #416 from brauner/2020-06-09/fixes

proc_fuse: more swap tweaks

4 years agoproc_fuse: more swap tweaks
Christian Brauner [Tue, 9 Jun 2020 13:38:15 +0000 (15:38 +0200)]
proc_fuse: more swap tweaks

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #415 from brauner/2020-06-09/fixes
Stéphane Graber [Tue, 9 Jun 2020 13:33:16 +0000 (09:33 -0400)]
Merge pull request #415 from brauner/2020-06-09/fixes

proc_fuse: cap swap to global values

4 years agoproc_cpuview: tweak cpuacct.percpu_usage fallback
Christian Brauner [Tue, 9 Jun 2020 12:30:04 +0000 (14:30 +0200)]
proc_cpuview: tweak cpuacct.percpu_usage fallback

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_fuse: cap swap to global values
Christian Brauner [Tue, 9 Jun 2020 09:29:25 +0000 (11:29 +0200)]
proc_fuse: cap swap to global values

Closes: #412.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #413 from brauner/2020-06-07/swap_fixes
Stéphane Graber [Mon, 8 Jun 2020 23:19:15 +0000 (19:19 -0400)]
Merge pull request #413 from brauner/2020-06-07/swap_fixes

swap fixes

4 years agoproc_fuse: don't cause invalid swap values
Christian Brauner [Mon, 8 Jun 2020 22:05:48 +0000 (00:05 +0200)]
proc_fuse: don't cause invalid swap values

Closes: #412.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_fuse: improve swap calculation a little
Christian Brauner [Mon, 8 Jun 2020 21:31:35 +0000 (23:31 +0200)]
proc_fuse: improve swap calculation a little

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #411 from brauner/2020-06-04/performance_tweaks
Stéphane Graber [Fri, 5 Jun 2020 16:33:10 +0000 (12:33 -0400)]
Merge pull request #411 from brauner/2020-06-04/performance_tweaks

fixes

4 years agoutils: don't leak fds in in_same_namespace()
Christian Brauner [Fri, 5 Jun 2020 15:03:32 +0000 (17:03 +0200)]
utils: don't leak fds in in_same_namespace()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_fuse: cleanup proc_uptime_read() a little
Christian Brauner [Fri, 5 Jun 2020 13:42:41 +0000 (15:42 +0200)]
proc_fuse: cleanup proc_uptime_read() a little

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #410 from brauner/2020-06-04/performance_tweaks
Stéphane Graber [Fri, 5 Jun 2020 13:29:46 +0000 (09:29 -0400)]
Merge pull request #410 from brauner/2020-06-04/performance_tweaks

performance tweaks and leak fixes

4 years agoproc_fuse: move get_reaper_busy() down
Christian Brauner [Fri, 5 Jun 2020 12:53:54 +0000 (14:53 +0200)]
proc_fuse: move get_reaper_busy() down

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_loadavg: avoid needless memory allocation
Christian Brauner [Fri, 5 Jun 2020 11:24:33 +0000 (13:24 +0200)]
proc_loadavg: avoid needless memory allocation

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_loadavg: remove dummy variable
Christian Brauner [Fri, 5 Jun 2020 11:23:31 +0000 (13:23 +0200)]
proc_loadavg: remove dummy variable

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_loadavg: use must_* alloc helpers
Christian Brauner [Fri, 5 Jun 2020 11:11:39 +0000 (13:11 +0200)]
proc_loadavg: use must_* alloc helpers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_fuse: use zalloc()
Christian Brauner [Fri, 5 Jun 2020 11:11:27 +0000 (13:11 +0200)]
proc_fuse: use zalloc()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agolxcfs: free opts on lxcfs binary exit
Christian Brauner [Fri, 5 Jun 2020 10:59:05 +0000 (12:59 +0200)]
lxcfs: free opts on lxcfs binary exit

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agobindings: avoid dynamic stack allocations in clone()
Christian Brauner [Fri, 5 Jun 2020 10:52:12 +0000 (12:52 +0200)]
bindings: avoid dynamic stack allocations in clone()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agobindings: wipe initpid cache on library reload
Christian Brauner [Fri, 5 Jun 2020 10:41:00 +0000 (12:41 +0200)]
bindings: wipe initpid cache on library reload

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_loadavg: simplify calc_pid()
Christian Brauner [Fri, 5 Jun 2020 10:24:15 +0000 (12:24 +0200)]
proc_loadavg: simplify calc_pid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_loadavg(): use strdup() in calc_pid()
Christian Brauner [Fri, 5 Jun 2020 10:13:01 +0000 (12:13 +0200)]
proc_loadavg(): use strdup() in calc_pid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agomacro: use ISO C compatible __typeof__
Christian Brauner [Fri, 5 Jun 2020 10:12:32 +0000 (12:12 +0200)]
macro: use ISO C compatible __typeof__

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_loadavg: replace malloc() with asprintf() in calc_pid()
Christian Brauner [Fri, 5 Jun 2020 09:44:56 +0000 (11:44 +0200)]
proc_loadavg: replace malloc() with asprintf() in calc_pid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_loadavg: don't leak getline() memory
Christian Brauner [Fri, 5 Jun 2020 09:44:37 +0000 (11:44 +0200)]
proc_loadavg: don't leak getline() memory

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_loadavg: ensure pointer is NULL when passing to calc_pid()
Christian Brauner [Fri, 5 Jun 2020 09:43:10 +0000 (11:43 +0200)]
proc_loadavg: ensure pointer is NULL when passing to calc_pid()

We passed down an uninitialized pointer that we then pass to realloc()
which is problematic since it contains garbage.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoproc_loadavg: don't leak getline() memory in calc_pid()
Christian Brauner [Fri, 5 Jun 2020 09:42:31 +0000 (11:42 +0200)]
proc_loadavg: don't leak getline() memory in calc_pid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agobindings: s/get_init_pid_for_task()/scm_init_pid()/g
Christian Brauner [Thu, 4 Jun 2020 18:14:49 +0000 (20:14 +0200)]
bindings: s/get_init_pid_for_task()/scm_init_pid()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #409 from brauner/2020-06-02/proc_stat
Stéphane Graber [Tue, 2 Jun 2020 14:24:26 +0000 (10:24 -0400)]
Merge pull request #409 from brauner/2020-06-02/proc_stat

cpuview: fix /proc/stat virtualization

4 years agocpuview: fix /proc/stat virtualization
Christian Brauner [Tue, 2 Jun 2020 14:10:20 +0000 (16:10 +0200)]
cpuview: fix /proc/stat virtualization

Closes: #406.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #408 from brauner/2020-05-28/fixes
Stéphane Graber [Thu, 28 May 2020 13:01:50 +0000 (09:01 -0400)]
Merge pull request #408 from brauner/2020-05-28/fixes

bindings: fix init pid hashing

4 years agobindings: cleanup init pid verification
Christian Brauner [Thu, 28 May 2020 12:24:06 +0000 (14:24 +0200)]
bindings: cleanup init pid verification

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agobindings: cleanup cache locking
Christian Brauner [Thu, 28 May 2020 12:07:09 +0000 (14:07 +0200)]
bindings: cleanup cache locking

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agobindings: use brackets to make logic clearer
Christian Brauner [Thu, 28 May 2020 11:31:59 +0000 (13:31 +0200)]
bindings: use brackets to make logic clearer

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agobindings: make opts pointer const
Christian Brauner [Thu, 28 May 2020 11:27:37 +0000 (13:27 +0200)]
bindings: make opts pointer const

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agobindings: fix init pid hashing
Christian Brauner [Thu, 28 May 2020 09:03:05 +0000 (11:03 +0200)]
bindings: fix init pid hashing

We were stupidly always hashing entry->ino where entry was just freshly
allocated zeroed-memory so we effectively added stuff to the cache
forever but this meant:
- we never found a match when we hashed the actual inode
- we kept growing the cache
- we leaked memory

Closes: #407.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agocoverity: Use build custom build script
Stéphane Graber [Fri, 22 May 2020 17:01:40 +0000 (13:01 -0400)]
coverity: Use build custom build script

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
4 years agoMerge pull request #405 from joemoore13/patch-1
Christian Brauner [Wed, 6 May 2020 20:53:10 +0000 (22:53 +0200)]
Merge pull request #405 from joemoore13/patch-1

Fix https://github.com/lxc/lxcfs/issues/404

4 years agoFix https://github.com/lxc/lxcfs/issues/404
Joseph Moore [Wed, 6 May 2020 20:23:35 +0000 (13:23 -0700)]
Fix https://github.com/lxc/lxcfs/issues/404

reset  read_pos=0 after building usage_str

Signed-off-by: Joseph Moore <joemoore1123@gmail.com>
4 years agoMerge pull request #403 from brauner/2020-04-28/fixes
Stéphane Graber [Tue, 28 Apr 2020 11:45:35 +0000 (07:45 -0400)]
Merge pull request #403 from brauner/2020-04-28/fixes

sysfs_fuse: remove logically dead code

4 years agosysfs_fuse: remove logically dead code
Christian Brauner [Tue, 28 Apr 2020 11:24:00 +0000 (13:24 +0200)]
sysfs_fuse: remove logically dead code

Fixes: Coverity 357808.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #402 from brauner/2020-04-28/fixes
Stéphane Graber [Tue, 28 Apr 2020 11:13:24 +0000 (07:13 -0400)]
Merge pull request #402 from brauner/2020-04-28/fixes

sysfs: cpuinfo: show cgroup cpuset value

4 years agosysfs: cpuinfo: show cgroup cpuset value
Christian Brauner [Tue, 28 Apr 2020 08:35:26 +0000 (10:35 +0200)]
sysfs: cpuinfo: show cgroup cpuset value

To stop the immediate bleeding.

Closes #401.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #400 from Blub/silence-unlimited-cgv2-no-memlimit
Christian Brauner [Fri, 24 Apr 2020 07:44:14 +0000 (09:44 +0200)]
Merge pull request #400 from Blub/silence-unlimited-cgv2-no-memlimit

proc_fuse: silence error when we find no memlimit

4 years agoproc_fuse: silence error when we find no memlimit
Wolfgang Bumiller [Fri, 24 Apr 2020 07:17:06 +0000 (09:17 +0200)]
proc_fuse: silence error when we find no memlimit

We get a positive result with an empty string if we do not
encounter any limits while walking up the cgroup.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoMerge pull request #399 from brauner/2020-04-17/fixes
Stéphane Graber [Fri, 17 Apr 2020 20:10:11 +0000 (16:10 -0400)]
Merge pull request #399 from brauner/2020-04-17/fixes

proc_fuse: improve swap calculation

4 years agoproc_fuse: improve swap calculation
Stéphane Graber [Fri, 17 Apr 2020 19:59:53 +0000 (21:59 +0200)]
proc_fuse: improve swap calculation

Stéphane has been running into issues with wrong sawp limits. The logic
he suggested does:
- if memory == memory+swap, we list both at the memlimit for total size
- if memory+swap is larger than memory, then we add the extra amount to
  total swap but still cap to physical swap limit

We came to the conclusion that this is currently the best approach as we
show the mem limit as both Memory and Swap so advertising twice as much
as allowed but there's no way around that really or we'd need to
dynamically update both MemTotal and SwapTotal based on what's used to
keep MemTotal+SwapTotal == limit that's certainly doable but it will be
somewhat racy and also likely confused userspace more than mis-reporting
swap.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #398 from brauner/2020-04-17/fixes
Stéphane Graber [Fri, 17 Apr 2020 16:32:03 +0000 (12:32 -0400)]
Merge pull request #398 from brauner/2020-04-17/fixes

cgroups: simplify cgroup_walkup_to_root()

4 years agocgroups: simplify cgroup_walkup_to_root()
Christian Brauner [Fri, 17 Apr 2020 15:50:56 +0000 (17:50 +0200)]
cgroups: simplify cgroup_walkup_to_root()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #397 from brauner/2020-04-17/fixes
Stéphane Graber [Fri, 17 Apr 2020 15:26:13 +0000 (11:26 -0400)]
Merge pull request #397 from brauner/2020-04-17/fixes

cgroups: please Coverity

4 years agocgroups: please Coverity
Christian Brauner [Fri, 17 Apr 2020 13:33:01 +0000 (15:33 +0200)]
cgroups: please Coverity

Fixes: Coverity 355759.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #396 from brauner/2020-04-16/fixes
Wolfgang Bumiller [Fri, 17 Apr 2020 13:22:36 +0000 (15:22 +0200)]
Merge pull request #396 from brauner/2020-04-16/fixes

cgroups: more cgroup2 fun

4 years agotests: correctly skip readdir test
Christian Brauner [Fri, 17 Apr 2020 11:20:52 +0000 (13:20 +0200)]
tests: correctly skip readdir test

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agocgroups: more cgroup2 fun
Christian Brauner [Fri, 17 Apr 2020 10:20:55 +0000 (12:20 +0200)]
cgroups: more cgroup2 fun

Try too read a valid value from a given cgroup file. If it is a legacy
cgroup hierarchy and we fail to find a valid value we terminate early
and report an error.
The cgroup2 hierarchy however, has different semantics. In a few
controller files it will show the value "max" or simply leave it
completely empty thereby indicating that no limit has been set for this
particular cgroup.  However, that doesn't mean that there's no limit. A
cgroup further up the hierarchy could have a limit set that also applies
to the cgroup we are interested in. So for the unified cgroup hierarchy
we need to keep walking towards the cgroup2 root cgroup and try to parse
a valid value.

Fixes: #389.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #395 from brauner/2020-04-16/fixes
Stéphane Graber [Thu, 16 Apr 2020 17:28:32 +0000 (13:28 -0400)]
Merge pull request #395 from brauner/2020-04-16/fixes

bindings: use zalloc()

4 years agobindings: use zalloc()
Christian Brauner [Thu, 16 Apr 2020 17:12:34 +0000 (19:12 +0200)]
bindings: use zalloc()

Fixes: Coverity 355747.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #394 from brauner/2020-04-16/fixes
Stéphane Graber [Thu, 16 Apr 2020 17:07:06 +0000 (13:07 -0400)]
Merge pull request #394 from brauner/2020-04-16/fixes

fixes

4 years agoutils: fix recv_creds()
Christian Brauner [Thu, 16 Apr 2020 15:58:37 +0000 (17:58 +0200)]
utils: fix recv_creds()

Fixes: Coverity 355704.
Fixes: Coverity 355718.
Fixes: Coverity 355738.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agolxcfs: don't cause a uaf
Christian Brauner [Thu, 16 Apr 2020 15:45:04 +0000 (17:45 +0200)]
lxcfs: don't cause a uaf

Fixes: Coverity 355711.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agocgroup_fuse: be cautios when dereferencing d->controller
Christian Brauner [Thu, 16 Apr 2020 15:43:00 +0000 (17:43 +0200)]
cgroup_fuse: be cautios when dereferencing d->controller

Fixes: Coverity 355712.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agobindings: do not falsely return
Christian Brauner [Thu, 16 Apr 2020 15:39:05 +0000 (17:39 +0200)]
bindings: do not falsely return

This may also explain some of the performance regressions that Blub\0
reported.

Fixes: Coverity 355716.
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agocgroup_fuse: s/clone/lxcfs_clone/g
Christian Brauner [Thu, 16 Apr 2020 15:34:42 +0000 (17:34 +0200)]
cgroup_fuse: s/clone/lxcfs_clone/g

Fixes: Coverity 355713.
Fixes: Coverity 355723.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agolxcfs: remove fl.* prefix
Christian Brauner [Thu, 16 Apr 2020 15:31:12 +0000 (17:31 +0200)]
lxcfs: remove fl.* prefix

Fixes: Coverity 355708.
Fixes: Coverity 355702.
Fixes: Coverity 355729.
Fixes: Coverity 355735.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agocgroup_fuse: do not double-close
Christian Brauner [Thu, 16 Apr 2020 15:27:58 +0000 (17:27 +0200)]
cgroup_fuse: do not double-close

Fixes: Coverity 355703.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years ago.travis: fix coverity
Christian Brauner [Thu, 16 Apr 2020 16:51:03 +0000 (18:51 +0200)]
.travis: fix coverity

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #393 from brauner/2020-04-15/coverity
Stéphane Graber [Wed, 15 Apr 2020 14:46:56 +0000 (10:46 -0400)]
Merge pull request #393 from brauner/2020-04-15/coverity

memory_utils: make it easier for Coverity

4 years agomemory_utils: make it easier for Coverity
Christian Brauner [Wed, 15 Apr 2020 13:32:44 +0000 (15:32 +0200)]
memory_utils: make it easier for Coverity

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #391 from Blub/relaxed-locking
Christian Brauner [Wed, 15 Apr 2020 13:25:11 +0000 (15:25 +0200)]
Merge pull request #391 from Blub/relaxed-locking

relax init pid store locking a bit

4 years agoMerge pull request #392 from brauner/2020-04-15/coverity
Stéphane Graber [Wed, 15 Apr 2020 13:24:24 +0000 (09:24 -0400)]
Merge pull request #392 from brauner/2020-04-15/coverity

travis: enable coverity integration

4 years agotravis: enable coverity integration
Christian Brauner [Wed, 15 Apr 2020 13:15:02 +0000 (15:15 +0200)]
travis: enable coverity integration

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agorelax init pid store locking a bit
Wolfgang Bumiller [Wed, 15 Apr 2020 08:41:01 +0000 (10:41 +0200)]
relax init pid store locking a bit

So we don't keep holding it throughout the expensive the
fork/clone/send cycle of figuring out a namespace's init
pid.

Also change some functions to pass the init namespace inode
instead of the process' struct stat, so that it is obvious
that we don't use other parts of the stat info. The reason
is that we previously acquired the store lock before doing
the call to `stat()` and therefore it may not be immediately
obvious that things such as the timestamps found inside the
`struct stat` are not contributing to any race between the
multiple acquisitions of the store lock.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoMerge pull request #388 from DarkDimius/patch-1
Christian Brauner [Thu, 9 Apr 2020 06:49:17 +0000 (08:49 +0200)]
Merge pull request #388 from DarkDimius/patch-1

Fix #387. Include `:` in matching of lines in /proc/meminfo

4 years agoFix #387. Include `:` in matching of lines in /proc/meminfo
Dmitry Petrashko [Thu, 9 Apr 2020 01:27:06 +0000 (18:27 -0700)]
Fix #387. Include `:` in matching of lines in /proc/meminfo

Some lines of /proc/meminfo can be prefixes of the other,
e.g. `Writeback:` and `WritebackTmp:`

This means that in order to to precise match, the code should always match up until `:`

Signed-off-by: Dmitry Petrashko <dark@d-d.me>
4 years agoMerge pull request #386 from stgraber/master
Christian Brauner [Wed, 25 Mar 2020 15:02:23 +0000 (16:02 +0100)]
Merge pull request #386 from stgraber/master

tests: Handle different lib paths

4 years agotests: Handle different lib paths
Stéphane Graber [Wed, 25 Mar 2020 14:55:51 +0000 (10:55 -0400)]
tests: Handle different lib paths

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
4 years agoMerge pull request #385 from brauner/2020-03-24/fixes
Stéphane Graber [Tue, 24 Mar 2020 12:42:21 +0000 (08:42 -0400)]
Merge pull request #385 from brauner/2020-03-24/fixes

proc_fuse: fix swap calculations

4 years agoproc_fuse: fix swap calculations
Christian Brauner [Tue, 24 Mar 2020 09:03:06 +0000 (10:03 +0100)]
proc_fuse: fix swap calculations

The sscanf() line got removed on accident.

Closes #384.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agoMerge pull request #383 from brauner/2020-03-20/fixes
Stéphane Graber [Fri, 20 Mar 2020 20:29:10 +0000 (16:29 -0400)]
Merge pull request #383 from brauner/2020-03-20/fixes

tree-wide: add and use syscall_numbers.h

4 years agotree-wide: add and use syscall_numbers.h
Christian Brauner [Fri, 20 Mar 2020 17:42:37 +0000 (18:42 +0100)]
tree-wide: add and use syscall_numbers.h

The same thing that I did for LXC.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>