Commit graph

70056 commits

Author SHA1 Message Date
Luca Boccassi 5af0f171f9 udev: add upper bound of 5 hours to SYSTEMD_UDEV_EXTRA_TIMEOUT_SEC=
Follow-up for b16c6076cb

CID#1533111
2024-01-04 14:30:20 +01:00
Luca Boccassi 43108bf87a dissect: add assert to guide static analysis
CID#1533112
2024-01-04 14:30:20 +01:00
Luca Boccassi c658ad79f0 core: add an assert to guide static analysis
Follow-up for 4fb0d2dc14

CID#1533110
2024-01-04 14:30:20 +01:00
Lennart Poettering 5863f1da42 execute: make sure Type=exec and PAMName= work together
If PAMName= is used we'll spawn a PAM session for the service, and leave
a process around that closes the PAM session eventually. That process
must close the "exec_fd" that we use to implement Type=exec. After all
the logic relies on the fact that execve() will implicitly close the
exec_fd, and the EOF seen on it is hence indication for the service
manager that execve() has worked. But if we keep an fd open in the PAM
service process, then this is not going to work.

Hence close the fd explicitly so that it definitely doesn't stay pinned
in the child.
2024-01-04 21:03:51 +08:00
Alberto Planas 59fe7e6ef1 Fix typo in verb_make_policy explanation
Signed-off-by: Alberto Planas <aplanas@suse.com>
2024-01-04 13:46:04 +01:00
Gabríel Arthúr Pétursson ab39d29606 pcrlock: Print correct NV index when writing new policy 2024-01-04 12:42:57 +00:00
Mike Yuan 17b1c60ccd
Merge pull request #30725 from YHNdnzj/string-util
string-util,strv: follow-ups
2024-01-04 20:34:41 +08:00
Yu Watanabe f475584ebf network/netdev: call done() per netdev kind before freeing netdev name or so
Otherwise, log_netdev_xyz() does not provide netdev name if it is called
in done(). It is hard to debug.

This should not change any effective behavior, at least with the current
implementation of done() per netdev kind.
2024-01-04 20:34:14 +08:00
Mike Yuan efc438d928 tpm2-generator: sort includes 2024-01-04 20:33:32 +08:00
Lennart Poettering d38c0b105b logind: use FOREACH_ARRAY() where appropriate 2024-01-04 20:32:26 +08:00
Lennart Poettering 3dc8b2df12 pam_systemd_home: minor coding style adjustment 2024-01-04 12:49:25 +01:00
Lennart Poettering faef9ba27f homed: add some function parameter assert()s 2024-01-04 12:47:15 +01:00
Lennart Poettering 5157b0d823 logind: cast various calls that return errors we ignore to (void) 2024-01-04 12:46:04 +01:00
Luca Boccassi 2717d36d9d core: fix cgroup copy
Follow-up for 84c01612de

CID#1533113
2024-01-04 12:42:23 +01:00
Luca Boccassi cae58298dd core: fix OOM check
Follow-up for 84c01612de

