]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agomkosi: Enable more options 27904/head
Daan De Meyer [Fri, 2 Jun 2023 15:25:23 +0000 (17:25 +0200)] 
mkosi: Enable more options

We build with support for selinux/apparmor where applicable but
disable them at runtime as even in permissive mode they're horribly
broken.

2 years agoMerge pull request #27849 from DaanDeMeyer/sign-pcr
Daan De Meyer [Fri, 2 Jun 2023 14:16:41 +0000 (16:16 +0200)] 
Merge pull request #27849 from DaanDeMeyer/sign-pcr

mkosi: Sign expected PCRs

2 years agodissect-image: fix partition label version compare
Lennart Poettering [Fri, 2 Jun 2023 10:25:09 +0000 (12:25 +0200)] 
dissect-image: fix partition label version compare

The logic was borked: if we find multiple partitions of the same
designator, we should first prefer the better arch, and then prefer the
better version, and then the first found. Fix that.

Fixes: #27897
2 years agomkosi: Only lower device timeout instead of all timeouts 27849/head
Daan De Meyer [Wed, 31 May 2023 14:19:21 +0000 (16:19 +0200)] 
mkosi: Only lower device timeout instead of all timeouts

We only really care about lowering the device timeout so we get to
a shell faster when the root device doesn't appear so let's only
lower that timeout instead of lowering all default timeouts.

2 years agocore: Add systemd.default_device_timeout_sec= cmdline option
Daan De Meyer [Wed, 31 May 2023 14:16:21 +0000 (16:16 +0200)] 
core: Add systemd.default_device_timeout_sec= cmdline option

2 years agomkosi: Sign expected PCRs
Daan De Meyer [Tue, 30 May 2023 12:09:44 +0000 (14:09 +0200)] 
mkosi: Sign expected PCRs

This is now possible without a TMP device so let's start signing
PCRs when building images with mkosi.

2 years agomkosi: Remove file blacklisting erofs module in opensuse initrd
Daan De Meyer [Fri, 2 Jun 2023 13:42:34 +0000 (15:42 +0200)] 
mkosi: Remove file blacklisting erofs module in opensuse initrd

2 years agomkosi: Enable set -e in postinst script
Daan De Meyer [Fri, 2 Jun 2023 13:42:14 +0000 (15:42 +0200)] 
mkosi: Enable set -e in postinst script

2 years agomkosi: Move python3-pytest-flakes to build packages on opensuse
Daan De Meyer [Fri, 2 Jun 2023 13:41:45 +0000 (15:41 +0200)] 
mkosi: Move python3-pytest-flakes to build packages on opensuse

2 years agomkosi: Add missing tss2 dependencies
Daan De Meyer [Fri, 2 Jun 2023 13:41:12 +0000 (15:41 +0200)] 
mkosi: Add missing tss2 dependencies

2 years agomeson: Add missing tss2-tcti-device dependency
Daan De Meyer [Fri, 2 Jun 2023 13:40:35 +0000 (15:40 +0200)] 
meson: Add missing tss2-tcti-device dependency

2 years agomkosi: Update to latest
Daan De Meyer [Thu, 1 Jun 2023 10:45:45 +0000 (12:45 +0200)] 
mkosi: Update to latest

2 years agofstab-generator: if we mount via roothash=/usrhash= let's imply "ro" mount option
Lennart Poettering [Fri, 2 Jun 2023 07:54:18 +0000 (09:54 +0200)] 
fstab-generator: if we mount via roothash=/usrhash= let's imply "ro" mount option

If we discover the root or /usr/ fs via roothash=/usrhash= we know the
file system mounted on it will be read-only, since Verity volumes are by
definition immutable. Hence, let's imply the "ro" mount option for them.

This way the "kernel: /dev/mapper/usr: Can't open blockdev" boot-time
log message goes away, reported here:

https://github.com/systemd/systemd/issues/27682

(I do wonder though why erofs even tries to open the block device as
writable, that sounds utterly pointless for a file system that carries
the fact it is read-only even in the name...)

2 years agoMerge pull request #27891 from mrc0mmand/more-tests-again
Frantisek Sumsal [Fri, 2 Jun 2023 08:05:17 +0000 (10:05 +0200)] 
Merge pull request #27891 from mrc0mmand/more-tests-again

test: improve systemd-pstore tests & add a couple of tests for systemd-run

2 years agoMerge pull request #27889 from poettering/no-usr-verity-detach
Lennart Poettering [Fri, 2 Jun 2023 04:24:13 +0000 (06:24 +0200)] 
Merge pull request #27889 from poettering/no-usr-verity-detach

veritysetup: make sure we don't try to detach /usr/ verity on shutdown

2 years agotest: add a couple of tests for systemd-run 27891/head
Frantisek Sumsal [Thu, 1 Jun 2023 06:47:51 +0000 (08:47 +0200)] 
test: add a couple of tests for systemd-run

2 years agosocket: avoid memory leak on incomplete SocketPort object
Frantisek Sumsal [Thu, 1 Jun 2023 20:11:01 +0000 (22:11 +0200)] 
socket: avoid memory leak on incomplete SocketPort object

