Lennart Poettering
4265a66a5e
fs-util: check for /proc mounted in access_fd()
...
It's a very basic function very similar to other cases where we go via
/proc/self/fd/, hence do the explicit proc_mounted() check here too.
2020-09-23 18:20:38 +02:00
Lennart Poettering
48d837cd92
fs-util: use strna() on returned strings of fd_get_path() if we don't check its return value
...
Let's make sure to use strna() on the strings returned by fd_get_path()
where we knowingly ignore any failures. We got this right in most cases,
but two were missing.
2020-09-23 18:20:38 +02:00
Lennart Poettering
8fe8f3aaba
basic: update fd_get_path() to use proc_mounted() helper
...
We use it pretty much everywhere else, hence use it here too.
This also changes the error generated from EOPNOTSUPP to ENOSYS, to
match the other cases where we do such a check. One user checked for
EOPNOTSUPP which is updated to check for ENOSYS instead.
2020-09-23 18:20:38 +02:00
Lennart Poettering
1e5bfa2ac8
fs-util: drop chmod_and_chown_unsafe() which is unused now
2020-09-23 18:00:19 +02:00
Lennart Poettering
62c03398ba
sysusers: modernize file backup logic a bit
...
Let's use _cleanup_ magic to clean up files, let's fully operate by fds
whenever we can.
2020-09-23 18:00:19 +02:00
Zbigniew Jędrzejewski-Szmek
8038b99d0d
run: let systemd resolve the path with RootDirectory=/RootImage=
...
Fixes #13338 .
2020-09-23 14:49:37 +02:00
Zbigniew Jędrzejewski-Szmek
526e3cbbdd
core: don't try to load units from non-absolute paths
...
The error message disagreed with the check that was actually performed. Adjust the check.
2020-09-23 14:49:37 +02:00
Lennart Poettering
6333aa9d46
sd-radv: fix indentation
...
Fix-up for 97efde65d8
2020-09-23 13:44:26 +02:00
Lennart Poettering
d5bc4e6898
machine: fix error code propagation in two cases
2020-09-23 13:24:25 +02:00
Lennart Poettering
6b6737119a
Merge pull request #17130 from keszybz/static-analyzer-cleanups
...
Trivial cleanups based on static analysis
2020-09-23 13:23:56 +02:00
Ronan Pigott
1f0541dace
sd-path: include 'search' in search pathnames
2020-09-23 10:08:44 +02:00
Lennart Poettering
2d52f8c46c
Merge pull request #17124 from bluca/copypasta
...
dissect-image: use correct path variable when reading verity signatures, do not refuse verity GPT without /usr partition
2020-09-23 09:43:39 +02:00
Lennart Poettering
3cbf74652b
Merge pull request #17127 from poettering/errno-fixup
...
make more use of errno-util.h macros
2020-09-23 09:43:18 +02:00
Zbigniew Jędrzejewski-Szmek
a5d815bb7f
Merge pull request #16938 from poettering/homed-rtc-wrong
...
homed: don't refuse logins when RTC is wrong
2020-09-22 20:51:39 +02:00
Zbigniew Jędrzejewski-Szmek
2b2919a5ff
Merge pull request #17109 from fbuihuu/udev-opts-tweaks
...
Udev opts tweaks
2020-09-22 18:54:48 +02:00
Zbigniew Jędrzejewski-Szmek
fec5929f8b
shared/conf-parser: drop redundant cast to boolean
...
parse_boolean returns either 0 or 1 or error, and we checked for errors
earlier already.
2020-09-22 18:00:44 +02:00
Zbigniew Jędrzejewski-Szmek
0a9bf7fa59
logind: use _cleanup_ in one more place
2020-09-22 18:00:44 +02:00
Zbigniew Jędrzejewski-Szmek
d52e1c420c
sd-{login,netlink,network}: use TAKE_FD() in more places
2020-09-22 18:00:44 +02:00
Zbigniew Jędrzejewski-Szmek
90e207e41f
test-bus-chat: add missing return value in check
2020-09-22 17:58:11 +02:00
Zbigniew Jędrzejewski-Szmek
afa8ffae99
various: remove assignments of unread variables
2020-09-22 17:58:11 +02:00
Zbigniew Jędrzejewski-Szmek
4ffd4705fb
activate: reduce scope of iterator variable
2020-09-22 17:58:11 +02:00
Zbigniew Jędrzejewski-Szmek
89de370edd
core/namespace: drop bitfield annotations from boolean fields
...
Such microoptimization makes sense when the structure is used in many many copies,
but here's it's not, and the few bytes we save are not worth the extra code the
compiler has to generate:
return ns_info->mount_apivfs ||
ns_info->protect_control_groups ||
ns_info->protect_kernel_tunables ||
...
before:
49b187: 48 8b 45 f8 mov -0x8(%rbp),%rax
49b18b: 0f b6 00 movzbl (%rax),%eax
49b18e: 83 e0 80 and $0xffffff80,%eax
49b191: 84 c0 test %al,%al
49b193: 75 32 jne 49b1c7 <namespace_info_mount_apivfs+0x80>
49b195: 48 8b 45 f8 mov -0x8(%rbp),%rax
49b199: 0f b6 00 movzbl (%rax),%eax
49b19c: 83 e0 08 and $0x8,%eax
49b19f: 84 c0 test %al,%al
49b1a1: 75 24 jne 49b1c7 <namespace_info_mount_apivfs+0x80>
49b1a3: 48 8b 45 f8 mov -0x8(%rbp),%rax
49b1a7: 0f b6 00 movzbl (%rax),%eax
49b1aa: 83 e0 10 and $0x10,%eax
49b1ad: 84 c0 test %al,%al
49b1af: 75 16 jne 49b1c7 <namespace_info_mount_apivfs+0x80>
after:
49b024: 48 8b 45 f8 mov -0x8(%rbp),%rax
49b028: 0f b6 40 07 movzbl 0x7(%rax),%eax
49b02c: 84 c0 test %al,%al
49b02e: 75 2e jne 49b05e <namespace_info_mount_apivfs+0x7a>
49b030: 48 8b 45 f8 mov -0x8(%rbp),%rax
49b034: 0f b6 40 03 movzbl 0x3(%rax),%eax
49b038: 84 c0 test %al,%al
49b03a: 75 22 jne 49b05e <namespace_info_mount_apivfs+0x7a>
49b03c: 48 8b 45 f8 mov -0x8(%rbp),%rax
49b040: 0f b6 40 04 movzbl 0x4(%rax),%eax
49b044: 84 c0 test %al,%al
49b046: 75 16 jne 49b05e <namespace_info_mount_apivfs+0x7a>
2020-09-22 17:58:11 +02:00
Lennart Poettering
fce93d7aa3
ptyfwd: use ERRNO_IS_DISCONNECT() when checking for disconnection on foreign fds
2020-09-22 16:25:22 +02:00
Lennart Poettering
065b47749d
tree-wide: use ERRNO_IS_PRIVILEGE() whereever appropriate
2020-09-22 16:25:22 +02:00
Luca Boccassi
c848516f3f
dissect-image: do not refuse verity GPT without /usr partition
...
Only enforce that /usr verity partition is present if a /usr
partition is there
2020-09-22 15:24:59 +01:00
Luca Boccassi
7025fa8b1a
dissect-image: use correct path variable when reading verity signatures
...
Copypasta slipped in via https://github.com/systemd/systemd/pull/17101
2020-09-22 13:19:19 +01:00
Hubert Kario
0b220a5f2a
Try stopping MD RAID devices in shutdown too
...
Currently the systemd-shutdown command attempts to stop swaps, DM
(crypt, LVM2) and loop devices, but it doesn't attempt to stop MD
RAID devices, which means that if the RAID is set up on crypt,
loop, etc. device, it won't be able to stop those underlying devices.
This code extends the shutdown application to also attempt stopping
the MD RAID devices.
Signed-off-by: Hubert Kario <hubert@kario.pl >
2020-09-22 10:41:59 +02:00
Franck Bui
027f96c851
udevadm: rename option '--log-priority' into '--log-level'
...
Let's be consistent with systemctl(1).
'--log-priority' i still kept only for backward compatibility.
2020-09-22 09:05:57 +02:00
Franck Bui
64a3494c3d
udev: rename kernel option 'log_priority' into 'log_level'
...
Let's be consistent with the rest of the project.
'log_priority' is still supported for backward compatibility.
2020-09-22 09:05:57 +02:00
Lennart Poettering
a512e330ce
homed: in images that lack mkfs.btrfs automatically fall back to ext4
...
It's better to tweak suboptimal defaults than to just fail with
compiled-in defaults.
2020-09-21 18:02:35 +02:00
Lennart Poettering
f2ba663ea5
homed: show actual file system in messages about file systems
2020-09-21 18:02:35 +02:00
Lennart Poettering
3e0b54867e
user-record: don't refuse login when last pw change time is in the future
...
The RTC is like just off, it's a weird system state, let's continue
without requiring pw change.
2020-09-21 18:02:35 +02:00
Lennart Poettering
61a29a020c
homed: ignore ratelimiting counters when timestamp is from future
...
This likely indicates that the system clock is simply wrong, hence allow
access in this case.
Fixes : #15917
2020-09-21 18:02:35 +02:00
Lennart Poettering
51a95db6dc
homed: don't block logins into accounts with future change time
...
This might happen if the system clock is wrong, and we should allow
access in this case (though certainly log about it).
2020-09-21 18:02:31 +02:00
Lennart Poettering
aee36b4ea2
dissect-image: process /usr/ GPT partition type
2020-09-19 21:19:51 +02:00
Lennart Poettering
2bc181dae7
gpt: add new GPT partition types of /usr partitions
2020-09-19 21:19:23 +02:00
Zbigniew Jędrzejewski-Szmek
8a4024120f
Merge pull request #17100 from poettering/homed-fixes
...
various homed fixes
2020-09-19 18:17:56 +02:00
Anita Zhang
d2841d563e
Merge pull request #17082 from poettering/nspawn-ctty-tweaks
...
nspawn controlling tty tweaks
2020-09-18 14:26:14 -07:00
Lennart Poettering
f9d525ae55
homed: make clean that --storage=directory --image-path=/dev/some-block-device is not supported
...
The directory backend needs a file system path, and not a raw block
device. That's only supported for the LUKS2 backend.
Let's make this clearer in the man page and also generate a better error
message if attempted anyway.
Fixes : #17068
2020-09-18 22:35:36 +02:00
Lennart Poettering
9796a9fbad
homed: make sure our worker processes finish before we exit
...
When exiting, let's explicitly wait for our worker processes to finish
first. That's useful if unmounting of /home/ is scheduled to happen
right after homed is down, as we then can be sure that the home
directories are properly unmounted and detached by the time homed is
fully terminated (otherwise it might happen that our worker gets killed
by the service manager, thus leaving the home directory and its backing
devices up/left for auto-clean which might be async).
Likely fixes #16842
2020-09-18 22:35:36 +02:00
Lennart Poettering
cc9886bc20
homed: make it easier to run multiple instances of homed
...
When debugging homed while being logged into a user account manged by
homed it is a good idea to be able to run a second copy of homed. In
order to not collide with its AF_UNIX socket and bus name use, let's add
a new env var $SYSTEMD_HOME_DEBUG_SUFFIX, when set the busnames/socket
names are suffixed by it. When setting this while debugging one can
invoke an additional copy without interfering with the host one.
2020-09-18 22:35:36 +02:00
Lennart Poettering
79a6b4cc55
homed-bus: add missing spdx header
2020-09-18 22:35:36 +02:00
Lennart Poettering
3f440b13b7
Merge pull request #16981 from keszybz/use-crypt_ra
...
Use crypt_ra to allocate scratch area for password hashing
2020-09-18 19:46:08 +02:00
Zbigniew Jędrzejewski-Szmek
0af07108e4
core/execute: reduce indentation level a bit
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek
9f71ba8d95
core: resolve binary names immediately before execution
...
This has two advantages:
- we save a bit of IO in early boot because we don't look for executables
which we might never call
- if the executable is in a different place and it was specified as a
non-absolute path, it is OK if it moves to a different place. This should
solve the case paths are different in the initramfs.
Since the executable path is only available quite late, the call to
mac_selinux_get_child_mls_label() which uses the path needs to be moved down
too.
Fixes #16076 .
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek
92673045b5
basic/path-util: enhance find_executable() for the fixed path case
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek
cd4ff5aa11
basic/path-util: inline two trivial functions
...
While at it, add assert() for the argument.
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek
f7bc0c324a
Rename find_binary to find_executable
...
"executable" is more correct than "binary", since scripts are OK too.
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek
0706c01259
Add CLOSE_AND_REPLACE helper
...
Similar to free_and_replace. I think this should be uppercase to make it
clear that this is a macro. free_and_replace should probably be uppercased
too.
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek
831d57953e
core: use X_OK when looking for executables
...
Other tools silently ignore non-executable names found in path. By checking
F_OK, we would could pick non-executable path even though there is an executable
one later.
2020-09-18 15:28:48 +02:00