]> git.proxmox.com Git - mirror_lxcfs.git/log
mirror_lxcfs.git
15 months agoMerge pull request #579 from mihalicyn/cpuview_deadlock master
Christian Brauner [Mon, 16 Jan 2023 12:15:02 +0000 (13:15 +0100)]
Merge pull request #579 from mihalicyn/cpuview_deadlock

cpuview: fix ABBA deadlock in find_proc_stat_node

15 months agocpuview: fix ABBA deadlock in find_proc_stat_node
Alexander Mikhalitsyn [Mon, 16 Jan 2023 11:34:52 +0000 (12:34 +0100)]
cpuview: fix ABBA deadlock in find_proc_stat_node

Thanks to detailed report from Nikhil it was discovered
that on some workloads reads from lxcfs getting stuck.

After analysis of kernel crashdump it was found, that many
"mtail" processes waiting on read() from /proc/stat file.

First suspect was my last commit that fixes use-after-free,
but unfortunately it also adds ABBA deadlock.

Thread 1                                                   Thread 2

find_proc_stat_node():
rwlock_read                                               rwlock_read
mutex_lock(some_node) [taken]                      mutex_lock(some_node) [wait T1]
rwlock_unlock
rwlock_wrlock (prune_proc_stat_history call) [wait T2]

BOOM. That's deadlock.

Fix is simple, let's just move prune_proc_stat_history call
before taking mutex on cg_proc_stat node.

Fixes: 54db3e71b ("cpuview: fix possible use-after-free in find_proc_stat_node")
Issue #471

Reported-by: Nikhil Kshirsagar <nikhil.kshirsagar@canonical.com>
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
15 months agoMerge pull request #577 from deleriux/file_info_api
Christian Brauner [Thu, 12 Jan 2023 16:48:56 +0000 (17:48 +0100)]
Merge pull request #577 from deleriux/file_info_api

lxcfs: handle NULL path in lxcfs_releasedir/lxcfs_release

15 months agolxcfs: handle NULL path in lxcfs_releasedir/lxcfs_release
Matthew Ife [Wed, 11 Jan 2023 14:30:06 +0000 (14:30 +0000)]
lxcfs: handle NULL path in lxcfs_releasedir/lxcfs_release

Implement a file_info_type function.
Create a series of defines for the file type

Inspect the file type for each file handler and perform the relevant
release code to free any memory.

If the type cannot be determined, print an error and return -EINVAL.

This should also be slightly faster than a strcmp() but its not likely
that measurable.

This code could be used elsewhere in the process to reduce the strcmp
requirements, but for now just handle the release/releasedir case.

This fixes SEGV in lxcfs_relase/releasedir when path=NULL but invoked a
strcmp().

Signed-off-by: Matthew Ife <matthewi@mustardsystems.com>
15 months agoMerge pull request #557 from tych0/dont-mask-system-cpu
Stéphane Graber [Fri, 6 Jan 2023 22:16:50 +0000 (17:16 -0500)]
Merge pull request #557 from tych0/dont-mask-system-cpu

sysfs: don't mask cpus in /sys/devices/system/cpu

15 months agoMerge pull request #558 from tych0/cpu-num-proc-stat
Stéphane Graber [Wed, 4 Jan 2023 17:20:15 +0000 (12:20 -0500)]
Merge pull request #558 from tych0/cpu-num-proc-stat

/proc/stat: render physical cpu number in non-view mode

15 months agosysfs: don't mask cpus in /sys/devices/system/cpu
Tycho Andersen [Thu, 27 Oct 2022 16:23:08 +0000 (10:23 -0600)]
sysfs: don't mask cpus in /sys/devices/system/cpu

The kernel does not mask the cpu%d dirs when they are offlined:

