1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-03 17:47:28 +03:00

71114 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
15d660fb41 sysusers: convert to conf_file_read()
I was annoyed that systemd-sysusers doesn't print any info when it opens a
config file. Its read_config_file() started out the same as the one in tmpfiles,
and then they diverged. The one in tmpfiles has that logging, hence the rework
to use it here too and get better logging. The two programs should provide
similar functionality, so using a common helper will make it easier to extend
them in tandem later.

No functional change apart from the log info.

The userdata argument (Context) is moved to the last position as requested in
the review.
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
f6a1346e4e tmpfiles: split out helper to open and read a "config file"
No functional change.

Note that this function will be modified in subsequent commits, and the API
will change.
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
376d0495f5 tmpfiles: only populate uid and gid caches once
a3451c2c4ce7d3c02451f6ace4ee9f873880f78f added offline uid/gid support in a way
where the <root>/etc/passwd and <root>/etc/group would be read anew for each
configuration file that was parsed. The result would always be the same, so I
assume that this was an oversight. Let's use a global cache and and read the
file just once.
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
5ac41a1672 tmpfiles: adjust vertical whitespace 2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
37ee46f7c8 sysusers,tmpfiles: clarify error message for --replace
I was trying to run sysusers --replace, but the input file didn't have the right
suffix, and the message was very confusing. Let's split the message in two to
make it clearer that we care about the extension.
2024-02-09 17:57:41 +01:00
Luca Boccassi
7716498548
Merge pull request #31268 from poettering/bpf-device-fixes
bpf-devices: various smaller fixes
2024-02-09 16:34:52 +00:00
Yu Watanabe
8c244a5094 systemctl: fix typo
Follow-up for 1baa0415ae612266c77016567390a8232a60d9db.
2024-02-10 00:34:08 +09:00
Yu Watanabe
07ae001f81 test: add tests for journal_file_next_entry() 2024-02-10 00:30:04 +09:00
Yu Watanabe
6c4ea35962 sd-journal: do not read unnecessary object
In journal_file_next_entry(), if the passed offset matches an entry object,
then generic_array_bisect() returns the object, but the object we
requested is the next (or previous) object. Hence, we should not validate
the object returned by generic_array_bisect(), otherwise it may fail
when the journal is corrupted.

