Commit Graph
58810 Commits
Author SHA1 Message Date
Lennart Poettering 3e9b77dea4 Merge pull request #23986 from poettering/cache-selinux-unit-labels
selinux: make selinux access checks based on unit file contexts read at unit load time
2022-07-21 10:24:51 +02:00
Alexander Wilson 64b634fbc6 coredumpctl: Use BusLocator functions 2022-07-21 09:50:47 +02:00
Zbigniew Jędrzejewski-Szmek a5d0919c9b Merge pull request #24051 from yuwata/json-fpclassify
json: use fpclassify() macro and refuse -ffinite-math-only
2022-07-21 09:35:19 +02:00
Daan De Meyer fc4c10b28b tree-wide: Introduce free_and_replace_full()
Let's have all our free_and_replace() functions use a single
implementation.
2022-07-21 09:45:55 +09:00
Yu Watanabe 60f97fee2d meson: refuse -ffinite-math-only
Closes #23610.
2022-07-21 09:18:13 +09:00
Yu Watanabe 1561db8ac2 json: use fpclassify() or its helper functions 2022-07-21 09:18:13 +09:00
Yu Watanabe fbccfa95c4 math-util: introduce iszero_safe() and fp_equal() 2022-07-21 09:18:08 +09:00
Yu Watanabe 39229a2a0e test: use fabs() as the argument is double
This also drop unnecessary cast.
2022-07-21 09:06:53 +09:00
Lennart Poettering 4a0cb5474e Merge pull request #23963 from matoro/main
Replace __sync intrinsics with __atomic
2022-07-21 00:10:01 +02:00
Lennart Poettering 62f174cf1f selinux: include precise low-level error string in returned D-Bus errors 2022-07-20 19:09:24 +02:00
Lennart Poettering 23e9a7dde5 core: cache unit file selinux label, and make decisions based on that
Do not go back to disk on each selinux access, but instead cache the
label off the inode we are actually reading. That way unit file contents
and unit file label we use for access checks are always in sync.

Based on discussions here:

https://github.com/systemd/systemd/pull/10023#issuecomment-1179835586

Replaces:

https://github.com/systemd/systemd/pull/23910

This changes behaviour a bit, because we'll reach and cache the label at
the moment of loading the unit (i.e. usually on boot and reload), but
not after relabelling. Thus, users must refresh the cache explicitly via
a "systemctl daemon-reload" if they relabelled things.

This makes the SELinux story a bit more debuggable, as it adds an
AccessSELinuxContext bus property to units that will report the label we are
using for a unit (or the empty string if not known).

This also drops using the "source" path of a unit as label source. if
there's value in it, then generators should manually copy the selinux
label from the source files onto the generated unit files, so that the
rule that "access labels are read when we read the definition files" is
upheld. But I am not convinced this is really a necessary, good idea.
2022-07-20 19:08:28 +02:00
Luca Boccassi 74c1cf6267 Merge pull request #23640 from cerebro1/week1
Estimate battery level
2022-07-20 18:07:22 +01:00
Sonali Srivastava 91ea7ebcdf sleep: store battery discharge rate/hour with hash
Estimated battery discharge rate per hour is stored in :
/var/lib/systemd/sleep/battery_discharge_percentage_rate_per_hour

This value is used to determine the initial suspend interval. In case
this file is not available or value is invalid, HibernateDelaySec
interval is used.
After wakeup from initial suspend, this value is again estimated and
written to file if value is in range of 1-199.

Logs for reference : HibernateDelaySec=15min
- Updated in /etc/systemd/sleep.conf