(root) /sys/devices/system/cpu # cat online
0-7
(root) /sys/devices/system/cpu # chcpu -d 4
CPU 4 disabled
(root) /sys/devices/system/cpu # cat online
0-3,5-7
(root) /sys/devices/system/cpu # cat offline
4
(root) /sys/devices/system/cpu # ls -al
total 0
drwxr-xr-x 16 root root    0 Oct 25 20:42 .
drwxr-xr-x 10 root root    0 Oct 25 20:42 ..
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu0
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu1
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu2
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu3
drwxr-xr-x  5 root root    0 Oct 25 20:42 cpu4
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu5
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu6
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu7
drwxr-xr-x  2 root root    0 Oct 25 20:43 cpufreq
drwxr-xr-x  2 root root    0 Oct 26 15:19 cpuidle
drwxr-xr-x  2 root root    0 Oct 26 15:19 hotplug
-r--r--r--  1 root root 4096 Oct 25 20:42 isolated
-r--r--r--  1 root root 4096 Oct 25 20:43 kernel_max
-r--r--r--  1 root root 4096 Oct 26 15:19 modalias
-r--r--r--  1 root root 4096 Oct 26 15:19 offline
-r--r--r--  1 root root 4096 Oct 25 20:42 online
-r--r--r--  1 root root 4096 Oct 25 20:43 possible
drwxr-xr-x  2 root root    0 Oct 26 15:19 power
-r--r--r--  1 root root 4096 Oct 25 20:43 present
drwxr-xr-x  2 root root    0 Oct 26 15:19 smt
-rw-r--r--  1 root root 4096 Oct 25 20:42 uevent
drwxr-xr-x  2 root root    0 Oct 26 15:19 vulnerabilities

let's not mask them in lxcfs either. In particular, we have observed this
causing problems with some JVMs' implementation of
Runtime.getRuntime().availableProcessors().

This is a bit of a strange patch: it seems masking this dir was always
incorrect, so we could go back to just not offering it as an lxcfs
endpoint, and having people use sysfs' implementation directly. But maybe
people are expecting it now, so I've left it as a proxy. Perhaps a more
appropriate patch is to just delete it entirely and add an API extension
note?

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
15 months ago/proc/stat: render physical cpu number in non-view mode
Tycho Andersen [Fri, 28 Oct 2022 20:24:54 +0000 (14:24 -0600)]
/proc/stat: render physical cpu number in non-view mode

When the kernel has an offline CPU, it only renders the online CPUs in
/proc/stat.

When in non-use_view mode, /sys/devices/system/cpu/online shows the CPU
numbers as they actually are on the physical system, but /proc/stat used
"virtual" (i.e. always zero-indexed) numbers, which causes confusion for
some applications. Let's use the same use_view logic in /proc/stat as well.

(root) ~ # chcpu -d 4
CPU 4 disabled
(root) ~ # cat /sys/devices/system/cpu/online
0-3,5-7
(root) ~ # cat /proc/stat
cpu  5599257 116799 1924319 150675607 147630 0 51038 2454 0 0
cpu0 664385 19911 221078 19009148 14812 0 9832 2238 0 0
cpu1 783128 16478 282310 18416428 14325 0 6287 27 0 0
cpu2 822527 15344 275820 18355637 11215 0 5762 26 0 0
cpu3 807309 15631 277152 18399668 9697 0 7623 27 0 0
cpu5 712191 13680 245495 20759989 13959 0 6968 46 0 0
cpu6 728409 14828 247631 20794157 40037 0 5624 29 0 0
cpu7 709679 14321 251154 20785870 18872 0 6226 32 0 0
intr 10891106673 0 10 0 0 418 0 0 0 0 1 0 0 3 0 0 0 0 0 0 0 0 0 0 0 8 8 406552 434812 1863708 2335638 258448 3878047 1907518 1500768 1860249 1506066 1743056 1527121 1564894 258398 779468 275941 275383 277085 271838 271729 273211 271677 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ctxt 814064094
btime 1666730552
processes 5152733
procs_running 1
procs_blocked 0
softirq 772324623 4 31396133 263035 39649581 20 4 1593903 442777055 51 256644837

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
16 months agoMerge pull request #571 from mihalicyn/libfuse3_direct_IO
Stéphane Graber [Fri, 16 Dec 2022 15:32:23 +0000 (10:32 -0500)]
Merge pull request #571 from mihalicyn/libfuse3_direct_IO

Libfuse3 direct io

16 months agolxcfs: fix copypaste typo in error message
Alexander Mikhalitsyn [Fri, 16 Dec 2022 15:24:44 +0000 (16:24 +0100)]
lxcfs: fix copypaste typo in error message

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
16 months agolxcfs: explicitly enable direct_IO for libfuse3
Alexander Mikhalitsyn [Fri, 16 Dec 2022 15:22:35 +0000 (16:22 +0100)]
lxcfs: explicitly enable direct_IO for libfuse3

It was discovered that with libfuse3 we lost FOPEN_DIRECT_IO flag
on (struct fuse_file)->open_flags. I'm sure that this is the reason
for all the strange bugs that our users met recently.