Note the validity of the entry object that should be returned by
journal_file_next_entry() will be checked in the following generic_array_get().
So, when journal_file_next_entry() succeeds, the returned object is
always validated.
2024-02-10 00:29:16 +09:00
dependabot[bot]
0279c0abf3 build(deps): bump systemd/mkosi
Bumps [systemd/mkosi](https://github.com/systemd/mkosi) from dbce89aabda438ba58080366631b2c242e365f21 to 070528fec478fc93af7ec057a5d2fd0045123c99.
- [Release notes](https://github.com/systemd/mkosi/releases)
- [Changelog](https://github.com/systemd/mkosi/blob/main/NEWS.md)
- [Commits](dbce89aabd...070528fec4)

---
updated-dependencies:
- dependency-name: systemd/mkosi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-09 16:28:12 +01:00
Yu Watanabe
1b4e322cdb sd-journal: always put verified object into the chain cache
Let's consider the case that
- the first array contains valid entries,
- all entries in the second array are corrupted.

Then, when we are going to upwards, and a call of generic_array_bisect()
matches the last entry of the first array, then the second array was
cached with last_index == UINT64_MAX, instead of the first array with
its last entry.
Hence, when generic_array_bisect() is called next time, the function call
of test() always fail. So, the cache entry is mostly meaningless.

Let's always store valid cache entry.
2024-02-10 00:26:17 +09:00
Yu Watanabe
821d55a8d7 sd-journal: drop duplicated tests in generic_array_bisect()
When left == right (== 0), generic_array_bisec_step() does not update
left and right. So the following test is exactly the same.
2024-02-10 00:26:17 +09:00
Luca Boccassi
0a8264080a repart: support OpenSSL engines/providers for signing
The provider API which is new requires providers, which are not
widely available and don't work very well yet, so also use a
fallback with the legacy engine API.
2024-02-09 15:11:25 +00:00
Luca Boccassi
dba0afa14e openssl: add helper to load key from provider/engine
It's not the literal private key, but EVP_PKEY becomes a reference
to the engine/provider that OpenSSL knows how to use later
2024-02-09 14:36:10 +00:00
Lennart Poettering
3a51cf673f bpf-devices: if a device node is referenced which doesn't exist, downgrade log message
Currently in many of our test cases you'll see a warning about a tun
device not being around. Let's make that quiet, since if there's no such
device there's no point in adding it to a policy anyway, and it makes
useless noise go away.

We keep the warning as a warning if a device node is missing for other
errors than ENOENT.
2024-02-09 15:32:10 +01:00
Lennart Poettering
958b73bef1 bpf-devices: normalize the return handling of functions that put together policy
under some conditions we suppress generating BPF programs. Let's
systematically return 0 when we do this, and 1 if we did actually
soething, instead of second guessing this in the caller.

This is not only more correct, but allows us to suppress BPF programs in
more cases in later commits.
2024-02-09 15:32:10 +01:00
Lennart Poettering
893220f62f bpf-devices: normalize how we pass around major/minor values
There's some unclarity whether major/minor of device nodes are supposed
to be "unsigned" or "dev_t". Various codebases assume the latter, but
glibc's major()/minor() types actually return a value typed to
"unsigned". On glibc dev_t is actually 64bit even if the kernel only
exposes 32bit. Hence this distinction kinda matters.

Let's clean things up a bit with handling: let's followe glibc's type
system here, and use unsigned (and not int).

Also let's pass invalid major/minor values around as UINT_MAX rather
than via pointers, to match how we usually do this, and to shorten our
code a bit. This is safe, since given the linux dev_t space being 32bit
only we can't possibly have a valid major or minor this hight, given
they must be smaller in size. While other archs disagree on the types of
major/minor, they also tend to have similar limits. In fact on FreeBSD
for example major()/minor() returns a signed int. Which would hence also
mean that UINT_MAX cannot be a valid major or minor.
2024-02-09 15:32:04 +01:00
Luca Boccassi
c505275476
Merge pull request #31243 from YHNdnzj/systemctl-disable-now-template
systemctl: support disable/mask --now with unit template
2024-02-09 14:29:50 +00:00
Luca Boccassi
9131b93590
Merge pull request #31224 from mrc0mmand/packit-bpftool-workaround
packit: temporarily build systemd without BPF stuff
2024-02-09 13:48:13 +00:00
Luca Boccassi
6e7134ad95
Merge pull request #31264 from poettering/sysext-help
sysext: tweaks to the systemd-sysext/systemd-confext --help text
2024-02-09 13:46:28 +00:00
Lennart Poettering
f244e7a7ea pid1,vconsole-setup: gracefully handle if /dev/vconsole is not accessible due to ENODEV
I think this is generally the right thing to do and is just an extension
of the existing ENOENT check.

Prompted by: #31257
2024-02-09 14:19:20 +01:00
Lennart Poettering
a0f6b68135 dev-setup: normalize logging around lock_dev_console()
Previously this function would log loudly in some cases but not in
others. Clean this up, and dont log at all, matching our coding style
which says we should either log in all error cases or in none.

Both callers of this function do logging already, hence no need to
duplicate it here.
2024-02-09 14:19:16 +01:00
Sam Leonard
51747b3444
vmspawn: accept kvm/vhost-vsock device fds through sd_listen 2024-02-09 12:46:44 +00:00
Sam Leonard
75331bedeb
vmspawn: add nic configuration 2024-02-09 12:46:43 +00:00
Sam Leonard
88af28d170
vmspawn: add initrd configuration option 2024-02-09 12:46:43 +00:00
Daan De Meyer
317cb6f9b5 Install pacman in Arch Linux image
We install apt and dnf in the other images as well, so lets be
consistent and install pacman in the Arch image as well.
2024-02-09 12:41:54 +00:00
Frantisek Sumsal
e7a52b1b33 test: adjust test-path to fail gracefully with the new pidfd_spawn stuff
Since 2e106312e2 the test unit fails with 'resources' result instead of
'exit-code', which the test didn't account for when running unprivileged.

Before 2e106312e2:
$ /root/systemd/build/test-path
Failed to start transient scope unit: Interactive authentication required.
Couldn't allocate a scope unit for this test, proceeding without.
...
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
...
line 151: path-exists.path: state = running; result = success (left: 29986250)
line 151: path-exists.service: state = start; result = success
path-exists.service: Main process exited, code=exited, status=219/CGROUP
path-exists.service: Failed with result 'exit-code'.
line 151: path-exists.path: state = running; result = success (left: 29985948)
line 151: path-exists.service: state = failed; result = exit-code
Failed to start service path-exists.service, aborting test: failed/exit-code

After 2e106312e2:
$ /root/systemd/build/test-path
Failed to start transient scope unit: Interactive authentication required.
Couldn't allocate a scope unit for this test, proceeding without.
...
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
path-exists.service: Failed to spawn executor: No such file or directory
path-exists.service: Failed to spawn 'start' task: No such file or directory
path-exists.service: Failed with result 'resources'.
2024-02-09 12:50:21 +01:00
Frantisek Sumsal
8a0ec8852c packit: temporarily build systemd without BPF stuff
The kernel-tools meta-package was retired in Rawhide, but its
replacement has not landed, yet. Until that happens, let's build without
the bpf-framework stuff.
2024-02-09 12:50:21 +01:00
Sam Leonard
19301e76e6
vmspawn: synthesise root= argument for direct kernel boot 2024-02-09 11:43:19 +00:00
Sam Leonard
0f25e3e443
vmspawn: add kernel configuration options 2024-02-09 11:43:19 +00:00
Sam Leonard
cf3beb273b
vmspawn: add swtpm feature 2024-02-09 11:43:18 +00:00
Sam Leonard
fd1cd4a843
path-lookup: add runtime_directory for resolving $RUNTIME_DIRECTORY 2024-02-09 11:43:18 +00:00
Daan De Meyer
7bf52f5d1c Add systemd.default_debug_tty=
Let's allow configuring the debug tty independently of enabling/disabling
the debug shell. This allows mkosi to configure the correct tty while
leaving enabling/disabling the debug tty to the user.
2024-02-09 11:47:53 +01:00
Frantisek Sumsal
c078f4af6b semaphore: temporarily pin autopkgtest to v5.32
The latest commit (ATTOW) [0] calls adduser with --logmsglevel, which is
not a valid flag for adduser on Ubuntu Focal/Jammy.

[0] 9c033b3db4
2024-02-09 11:18:25 +01:00
Yu Watanabe
6a32108812 man: add missing "=" after setting name
Follow-up for b93bf1bf9fb8f091c52588c5fc9edef6225f4ed3.
2024-02-09 19:03:56 +09:00
Frantisek Sumsal
8632590278
Merge pull request #31230 from mrc0mmand/test-seccomp
process-util: use only the least significant byte from personality()
2024-02-09 10:39:23 +01:00
Yu Watanabe
15875f524f README: update link to CentOS CI 2024-02-09 18:08:58 +09:00
Yu Watanabe
d2eb27eb7b man: fix typo
Follow-up for 631cf7f0040234d2bca81bdfdf9efecc4fb5f40f.
2024-02-09 17:49:48 +09:00
Lennart Poettering
00d0f58443 sysext: output an appropriate blurb for the mode we are executed in 2024-02-09 09:41:33 +01:00
Lennart Poettering
82d371eeaf sysext: point to the right man page for the mode we are invoked in 2024-02-09 09:41:26 +01:00
Lennart Poettering
457a74b3d0 sysext: rename "directory_name" field to "full_identifier"
So the field contains simply the full name of the command being invoked,
hence rename the field to match the contents, and to mirror the
"short_identifier" field.

Interestingly, the field is apparently not actually used by anything
though! But we are not going to remove it, since a follow-up commit will
start making use of it.
2024-02-09 09:41:19 +01:00
Lennart Poettering
97b944c23a sysext: fix --help indenting/line breaking
Let's make sure there's an empty line after the explanatory text like we
usually do it, and do not indent the 2nd line more than the 1st
2024-02-09 09:40:45 +01:00
Yu Watanabe
9e95c0e495
Merge pull request #31172 from yuwata/network-bond-port
network: do not bring down bonding port on reconfigure
2024-02-09 17:32:29 +09:00
Yu Watanabe
2686855b93
Merge pull request #31247 from yuwata/network-make-reload-bus-method-synchronous
network: make Reload bus method synchronous
2024-02-09 17:32:07 +09:00
Mike Yuan
f9c76997db
systemctl: allow --now only if not install_client_side() 2024-02-09 16:18:53 +08:00
Mike Yuan
1baa0415ae
systemctl: support disable/mask --now with unit template
Closes #15620
Replaces #28240
2024-02-09 16:18:44 +08:00
Mike Yuan
8749b09390
basic/unit-name: introduce unit_name_replace_instance_full
that optionally accepts a globbed instance
2024-02-09 16:17:59 +08:00
Mike Yuan
f27d595d7e
systemctl-util: some modernizations 2024-02-09 16:10:43 +08:00
Mike Yuan
09d7952a67
basic/unit-name: include param name in function prototype 2024-02-09 16:10:41 +08:00
Yu Watanabe
4bc771d061 test: drop unnecessary sleep
Now, 'Reload' dbus method is synchronous. It is not necessary to wait
for link enter configuring state.
2024-02-09 14:25:54 +09:00