Commit Graph

30503 Commits

Author SHA1 Message Date
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
Yu Watanabe e4c01fe6af test: add test cases for RuntimeDirectoryPreserve=yes 2020-09-18 13:11:39 +02:00
Zbigniew Jędrzejewski-Szmek 05d418fed9
Merge pull request #17085 from yuwata/network-configure-mdb-entries-on-bridge-master
network: allow to configure mdb entries on bridge master
2020-09-18 13:06:44 +02:00
Lennart Poettering 50406dc7f1
Merge pull request #17093 from poettering/dissect-tweaks2
dissect: some more tweaks
2020-09-18 10:13:31 +02:00
Yu Watanabe 1034044260
Merge pull request #15050 from ssahani/fq-pie
network: tc: add support for FQ-PIE packet scheduler
2020-09-18 03:50:02 +09:00
Lennart Poettering 4f309abb3e dissect: show partition output even if os-release is missing
It's just too useful to immediately see with "systemd-dissect" what
"systemd-repart" generated for us without having to populate it with
/etc/os-release. Hence let's log a message if /etc/os-release is
missing, but proceed otherwise and show the partition table.
2020-09-17 18:02:49 +02:00
Lennart Poettering 9434438543 dissect: use structured initialization, it's prettier 2020-09-17 18:02:45 +02:00
Lennart Poettering 3afda7c797 dissect: is_loop_device() returns negative on error, don't mistake that is true 2020-09-17 18:02:41 +02:00
Lennart Poettering 74cb2db9f4 dissect: always invalidate secondary arch partitions if we found primary arch
Let's suppress the secondary arch data, since we never ever want to
mount it if we found the primary arch.

Previously we only suppressed in the Verity case, but there's little
reason to entertain the idea of a secondary arch in non-Verity
environments either, we are not going to use them, and should not do
decryption or anything like that.
2020-09-17 18:02:37 +02:00
Lennart Poettering 220431724b dissect: three trivial fixes
Uppercase first char of log message, and indicate correct program name.

Reindent comment table at one place.

Use correct, specific, enum type at one more place.
2020-09-17 18:02:33 +02:00
Lennart Poettering 10e8a60baa nspawn: add --console=autopipe mode
By default we'll run a container in --console=interactive and
--console=read-only mode depending if we are invoked on a tty or not so
that the container always gets a /dev/console allocated, i.e is always
suitable to run a full init system /as those typically expect a
/dev/console to exist).

With the new --console=autopipe mode we do something similar, but
slightly different: when not invoked on a tty we'll use --console=pipe.
This means, if you invoke some tool in a container with this you'll get
full inetractivity if you invoke it on a tty but things will also be
very nicely pipeable. OTOH you cannot invoke a full init system like
this, because you might or might not become a /dev/console this way...

Prompted-by: #17070

(I named this "autopipe" rather than "auto" or so, since the default
mode probably should be named "auto" one day if we add a name for it,
and this is so similar to "auto" except that it uses pipes in the
non-tty case).
2020-09-17 16:39:27 +02:00
Lennart Poettering 335d2eadca nspawn: don't become TTY controller just to undo it later again
Instead of first becoming a controlling process of the payload pty
as side effect of opening it (without O_NOCTTY), and then possibly
dropping it again, let's do it cleanly an reverse the logic: let's open
the pty without becoming its controller first. Only after everything
went the way we wanted it to go become the controller explicitly.

This has the benefit that the PID 1 stub process we run (as effect of
--as-pid2) doesn't have to lose the tty explicitly, but can just
continue running with things. And we explicitly make the tty controlling
right before invoking actual payload.

In order to make sure everything works as expected validate that the
stub PID 1 in the container really has no conrolling tty by issuing the
TIOCNOTTY tty and expecting ENOTTY, and log about it.

This shouldn't change behaviour much, it just makes thins a bit cleaner,
in particular as we'll not trigger SIGHUP on ourselves (since we are
controller and session leader) due to TIOCNOTTY which we then have to
explicitly ignore.
2020-09-17 16:39:23 +02:00
Lennart Poettering 2fef50cd9e nspawn: fix fd leak on failure path 2020-09-17 16:39:19 +02:00
Lennart Poettering 554c4beb47 nspawn: print log notice when we are invoked from a tty but in "pipe" mode
If people do this then things are weird, and they should probably use
--console=interactive (i.e. the default) instead.

Prompted-by: #17070
2020-09-17 16:39:16 +02:00
Lennart Poettering efe4266240 nspawn: check return of setsid()
Let's verify that everything works the way we expect it to work, hence
check setsid() return code.
2020-09-17 16:38:58 +02:00