==1==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 17 byte(s) in 1 object(s) allocated from:
    #0 0x7fc096c7243b in strdup (/lib64/libasan.so.8+0x7243b)
    #1 0x7fc095db3899 in bus_socket_set_transient_property ../src/core/dbus-socket.c:386
    #2 0x7fc095db5140 in bus_socket_set_property ../src/core/dbus-socket.c:460
    #3 0x7fc095dd20f1 in bus_unit_set_properties ../src/core/dbus-unit.c:2473
    #4 0x7fc095d87d53 in transient_unit_from_message ../src/core/dbus-manager.c:1025
    #5 0x7fc095d8872f in method_start_transient_unit ../src/core/dbus-manager.c:1112
    #6 0x7fc0944ddf4f in method_callbacks_run ../src/libsystemd/sd-bus/bus-objects.c:406
    #7 0x7fc0944e7854 in object_find_and_run ../src/libsystemd/sd-bus/bus-objects.c:1319
    #8 0x7fc0944e8f03 in bus_process_object ../src/libsystemd/sd-bus/bus-objects.c:1439
    #9 0x7fc09454ad78 in process_message ../src/libsystemd/sd-bus/sd-bus.c:3011
    #10 0x7fc09454b302 in process_running ../src/libsystemd/sd-bus/sd-bus.c:3053
    #11 0x7fc09454e158 in bus_process_internal ../src/libsystemd/sd-bus/sd-bus.c:3273
    #12 0x7fc09454e2f2 in sd_bus_process ../src/libsystemd/sd-bus/sd-bus.c:3300
    #13 0x7fc094551a59 in io_callback ../src/libsystemd/sd-bus/sd-bus.c:3642
    #14 0x7fc094727830 in source_dispatch ../src/libsystemd/sd-event/sd-event.c:4187
    #15 0x7fc094731009 in sd_event_dispatch ../src/libsystemd/sd-event/sd-event.c:4808
    #16 0x7fc094732124 in sd_event_run ../src/libsystemd/sd-event/sd-event.c:4869
    #17 0x7fc095f7af9f in manager_loop ../src/core/manager.c:3242
    #18 0x41cc7c in invoke_main_loop ../src/core/main.c:1937
    #19 0x4252e0 in main ../src/core/main.c:3072
    #20 0x7fc092a4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)

SUMMARY: AddressSanitizer: 17 byte(s) leaked in 1 allocation(s).

2 years agoman: fix sd_journal_*_with_location's func argument
Hannu Lounento [Tue, 30 May 2023 10:48:20 +0000 (13:48 +0300)] 
man: fix sd_journal_*_with_location's func argument

`sd_journal_print_with_location` and similar functions behave
inconsistently compared to their documentation, which says:

    sd_journal_print_with_location(), sd_journal_printv_with_location(),
    sd_journal_send_with_location(), sd_journal_sendv_with_location(),
    and sd_journal_perror_with_location() [...] accept additional
    parameters to explicitly set the source file name, function, and
    line. Those arguments must contain valid journal entries including
    the variable name, e.g. "CODE_FILE=src/foo.c", "CODE_LINE=666",
    "CODE_FUNC=myfunc".

Calling e.g. `sd_journal_sendv_with_location` with
`CODE_FUNC=myfunction` as the value of the argument `func` results in

    "CODE_FUNC" : "CODE_FUNC=myfunction"

because `sd_journal_*_with_location` implicitly prefix the argument
`func` with `CODE_FUNC=`. For example:

    _public_ int sd_journal_sendv_with_location(
                    const char *file, const char *line,
                    const char *func,
                    const struct iovec *iov, int n) {
            [...]
            char *f;
            [...]
            niov = newa(struct iovec, n + 3);
            [...]
            ALLOCA_CODE_FUNC(f, func);
            [...]
            niov[n++] = IOVEC_MAKE_STRING(f);

            return sd_journal_sendv(niov, n);
    }

where `ALLOCA_CODE_FUNC` is:

    #define ALLOCA_CODE_FUNC(f, func)                 \
            do {                                      \
                    size_t _fl;                       \
                    const char *_func = (func);       \
                    char **_f = &(f);                 \
                    _fl = strlen(_func) + 1;          \
                    *_f = newa(char, _fl + 10);       \
                    memcpy(*_f, "CODE_FUNC=", 10);    \
                    memcpy(*_f + 10, _func, _fl);     \
            } while (false)

The arguments `file` and `line` are _not_ prefixed similarly but
expected to be prefixed already with `CODE_FILE=` and `CODE_LINE=`
respectively and sent as is like the documentation describes.

That is, the argument `func` is treated differently and behaves
inconsistently compared to the arguments `file` and `line`. The behavior
seems still intentional:

    _public_ int sd_journal_printv_with_location(int priority, const char *file, const char *line, const char *func, const char *format, va_list ap) {
            [...]
            /* func is initialized from __func__ which is not a macro, but
            * a static const char[], hence cannot easily be prefixed with
            * CODE_FUNC=, hence let's do it manually here. */
            ALLOCA_CODE_FUNC(f, func);
            [...]
    }

Thus, change the documentation to match the actual behavior.