Fixes:
https://github.com/lxc/lxcfs/issues/565
https://discuss.linuxcontainers.org/t/number-of-cpus-reported-by-proc-stat-fluctuates-causing-issues/15780/14

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
16 months agoMerge pull request #570 from mihalicyn/readme_sanitizers
Christian Brauner [Tue, 6 Dec 2022 23:08:37 +0000 (00:08 +0100)]
Merge pull request #570 from mihalicyn/readme_sanitizers

Enable ASAN and UBSAN in PR tests

16 months agogithub: enable ASAN and UBSAN during PR tests
Alexander Mikhalitsyn [Tue, 6 Dec 2022 17:54:19 +0000 (18:54 +0100)]
github: enable ASAN and UBSAN during PR tests

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
16 months agocpuset_parse: check input string in cpuset_nexttok
Alexander Mikhalitsyn [Tue, 6 Dec 2022 19:06:15 +0000 (20:06 +0100)]
cpuset_parse: check input string in cpuset_nexttok

We have to check input string length to be at least 1 in size,
to safely add 1 to string pointer.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
16 months agoREADME: how to build with sanitizers
Alexander Mikhalitsyn [Tue, 6 Dec 2022 17:46:07 +0000 (18:46 +0100)]
README: how to build with sanitizers

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
16 months agoMerge pull request #569 from mihalicyn/meson_coverity
Christian Brauner [Tue, 6 Dec 2022 17:38:06 +0000 (18:38 +0100)]
Merge pull request #569 from mihalicyn/meson_coverity

github: make coverity workflow work with meson

16 months agogithub: make coverity workflow work with meson
Alexander Mikhalitsyn [Tue, 6 Dec 2022 17:16:23 +0000 (18:16 +0100)]
github: make coverity workflow work with meson

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
16 months agoMerge pull request #555 from tych0/init-respect-prefix
Stéphane Graber [Mon, 5 Dec 2022 15:41:46 +0000 (10:41 -0500)]
Merge pull request #555 from tych0/init-respect-prefix

init: respect --prefix when installing systemd unit files

16 months agoMerge pull request #568 from mihalicyn/cg_proc_stat_use_after_free
Christian Brauner [Mon, 5 Dec 2022 15:15:56 +0000 (16:15 +0100)]
Merge pull request #568 from mihalicyn/cg_proc_stat_use_after_free

[RFC] cpuview: fix possible use-after-free in find_proc_stat_node

16 months agocpuview: fix possible use-after-free in find_proc_stat_node
Alexander Mikhalitsyn [Fri, 2 Dec 2022 11:57:33 +0000 (12:57 +0100)]
cpuview: fix possible use-after-free in find_proc_stat_node

Our current lock design uses 2 sync primitives.
First (pthread_rwlock) protects hash table buckets.
Second (pthread_mutex) protects each struct cg_proc_stat
from concurrent modification. But the problem is that function
find_proc_stat_node() can return a pointer to the node
(struct cg_proc_stat) which can be freed by prune_proc_stat_history()
call *before* we take pthread_mutex. Moreover, we perform
memory release of (struct cg_proc_stat) in prune_proc_stat_list()
without any protection like refcounter or mutex on (struct cg_proc_stat).

An attempt to guess what happens in:
https://github.com/lxc/lxcfs/issues/565
https://discuss.linuxcontainers.org/t/number-of-cpus-reported-by-proc-stat-fluctuates-causing-issues/15780/14

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
16 months agoMerge pull request #567 from mihalicyn/cpuinfo_with_personality
Christian Brauner [Thu, 1 Dec 2022 09:16:45 +0000 (10:16 +0100)]
Merge pull request #567 from mihalicyn/cpuinfo_with_personality

cpuinfo with personality

16 months agocpuview: paththrough personality when reading cpuinfo
Alexander Mikhalitsyn [Mon, 28 Nov 2022 13:54:56 +0000 (14:54 +0100)]
cpuview: paththrough personality when reading cpuinfo

Let's change processing thread personality if caller personality
is different. It allows to read /proc/cpuinfo properly in
some cases (arm64 rely on current->personality inside Linux kernel).

https://github.com/lxc/lxcfs/issues/553

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
16 months agoutils: add get_task_personality helper
Alexander Mikhalitsyn [Mon, 28 Nov 2022 13:51:24 +0000 (14:51 +0100)]
utils: add get_task_personality helper

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
16 months agomacro.h: add strnprintf macro
Alexander Mikhalitsyn [Wed, 30 Nov 2022 22:57:37 +0000 (23:57 +0100)]
macro.h: add strnprintf macro

