1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00
Commit Graph

62470 Commits

Author SHA1 Message Date
Lennart Poettering
951174e4fe test-journal-flush: minor modernizations
let's automatically destroy test dirs, instead of manually.
2023-02-01 15:25:44 +01:00
Lennart Poettering
74e795ee55 id128: introduce ERRNO_IS_MACHINE_ID_UNSET() helper macro 2023-02-01 15:25:30 +01:00
Yu Watanabe
5479d0f83a test: make helper_check_device_units() log unit name 2023-02-01 23:04:13 +09:00
Robin Humble
19cfda9fc3
pid1: fix segv triggered by status query (#26279)
If any query makes it to the end of install_info_follow() then I think symlink_target is set to NULL.
If that is followed by -EXDEV from unit_file_load_or_readlink(), then that causes basename(NULL)
which segfaults pid 1.

This is triggered by eg. "systemctl status crond" in RHEL9 if

/etc/systemd/system/crond.service
  -> /ram/etc/systemd/system/crond.service
  -> /usr/lib/systemd/system/.crond.service.blah.blah
  -> /usr/lib/systemd/system/crond.service
2023-02-01 21:36:48 +09:00
Zbigniew Jędrzejewski-Szmek
e4c7b5f517 core: split system/user job timeouts and make them configurable
Config options are -Ddefault-timeout-sec= and -Ddefault-user-timeout-sec=.
Existing -Dupdate-helper-user-timeout= is renamed to -Dupdate-helper-user-timeout-sec=
for consistency. All three options take an integer value in seconds. The
renaming and type-change of the option is a small compat break, but it's just
at compile time and result in a clear error message. I also doubt that anyone was
actually using the option.

This commit separates the user manager timeouts, but keeps them unchanged at 90 s.
The timeout for the user manager is set to 4/3*user-timeout, which means that it
is still 120 s.

Fedora wants to experiment with lower timeouts, but doing this via a patch would
be annoying and more work than necessary. Let's make this easy to configure.
2023-02-01 11:52:29 +00:00
Zbigniew Jędrzejewski-Szmek
3e74e6a15b test-sysusers: check that sysusers creates /etc when missing 2023-02-01 11:38:35 +01:00
Zbigniew Jędrzejewski-Szmek
d173d5564f basic/user-util: create /etc from take_etc_passwd_lock
This allows sysusers to operate with --root that is an empty directory.
It may be useful to, for example, populate the user database before installing
anything else.

firstboot was already doing this, so drop the duplicated call there.
2023-02-01 11:38:35 +01:00
Zbigniew Jędrzejewski-Szmek
e5b30f7232 basic/user-util: convert prefix_roota→path_join and use _cleanup_ more 2023-02-01 11:38:35 +01:00
Zbigniew Jędrzejewski-Szmek
fddb524d8a basic: reword some comments
Without commas, the sentences can be hard to parse.
2023-02-01 11:38:35 +01:00
Zbigniew Jędrzejewski-Szmek
7519b880e7 sysusers: when comparing items, log debug the difference 2023-02-01 11:31:29 +01:00
Zbigniew Jędrzejewski-Szmek
9a87bdd7ed sysusers: add helper to create new Item 2023-02-01 11:30:26 +01:00
dependabot[bot]
15796f28ea build(deps): bump systemd/mkosi
Bumps [systemd/mkosi](https://github.com/systemd/mkosi) from f36983f552a197faf9e36361cc68a297e68bee73 to 500f93a36cc3d5bf1d06848a0a8870bf1424625f.
- [Release notes](https://github.com/systemd/mkosi/releases)
- [Changelog](https://github.com/systemd/mkosi/blob/main/NEWS.md)
- [Commits](f36983f552...500f93a36c)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 09:48:30 +00:00
dependabot[bot]
b8565f93e9 build(deps): bump actions/github-script from 6.3.3 to 6.4.0
Bumps [actions/github-script](https://github.com/actions/github-script) from 6.3.3 to 6.4.0.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](d556feaca3...98814c53be)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 09:15:44 +00:00
dependabot[bot]
b0126d1e8e build(deps): bump redhat-plumbers-in-action/advanced-issue-labeler
Bumps [redhat-plumbers-in-action/advanced-issue-labeler](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler) from 2.0.1 to 2.0.4.
- [Release notes](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/releases)
- [Commits](88209aef58...25a1e41826)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/advanced-issue-labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 09:14:38 +00:00
Zbigniew Jędrzejewski-Szmek
2584e16cb7
Merge pull request #26236 from medhefgo/meson-fixes
meson: Fixes
2023-02-01 10:05:36 +01:00
Lennart Poettering
0e8330262e journald: some minor modernizations 2023-02-01 09:25:57 +01:00
Lennart Poettering
2308cf7c9c journal: generate a clean message when we try to write to a journal file from a different host 2023-02-01 09:23:18 +01:00
Lennart Poettering
75bf2627b0 journal-file: refuse writing to journal files where the header size is different then expected
We keep adding fields to the header, and it's fine reading files with
different header sizes, as we check via the size if the fields we need
are included. However, let's be stricter when writing journal files than
when reading, and insist that the header structure in the file actually
matches our expectations. Refuse otherwise, so that a new file is
created after rotation that then matches our expectations.

This makes sure that mismatch in header size is treated exactly as
unknown "compatible" flags, which is our other mechanism to allow
extending the journal file format in a non-breaking way.
2023-02-01 09:20:18 +01:00
Rudi Heitbaum
1bb6ba08b1 glibc: Conditionally #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36
Co-authored-by: Frantisek Sumsal <frantisek@sumsal.cz>
2023-02-01 00:02:41 +00:00
Zbigniew Jędrzejewski-Szmek
49bb7fe5f8 sysusers: insist that root group is 0
In https://bugzilla.redhat.com/show_bug.cgi?id=2156900 sysusers was reporting a
conflict between the following lines:
  u root 0:0 "Super User" /root /bin/bash
  u root    0     "Super User" /root

The problem is that those configurations are indeed not equivalent. If group 0
exists with a different name, the first line would just create the user, but the
second line would create a 'root' group with a different GID. The second
behaviour seems definitely wrong. (Or at least more confusing in practice than
the first one. The system is in a strange shape, but the second approach takes
an additional step than is worse than doing nothing.)

When this line was initially added, we didn't have the uid:gid functionality for
'u', so we didn't think about this too much. But now we do, so we should use it.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'g foobar 0'
Creating group 'foobar' with GID 0.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'u root 0 "Zuper zuper"'
src/sysusers/sysusers.c:1365: Creating group 'root' with GID 999.
src/sysusers/sysusers.c:1115: Suggested user ID 0 for root already used.
src/sysusers/sysusers.c:1183: Creating user 'root' (Zuper zuper) with UID 999 and GID 999.

vs.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'u root 0:0 "Zuper zuper"'
src/sysusers/sysusers.c:1183: Creating user 'root' (Zuper zuper) with UID 0 and GID 0.
2023-02-01 00:02:09 +00:00
Zbigniew Jędrzejewski-Szmek
a0d613ec43 meson: fail build on implicit int warnings 2023-02-01 00:01:03 +00:00
Yu Watanabe
2cb1cabb41 network: dhcp-server: do not create DHCPServer object when the DHCP server is running in relaying mode
Follow-up for c95df5879e.

Fixes #26196.
2023-02-01 00:00:19 +00:00
Tuetuopay
1d84a3c779 network/dhcp4: accept local subnet routes from DHCP
RFC3442 specifies option 121 (Classless Static Routes) that allow a DHCP
server to push arbitrary routes to a client. It has a Local Subnet
Routes section expliciting the behavior of routes with a null (0.0.0.0)
gateway.

Such routes are to be installed on the interface with a Link scope, to
mark them as directly available on the link without any gateway.

Networkd currently drops those routes, which is against the RFC, as
Linux has proper support for such routes.

Fixes: 7f20627 ("network: dhcp4: ignore gateway in static routes if destination is link-local or in the same network")
2023-01-31 23:58:34 +00:00
Frantisek Sumsal
9c45bfb2ac ukify: don't install ukify man page if ukify is not enabled
Checking for gnu-efi is not enough, since ukify can be explicitly
disabled.

Resolves: #26274
2023-01-31 23:57:28 +00:00
Zbigniew Jędrzejewski-Szmek
5afdb4629a pid1,sysusers: drop unused SYNTHETIC_ERRNO
The only function of SYNTHETIC_ERRNO is to set the return value.
If we're ignoring the return value, it shouldn't be used.
2023-01-31 14:30:41 +01:00
Zbigniew Jędrzejewski-Szmek
616c53544f sysusers: drop counterproductive bitfield annotations
The usual story:
$ diff -u <(pahole build/systemd-sysusers.0) <(pahole build/systemd-sysusers)
 	/* size: 80, cachelines: 2, members: 15 */
-	/* sum members: 68, holes: 1, sum holes: 4 */
-	/* sum bitfield members: 5 bits (0 bytes) */
-	/* padding: 7 */
-	/* bit_padding: 3 bits */
+	/* sum members: 73, holes: 1, sum holes: 4 */
+	/* padding: 3 */
 	/* last cacheline: 16 bytes */

Effectively, because of padding, we were not saving anything. We're not putting
struct Item in arrays, but when allocating on the heap, we're going to round up to
normal alignment too.

The code becomes shorter (and quicker):
$ size build/systemd-sysusers{,.0}
   text	   data	    bss	    dec	    hex	filename
  79967	   2040	    264	  82271	  1415f	build/systemd-sysusers.0
  79726	   2040	    264	  82030	  1406e	build/systemd-sysusers

(In case you're wondering, I wrote this long commit message for a very simple
change on purpose: I want to deflate the bitfield cargo cult a bit.)
2023-01-31 13:47:17 +01:00
Ilya Leoshkevich
907046282c bpf: fix restrict_fs on s390x
Linux kernel's bpf-next contains BPF LSM support for s390x. systemd's
test-bpf-lsm currently fails with this kernel.

This is an endianness issue: in the restrict_fs bpf program,
magic_number has type unsigned long (64 bits on s390x), but magic_map
keys are uint32_t (32 bits). Accessing magic_map using 64-bit keys may
work by accident on little-endian systems, but fails hard on big-endian
ones.

Fix by casting magic_number to uint32_t.
2023-01-31 12:23:16 +01:00
Arsen Arsenović
181eea677d importd: Always specify file unpacked by tar
Despite popular belief, the default file extracted by GNU tar is not stdin.  It
is the value of the TAPE environment variable, falling back on a compile-time
constant.  On my system, the default value is /dev/full, which causes tar to
just spin forever due to --ignore-zeros.  Always specifying this flag is the
safe thing to do.

  ~$ tar --show-defaults
  --format=gnu -f/dev/full -b20 --quoting-style=escape
  --rmt-command=/usr/sbin/grmt

See also: ``(tar)defaults'', available via Info viewers, and in HTML form at:
https://www.gnu.org/s/tar/manual/html_node/defaults.html
2023-01-31 12:21:44 +01:00
Lennart Poettering
a444091840
Merge pull request #26249 from DaanDeMeyer/nspawn-uid-fix
nspawn: Make sure we create bind mount points as the correct UID/GID
2023-01-31 12:21:09 +01:00
Lennart Poettering
e9125200ac
Merge pull request #26245 from ldv-alt/tmpfiles-fixes
tmpfiles: fix specifier expansion in arguments of C and L lines
2023-01-30 17:14:03 +01:00
Yu Watanabe
808f7c94f0
Merge pull request #23956 from mrc0mmand/resolved-ipv6
test: cover (not only) IPv6 in the resolved test suite
2023-01-30 19:21:19 +09:00
Luca Boccassi
0a5bd40a70
Merge pull request #25374 from yuwata/sleep-fixlets
sleep: several fixlets
2023-01-30 09:51:21 +00:00
Daan De Meyer
1ac51b0dc7
Merge pull request #26252 from DaanDeMeyer/mkosi-drop-workaround
mkosi fixes
2023-01-29 19:31:15 +01:00
Daan De Meyer
60f42f7ec2 test-systemd-tmpfiles: Fix execution when user is not in /etc/passwd
We might be running in a chroot as a uid that doesn't exist in /etc/passwd.
Let's make sure we don't fail in this scenario.

We pass $HOME when resetting the env so that we can find a home directory
and skip tests that depend on user name/group.
2023-01-29 17:49:38 +00:00
Daan De Meyer
3d4fa9aaa0 mkosi: Disable auditd when running with nspawn in CI
auditd fails to start in CentOS Stream 9 causing CI failures so let's
disable it when running with nspawn in CI.
2023-01-29 17:34:21 +01:00
Daan De Meyer
868c318ba3 mkosi: Add back CentOS Stream 8 to CI
It's still useful to test the EFI handover logic in systemd-boot.
We use a mkosi.prepare script to install a newer python and update
the system to use it.
2023-01-29 17:05:23 +01:00
Daan De Meyer
fc4b61d0b9 mkosi: Drop focal workaround in build script
Now that jammy is the latest LTS, lets drop the focal workaround
from the build script.
2023-01-29 17:05:23 +01:00
Daan De Meyer
84a4af2c81 mkosi: Don't modify rootfs in build script
When unprivileged mkosi becomes available, builds will be executed
as an unprivileged user, so we won't be able to modify the rootfs
anymore. Let's update the build script to account for this.
2023-01-29 17:05:23 +01:00
Daan De Meyer
ac3326dfb8 mkosi: Fix shellcheck warnings 2023-01-29 17:05:04 +01:00
cake03
98a6d8505d update footer to 2023 2023-01-29 20:26:28 +09:00
Daan De Meyer
c3caadb400 mkosi: Drop epel-testing repository from centos config
python3-pefile was pushed to epel 9 stable.
2023-01-29 11:55:57 +01:00
Daan De Meyer
0a67965fa2 nspawn: Make sure we create bind mount points as the correct UID/GID
When using --private-users, we have to create bind mount points as
the user that will become root in the user namespace, so let's take
that into account.
2023-01-29 08:59:19 +01:00
Daan De Meyer
2312fd17cc mkdir-label: Add mkdir_parents_safe_label() 2023-01-28 15:11:29 +01:00
Yu Watanabe
b52031dbbc sd-dhcp-server: allow to send header only message
If we receive a header only message, and the server is running in relay
mode, then the assertion was triggered.

Fixes #26151.
2023-01-28 10:44:30 +00:00
Yu Watanabe
21a9c92625 test: add tests for localectl --no-convert 2023-01-28 15:06:00 +09:00
Yu Watanabe
7bb322e982 locale: downgrade level of one more log message 2023-01-28 15:06:00 +09:00
Yu Watanabe
8669bbb565 locale: move logging from library-like functions to caller 2023-01-28 15:06:00 +09:00
Yu Watanabe
189cacabe9 locale: decouple vconsole_read_data() from x11_read_data()
Let's make library-functions simple and independent as possible as they
are. No functional change, just refactoring.
2023-01-28 15:05:55 +09:00
Yu Watanabe
f41338da6e locale: also check if converted keymap or friends is same as the current settings
Before this commit, if virtual console keymap is unchanged, localed just
returns without modifying anything. However, the X11 part may need updating.
So we should check for both and ensure they are unmodified.

Replaces #26190.
2023-01-28 14:54:50 +09:00
Yu Watanabe
71fa933b46 locale: sync two X11 contexts on update 2023-01-28 14:53:18 +09:00