Jul 14 19:17:58 localhost systemd-sleep[567]: Current battery charge
percentage: 100%
Jul 14 19:17:58 localhost systemd-sleep[567]: Failed to read discharge
rate from /var/lib/systemd/sleep/batt
ery_discharge_percentage_rate_per_hour: No such file or directory
Jul 14 19:17:58 localhost systemd-sleep[567]: Set timerfd wake alarm
for 15min
Jul 14 19:33:00 localhost systemd-sleep[567]: Current battery charge
percentage after wakeup: 90%
Jul 14 19:33:00 localhost systemd-sleep[567]: Attempting to estimate
battery discharge rate after wakeup from 15min sleep
Jul 14 19:33:00 localhost systemd-sleep[567]: product_id does not
exist: No such file or directory
Jul 14 19:33:00 localhost systemd-sleep[567]: Estimated discharge rate
39 successfully updated to
/var/lib/systemd/sleep/battery_discharge_percentage_rate_per_hour
Jul 14 19:33:00 localhost systemd-sleep[567]: Current battery charge
percentage: 90%
Jul 14 19:33:00 localhost systemd-sleep[567]: product_id does not
exist: No such file or directory
Jul 14 19:33:00 localhost systemd-sleep[567]: Set timerfd wake alarm
for 1h 48min 27s
Jul 14 21:21:30 localhost systemd-sleep[567]: Current battery charge
percentage after wakeup: 90%
Jul 14 21:21:30 localhost systemd-sleep[567]: Battery was not
discharged during suspension
2022-07-20 17:39:07 +05:30
Sonali Srivastava 96d662fa4c sleep: use current charge level to decide suspension
If battery current charge percentage is below 5% hibernate directly.
Else initial suspend interval is set for HibernateDelaySec. On wakeup
estimate battery discharge rate per hour and if battery charge
percentage is not below 5% system is suspended else hibernated.
2022-07-20 14:46:43 +05:30
Yu Watanabe e1b45a756f tree-wide: fix typo 2022-07-20 13:15:37 +09:00
Lennart Poettering 9f3a3ac70f update TODO 2022-07-19 22:33:13 +02:00
Daan De Meyer 5a4327d1a8 mkosi: Silence gdb debuginfo messages/prompts
Let's silence gdb asking about debuginfod and complaining about
missing debuginfo to reduce friction when using mkosi to work
on systemd.
2022-07-19 17:32:11 +01:00
Jan Janssen 6a1d8f1161 man: Miscellaneous fixes
Fixes: #24056
2022-07-19 10:41:13 +01:00
김인수 98c143edc1 po: Translated using Weblate (Korean)
Currently translated at 100.0% (189 of 189 strings)

Co-authored-by: 김인수 <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ko/
Translation: systemd/main
2022-07-18 20:17:00 +01:00
Evgeny Vereshchagin e99e4e4fec Merge pull request #24025 from DaanDeMeyer/mkosi-sanitizers
mkosi: Changes to allow booting with sanitizers in mkosi
2022-07-18 19:24:51 +03:00
Daan De Meyer 7ca9563ca1 mkosi: Remove usage of deprecated option names/sections 2022-07-18 16:54:58 +02:00
Daan De Meyer 69d638e67e mkosi: Changes to allow booting with sanitizers in mkosi
- Extra memory because ASAN needs it
- The environment variables to make the sanitizers more useful
- LD_PRELOAD because the ASAN DSO needs to be the first in the list
- The sanitizer library packages
- Disable syscall filters because they interfere with ASAN
- Disable systemd-hwdb-update because it's super slow when systemd-hwdb
  is built with sanitizers
- Take the value for meson's b_sanitize option from the SANITIZERS
  environment variable