Stolen from LXC

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
16 months agoutils: add safe_uint32() helper
Alexander Mikhalitsyn [Wed, 30 Nov 2022 16:25:24 +0000 (17:25 +0100)]
utils: add safe_uint32() helper

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
16 months agoMerge pull request #564 from blue-troy/master
Stéphane Graber [Thu, 24 Nov 2022 04:04:26 +0000 (23:04 -0500)]
Merge pull request #564 from blue-troy/master

doc: guide for mount /sys/devices/system/cpu in docker demo

16 months agodoc: guide for mount /sys/devices/system/cpu in docker demo
blue-troy [Wed, 23 Nov 2022 07:51:50 +0000 (15:51 +0800)]
doc: guide for mount /sys/devices/system/cpu in docker demo

Signed-off-by: blue-troy <12729455+blue-troy@users.noreply.github.com>
17 months agoMerge pull request #563 from gibmat/fix-ia64-build
Stéphane Graber [Thu, 17 Nov 2022 23:55:41 +0000 (18:55 -0500)]
Merge pull request #563 from gibmat/fix-ia64-build

Fix build on ia64

17 months agoFix build on ia64
Mathias Gibbens [Thu, 17 Nov 2022 21:57:58 +0000 (21:57 +0000)]
Fix build on ia64

The relevant code was added in commit 35acc24, but the function/macro
prctl_arg() didn't seem to be defined anywhere in the repo. lxc
currently has a corresponding macro defined in src/lxc/macro.h that
casts the value to an unsigned long. But 0 doesn't require any special
handling, so remove the call to prctl_arg().

Verified that the code compiles properly on Debian's ia64 porterbox
(yttrium).

Signed-off-by: Mathias Gibbens <gibmat@debian.org>
19 months agoinit: respect --prefix when installing systemd unit files
Tycho Andersen [Mon, 12 Sep 2022 20:21:41 +0000 (14:21 -0600)]
init: respect --prefix when installing systemd unit files

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
19 months agoMerge pull request #552 from bytedance/set-oom-score-adj
Stéphane Graber [Tue, 23 Aug 2022 21:06:24 +0000 (17:06 -0400)]
Merge pull request #552 from bytedance/set-oom-score-adj

set oom_score_adj of lxcfs process to -1000

19 months agoset oom_score_adj of lxcfs process to -1000
Teng Hu [Tue, 23 Aug 2022 09:31:58 +0000 (17:31 +0800)]
set oom_score_adj of lxcfs process to -1000

Disable oom killing entirely to minimize the hassle comes from
lxcfs exiting unexpectedly, e.g. the mountpoint got lost.

Signed-off-by: Teng Hu <huteng.ht@bytedance.com>
20 months agoMerge pull request #550 from Blub/bindings-reinit-fuse3-fixup
Stéphane Graber [Fri, 29 Jul 2022 14:56:01 +0000 (10:56 -0400)]
Merge pull request #550 from Blub/bindings-reinit-fuse3-fixup

fix reinitialization with fuse3

20 months agofix reinitialization with fuse3
Wolfgang Bumiller [Fri, 29 Jul 2022 07:30:10 +0000 (09:30 +0200)]
fix reinitialization with fuse3

With fuse3 `fuse_get_context` returns NULL before fuse was
fully initialized, so we must not access it.

Futher, we call 'do_reload' for normal initialization as
well, so let's prevent that from re-initializing the
bindings initially and only do this on actual reloads,
otherwise we do it twice on startup.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes #549

21 months agoMerge pull request #545 from Blub/init-lib-at-reload-drop-fuse-init-return
Stéphane Graber [Tue, 5 Jul 2022 21:44:19 +0000 (17:44 -0400)]
Merge pull request #545 from Blub/init-lib-at-reload-drop-fuse-init-return

re-initialize library after reload

21 months agoMerge pull request #547 from stgraber/master
Christian Brauner [Tue, 5 Jul 2022 21:33:10 +0000 (23:33 +0200)]
Merge pull request #547 from stgraber/master

Complete Github Actions migration