Note: `sd_journal_{print,send}` and `sd_journal_{print,send}v` work as
expected as they only pass the function name (i.e. without `CODE_FUNC=`)
to the `func` argument of the `sd_journal_*_with_location` functions
they call. For example:

    #define sd_journal_print(priority, ...) sd_journal_print_with_location(priority, "CODE_FILE=" __FILE__, "CODE_LINE=" _SD_STRINGIFY(__LINE__), __func__, __VA_ARGS__)

2 years agodbus-util: let's take it down a notch when converting file mode to string
Frantisek Sumsal [Thu, 1 Jun 2023 18:22:20 +0000 (20:22 +0200)] 
dbus-util: let's take it down a notch when converting file mode to string

I'm definitely a fan of precision, but in this case it's a bit too much:

    $ systemd-run --unit=test --socket-property=ListenFIFO=/tmp/foo --socket-property=SocketMode=0644 true
    $ systemctl cat test.socket
    # /run/systemd/transient/test.socket
    # This is a transient unit file, created programmatically via the systemd API. Do not edit.
    [Unit]
    Description=/usr/bin/true

    [Socket]
    ListenFIFO=/tmp/foo
    SocketMode=0000000000000000000000000000000000000644

2 years agotest: make the multiple-file test more thorough
Frantisek Sumsal [Thu, 1 Jun 2023 18:02:20 +0000 (20:02 +0200)] 
test: make the multiple-file test more thorough

Let's check if we keep the old records after multiple systemd-pstore
invocations (i.e. simulate a scenario where we get multiple crashes and
multiple machine reboots).

2 years agoveritysetup: remove double escaping of data device + hash device spec 27889/head
Lennart Poettering [Thu, 1 Jun 2023 17:15:10 +0000 (19:15 +0200)] 
veritysetup: remove double escaping of data device + hash device spec

generator_write_veritysetup_service_section() already escapes the
parameters internally, doing so in the caller means double escaping,
which is a bug. Fix it.

2 years agoveritysetup: minor renaming of functions
Lennart Poettering [Thu, 1 Jun 2023 16:54:33 +0000 (18:54 +0200)] 
veritysetup: minor renaming of functions

create_device() and create_disk() so far did very similar things, but
the name didn't give a hint what the difference was.

Hence let's rename them to create_special_device() and
create_veritytab_device() to make this more understandabe, as one
creates /proc/cmdline specified roothash=/usrhash= devices, and the
other one devices for items listed in /etc/veritytab.

No code changes besides renaming.

2 years ago{crypt|verity}setup: mention volume name in some error messages
Lennart Poettering [Thu, 1 Jun 2023 13:31:25 +0000 (15:31 +0200)] 
{crypt|verity}setup: mention volume name in some error messages

2 years ago{crypt|verity}setup: replace dep on systemd-tmpfiles-setup-dev.service by modprobe...
Lennart Poettering [Thu, 1 Jun 2023 13:00:27 +0000 (15:00 +0200)] 
{crypt|verity}setup: replace dep on systemd-tmpfiles-setup-dev.service by modprobe@loop.service

Both should have the same effect: the /dev/loop-control devices should
become available. systemd-tmpfiles-setup-dev.service creates the device
node "dry" based on modalias data, while modprobe@loop.service creates
it fully, because the module backing it is loaded properly. This should
shorten the deps chain a bit, simplify things and allows us to focus on
the stuff we actually need (i.e. the loopback infra) instead of all
entrypoints anyone might possibly need (i.e. the device nodes)

2 years agoveritysetup-generator: only generate one set of deps on systemd-tmpfiles-setup-dev...
Lennart Poettering [Thu, 1 Jun 2023 12:55:26 +0000 (14:55 +0200)] 
veritysetup-generator: only generate one set of deps on systemd-tmpfiles-setup-dev.service

If both the data and the hash device are a regular file we might create
two sets of deps on s-t-s-d.s, which is of course redundant. Shorten the
code to only generate this once.

No change in behaviour.

2 years agoveritysetup-generator: imply x-initrd.attach for "usr" and "root" volumes
Lennart Poettering [Thu, 1 Jun 2023 12:50:15 +0000 (14:50 +0200)] 
veritysetup-generator: imply x-initrd.attach for "usr" and "root" volumes

Similar to the previous commit, just vor Verity rather than LUKS.

2 years agocryptsetup-generator: imply x-initrd.attach for "usr" and "root" volumes
Lennart Poettering [Thu, 1 Jun 2023 12:40:38 +0000 (14:40 +0200)] 
cryptsetup-generator: imply x-initrd.attach for "usr" and "root" volumes

Let's imply "x-initrd.attach" for "usr" and "root" volumes, so that
we do not attempt to umount them anymore during shutdown.

The names of these volumes have been mandated by the Discoverable
Partition Spec:

https://uapi-group.org/specifications/specs/discoverable_partitions_specification/#suggested-mode-of-operation

Hence it appears reasonably safe to special case these volume names.

Note that a similar logic is implemented in fstab-generator and in fact
PID 1 to treat the root mount and /usr/ mount specially too, to avoid
trying to umount it at shutdown. (This is what fstab_is_extrinsic()
checks).