2022-07-18 16:54:56 +02:00
Ansgar Burchardt 34aee208b5 man/system-or-user-ns.xml: explicitly refer to PrivateUsers= option
It is not clear what "unprivileged user namespaces are available" means.
It could mean either that they are only usable, that is, enabled in the kernel,
or they have been enabled for the specific service. Referring to the
`PrivateUsers=` options makes it clear that the latter is meant.
2022-07-18 13:54:51 +01:00
Luca Boccassi 9b9ddaf09d Merge pull request #24001 from yuwata/network-lifetime-fix
network: fixes for lifetime handling
2022-07-18 10:02:02 +01:00
Daan De Meyer 111ff5d511 mkosi: Update Ubuntu config to 22.04 2022-07-18 10:20:48 +02:00
Daan De Meyer 2401c9ace6 mkosi: Fix build script indentation 2022-07-18 10:20:48 +02:00
Daan De Meyer c0daae3ad8 mkosi: Enable meson developer mode 2022-07-18 10:20:48 +02:00
Daan De Meyer 2d2ac49787 mkosi: Don't try to install systemd-boot in non-efi images
When using mkosi's direct linux boot support, there's no EFI
system partition so don't try to install systemd-boot in that case.
2022-07-18 10:20:48 +02:00
Daan De Meyer a6e6b6954c mkosi: Install xxd in images
Came in handy while working on
https://github.com/systemd/systemd/pull/24024 so let's install it
in the image by default.
2022-07-18 10:20:43 +02:00
Yu Watanabe 5509518193 Merge pull request #24047 from dtardon/list-users-linger
Add linger status to `loginctl list-users`
2022-07-18 15:05:25 +09:00
Richard Huang 5f2b4f9cb9 Update sleep.conf HibernateDelaySec default to match implementation 2022-07-18 15:04:03 +09:00
Mitchell Freiderich 0216462f08 hwdb: Add Acer Aspire A317-33 (#24050)
Enables the power button on the Acer Aspire 3 A317-33
2022-07-18 15:03:44 +09:00
David Tardon cbc2593eea systemctl: include upheld units in dependencies
Fixes: #22706
2022-07-17 20:50:19 +01:00
David Tardon 283db37a20 test: merge grep | awk calls 2022-07-17 20:26:09 +02:00
David Tardon 6083f7a604 test: add a simple test for list-users 2022-07-17 20:26:09 +02:00
David Tardon c5912adc85 loginctl: add linger status to list-users output
Fixes: #3907
2022-07-16 15:10:26 +02:00
Vito Caputo 729d2df806 man: fix grammatical error in --cursor-file description
Just a minor cleanup to fix unparseable wording
2022-07-16 11:35:46 +09:00
Frantisek Sumsal e99b9285cb core: drop a stray %m specifier from a warning message
since in this specific case (r == 0) `errno` is irrelevant and most likely
set to zero, leading up to a confusing message:

```
[  120.595085] H systemd[1]: session-5.scope: No PIDs left to attach to the scope's control group, refusing: Success
[  120.595144] H systemd[1]: session-5.scope: Failed with result 'resources'.
```
2022-07-16 07:00:40 +09:00
Yu Watanabe 59159aee20 Merge pull request #24018 from keszybz/generator-cleanups
Make generators easier to test, fix various corner issues
2022-07-16 05:11:49 +09:00
Yu Watanabe c798e1dfee Merge pull request #24035 from yuwata/sd-event-cleanup
sd-event: tiny cleanups
2022-07-16 05:11:00 +09:00
Daan De Meyer 5edf875b92 coredump: Try to write journald coredump metadata to the journal
Currently, if journald coredumps, the coredump is written to
/var/lib/systemd/coredump but the coredump metadata is not written
to  the journal meaning we can't find out about the coredump's
existence via the journal. This means that coredumpctl can't be
used to work with journald coredumps, as well as any other tools
that rely on journald to know about coredumps.

To solve the issue, let's have systemd-coredump try to write
systemd-journald coredump metadata to the journal. We have to be
careful though, since if journald coredumps, there's no active
reader on the receive end of the journal socket, so we have to make
sure we don't deadlock trying to write to the socket. To avoid the
deadlock, we put the socket in nonblocking mode before trying to
write to it.
2022-07-15 19:27:00 +01:00
Lennart Poettering 3acb6edef3 sysusers: allow defining additional sysusers lines via credentials 2022-07-16 00:47:22 +09:00
lastkrick 69a7d10832 man: fix typo in systemd.network documentation in IPv6RoutePrefix section (#24030) 2022-07-16 00:45:56 +09:00
Yu Watanabe c8e9d15cbf sd-event: introduce PROTECT_EVENT() macro 2022-07-16 00:42:39 +09:00
Yu Watanabe 76d04c3a34 sd-event: drop redundant code
The function `source_io_unregister()` will be anyway called in
`source_disconnect()`.
2022-07-16 00:38:37 +09:00
Zbigniew Jędrzejewski-Szmek ff52ff2565 fstab-generator: do not skip /sysroot prefix if the mount point is missing
When chase_symlinks() is called on something on a doesn't exist, it immediately
returns an error. But we were relying on it to prepend "/sysroot/". If it
fails, we need to do that ourselves.

For example, with /sysroot/etc/fstab containing a line for /foo, if /sysroot/foo
doesn't exist, we'd generate a mount point for /foo.
2022-07-15 15:48:05 +02:00
Zbigniew Jędrzejewski-Szmek 640dc2f3ad fsck,sulogin: fix cargo-culted comment 2022-07-15 15:48:05 +02:00
Zbigniew Jędrzejewski-Szmek da69e8e430 fstab-generator: rename 'post' variable
Originally (6b1dc2bd3c) we had 'pre' and 'post'
to refer to remote-fs-pre.target and remote-fs.target or local-fs-pre.target
and local-fs.target. But 'pre' is long gone, and 'post' by itself doesn't
make much sense. Rename it for clarity.
2022-07-15 15:48:05 +02:00
Zbigniew Jędrzejewski-Szmek 4981427cd4 fstab-generator: tweak comments 2022-07-15 15:48:05 +02:00
Zbigniew Jędrzejewski-Szmek 99e3d47679 fstab-generator: allow overriding path to /sysroot/etc/fstab too
This adds $SYSTEMD_SYSROOT_FSTAB analoguous to $SYSTEMD_FSTAB.
2022-07-15 15:48:05 +02:00