21 months agogithub: Validate target branch
Stéphane Graber [Tue, 5 Jul 2022 21:26:42 +0000 (17:26 -0400)]
github: Validate target branch

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
21 months agogithub: Restrict permissions
Stéphane Graber [Tue, 5 Jul 2022 21:26:30 +0000 (17:26 -0400)]
github: Restrict permissions

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
21 months agoMerge pull request #546 from Blub/sys-cpu-cpu-readdir
Christian Brauner [Tue, 5 Jul 2022 12:47:02 +0000 (14:47 +0200)]
Merge pull request #546 from Blub/sys-cpu-cpu-readdir

replace opathdir with opendir_flags

21 months agoreplace opathdir with opendir_flags
Wolfgang Bumiller [Tue, 5 Jul 2022 11:55:20 +0000 (13:55 +0200)]
replace opathdir with opendir_flags

`opathdir` was used to replace `opendir` in order to ensure
`O_NOFOLLOW` and `O_CLOEXEC` were set, however it also added
`O_PATH` which prevents `readdir`/`getdents` to be used on
it, causing the `/sys/devices/system/cpu/<subdir>`
directories to be empty.

Instead, let's have an `opendir_flags` utility which simply
passed additional flags to the `open(..., O_DIRECTORY)` call
preceding `fdopendir()`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
21 months agore-initialize library after reload
Wolfgang Bumiller [Tue, 5 Jul 2022 08:26:26 +0000 (10:26 +0200)]
re-initialize library after reload

When introducing versioned options, we started using fuse's
"init" callback in order to tell the library to set
`can_use_sys_cpu` and `has_versioned_opts` accordingly.

However, we forgot to also do this on a reload. Fix this by
simply calling `lxcfs_fuse_init()` in `do_reload()` as well.

Additionaly: ignore lxcfs_fuse_init()'s return value.
We just "passed through" the private_data from fuse which is
set via the `fuse_main()` call.

It's better to not leave this up to the library anyway in
order to make it easier to be fuse version agnostic in the
future.

Without this, issuing a reload to lxcfs would cause
files in `/sys/devices/system/cpu/` to be visible via
`readdir`, but accessing them would fail:

    ~ # ls /sys/devices/system/cpu/
    ls: /sys/devices/system/cpu/cpuidle: No such file or directory
    ls: /sys/devices/system/cpu/uevent: No such file or directory
    (...)

    ~ # echo /sys/devices/system/cpu/*
    /sys/devices/system/cpu/cpu0 /sys/devices/system/cpu/cpu1 (...)

    ~ # strace stat /sys/devices/system/cpu/cpu0
    lstat("/sys/devices/system/cpu/cpu0", 0x7ffdb2c57a00) = -1 ENOENT (No such file or directory)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
21 months agoMerge pull request #544 from mchtech/cgoup-v2-cpu-count
Christian Brauner [Tue, 5 Jul 2022 05:25:32 +0000 (07:25 +0200)]
Merge pull request #544 from mchtech/cgoup-v2-cpu-count

cgroup v2: /sys/devices/system/cpu/online returns zero

21 months agocgroup v2: return cpuset cpu count when no quota is set
michuan [Mon, 4 Jul 2022 02:49:49 +0000 (10:49 +0800)]
cgroup v2: return cpuset cpu count when no quota is set

Signed-off-by: michuan <michu_an@126.com>
22 months agoMerge pull request #541 from bytedance/cleanup-getsize
Christian Brauner [Tue, 24 May 2022 12:31:06 +0000 (14:31 +0200)]
Merge pull request #541 from bytedance/cleanup-getsize

sysfs: cleanup sys_devices_system_cpu_online_getsize

22 months agosysfs: cleanup sys_devices_system_cpu_online_getsize
huteng.ht [Tue, 24 May 2022 05:13:01 +0000 (13:13 +0800)]
sysfs: cleanup sys_devices_system_cpu_online_getsize

cleanup useless parameters and local variables, meanwhile,
a compiler warning resolved.

Signed-off-by: huteng.ht <huteng.ht@bytedance.com>
22 months agoMerge pull request #539 from bytedance/calc-online-file-size
Christian Brauner [Mon, 23 May 2022 08:13:01 +0000 (10:13 +0200)]
Merge pull request #539 from bytedance/calc-online-file-size

sysfs: correct file size of /sys/devices/system/cpu/online.

22 months agosysfs: correct file size of /sys/devices/system/cpu/online.
huteng.ht [Sat, 21 May 2022 11:39:14 +0000 (19:39 +0800)]
sysfs: correct file size of /sys/devices/system/cpu/online.

Calculate accurate size of 'online' file in sys_getattr routine.