This should ensure that if /usr/ or / is for some reason a LUKS medium
we won't try to detach it during runtime, which likely fails, since we
run off it.

Note this also moves an ordering dep towards umount.target under the
x-initrd.attach check, becasue that's where the crucial conflicts dep is
placed too.

2 years agounits: don't stop blockdev@.target unit at shutdown
Lennart Poettering [Thu, 1 Jun 2023 16:31:17 +0000 (18:31 +0200)] 
units: don't stop blockdev@.target unit at shutdown

We want that cryptsetup/veritysetup devices can stick around until the
very end, as well as the users of them which might depend on
blockdev@.target for the devices. Hence leave the targets around till
the very end.

Note that their runtime is managed via StopWhenUnneeded= anyway, hence
unless their are volumes that actually survive still the very end they
target units will still be stopped.

2 years agounits: set DefaultDependencies=no for veritysetup slice
Lennart Poettering [Thu, 1 Jun 2023 16:28:08 +0000 (18:28 +0200)] 
units: set DefaultDependencies=no for veritysetup slice

This mimics what we already have for cryptsetup services: the slice they
are placed in (they have their own slice since that's what we do by
default for instantiated services) shouldn't conflict with
shutdown.target, so that veritysetup services can stay around until the
very end (which is what we want for the root and usr verity volumes).

It's literally just a copy of the same unit we already have for
cryptsetup, just with an updated description string.

2 years agoveritysetup-generator: use generic veritysetup writers at one more place
Lennart Poettering [Thu, 1 Jun 2023 15:20:59 +0000 (17:20 +0200)] 
veritysetup-generator: use generic veritysetup writers at one more place

Let's use the common generator_write_veritysetup_unit_section(),
ggenerator_write_veritysetup_service_section(), generator_add_symlink()
implementation we already have at one more place.

This mostly generates the same unit, but for the first time hooks up
blockdev@dev-mapper-*.device for the device, which means things like
growfs on usr+root volumes will actually work now. (I mean, growfs
won#t, because verity devices are immutable after all, but things *like*
it that want to run between the device popping up and being mounted.)

2 years agocryptsetup: fix whitespace issue
Lennart Poettering [Thu, 1 Jun 2023 16:49:16 +0000 (18:49 +0200)] 
cryptsetup: fix whitespace issue

2 years agofstab-util: drop redundant check
Lennart Poettering [Thu, 1 Jun 2023 12:48:55 +0000 (14:48 +0200)] 
fstab-util: drop redundant check

fstab_test_option() checks this as first thing anyway, hence let's drop
the redundant check.

2 years agosd-journal: fix assignment of tail entry offset
Yu Watanabe [Tue, 16 May 2023 21:02:00 +0000 (06:02 +0900)] 
sd-journal: fix assignment of tail entry offset

Fixes a bug introduced by 206f0f397edf1144c63a158fb30f496c3e89f256.

2 years agobuild(deps): bump github/codeql-action from 2.2.9 to 2.3.5
dependabot[bot] [Thu, 1 Jun 2023 09:57:12 +0000 (09:57 +0000)] 
build(deps): bump github/codeql-action from 2.2.9 to 2.3.5

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.9 to 2.3.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/04df1262e6247151b5ac09cd2c303ac36ad3f62b...0225834cc549ee0ca93cb085b92954821a145866)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 years agobuild(deps): bump meson from 1.1.0 to 1.1.1 in /.github/workflows
dependabot[bot] [Thu, 1 Jun 2023 09:57:18 +0000 (09:57 +0000)] 
build(deps): bump meson from 1.1.0 to 1.1.1 in /.github/workflows

