1
0
mirror of https://github.com/systemd/systemd synced 2026-04-13 10:35:08 +02:00

Compare commits

..

10 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
ba900c1719
Merge pull request #22093 from yuwata/meson-bpftool-version
meson: require bpftool version >= 5.6
2022-01-18 15:09:47 +01:00
Evgeny Vereshchagin
691db9a718 meson: force ctags to use absolute paths
Looks like https://github.com/mesonbuild/meson/issues/957 was
reintroduced in meson-0.57.0 (and looking and https://mesonbuild.com/Release-notes-for-0-57-0.html
I'm not sure whether it was intentional or not) so run_command can no
longer be used to get around
https://github.com/mesonbuild/meson/issues/3589. Let's just force
ctags to always use absolute paths to fix it once and for all.
2022-01-18 15:07:11 +01:00
Luca Boccassi
5a2de315ff
Merge pull request #22153 from evverx/switch-to-bullseye
ci: switch Debian from unstable to testing on mkosi
2022-01-18 11:54:35 +00:00
Yu Watanabe
1fb50408ce pid1,cgroup-show: ignore -EOPNOTSUPP in cg_read_pid()
The function is called in recursion, and cgroup.procs in some subcgroups
may not be read.

Fixes #22089.
2022-01-18 12:34:30 +01:00
Evgeny Vereshchagin
881b152660 ci: point mkosi to commit where "testing" is fixed
https://github.com/systemd/mkosi/pull/886
2022-01-18 10:30:33 +00:00
Evgeny Vereshchagin
b0f1f76ca1 ci: switch from unstable to testing on mkosi 2022-01-18 10:27:28 +00:00
Yu Watanabe
f67b4351f3 test: fix a copy-and-paste error
Follow-up for 12727c2bc2859995cbd561ffc3d9a4d571202254.

Addresses https://github.com/systemd/systemd/pull/22125#discussion_r786358474.

Fixes CID#1469023.
2022-01-18 09:30:46 +01:00
Yu Watanabe
dc7e9c1bc4 meson: use the compiler command array as is
Also check if the flags used when building bpf are supported by clang.
2022-01-14 17:01:58 +09:00
Yu Watanabe
a6ac8b5a4d meson: check if clang supports bpf 2022-01-14 16:43:31 +09:00
Yu Watanabe
ea78d2fb11 meson: require bpftool version >= 5.6
Closes #22051.
2022-01-14 16:43:31 +09:00
6 changed files with 54 additions and 18 deletions

View File

@ -40,7 +40,7 @@ jobs:
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- uses: systemd/mkosi@01ea953fd2af738f974b228991c768c12b50db95
- uses: systemd/mkosi@30288805db1a953ea31045933adb93194f91e3da
- name: Install
run: sudo apt-get update && sudo apt-get install --no-install-recommends python3-pexpect python3-jinja2

View File

@ -989,12 +989,32 @@ if want_bpf_framework == 'false'
else
# Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
# (like clang-10/llvm-strip-10)
clang_bin = cc.get_id() == 'clang' ? cc.cmd_array()[0] : 'clang'
if meson.is_cross_build() or clang_bin.contains('afl-clang') or clang_bin.contains('hfuzz-clang')
clang_bin = 'clang'
if meson.is_cross_build() or cc.get_id() != 'clang' or cc.cmd_array()[0].contains('afl-clang') or cc.cmd_array()[0].contains('hfuzz-clang')
r = find_program('clang', required : bpf_framework_required)
clang_found = r.found()
if clang_found
if meson.version().version_compare('>= 0.55')
clang = [r.full_path()]
else
clang = [r.path()]
endif
endif
# Assume that the required flags are supported by the found clang.
clang_supports_flags = clang_found
else
clang_found = true
clang = cc.cmd_array()
clang_supports_flags = cc.has_argument('-Wno-compare-distinct-pointer-types')
endif
clang = find_program(clang_bin, required : bpf_framework_required)
if not meson.is_cross_build() and clang.found()
if clang_found
# Check if 'clang -target bpf' is supported.
clang_supports_bpf = run_command(clang, '-target', 'bpf', '--print-supported-cpus', check : false).returncode() == 0
else
clang_supports_bpf = false
endif
if not meson.is_cross_build() and clang_found
llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
check : true).stdout().strip()
else
@ -1004,9 +1024,14 @@ else
# Debian installs this in /usr/sbin/ which is not in $PATH.
# We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
bpftool = find_program('bpftool', '/usr/sbin/bpftool', required : bpf_framework_required)
# We use 'bpftool gen' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
bpftool = find_program('bpftool',
'/usr/sbin/bpftool',
required : bpf_framework_required,
version : '>= 5.6')
deps_found = libbpf.found() and clang_found and clang_supports_bpf and clang_supports_flags and llvm_strip.found() and bpftool.found()
deps_found = libbpf.found() and clang.found() and llvm_strip.found() and bpftool.found()
# Can build BPF program from source code in restricted C
conf.set10('BPF_FRAMEWORK', deps_found)
endif
@ -3876,7 +3901,7 @@ if git.found()
command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
run_target(
'ctags',
command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
command : [env, 'ctags', '--tag-relative=never', '-o', '@0@/tags'.format(project_source_root)] + all_files)
endif
endif

View File

@ -5,7 +5,7 @@
[Distribution]
Distribution=debian
Release=unstable
Release=testing
[Packages]
BuildPackages=

View File

@ -1314,11 +1314,15 @@ static int append_cgroup(sd_bus_message *reply, const char *p, Set *pids) {
for (;;) {
pid_t pid;
/* libvirt / qemu uses threaded mode and cgroup.procs cannot be read at the lower levels.
* From https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#threads,
* cgroup.procs in a threaded domain cgroup contains the PIDs of all processes in
* the subtree and is not readable in the subtree proper. */
r = cg_read_pid(f, &pid);
if (IN_SET(r, 0, -EOPNOTSUPP))
break;
if (r < 0)
return r;
if (r == 0)
break;
if (is_kernel_thread(pid) > 0)
continue;

View File

@ -89,7 +89,6 @@ static int show_cgroup_one_by_path(
_cleanup_fclose_ FILE *f = NULL;
_cleanup_free_ char *p = NULL;
size_t n = 0;
pid_t pid;
char *fn;
int r;
@ -102,7 +101,18 @@ static int show_cgroup_one_by_path(
if (!f)
return -errno;
while ((r = cg_read_pid(f, &pid)) > 0) {
for (;;) {
pid_t pid;
/* libvirt / qemu uses threaded mode and cgroup.procs cannot be read at the lower levels.
* From https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#threads,
* cgroup.procs in a threaded domain cgroup contains the PIDs of all processes in
* the subtree and is not readable in the subtree proper. */
r = cg_read_pid(f, &pid);
if (IN_SET(r, 0, -EOPNOTSUPP))
break;
if (r < 0)
return r;
if (!(flags & OUTPUT_KERNEL_THREADS) && is_kernel_thread(pid) > 0)
continue;
@ -113,9 +123,6 @@ static int show_cgroup_one_by_path(
pids[n++] = pid;
}
if (r < 0)
return r;
show_pid_array(pids, n, prefix, n_columns, false, more, flags);
return 0;

View File

@ -333,7 +333,7 @@ TEST_RET(copy_holes) {
assert_se(fd >= 0);
fd_copy = mkostemp_safe(fn_copy);
assert_se(fd >= 0);
assert_se(fd_copy >= 0);
r = RET_NERRNO(fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1));
if (ERRNO_IS_NOT_SUPPORTED(r))