Signed-off-by: huteng.ht <huteng.ht@bytedance.com>
23 months agoMerge pull request #537 from dasteihn/sta/commentfix
Christian Brauner [Mon, 16 May 2022 12:10:47 +0000 (14:10 +0200)]
Merge pull request #537 from dasteihn/sta/commentfix

util: remove doubled comment

23 months agoutil: remove doubled comment
Philipp Stanner [Mon, 16 May 2022 11:12:29 +0000 (13:12 +0200)]
util: remove doubled comment

Signed-off-by: Philipp Stanner <stanner@posteo.de>
23 months agoMerge pull request #536 from yrhki/extra-space
Christian Brauner [Fri, 13 May 2022 10:09:28 +0000 (12:09 +0200)]
Merge pull request #536 from yrhki/extra-space

proc_fuse: extra space in /proc/stat

23 months agoproc_fuse: extra space in /proc/stat
Tuomas Yrjölä [Thu, 12 May 2022 22:24:47 +0000 (01:24 +0300)]
proc_fuse: extra space in /proc/stat

Signed-off-by: Tuomas Yrjölä <mail@yrhki.fi>
23 months agoMerge pull request #535 from stgraber/master
Christian Brauner [Fri, 29 Apr 2022 07:52:16 +0000 (09:52 +0200)]
Merge pull request #535 from stgraber/master

meson: Syntax nit

23 months agomeson: Syntax nit
Stéphane Graber [Fri, 29 Apr 2022 00:13:38 +0000 (20:13 -0400)]
meson: Syntax nit

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #533 from stgraber/master
Christian Brauner [Mon, 11 Apr 2022 19:26:50 +0000 (21:26 +0200)]
Merge pull request #533 from stgraber/master

Meson tweaks for init systems

2 years agomeson: Support multiple init systems
Stéphane Graber [Mon, 11 Apr 2022 18:31:07 +0000 (14:31 -0400)]
meson: Support multiple init systems

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoinit: Fix install paths for sysvinit and openrc
Stéphane Graber [Mon, 11 Apr 2022 14:54:02 +0000 (10:54 -0400)]
init: Fix install paths for sysvinit and openrc

Closes #532

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #531 from stgraber/master
Christian Brauner [Fri, 8 Apr 2022 05:22:15 +0000 (07:22 +0200)]
Merge pull request #531 from stgraber/master

Fix tests

2 years agotests: Skip sysfs test on older FUSE versions
Stéphane Graber [Thu, 7 Apr 2022 23:51:23 +0000 (19:51 -0400)]
tests: Skip sysfs test on older FUSE versions

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agogithub: Re-organize Github Actions
Stéphane Graber [Thu, 7 Apr 2022 23:48:52 +0000 (19:48 -0400)]
github: Re-organize Github Actions

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #530 from Blub/2022-01-17/optional-fuse-2
Christian Brauner [Mon, 4 Apr 2022 15:19:26 +0000 (17:19 +0200)]
Merge pull request #530 from Blub/2022-01-17/optional-fuse-2

support explicit fuse version choice

2 years agosupport explicit fuse version choice
Wolfgang Bumiller [Mon, 4 Apr 2022 12:10:00 +0000 (14:10 +0200)]
support explicit fuse version choice

We'd like to provide an easy upgrade path which doesn't
cause an lxcfs-reload to crash because the new library was
built against the wrong version.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoMerge pull request #526 from brauner/2022-03-13.fixes
Stéphane Graber [Sun, 13 Mar 2022 17:09:32 +0000 (18:09 +0100)]
Merge pull request #526 from brauner/2022-03-13.fixes

sysfs_fuse: fixes

2 years agoMerge pull request #528 from thmo/unitdir
Christian Brauner [Sun, 13 Mar 2022 14:58:44 +0000 (15:58 +0100)]
Merge pull request #528 from thmo/unitdir

Query systemd system unit dir.

2 years agoQuery systemd system unit dir.
Thomas Moschny [Sun, 13 Mar 2022 12:00:56 +0000 (13:00 +0100)]
Query systemd system unit dir.

Signed-off-by: Thomas Moschny <thomas.moschny@gmx.de>
2 years agoMerge pull request #527 from Foxboron/morten/fix-libdir
Christian Brauner [Sun, 13 Mar 2022 12:01:05 +0000 (13:01 +0100)]
Merge pull request #527 from Foxboron/morten/fix-libdir

init/meson: Use libdir instead of hardcoded /lib path