Bumps [meson](https://github.com/mesonbuild/meson) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.1.0...1.1.1)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agotest: make TEST-04 stable once again
Frantisek Sumsal [Thu, 1 Jun 2023 07:07:28 +0000 (09:07 +0200)] 
test: make TEST-04 stable once again

Wait a bit if necessary for the cursor file to appear.

Follow-up fb35feae97.

2 years agoMerge pull request #27874 from keszybz/test-bus-server-shortening
Yu Watanabe [Thu, 1 Jun 2023 12:10:55 +0000 (21:10 +0900)] 
Merge pull request #27874 from keszybz/test-bus-server-shortening

Simplify the code in test-bus-server

2 years agotest-sizeof: let's be a tiny bit more careful when using glibc internal types
Lennart Poettering [Thu, 1 Jun 2023 08:46:47 +0000 (10:46 +0200)] 
test-sizeof: let's be a tiny bit more careful when using glibc internal types

One can argue that internal glibc types (i.e. those starting with __)
are not really part of the glibc API, hence let's at least ifdef them.

2 years agobuild(deps): bump redhat-plumbers-in-action/advanced-issue-labeler
dependabot[bot] [Thu, 1 Jun 2023 09:57:18 +0000 (09:57 +0000)] 
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.4 to 2.0.6.
- [Release notes](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/releases)
- [Commits](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/compare/25a1e41826424cdf577c71b58c852df4347f13b8...71bcf99aef4b9ea844db9a43755e8ac02c8e661e)

---
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>
2 years agobuild(deps): bump actions/labeler from 4.0.3 to 4.0.4
dependabot[bot] [Thu, 1 Jun 2023 09:57:05 +0000 (09:57 +0000)] 
build(deps): bump actions/labeler from 4.0.3 to 4.0.4

Bumps [actions/labeler](https://github.com/actions/labeler) from 4.0.3 to 4.0.4.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](https://github.com/actions/labeler/compare/ba790c862c380240c6d5e7427be5ace9a05c754b...0776a679364a9a16110aac8d0f40f5e11009e327)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agobuild(deps): bump redhat-plumbers-in-action/differential-shellcheck
dependabot[bot] [Thu, 1 Jun 2023 09:57:07 +0000 (09:57 +0000)] 
build(deps): bump redhat-plumbers-in-action/differential-shellcheck

Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 4.0.2 to 4.2.2.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/redhat-plumbers-in-action/differential-shellcheck/compare/d24099b9f39ddee81dea31eb0e135e0a623cb2b8...ac4483d8c6713bd2011037f44fe626989468af74)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoMerge pull request #27856 from arianvp/fix-bootctl-status
Zbigniew Jędrzejewski-Szmek [Thu, 1 Jun 2023 08:25:30 +0000 (10:25 +0200)] 
Merge pull request #27856 from arianvp/fix-bootctl-status

bootctl: Print version number of detected binaries again

2 years agotest-bus-server: simplify return value handling 27874/head
Zbigniew Jędrzejewski-Szmek [Wed, 31 May 2023 15:22:23 +0000 (17:22 +0200)] 
test-bus-server: simplify return value handling

Follow-up for f7794e423ae79325bdbf7b3637b7cb7a1a57e62e.

2 years agovarious: remove typo/unusual spelling
Zbigniew Jędrzejewski-Szmek [Wed, 31 May 2023 15:17:26 +0000 (17:17 +0200)] 
various: remove typo/unusual spelling

Wikitionary says that "noone" is known, but not preferred by a large margin.
(It's also an obsolete spelling of "noon".)

2 years agoMerge pull request #27796 from yuwata/memstream-util
Yu Watanabe [Thu, 1 Jun 2023 03:07:17 +0000 (12:07 +0900)] 
Merge pull request #27796 from yuwata/memstream-util

util: introduce memstream-util

2 years agonetworkd/dhcpserver: Save and expose the client hostname sent when requesting a DHCP...
Rene Hollander [Sat, 27 May 2023 11:33:37 +0000 (13:33 +0200)] 
networkd/dhcpserver: Save and expose the client hostname sent when requesting a DHCP lease.

DHCP clients often send their own hostname in option 12. It can be useful
to store it with the lease so it can be shown to a human to easily identify
which lease belongs to which device.

RFC: https://www.rfc-editor.org/rfc/rfc2132#section-3.14

2 years agotree-wide: use memstream-util 27796/head
Yu Watanabe [Fri, 26 May 2023 06:40:12 +0000 (15:40 +0900)] 
tree-wide: use memstream-util

2 years agoutil: introduce memstream-util
Yu Watanabe [Fri, 26 May 2023 06:22:03 +0000 (15:22 +0900)] 
util: introduce memstream-util

There is many pitfalls in using memstream.
Let's introduce a wrapper to make us safely use it.

2 years agocalendarspec: rename arguments
Yu Watanabe [Sun, 28 May 2023 14:03:26 +0000 (23:03 +0900)] 
calendarspec: rename arguments

2 years agoelf-util: rename stack_context_destroy() -> stack_context_done()
Yu Watanabe [Sun, 28 May 2023 13:56:02 +0000 (22:56 +0900)] 
elf-util: rename stack_context_destroy() -> stack_context_done()

2 years agosd-bus: rename introspect_free() -> introspect_done
Yu Watanabe [Sun, 28 May 2023 13:53:23 +0000 (22:53 +0900)] 
sd-bus: rename introspect_free() -> introspect_done

2 years agotree-wide: use _cleanup_set_free_ and friends
Yu Watanabe [Sun, 28 May 2023 13:33:44 +0000 (22:33 +0900)] 
tree-wide: use _cleanup_set_free_ and friends

Instead of _cleanup_(set_freep) or so.

2 years agooomd: drop unused key
Yu Watanabe [Sun, 28 May 2023 12:43:45 +0000 (21:43 +0900)] 
oomd: drop unused key

2 years agocore/cgroup: fix setting SocketBindAllow=/SocketBindDeny= through DBus
Yu Watanabe [Sun, 28 May 2023 06:46:14 +0000 (15:46 +0900)] 
core/cgroup: fix setting SocketBindAllow=/SocketBindDeny= through DBus

2 years agocore/transaction: drop job that has unfulfilled required (Requires, BindsTo) dependencies
Michal Sekletar [Tue, 30 May 2023 13:47:16 +0000 (15:47 +0200)] 
core/transaction: drop job that has unfulfilled required (Requires, BindsTo) dependencies

Resolves: #11338

2 years agoman: vconsole.conf: replace the hardcoded keymap with build-time default
Mike Yuan [Wed, 31 May 2023 13:10:46 +0000 (21:10 +0800)] 
man: vconsole.conf: replace the hardcoded keymap with build-time default

Follow-up for #26089

2 years agotest: skip the test early if we're built without systemd-homed
Frantisek Sumsal [Wed, 31 May 2023 13:40:33 +0000 (15:40 +0200)] 
test: skip the test early if we're built without systemd-homed

We check for homed stuff in the test itself, but this is way too late,
since we already started a unit that Requires=systemd-homed.service
(testsuite-46.service). For now this doesn't matter, but with #27852
the offending transaction is dropped from the job queue, making the test
fail.

Spotted in #27852 in Ubuntu CI.

2 years agoMerge pull request #27826 from yuwata/network-link-ready-without-ndisc-when-has-stati...
Yu Watanabe [Wed, 31 May 2023 21:29:55 +0000 (06:29 +0900)] 
Merge pull request #27826 from yuwata/network-link-ready-without-ndisc-when-has-static-address

network: do not request dynamic addressing protocols finished when at…

2 years agoMerge pull request #27628 from ddstreet/tpm2_header_cleanup
Daan De Meyer [Wed, 31 May 2023 21:06:14 +0000 (23:06 +0200)] 
Merge pull request #27628 from ddstreet/tpm2_header_cleanup

Tpm2 header cleanup

2 years agoMerge pull request #27844 from DaanDeMeyer/repart-arch
Daan De Meyer [Wed, 31 May 2023 21:00:19 +0000 (23:00 +0200)] 
Merge pull request #27844 from DaanDeMeyer/repart-arch

repart: Add --architecture option

2 years agowait-online: request that at least one managed online interface exists
Yu Watanabe [Mon, 29 May 2023 03:37:44 +0000 (12:37 +0900)] 
wait-online: request that at least one managed online interface exists

Fixes a regression caused by ab3aed4a0349bbaa26f53340770c1b59b463e05d.

I thought the commit does not cause any severe regression. However,
drivers for network interfaces may be loaded later. So, we should wait
if no network interface is found.

Fixes #27822.

2 years agohwdb: add support for Elgato Stream Deck mini (gen 2)
Times-Z [Wed, 31 May 2023 16:44:09 +0000 (18:44 +0200)] 
hwdb: add support for Elgato Stream Deck mini (gen 2)

2 years agounits: pull in local-fs-pre.target from systemd-tmpfiles-setup-dev.service
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 16:44:46 +0000 (18:44 +0200)] 
units: pull in local-fs-pre.target from systemd-tmpfiles-setup-dev.service

local-fs-pre.target is a passive unit, which means that it is supposed to be
pulled in by everything that is ordered before it. We had
Before=local-fs-pre.target, so add Wants= too.

I don't expect this to change anything. Instead, just make things follow the
docs so it's easier to reason about the dependency set.

2 years agoMerge pull request #27861 from poettering/find-esp-tweaks
Lennart Poettering [Wed, 31 May 2023 13:42:05 +0000 (15:42 +0200)] 
Merge pull request #27861 from poettering/find-esp-tweaks

minor tweaks to find-esp.c

2 years agoMerge pull request #27806 from DaanDeMeyer/fix-mkosi-check
Daan De Meyer [Wed, 31 May 2023 13:26:05 +0000 (15:26 +0200)] 
Merge pull request #27806 from DaanDeMeyer/fix-mkosi-check

mkosi: Use proper check to detect whether we're in a VM

2 years agotpm2: sort tpm2 symbol list 27628/head
Dan Streetman [Thu, 16 Feb 2023 23:10:55 +0000 (18:10 -0500)] 
tpm2: sort tpm2 symbol list

Only cosmetic, no functional change.

2 years agotpm2: remove all extern tpm2-tss symbols
Dan Streetman [Fri, 5 May 2023 23:49:49 +0000 (19:49 -0400)] 
tpm2: remove all extern tpm2-tss symbols

These library syms should be restricted to use only in tpm2-util.c,
and all other code should use simpler functions exported in tpm2-util.h.

Also move the Esys_Freep() cleanup function into tpm-util.c, and make
tpm2-tss symbols static.

2 years agotpm: remove external calls to dlopen_tpm2()
Dan Streetman [Fri, 5 May 2023 23:53:32 +0000 (19:53 -0400)] 
tpm: remove external calls to dlopen_tpm2()

The calls outside tpm2-util.c are redundant, as tpm2_context_new()
is always called immediately after, which then calls dlopen_tpm2().

2 years agoMerge pull request #27766 from rphibel/cleanup-cgroups-before-cleaning-units
Daan De Meyer [Wed, 31 May 2023 12:48:42 +0000 (14:48 +0200)] 
Merge pull request #27766 from rphibel/cleanup-cgroups-before-cleaning-units

Don't GC unit if it is in cgroup_empty_queue

2 years agoMerge pull request #26969 from DaanDeMeyer/xopenat-label
Daan De Meyer [Wed, 31 May 2023 12:35:50 +0000 (14:35 +0200)] 
Merge pull request #26969 from DaanDeMeyer/xopenat-label

fs-util: Add labelling support to xopenat()

2 years agobootctl: also print efi files not owned by systemd in status 27856/head
Arian van Putten [Wed, 31 May 2023 11:27:13 +0000 (13:27 +0200)] 
bootctl: also print efi files not owned by systemd in status

We should not skip over unknown entries in EFI/BOOT/ but
also print them out in status so people are aware that they are there.

2 years agomkosi: Check for failures by mounting again 27806/head
Daan De Meyer [Wed, 31 May 2023 11:03:18 +0000 (13:03 +0200)] 
mkosi: Check for failures by mounting again

We rely on vsock to communicate the exit status back to us from the
VM but vsock in Github Actions is broken so let's switch back to
mounting for now.

2 years agomkosi: Don't fail on systemd-vconsole-setup.service failure for now
Daan De Meyer [Wed, 31 May 2023 12:21:49 +0000 (14:21 +0200)] 
mkosi: Don't fail on systemd-vconsole-setup.service failure for now

Let's make CI green again and dig into this failure later

2 years agomkosi: Disable cmdline addon test for now
Daan De Meyer [Wed, 31 May 2023 11:24:10 +0000 (13:24 +0200)] 
mkosi: Disable cmdline addon test for now

This fails but we didn't notice until now because error reporting
from the mkosi VM was broken. Let's disable it for now to get CI
green again.

2 years agomkosi: Use proper check to detect whether we're in a VM
Daan De Meyer [Fri, 26 May 2023 15:38:23 +0000 (17:38 +0200)] 
mkosi: Use proper check to detect whether we're in a VM

2 years agomkosi: Blacklist vmw_vmci to avoid issues with vsock in Github Actions
Daan De Meyer [Tue, 30 May 2023 12:48:43 +0000 (14:48 +0200)] 
mkosi: Blacklist vmw_vmci to avoid issues with vsock in Github Actions

If this module is loaded, sending readiness notifications from the
VM will fail with "no route to host" so let's blacklist the module
to prevent that from happening.

2 years agomkosi: Enforce usage of vsock with qemu in CI
Daan De Meyer [Sat, 27 May 2023 09:12:22 +0000 (11:12 +0200)] 
mkosi: Enforce usage of vsock with qemu in CI

2 years agomkosi: Update to latest
Daan De Meyer [Sat, 27 May 2023 09:12:11 +0000 (11:12 +0200)] 
mkosi: Update to latest

2 years agosd-daemon: Add debug logging
Daan De Meyer [Wed, 31 May 2023 08:22:57 +0000 (10:22 +0200)] 
sd-daemon: Add debug logging

2 years agosd-daemon: Introduce pid_notify_with_fds_internal()
Daan De Meyer [Wed, 31 May 2023 08:08:47 +0000 (10:08 +0200)] 
sd-daemon: Introduce pid_notify_with_fds_internal()

No change in behavior, just refactoring

2 years agosysv-generator-test: Bump log level to info
Daan De Meyer [Wed, 31 May 2023 12:18:35 +0000 (14:18 +0200)] 
sysv-generator-test: Bump log level to info

Otherwise, non-fatal debug error logs might interfere with the test.

2 years agoMerge pull request #27860 from poettering/loopback-no-prefix-route
Lennart Poettering [Wed, 31 May 2023 12:03:04 +0000 (14:03 +0200)] 
Merge pull request #27860 from poettering/loopback-no-prefix-route

loopback-setup: only create a single loopback route when configuring 'lo'

2 years agorepart: Add --architecture option 27844/head
Daan De Meyer [Tue, 30 May 2023 08:11:23 +0000 (10:11 +0200)] 
repart: Add --architecture option

This option allows overriding the architecture that's used for the
architecture specific partition types. This is useful to allow
reusing the same repart configuration to produce the same image for
different architectures.

2 years agogpt: Add gpt_partition_type_override_architecture()
Daan De Meyer [Wed, 31 May 2023 11:44:00 +0000 (13:44 +0200)] 
gpt: Add gpt_partition_type_override_architecture()

Let's add a function that allows changing the architecture of a given
partition type.

2 years agogpt: Use FOREACH_ARRAY
Daan De Meyer [Wed, 31 May 2023 11:32:23 +0000 (13:32 +0200)] 
gpt: Use FOREACH_ARRAY

2 years agofs-util: Add XOpenFlags with XO_LABEL flag to have xopenat() MAC label files/dirs 26969/head
Daan De Meyer [Sun, 26 Mar 2023 17:48:57 +0000 (19:48 +0200)] 
fs-util: Add XOpenFlags with XO_LABEL flag to have xopenat() MAC label files/dirs

2 years agolabel: Introduce LabelOps to do pre/post labelling operations
Daan De Meyer [Sun, 26 Mar 2023 16:20:41 +0000 (18:20 +0200)] 
label: Introduce LabelOps to do pre/post labelling operations

By default, label_ops is initialized with a NULL pointer which translates
to noop labelling operations. In mac_selinux_init() and the new mac_smack_init(),
we initialize label_ops with a MAC specific LabelOps pointer.

We also introduce mac_init() to initialize any configured MACs and replace all
usages of mac_selinux_init() with mac_init().

2 years agoMerge pull request #27848 from keszybz/man-page-fixes
Luca Boccassi [Wed, 31 May 2023 10:13:51 +0000 (11:13 +0100)] 
Merge pull request #27848 from keszybz/man-page-fixes

Man page fixes

2 years agoMerge pull request #27858 from mrc0mmand/followups
Luca Boccassi [Wed, 31 May 2023 10:09:53 +0000 (11:09 +0100)] 
Merge pull request #27858 from mrc0mmand/followups

Use structured initialization in two more places

2 years agoMerge pull request #27853 from keszybz/various-bits-and-pieces-included-to-reuse...
Luca Boccassi [Wed, 31 May 2023 10:08:36 +0000 (11:08 +0100)] 
Merge pull request #27853 from keszybz/various-bits-and-pieces-included-to-reuse-the-ci-run

Various bits and pieces included to reuse the ci run

2 years agoMerge pull request #27840 from mrc0mmand/gcc-13
Luca Boccassi [Wed, 31 May 2023 10:07:22 +0000 (11:07 +0100)] 
Merge pull request #27840 from mrc0mmand/gcc-13

ci: add gcc-13, drop gcc-12

2 years agoMerge pull request #27519 from yuwata/journalctl-fixes
Luca Boccassi [Wed, 31 May 2023 10:05:54 +0000 (11:05 +0100)] 
Merge pull request #27519 from yuwata/journalctl-fixes

journalctl: several fixes and cleanups for --follow

2 years agoMerge pull request #27835 from keszybz/test-58-repart-modernization
Luca Boccassi [Wed, 31 May 2023 10:00:18 +0000 (11:00 +0100)] 
Merge pull request #27835 from keszybz/test-58-repart-modernization

Cleanup/simplifications for TEST-58-repart

2 years agotest-fstab-generator: fix test on systemd with systemd-boot
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 20:53:43 +0000 (22:53 +0200)] 
test-fstab-generator: fix test on systemd with systemd-boot