CID#1533114
2024-01-04 12:41:31 +01:00
Lennart Poettering e1ccf6b2b5 pam_systemd_home: port over to pam_get_item_many() 2024-01-04 12:29:37 +01:00
Lennart Poettering c0cb9e4ae9 pam_systemd: move over to pam_get_item_many() 2024-01-04 12:29:37 +01:00
Mike Yuan 5317451f12
man/loginctl: document "self" and "auto" special session IDs
session-status automatically uses "auto" if no ID is specified,
but show-session shows the manager's properties. Let's document
these special values so that users of show-session can benefit too.
2024-01-04 19:26:47 +08:00
Lennart Poettering f47d75de51 pam-util: add pam_get_item_many() helper that gets many PAM items at once
Just to shorten a bit of code.
2024-01-04 12:26:40 +01:00
Mike Yuan 771240fa3d
man/loginctl: use <literal> to quote possible values of --kill-whom= 2024-01-04 18:59:38 +08:00
Mike Yuan 5446a52b39
TEST-35-LOGIN: enable FileDescriptorStorePreserve= for coldplug test 2024-01-04 17:14:23 +08:00
Lennart Poettering 6d5743c411
Merge pull request #30513 from rpigott/resolved-ede
resolved: support RFC 8914 EDE error codes
2024-01-04 09:59:19 +01:00
Mike Yuan 2e6f012bf0
strv: rename strv_endswith to endswith_strv and dedup ENDSWITH_SET 2024-01-04 16:51:57 +08:00
Mike Yuan eba8b54130
string-util: move startswith_strv to strv 2024-01-04 16:49:05 +08:00
Mike Yuan 53190aa693
string-util: use strneq 2024-01-04 16:49:05 +08:00
Mike Yuan 3c1e6909d5
string-util-fundamental: postfix -> suffix, use streq 2024-01-04 16:30:10 +08:00
Mike Yuan 0ae9073f15
logind-session: watch pidfd in session_set_leader_consume 2024-01-04 16:19:20 +08:00
Mike Yuan 9d5b690100
logind: serialize session leader pidfd to fdstore 2024-01-04 16:19:20 +08:00
Mike Yuan faf0dd4b29
process-util: ensure pidref_is_alive only return ESRCH if not set 2024-01-04 16:19:20 +08:00
Mike Yuan fdbb56dc1f
logind-session: use one_zero where appropriate 2024-01-04 16:19:19 +08:00
Mike Yuan 889975bb00
logind-session: be tolerant if we failed to remove leader from hashmap
If something wrong happened before hashmap_put(), session_free()
may be called through gc logic, and the assertion is triggered.
2024-01-04 16:19:19 +08:00
Mike Yuan af1a6c97b6
logind: use RET_GATHER more, return first error 2024-01-04 16:19:16 +08:00
Ronan Pigott 9ca133e97a resolved: add transaction result for upstream failures
This new transaction result is emitted when the upstream server
indicates a fatal error that we will not try to recover from.

Currently, it is emitted when a validating recursive resolver reports an
error validating dnssec records for a domain. The extended error message
should help give context to the admin.
2024-01-03 17:35:02 -07:00
Ronan Pigott ac6844460c resolved: support RFC 8914 EDE error codes
If the server is able to indicate an extended error to us, using a
degraded feature set is unlikely to help.
2024-01-03 17:25:07 -07:00
Ronan Pigott 3fcd83645a resolved: delay server feature detection
Some fields of the DnsPacket are not populated until we extract an
answer, like p->opt, despite being referenced by macros like
DNS_PACKET_RCODE. We can reorder some of the basic checks to follow
dns_packet_extract.
2024-01-03 17:25:07 -07:00
Ronan Pigott 980cb160eb dns: remove some magic numbers
Let's use enum values for the EDNS codes now that we have them, for
readability.
2024-01-03 17:25:07 -07:00
Ronan Pigott 056db7863e dns: introduce more EDNS codes from IANA 2024-01-03 17:25:07 -07:00
Lennart Poettering 2a02a8db91
Merge pull request #26663 from poettering/vpick
add new "vpick" concept for automatically picking newest resource from .v/ dir containing versioned files
2024-01-03 22:17:32 +01:00
Yu Watanabe 82a1597778
Merge pull request #28797 from Werkov/eff_limits
Add MemoryMaxEffective=, MemoryHighEffective= and TasksMaxEff…  …ective= properties
2024-01-04 05:38:06 +09:00
Michal Sekletar 508b4786e8 logind: don't setup idle session watch for lock-screen and greeter
Reason to skip the idle session logic for these session classes is that
they are idle by default.
2024-01-04 05:27:41 +09:00
Rose b4a9d19e4e basic: fix overflow detection in sigbus_pop
The current check checks for n_sigbus_queue
being greater than or equal to SIGBUS_QUEUE_MAX,
when it should be just greater than as
n_sigbus_queue being SIGBUS_QUEUE_MAX indicates
that the queue is full, but not overflowed.
2024-01-04 05:26:01 +09:00
Yu Watanabe f3f6c65618
Merge pull request #30710 from YHNdnzj/logind-ret-gather
logind-session: modernization
2024-01-04 05:25:41 +09:00
Frantisek Sumsal c707e346fb test: temporarily adjust the default mount rate limit
(Hopefully) a temporary workaround for #30573 where starting a user
session when PID 1 is rate limited stalls even after it leaves the rate
limited state:

[   11.658201] H systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=UnitRemoved cookie=4208 reply_cookie=0 signature=so error-name=n/a error-mes>
[   11.658233] H systemd[1]: Event source 0x559babdd8bb0 (mount-monitor-dispatch) left rate limit state.
[  101.562697] H busctl[784]: Failed to get credentials: Transport endpoint is not connected
[  101.563480] H systemd[1]: systemd-journald.service: Got notification message from PID 300 (WATCHDOG=1)
[  101.563725] H testsuite-74.sh[784]: BusAddress=unixexec:path=systemd-run,argv1=-M.host,argv2=-PGq,argv3=--wait,argv4=-pUser%3dtestuser,argv5=-pPAMName%3dlogin,argv6=systemd-stdio-bridge,argv7=-punix:path%3d%24%7bXDG_RUNTIME_DIR%7d/bus
[  101.564136] H systemd[1]: Successfully forked off '(sd-expire)' as PID 787.
[  101.564754] H systemd[1]: Successfully forked off '(sd-expire)' as PID 788.
[  101.564831] H testsuite-74.sh[381]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/testsuite-74.busctl.sh failed'

The issue appeared after ee07fff03b which does a bunch of mounts/umounts
that get PID 1 into a rate limited state, and is frequent enough to be
annoying, so let's temporarily bump the rate limit to alleviate that.
2024-01-04 05:24:47 +09:00
Frantisek Sumsal 519f0074cf test: install correct kpartx udev rules on Debian
Resolves: #30703
2024-01-04 05:24:20 +09:00
Yu Watanabe 124c712692
Merge pull request #30532 from yuwata/udev-extend-timeout-kill-worker
udev: extend timeout to prevent kill worker
2024-01-04 05:21:50 +09:00
Yu Watanabe aea57b1415
Merge pull request #28836 from msekletar/aux-scope
core/manager: add dbus API to create auxiliary scope from running service
2024-01-04 04:52:39 +09:00
Dmitry Konishchev 0e1ab2261c Fix KeepCarrier tun/tap device option
When KeepCarrier is set, networkd doesn't close tun/tap file descriptor
preserving the active interface state, but doesn't disable its queue
which makes kernel to think that it's still active and send packets to
it.

This patch disables the created queue right after tun/tap interface
creation.

Here is the steps to reproduce the bug:

Having:

systemd/network/10-tun-test.netdev:

    [NetDev]
    Name=tun-test
    Kind=tun

    [Tun]
    MultiQueue=yes
    KeepCarrier=yes

systemd/network/10-tun-test.network:

    [Match]
    Name=tun-test

    [Network]
    DHCP=no
    IPv6AcceptRA=false

    LLMNR=false
    MulticastDNS=false

    Address=172.31.0.1/24

app.c:

    #include <fcntl.h>
    #include <stdio.h>
    #include <string.h>
    #include <unistd.h>
    #include <linux/if.h>
    #include <sys/ioctl.h>
    #include <linux/if_tun.h>

    int main() {
        int fd;
        struct ifreq ifr;

        memset(&ifr, 0, sizeof ifr);
        strcpy(ifr.ifr_name, "tun-test");
        ifr.ifr_flags = IFF_TUN | IFF_NO_PI | IFF_MULTI_QUEUE;

        if((fd = open("/dev/net/tun", O_RDWR)) < 0) {
            perror("Open error");
            return 1;
        }

        if(ioctl(fd, TUNSETIFF, &ifr)) {
            perror("Configure error");
            return 1;
        }

        puts("Ready.");

        char buf[1500];

        while(1) {
            int size = read(fd, buf, sizeof buf);
            if(size < 0) {
                perror("Read error");
                return 1;
            }
            printf("Read %d bytes.\n", size);
        }

        return 0;
    }

Run:
* gcc -o app app.c && ./app
* ping -I tun-test 172.31.0.2

Before the patch the app shows no pings, but after it works properly.
2024-01-04 04:37:39 +09:00
Lennart Poettering 97c493f214 update TODO 2024-01-03 19:01:37 +01:00
Lennart Poettering 0345366ac3 tests: add integration tests for vpick logic 2024-01-03 19:01:37 +01:00
Lennart Poettering 7d93e4af80 man: document the new vpick concept 2024-01-03 18:38:46 +01:00