2 years agoinit/meson: Use libdir instead of hardcoded /lib path
Morten Linderud [Sun, 13 Mar 2022 11:36:50 +0000 (12:36 +0100)]
init/meson: Use libdir instead of hardcoded /lib path

Hardcoding `/lib` makes meson create a directory which would conflict on
distros with usrmerge as `/lib` is a symlink. We define `libdir` in the
top-level so we should be using that instead.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2 years agomeson: handle fuse versions with buggy dt_type handling
Christian Brauner (Microsoft) [Sun, 13 Mar 2022 11:00:34 +0000 (12:00 +0100)]
meson: handle fuse versions with buggy dt_type handling

Link: https://github.com/libfuse/libfuse/pull/591
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agogithub: add fuse3 tests
Christian Brauner (Microsoft) [Sun, 13 Mar 2022 10:37:42 +0000 (11:37 +0100)]
github: add fuse3 tests

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agomeson: bump fuse version
Christian Brauner (Microsoft) [Sun, 13 Mar 2022 10:36:51 +0000 (11:36 +0100)]
meson: bump fuse version

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agosysfs_fuse: generate file info for cpu<nr> entries as well
Christian Brauner (Microsoft) [Sun, 13 Mar 2022 09:06:02 +0000 (10:06 +0100)]
sysfs_fuse: generate file info for cpu<nr> entries as well

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agosysfs_fuse: fix indendation
Christian Brauner (Microsoft) [Sun, 13 Mar 2022 08:48:27 +0000 (09:48 +0100)]
sysfs_fuse: fix indendation

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agoutils: add and use opathdir()
Christian Brauner (Microsoft) [Sun, 13 Mar 2022 08:46:37 +0000 (09:46 +0100)]
utils: add and use opathdir()

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agoMerge pull request #525 from stgraber/master
Christian Brauner [Sun, 13 Mar 2022 08:17:57 +0000 (09:17 +0100)]
Merge pull request #525 from stgraber/master

More sysfs fixes

2 years agotests: Fix sysfs test
Stéphane Graber [Sun, 13 Mar 2022 03:35:37 +0000 (22:35 -0500)]
tests: Fix sysfs test

For the sysfs test to be useful, we need /sys/devices/system/cpu/ to
actually be mounted.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agosysfs: Don't incorrectly filter entries
Stéphane Graber [Sun, 13 Mar 2022 03:34:15 +0000 (22:34 -0500)]
sysfs: Don't incorrectly filter entries

The filtering logic was completely skipping any entry which was 3
characters or shorter. Instead change the logic to only attempt to parse
those entries longer than 3 characters.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #524 from Foxboron/morten/docs
Stéphane Graber [Sat, 12 Mar 2022 16:14:00 +0000 (17:14 +0100)]
Merge pull request #524 from Foxboron/morten/docs

meson: Include documentation

2 years agoMerge pull request #523 from brauner/2022-03-12.fixes
Stéphane Graber [Sat, 12 Mar 2022 16:12:24 +0000 (17:12 +0100)]
Merge pull request #523 from brauner/2022-03-12.fixes

fuse: set file info for fuse2

2 years agoworkflows: disable documentation generation
Morten Linderud [Sat, 12 Mar 2022 14:58:27 +0000 (15:58 +0100)]
workflows: disable documentation generation

Signed-off-by: Morten Linderud <morten@linderud.pw>
2 years agomeson: Include documentation
Morten Linderud [Sat, 12 Mar 2022 14:53:51 +0000 (15:53 +0100)]
meson: Include documentation

Documentation was removed from the build system with the migration to
meson. This implements the help2man generation which existed in the
autoconf setup.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2 years agotests: add test for issue #522
Christian Brauner (Microsoft) [Sat, 12 Mar 2022 10:54:41 +0000 (11:54 +0100)]
tests: add test for issue #522

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agotree-wide: ensure that file information is set even with legacy fuse
Christian Brauner (Microsoft) [Sat, 12 Mar 2022 10:38:06 +0000 (11:38 +0100)]
tree-wide: ensure that file information is set even with legacy fuse