(… or other boot loaders implementing the Boot Loader Interface.)

Fixes #27857.

2 years agotest-loopback: run test in network + user namespace 27860/head
Lennart Poettering [Wed, 31 May 2023 07:41:26 +0000 (09:41 +0200)] 
test-loopback: run test in network + user namespace

This way it can actually do useful testing even when unprivileged.

2 years agoloopback-setup: clean up logging
Lennart Poettering [Wed, 31 May 2023 07:57:33 +0000 (09:57 +0200)] 
loopback-setup: clean up logging

All users of loopback_setup() ignore the return values (with the notable
exception of the test cases). Hence let's adjust the log messaging to
always log at LOG_WARNING level at most, and suffix messages with ",
ignoring", to make clear these failures are ignored.

2 years agoloopback-setup: set IFA_F_NOPREFIXROUTE when configuring 'lo' ipv6 address
Lennart Poettering [Wed, 31 May 2023 07:42:45 +0000 (09:42 +0200)] 
loopback-setup: set IFA_F_NOPREFIXROUTE when configuring 'lo' ipv6 address

Otherwise the kernel will set up two routes to ::1, one in the "main",
and one in the "local" routing table.

Fixes: #25819
2 years agofind-esp: drop some redundant 'else' 27861/head
Lennart Poettering [Wed, 31 May 2023 07:37:24 +0000 (09:37 +0200)] 
find-esp: drop some redundant 'else'

