1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-24 02:03:54 +03:00

62402 Commits

Author SHA1 Message Date
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 c95df5879eeb2cec8bc8eec2cfa7e741e1d9469f.

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
Yu Watanabe
800f65f827 locale: always check input keyboard layout and friends earlier 2023-01-28 14:47:36 +09:00
Yu Watanabe
f59d83afaa locale: replace context_get_x11_context() with context_get_x11_context_safe()
Then, context_get_x11_context() always replies a valid X11 context.
No functional change, just refactoring.
2023-01-28 14:47:36 +09:00
Yu Watanabe
90005a4f0a locale: make vconsole_convert_to_x11() not update Context
This also makes x11_convert_to_vconsole() changed in the same way.
Then, their callers update Context if necessary.

No functional change, just preparation for later commits.
2023-01-28 14:47:36 +09:00
Yu Watanabe
ba4a886f2d locale: introduce VCContext and several helper functions for the struct
No functional changes, preparation for later commits.
2023-01-28 14:47:36 +09:00
Yu Watanabe
e0a720012d locale: add missing logs 2023-01-28 14:47:36 +09:00
Daan De Meyer
c811aba082 ukify: python 3.9 compat followup 2023-01-27 22:16:07 +01:00
Yu Watanabe
fe8e0f8e79 sleep: enumerate only existing and non-device batteries
The enumerator is now mostly consistent with on_ac_power() in
udev-util.c.
2023-01-27 20:52:12 +00:00
Yu Watanabe
3332cfe176 sleep: fix indentation 2023-01-27 20:52:12 +00:00
Yu Watanabe
a7795a4ecf sleep: introduce siphash24_compress_id128()
Also, rename get_battery_identifier() to siphash24_compress_device_sysattr().

This also makes any errors in sd_id128_get_machine() or id128_get_product()
ignored. For the machine ID, the failure should not be significant unless
the file stored in the discharge level is reused by another system, which
is quite unusual. For the product ID, if the firmware provides useless
ID (all zero or all 0xFF), then loading/storing the discharge rate
becomes completely broken, that should be avoided.

Note, now sysattrs are used instead of properties in uevent files, but
both provide the same information, hence no functionality should be
changed.
2023-01-27 20:52:12 +00:00
Yu Watanabe
3d9ca76f36 sleep: simplify code a bit
- use device_get_sysattr_int(),
- drop redundant log message.
2023-01-27 20:52:12 +00:00
Yu Watanabe
3c3f46013e sleep: coding style fixlets 2023-01-27 20:52:12 +00:00
Yu Watanabe
4f58b656d9 sleep: introduce SuspendEstimationSec=
Before v252, HibernateDelaySec= specifies the maximum timespan that the
system in suspend state, and the system hibernate after the timespan.

However, after 96d662fa4c8cab24da57523c5e49e6ef3967fc13, the setting is
repurposed as the default interval to measure battery charge level and
estimate the battery discharging late. And if the system has enough
battery capacity, then the system will stay in suspend state and not
hibernate even if the time passed. See issue #25269.

To keep the backward compatibility, let's introduce another setting
SuspendEstimationSec= for controlling the interval to measure
battery charge level, and make HibernateDelaySec= work as of v251.

This also drops implementation details from the man page.

Fixes #25269.
2023-01-27 20:52:12 +00:00
Jan Janssen
c49ac355c0 meson: Use files() in one more place 2023-01-27 18:37:15 +01:00
Jan Janssen
4c6d1e1665 meson: Install missing udev rule 2023-01-27 18:23:02 +01:00
Jan Janssen
7b2f84e3f2 meson: Install missing bash-completions 2023-01-27 17:56:12 +01:00
Jan Janssen
17be6f2709 meson: Install missing network file 2023-01-27 17:50:27 +01:00
Jan Janssen
3774ff06f2 meson: Install all catalogs 2023-01-27 17:47:09 +01:00
Jan Janssen
4c181c1a33 meson: Properly install 90-uki-copy.install 2023-01-27 17:47:09 +01:00