Fixes: #522
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agotree-wide: remove struct stat argument from DIR_FILLER and make it static inline
Christian Brauner (Microsoft) [Sat, 12 Mar 2022 09:55:10 +0000 (10:55 +0100)]
tree-wide: remove struct stat argument from DIR_FILLER and make it static inline

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agolxcfs_fuse: ensure lxcfs_fuse_compat.h is included after including fuse header
Christian Brauner (Microsoft) [Sat, 12 Mar 2022 09:51:58 +0000 (10:51 +0100)]
lxcfs_fuse: ensure lxcfs_fuse_compat.h is included after including fuse header

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agoRelease LXCFS 5.0.0 lxcfs-5.0.0
Stéphane Graber [Wed, 9 Mar 2022 16:58:08 +0000 (11:58 -0500)]
Release LXCFS 5.0.0

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #521 from stgraber/master
Christian Brauner [Wed, 9 Mar 2022 17:20:31 +0000 (18:20 +0100)]
Merge pull request #521 from stgraber/master

Makefile: Fix ordering and add PHONY

2 years agoMakefile: Fix ordering and add PHONY
Stéphane Graber [Wed, 9 Mar 2022 17:18:06 +0000 (12:18 -0500)]
Makefile: Fix ordering and add PHONY

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #520 from stgraber/master
Christian Brauner [Wed, 9 Mar 2022 17:14:14 +0000 (18:14 +0100)]
Merge pull request #520 from stgraber/master

More meson tweaks

2 years agoMakefile: Tweak for meson (add dist target)
Stéphane Graber [Wed, 9 Mar 2022 17:09:59 +0000 (12:09 -0500)]
Makefile: Tweak for meson (add dist target)

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agomeson: Set check argument on run_command
Stéphane Graber [Wed, 9 Mar 2022 17:04:30 +0000 (12:04 -0500)]
meson: Set check argument on run_command

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #519 from stgraber/master
Christian Brauner [Wed, 9 Mar 2022 16:56:25 +0000 (17:56 +0100)]
Merge pull request #519 from stgraber/master

meson: Cleanup build files

2 years agomeson: Cleanup build files
Stéphane Graber [Wed, 9 Mar 2022 16:48:12 +0000 (11:48 -0500)]
meson: Cleanup build files

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #518 from brauner/2022-03-07.fixes
Stéphane Graber [Mon, 7 Mar 2022 15:09:24 +0000 (16:09 +0100)]
Merge pull request #518 from brauner/2022-03-07.fixes

proc_fuse: improve error message

2 years agoproc_fuse: improve error message
Christian Brauner (Microsoft) [Mon, 7 Mar 2022 14:23:24 +0000 (15:23 +0100)]
proc_fuse: improve error message

Fixes: #516
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agoMerge pull request #515 from phanhuy1502/preserve-cpu-sum-when-cpu-set-changes
Christian Brauner [Mon, 31 Jan 2022 12:43:38 +0000 (13:43 +0100)]
Merge pull request #515 from phanhuy1502/preserve-cpu-sum-when-cpu-set-changes

Preseve cpu sum in /proc/stat when cpuset changes

2 years agoPreseve cpu sum in /proc/stat when cpuset changes
Nguyen Phan Huy [Thu, 27 Jan 2022 11:31:47 +0000 (19:31 +0800)]
Preseve cpu sum in /proc/stat when cpuset changes

Signed-off-by: Nguyen Phan Huy <phanhuy1502@gmail.com>
2 years agoMerge pull request #514 from Blub/2022-01-17/fix-and-reformat-format-strings
Stéphane Graber [Mon, 17 Jan 2022 13:46:03 +0000 (08:46 -0500)]
Merge pull request #514 from Blub/2022-01-17/fix-and-reformat-format-strings

fix and reformat format strings

2 years agofix and reformat format strings
Wolfgang Bumiller [Mon, 17 Jan 2022 09:20:33 +0000 (10:20 +0100)]
fix and reformat format strings

Some of these missed the spaces in between and in order to
make this more readable and apparent, put one field per line
and add comments matching the field names.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoMerge pull request #509 from brauner/2021-12-13.fixes
Stéphane Graber [Mon, 13 Dec 2021 15:40:17 +0000 (10:40 -0500)]
Merge pull request #509 from brauner/2021-12-13.fixes

tree-wide: use PRIu64 to print uint64_t

2 years agoproc_loadavg: use PRIu64 to print uint64_t
Christian Brauner [Mon, 13 Dec 2021 15:35:10 +0000 (16:35 +0100)]
proc_loadavg: use PRIu64 to print uint64_t

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoproc_fuse: use PRIu64 to print uint64_t
Christian Brauner [Mon, 13 Dec 2021 15:32:32 +0000 (16:32 +0100)]
proc_fuse: use PRIu64 to print uint64_t

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