2 years agofind-esp: change "unprivileged_mode" parameter to be tristate
Lennart Poettering [Wed, 31 May 2023 07:32:52 +0000 (09:32 +0200)] 
find-esp: change "unprivileged_mode" parameter to be tristate

Previously, unprivileged mode for find_esp_and_warn() and
find_xbootldr_and_warn() could be enabled or disabled. With this change
it can also be set to negative in which case the functions will enable
it automatically if found to be executing without privileges.

This just moves te geteuid() check we often do for the param inside of
the functions.

At the same time internally in the functions we also pass around the
VerifyESPFlags field across the various functions instead of booleans.

Both changes are just refactoring. No changes in behaviour.

2 years agotmpfiles: use same credstore perms everywhere
Lennart Poettering [Tue, 30 May 2023 13:13:38 +0000 (15:13 +0200)] 
tmpfiles: use same credstore perms everywhere

In b6033b706028a64e9affb79050ced1ad9a4f5b43 support was added to create
{/etc|/run}/credstore{|.encrypted} via tmpfiles.d with perms 0000. These
perms are so restrictive that not even root can access them unless it
has CAP_DAC_OVERRIDE capability. This is creates the dirs at boot time

In 24039e1207c169b18adf5234ad300ea3ba1b671e support was added to create
/etc/credstore with perm 0700 from meson.build at build time.

This patch makes unifies the two parts:

1. creates both /etc/credstore *and* /etc/credstore.encrypted in both
   places (the build system still won't create them in /run/, since
   that's pointless since not shipped, and the runtime won't create the
   dirs below /usr/lib/, since that's not generically writable anyway).

2. Both at runtime and at build time we'll create the dirs with mode
   0700. This is easier for packaging tools to handle since they
   generally react pretty negatively on dirs they can't enumerate.