systemd.git
5 months agotest: unset TZ before timezone-sensitive unit tests are run
Luca Boccassi [Fri, 26 Jan 2024 00:22:38 +0000 (00:22 +0000)]
test: unset TZ before timezone-sensitive unit tests are run

Some tests have hard-coded results that need to match, and change if
the caller has a timezone set via the TZ= environment variable, as it
is the case during reproducible build tests. Unset it.

(cherry picked from commit 1e902c3463024bb328bf0d01a5d58a69e1ccf739)
(cherry picked from commit 85c88db9c64242f65c814f1ede467ef66066e663)
(cherry picked from commit d7fa5b8acbb5013992ae93c120845f0dc3fcfa93)
(cherry picked from commit 4d6d1a9f0557771e09a210ea9e83a7ed20df78de)
(cherry picked from commit d91a1c0f2c661731bc8a2149807ed9fd613b7c80)

Gbp-Pq: Name test-unset-TZ-before-timezone-sensitive-unit-tests-are-ru.patch

5 months agoshared/calendarspec: when mktime() moves us backwards, jump forward
Zbigniew Jędrzejewski-Szmek [Mon, 22 Mar 2021 11:51:47 +0000 (12:51 +0100)]
shared/calendarspec: when mktime() moves us backwards, jump forward

When trying to calculate the next firing of 'Sun *-*-* 01:00:00', we'd fall
into an infinite loop, because mktime() moves us "backwards":

Before this patch:
tm_within_bounds: good=0 2021-03-29 01:00:00 → 2021-03-29 00:00:00
tm_within_bounds: good=0 2021-03-29 01:00:00 → 2021-03-29 00:00:00
tm_within_bounds: good=0 2021-03-29 01:00:00 → 2021-03-29 00:00:00
...

We rely on mktime() normalizing the time. The man page does not say that it'll
move the time forward, but our algorithm relies on this. So let's catch this
case explicitly.

With this patch:
$ TZ=Europe/Dublin faketime 2021-03-21 build/systemd-analyze calendar --iterations=5 'Sun *-*-* 01:00:00'
Normalized form: Sun *-*-* 01:00:00
    Next elapse: Sun 2021-03-21 01:00:00 GMT
       (in UTC): Sun 2021-03-21 01:00:00 UTC
       From now: 59min left
       Iter. #2: Sun 2021-04-04 01:00:00 IST
       (in UTC): Sun 2021-04-04 00:00:00 UTC
       From now: 1 weeks 6 days left           <---- note the 2 week jump here
       Iter. #3: Sun 2021-04-11 01:00:00 IST
       (in UTC): Sun 2021-04-11 00:00:00 UTC
       From now: 2 weeks 6 days left
       Iter. #4: Sun 2021-04-18 01:00:00 IST
       (in UTC): Sun 2021-04-18 00:00:00 UTC
       From now: 3 weeks 6 days left
       Iter. #5: Sun 2021-04-25 01:00:00 IST
       (in UTC): Sun 2021-04-25 00:00:00 UTC
       From now: 1 months 4 days left

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1941335.

(cherry picked from commit 129cb6e249bef30dc33e08f98f0b27a6de976f6f)

Gbp-Pq: Name shared-calendarspec-when-mktime-moves-us-backwards-jump-f.patch

5 months agoshared/calendarspec: abort calculation after 1000 iterations
Zbigniew Jędrzejewski-Szmek [Sun, 21 Mar 2021 19:59:32 +0000 (20:59 +0100)]
shared/calendarspec: abort calculation after 1000 iterations

We have a bug where we seem to enter an infinite loop when running in the
Europe/Dublin timezone. The timezone is "special" because it has negative SAVE
values. The handling of this should obviously be fixed, but let's use a
belt-and-suspenders approach, and gracefully fail if we fail to find an answer
within a specific number of attempts. The code in this function is rather
complex, and it's hard to rule out another bug in the future.

(cherry picked from commit 169615c9a8cdc54d748d4dfc8279be9b3c2bec44)

Gbp-Pq: Name shared-calendarspec-abort-calculation-after-1000-iteratio.patch

5 months agoAlways free deserialized_subscribed on reload
Ali Abdallah [Thu, 21 Jan 2021 06:37:21 +0000 (07:37 +0100)]
Always free deserialized_subscribed on reload

Otherwise, it will keep consuming memory on systemctl daemon-reload.

(cherry picked from commit 3deed59afdc2c18ecb76fe90b9bba0cd66045dfa)

Gbp-Pq: Name Always-free-deserialized_subscribed-on-reload.patch

5 months agomachined-varlink: fix double free
David Tardon [Mon, 2 Aug 2021 11:31:04 +0000 (13:31 +0200)]
machined-varlink: fix double free

Fixes: #18599
Gbp-Pq: Name machined-varlink-fix-double-free.patch

5 months agotime-util: fix buffer-over-run
Yu Watanabe [Thu, 7 Jul 2022 09:27:02 +0000 (18:27 +0900)]
time-util: fix buffer-over-run

Fixes #23928.

(cherry picked from commit 9102c625a673a3246d7e73d8737f3494446bad4e)
(cherry picked from commit 72d4c15a946d20143cd4c6783c802124bc894dc7)
(cherry picked from commit c32530f5bdd11c74e8f5a86eecd7c36b3bae739f)
(cherry picked from commit b2a25b5e64345bd0bb7697a956d33afd6980286a)
(cherry picked from commit 858dc1ad609290cc4ca288acf87046ee295c3d51)

Gbp-Pq: Name time-util-fix-buffer-over-run.patch

5 months agocoredump: do not allow user to access coredumps with changed uid/gid/capabilities
Zbigniew Jędrzejewski-Szmek [Mon, 28 Nov 2022 11:12:55 +0000 (12:12 +0100)]
coredump: do not allow user to access coredumps with changed uid/gid/capabilities

When the user starts a program which elevates its permissions via setuid,
setgid, or capabilities set on the file, it may access additional information
which would then be visible in the coredump. We shouldn't make the the coredump
visible to the user in such cases.

Reported-by: Matthias Gerstner <mgerstner@suse.de>
This reads the /proc/<pid>/auxv file and attaches it to the process metadata as
PROC_AUXV. Before the coredump is submitted, it is parsed and if either
at_secure was set (which the kernel will do for processes that are setuid,
setgid, or setcap), or if the effective uid/gid don't match uid/gid, the file
is not made accessible to the user. If we can't access this data, we assume the
file should not be made accessible either. In principle we could also access
the auxv data from a note in the core file, but that is much more complex and
it seems better to use the stand-alone file that is provided by the kernel.

Attaching auxv is both convient for this patch (because this way it's passed
between the stages along with other fields), but I think it makes sense to save
it in general.

We use the information early in the core file to figure out if the program was
32-bit or 64-bit and its endianness. This way we don't need heuristics to guess
whether the format of the auxv structure. This test might reject some cases on
fringe architecutes. But the impact would be limited: we just won't grant the
user permissions to view the coredump file. If people report that we're missing
some cases, we can always enhance this to support more architectures.

I tested auxv parsing on amd64, 32-bit program on amd64, arm64, arm32, and
ppc64el, but not the whole coredump handling.

(cherry picked from commit 3e4d0f6cf99f8677edd6a237382a65bfe758de03)
(cherry picked from commit 9b75a3d0502d6741c8ecb7175794345f8eb3827c)
(cherry picked from commit efca5283dc791a07171f80eef84e14fdb58fad57)
(cherry picked from commit 1d5e0e9910500f3c3584485f77bfc35e601036e3)
(cherry picked from commit 8215e1527d859e77dd1378fd7e42bbd32130edb3)
(cherry picked from commit 786df410b1cb3a2294c9a5d118c958525e7439e6)

Gbp-Pq: Name coredump-do-not-allow-user-to-access-coredumps-with-chang.patch

5 months agologind: fix getting property OnExternalPower via D-Bus
Michael Biebl [Wed, 12 Oct 2022 09:07:57 +0000 (11:07 +0200)]
logind: fix getting property OnExternalPower via D-Bus

The BUS_DEFINE_PROPERTY_GET_GLOBAL macro requires a value as third
argument, so we need to call manager_is_on_external_power(). Otherwise
the function pointer is interpreted as a boolean and always returns
true:

```
$ busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager OnExternalPower
b true
$ /lib/systemd/systemd-ac-power  --verbose
no
```

Thanks: Helmut Grohne <helmut@subdivi.de>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021644
(cherry picked from commit 63168cb517a556b2f4f175b365f5a4b4c7e85150)

Gbp-Pq: Name logind-fix-getting-property-OnExternalPower-via-D-Bus.patch

5 months agoudev: first set properties based on usb subsystem
Yu Watanabe [Thu, 3 Nov 2022 00:39:36 +0000 (09:39 +0900)]
udev: first set properties based on usb subsystem

After 479da1107a0d4e2f7ef5cd938512b87a0e45f180, the usb_id builtin
command does not set ID_SERIAL if ID_BUS is already set.
Before the commit, all properties set based on pci bus were overwritten
by the usb_id, hence now it is sufficient setting them only when ID_BUS is
not set yet.

Fixes #25238.

(cherry picked from commit 01e704eba982fbc1517287cd261d229ff8e0a779)

Gbp-Pq: Name udev-first-set-properties-based-on-usb-subsystem.patch

5 months agoRevert "udev: do not execute hwdb builtin import twice or thrice"
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 09:17:23 +0000 (10:17 +0100)]
Revert "udev: do not execute hwdb builtin import twice or thrice"

This reverts commit 876c75fe870846b09b54423a6b719d80bc879b27.

The patch seems to cause usb devices to get some attributes set from the parent
PCI device. 'hwdb' builtin has support for breaking iteration upwards on usb
devices. But when '--subsystem=foo' is specified, iteration is continued. I'm
sure it *could* be figured out, but it seems hard to get all the combinations
correct. So let's revert to functional status quo ante, even if does the lookup
more than once unnecessarily.

Fixes #18125.

(cherry picked from commit 451ba55fecd8b494add2001b3ca3c1915c8fd655)

Gbp-Pq: Name Revert-udev-do-not-execute-hwdb-builtin-import-twice-or-t.patch

5 months agoudev: always create device symlinks for USB disks
Yu Watanabe [Sun, 30 Oct 2022 00:43:05 +0000 (09:43 +0900)]
udev: always create device symlinks for USB disks

Previously, ata_id might not be able to retrieve attributes correctly,
and properties from usb_id were used as a fallback. See issue #24921
and PR #24923. To keep backward compatibility, still we need to create
symlinks based on USB serial.

Fixes #25179.

Gbp-Pq: Name udev-always-create-device-symlinks-for-USB-disks.patch

5 months agoata_id: Fixed getting Response Code from SCSI Sense Data (#24921)
Aleksey Vasenev [Wed, 5 Oct 2022 19:33:53 +0000 (22:33 +0300)]
ata_id: Fixed getting Response Code from SCSI Sense Data (#24921)

The Response Code is contained in the first byte of the SCSI Sense Data.
Bit number 7 is reserved or has a different meaning for some Response Codes
and is set to 1 for some drives.

(cherry picked from commit 2be1ae54badf7a3a12908a8094ebaba8f91887ca)

Gbp-Pq: Name ata_id-Fixed-getting-Response-Code-from-SCSI-Sense-Data-2.patch

5 months agovirt: detect OpenStack Nova instance
Michael Biebl [Sun, 7 Aug 2022 13:21:12 +0000 (15:21 +0200)]
virt: detect OpenStack Nova instance

(cherry picked from commit 01d9fbccddd694bc584aed24eaa0543f831dc929)

Gbp-Pq: Name virt-detect-OpenStack-Nova-instance.patch

5 months agovirt: Fix the detection for Hyper-V VMs
Boqun Feng [Tue, 23 Nov 2021 07:09:26 +0000 (15:09 +0800)]
virt: Fix the detection for Hyper-V VMs

Use product_version instead of product_name in DMI table and the string
"Hyper-V" to avoid misdetection.

Fixes: #21468
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
(cherry picked from commit 76eec0649936d9ae2f9087769f463feaf0cf5cb4)

Gbp-Pq: Name virt-Fix-the-detection-for-Hyper-V-VMs.patch

5 months agovirt: Support detection for ARM64 Hyper-V guests
Boqun Feng [Wed, 13 Oct 2021 03:32:09 +0000 (11:32 +0800)]
virt: Support detection for ARM64 Hyper-V guests

The detection of Microsoft Hyper-V VMs is done by cpuid currently,
however there is no cpuid on ARM64. And since ARM64 is now a supported
architecture for Microsoft Hyper-V guests[1], then use DMI tables to
detect a Hyper-V guest, which is more generic and works for ARM64.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7aff79e297ee1aa0126924921fd87a4ae59d2467

(cherry picked from commit 506bbc8569014253ea8614b680ccbc4fc2513a87)

Gbp-Pq: Name virt-Support-detection-for-ARM64-Hyper-V-guests.patch

5 months agoDrop bundled copy of linux/if_arp.h
Zbigniew Jędrzejewski-Szmek [Wed, 15 Sep 2021 14:33:05 +0000 (16:33 +0200)]
Drop bundled copy of linux/if_arp.h

As far as I can see, we use this to get a list of ARPHRD_* defines (used in
particular for Type= in .link files). If we drop our copy, and build against
old kernel headers, the user will have a shorter list of types available.  This
seems OK, and I don't think it's worth carrying our own version of this file
just to have newest possible entries.

7c5b9952c4f6e2b72f90edbe439982528b7cf223 recently updated this file, but we'd
have to update it every time the kernel adds new entries. But if we look at
the failure carefully:

src/basic/arphrd-from-name.gperf:65:16: error: ‘ARPHRD_MCTP’ undeclared (first use in this function); did you mean ‘ARPHRD_FCPP’?
   65 | MCTP, ARPHRD_MCTP
      |                ^~
      |                ARPHRD_FCPP

we see that the list we were generating was from the system headers, so it was
only as good as the system headers anyway, without the newer entries in our
bundled copy, if there were any. So let's make things simpler by always using
system headers.

And if somebody wants to fix things so that we always have the newest list,
then we should just generate and store the converted list, not the full header.

(cherry picked from commit e7f46ee3ae1cc66a94b293957721d68dc09d7449)

Gbp-Pq: Name Drop-bundled-copy-of-linux-if_arp.h.patch

5 months agomachine: enter target PID namespace when adding a live mount
Luca Boccassi [Wed, 13 Jan 2021 23:52:00 +0000 (23:52 +0000)]
machine: enter target PID namespace when adding a live mount

machinectl fails since 21935150a0c42b91a322105f6a9129116bfc8e2e as it's now
mounting onto a file descriptor in a target namespace, without joining the
target's PID namespace.
Note that it's not enough to setns CLONE_NEWPID, but a double-fork is required
as well, as implemented by namespace_fork().

Add a test case to TEST-13-NSPAWN to cover this use case.

(cherry picked from commit 98f654fdeab1e1b6df2be76e29e4ccbb6624898d)

Gbp-Pq: Name machine-enter-target-PID-namespace-when-adding-a-live-mou.patch

5 months agoshared/mount-util: use namespace_fork utils
Luca Boccassi [Thu, 13 Aug 2020 13:47:01 +0000 (14:47 +0100)]
shared/mount-util: use namespace_fork utils

(cherry picked from commit 2338a175fdec3859eab03115ca82a0d58453f5d7)

Gbp-Pq: Name shared-mount-util-use-namespace_fork-utils.patch

5 months agomachine: adjust error message to use 'normalized' instead of ../
Luca Boccassi [Tue, 15 Dec 2020 18:26:34 +0000 (18:26 +0000)]
machine: adjust error message to use 'normalized' instead of ../

(cherry picked from commit 724e689715c8d9f23d035ab20d8c87b6b6c06e33)

Gbp-Pq: Name machine-adjust-error-message-to-use-normalized-instead-of.patch

5 months agomachine/basic: factor out helper function to add airlocked mount to namespace
Luca Boccassi [Thu, 13 Aug 2020 13:01:34 +0000 (14:01 +0100)]
machine/basic: factor out helper function to add airlocked mount to namespace

(cherry picked from commit 6af52c3a458691b016bedeba34c1e72294a67c81)

Gbp-Pq: Name machine-basic-factor-out-helper-function-to-add-airlocked.patch

5 months agobasic: add make_mount_point_inode helper
Luca Boccassi [Sat, 19 Dec 2020 21:40:47 +0000 (21:40 +0000)]
basic: add make_mount_point_inode helper

Creates a file or a directory depending on the source path, useful
for creating mount points.

(cherry picked from commit 8bab8029105e44ce78c5e11bffa203a1135fe201)

Gbp-Pq: Name basic-add-make_mount_point_inode-helper.patch

5 months agoshared/rm-rf: loop over nested directories instead of instead of recursing
Zbigniew Jędrzejewski-Szmek [Tue, 30 Nov 2021 21:29:05 +0000 (22:29 +0100)]
shared/rm-rf: loop over nested directories instead of instead of recursing

To remove directory structures, we need to remove the innermost items first,
and then recursively remove higher-level directories. We would recursively
descend into directories and invoke rm_rf_children and rm_rm_children_inner.
This is problematic when too many directories are nested.

Instead, let's create a "TODO" queue. In the the queue, for each level we
hold the DIR* object we were working on, and the name of the directory. This
allows us to leave a partially-processed directory, and restart the removal
loop one level down. When done with the inner directory, we use the name to
unlinkat() it from the parent, and proceed with the removal of other items.

Because the nesting is increased by one level, it is best to view this patch
with -b/--ignore-space-change.

This fixes CVE-2021-3997, https://bugzilla.redhat.com/show_bug.cgi?id=2024639.
The issue was reported and patches reviewed by Qualys Team.
Mauro Matteo Cascella and Riccardo Schirone from Red Hat handled the disclosure.

(cherry picked from commit 5b1cf7a9be37e20133c0208005274ce4a5b5c6a1)
(cherry picked from commit 911516e1614e435755814ada5fc6064fa107a105)
(cherry picked from commit 6a28f8b55904c818b25e4db2e1511faac79fd471)
(cherry picked from commit c752f27b7647c99b4a17477c99d84fd8c950ddf0)
(cherry picked from commit 921810ea23357988ce67f49190f43abef1788a9c)

Gbp-Pq: Name shared-rm-rf-loop-over-nested-directories-instead-of-inst.patch

5 months agoshared/rm_rf: refactor rm_rf() to shorten code a bit
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 15:56:42 +0000 (16:56 +0100)]
shared/rm_rf: refactor rm_rf() to shorten code a bit

(cherry picked from commit 84ced330020c0bae57bd4628f1f44eec91304e69)
(cherry picked from commit 664529efa9431edc043126013ea54e6c399ae2d3)
(cherry picked from commit 811b137d6137cc3e8932599e6ef9254ba43ff5eb)
(cherry picked from commit 39a53d4f1445a8981efd0adcc1734dfad46647c5)
(cherry picked from commit aaad978868bd6ac84d463a94357ddcbc43b24248)

Gbp-Pq: Name shared-rm_rf-refactor-rm_rf-to-shorten-code-a-bit.patch

5 months agoshared/rm_rf: refactor rm_rf_children_inner() to shorten code a bit
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 14:55:45 +0000 (15:55 +0100)]
shared/rm_rf: refactor rm_rf_children_inner() to shorten code a bit

(cherry picked from commit 3bac86abfa1b1720180840ffb9d06b3d54841c11)
(cherry picked from commit 47741ff9eae6311a03e4d3d837128191826a4a3a)
(cherry picked from commit 89395b63f04f1acc0db533c32637ea20379f97c0)
(cherry picked from commit 3976f244990aa1210ebe018647f32ab060e1c3d3)
(cherry picked from commit 988e43630bb7592947c75fe530a6f7dfebc00c4f)

Gbp-Pq: Name shared-rm_rf-refactor-rm_rf_children_inner-to-shorten-cod.patch

5 months agotmpfiles: 'st' may have been used uninitialized
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 14:05:58 +0000 (15:05 +0100)]
tmpfiles: 'st' may have been used uninitialized

(cherry picked from commit 160dadc0350c77d612aa9d5569f57d9bc84c3dca)
(cherry picked from commit 7563de501246dccf5a9ea229933481aa1e7bd5c9)
(cherry picked from commit f54b97b1d05052bfee824ecc03ae9f07f6c37be8)
(cherry picked from commit ab927db9a7698ee1eceae14ecef7ab43ee3f104e)

Gbp-Pq: Name tmpfiles-st-may-have-been-used-uninitialized.patch

5 months agorm-rf: optionally fsync() after removing directory tree
Lennart Poettering [Tue, 5 Oct 2021 08:32:56 +0000 (10:32 +0200)]
rm-rf: optionally fsync() after removing directory tree

(cherry picked from commit bdfe7ada0d4d66e6d6e65f2822acbb1ec230f9c2)
(cherry picked from commit 2426beacca09d84091759be45b25c88116302184)
(cherry picked from commit 0e180f8e9c25c707b0465ad1b9447a4360f785f1)
(cherry picked from commit 9a9c2220cd3cb61c2de9c482f8ed7fa60807b14a)

Gbp-Pq: Name rm-rf-optionally-fsync-after-removing-directory-tree.patch

5 months agorm-rf: refactor rm_rf_children(), split out body of directory iteration loop
Lennart Poettering [Tue, 26 Jan 2021 15:30:06 +0000 (16:30 +0100)]
rm-rf: refactor rm_rf_children(), split out body of directory iteration loop

This splits out rm_rf_children_inner() as body of the loop. We can use
that to implement rm_rf_child() for deleting one specific entry in a
directory.

(cherry picked from commit 1f0fb7d544711248cba34615e43c5a76bc902d74)
(cherry picked from commit ca4a0e7d41f0b2a1fe2f99dbc3763187c16cf7ab)
(cherry picked from commit 85ccac3393e78d4bf2776ffb8c3a1d8a2a909a2a)
(cherry picked from commit a87d7ff1a60fe359978e12eb34224255a8f33e27)

Gbp-Pq: Name rm-rf-refactor-rm_rf_children-split-out-body-of-directory.patch

5 months agorm-rf: fstatat() might fail if containing dir has limited access mode, patch that too
Lennart Poettering [Tue, 26 Jan 2021 15:47:07 +0000 (16:47 +0100)]
rm-rf: fstatat() might fail if containing dir has limited access mode, patch that too

(cherry picked from commit 1b55621dabf741dd963f59ac706ea62cd6e3e95c)
(cherry picked from commit ce53b81a600e2162ee86e2f4d202e7f28eceb2c6)

Gbp-Pq: Name rm-rf-fstatat-might-fail-if-containing-dir-has-limited-ac.patch

5 months agobtrfs-util: add helper that abstracts "might be btrfs subvol?" check
Lennart Poettering [Fri, 26 Feb 2021 16:39:55 +0000 (17:39 +0100)]
btrfs-util: add helper that abstracts "might be btrfs subvol?" check

Let#s not hardcode inode nr 256 everywhere, but abstract this check
slightly.

(cherry picked from commit 674b04ff1b6deab17f5d36c036c0275ba94e1ebc)
(cherry picked from commit 190c6bcfc3518bec964ab740085ac88ccc86dcc7)

Gbp-Pq: Name btrfs-util-add-helper-that-abstracts-might-be-btrfs-subvo.patch

5 months agoudevadm-trigger: do not return immediately on EACCES
Yu Watanabe [Sat, 20 Feb 2021 07:30:23 +0000 (16:30 +0900)]
udevadm-trigger: do not return immediately on EACCES

Prompted by https://github.com/systemd/systemd/pull/18559.

(cherry picked from commit 0e789e6d48046d43c50dd949a71ac56f1127bb96)

Gbp-Pq: Name udevadm-trigger-do-not-return-immediately-on-EACCES.patch

5 months agobasic/unit-name: adjust comments
Zbigniew Jędrzejewski-Szmek [Wed, 23 Jun 2021 09:52:56 +0000 (11:52 +0200)]
basic/unit-name: adjust comments

We already checked for "too long" right above…

(cherry picked from commit 4e2544c30bfb95e7cb4d1551ba066b1a56520ad6)

Gbp-Pq: Name basic-unit-name-adjust-comments.patch

5 months agobasic/unit-name: do not use strdupa() on a path
Zbigniew Jędrzejewski-Szmek [Wed, 23 Jun 2021 09:46:41 +0000 (11:46 +0200)]
basic/unit-name: do not use strdupa() on a path

The path may have unbounded length, for example through a fuse mount.

CVE-2021-33910: attacked controlled alloca() leads to crash in systemd and
ultimately a kernel panic. Systemd parses the content of /proc/self/mountinfo
and each mountpoint is passed to mount_setup_unit(), which calls
unit_name_path_escape() underneath. A local attacker who is able to mount a
filesystem with a very long path can crash systemd and the whole system.

https://bugzilla.redhat.com/show_bug.cgi?id=1970887

The resulting string length is bounded by UNIT_NAME_MAX, which is 256. But we
can't easily check the length after simplification before doing the
simplification, which in turns uses a copy of the string we can write to.
So we can't reject paths that are too long before doing the duplication.
Hence the most obvious solution is to switch back to strdup(), as before
7410616cd9dbbec97cf98d75324da5cda2b2f7a2.

(cherry picked from commit 441e0115646d54f080e5c3bb0ba477c892861ab9)
(cherry picked from commit 764b74113e36ac5219a4b82a05f311b5a92136ce)
(cherry picked from commit 4a1c5f34bd3e1daed4490e9d97918e504d19733b)
(cherry picked from commit b00674347337b7531c92fdb65590ab253bb57538)

Gbp-Pq: Name basic-unit-name-do-not-use-strdupa-on-a-path.patch

5 months agounit-name: generate a clear error code when converting an overly long fs path to...
Lennart Poettering [Tue, 1 Jun 2021 17:43:55 +0000 (19:43 +0200)]
unit-name: generate a clear error code when converting an overly long fs path to a unit name

(cherry picked from commit 9d5acfab20c5f1177d877d0bec18063c0a6c5929)
(cherry picked from commit 1579dce2c2a162bb09afb9a8a46fd4f7e8fbf1d5)
(cherry picked from commit 0488b743e9c6ab1e885933eebda4ba9232003a2a)

Gbp-Pq: Name unit-name-generate-a-clear-error-code-when-convertin.patch

5 months agonetwork: Delay addition of IPv6 Proxy NDP addresses
Kevin P. Fleming [Sat, 6 Feb 2021 15:58:43 +0000 (10:58 -0500)]
network: Delay addition of IPv6 Proxy NDP addresses

Setting of IPv6 Proxy NDP addresses must be done at the same
time as static addresses, static routes, and other link attributes
that must be configured when the link is up. Doing this ensures
that they are reconfigured on the link if the link goes down
and returns to service.

(cherry picked from commit 12f7469bbe0142d7f360a29ca2b407ce7f5ff096)

Fixes https://github.com/systemd/systemd-stable/issues/89

(cherry picked from commit d5ea028e46673ef627843e90c3d01ebac8fe0e62)

Gbp-Pq: Name network-Delay-addition-of-IPv6-Proxy-NDP-addresses.patch

5 months agoLoadCredentials: do not assert on invalid syntax
Luca Boccassi [Thu, 1 Apr 2021 21:18:29 +0000 (22:18 +0100)]
LoadCredentials: do not assert on invalid syntax

LoadCredentials=foo causes an assertion to be triggered, as we
are not checking that the rvalue's right hand side part is non-empty
before using it in unit_full_printf.

Fixes #19178

# printf [Service]nLoadCredential=passwd.hashed-password.rootn > hello.service
# systemd-analyze verify ./hello.service
...
Assertion 'format' failed at src/core/unit-printf.c:232, function unit_full_printf(). Aborting.
Aborted (core dumped)

(cherry picked from commit f7a6f1226e800f7695c2073675523062ea697aa4)

Gbp-Pq: Name LoadCredentials-do-not-assert-on-invalid-syntax.patch

5 months agopkg-config: make prefix overridable again
Jan Tojnar [Sat, 2 Jan 2021 01:46:33 +0000 (02:46 +0100)]
pkg-config: make prefix overridable again

While we don't support prefix being != /usr, and this is hardcoded
all over the place, variables in pkg-config file are expected
to have overridable base directory.

This is important for at least the following two use cases:

- Installing projects to non-FHS package-specific prefixes for Nix-style
  package managers. Of course, it is then their responsibility
  to ensure systemd can find the service files.
- Installing to local path for development purposes.
  This is a compromise between running a program from a build directory,
  and running it fully installed to system prefix.

You will not want to write to system prefix in either case.

For more information, see also
https://www.bassi.io/articles/2018/03/15/pkg-config-and-paths/

Fixes https://github.com/systemd/systemd/issues/18082

Partially reverts 6e65df89c348242dbd10036abc7dd5e8181cf733

(cherry picked from commit 60bce7c6d9606185114df1bdcd5ea100407688b8)

Gbp-Pq: Name pkg-config-make-prefix-overridable-again.patch

5 months agotable: drop trailing white spaces of the last cell in row
Yu Watanabe [Mon, 1 Feb 2021 16:47:58 +0000 (01:47 +0900)]
table: drop trailing white spaces of the last cell in row

Fixes #18415.

(cherry picked from commit 71894e18313e41a72cecdc77fea5037f95d6903f)

Gbp-Pq: Name table-drop-trailing-white-spaces-of-the-last-cell-in-row.patch

5 months agorules: Move ID_SMARTCARD_READER definition to a <70 configuration.
Vincent Pelletier [Sat, 27 Feb 2021 00:17:06 +0000 (00:17 +0000)]
rules: Move ID_SMARTCARD_READER definition to a <70 configuration.

70-uaccess.rules sets the uaccess tag on devices with ID_SMARTCARD_READER
set, but it is set in 99-systemd.rules .
Move this to a 60-*.rules which already matches USB CCID class, factorising
the matching, so 70-uaccess.rules sets up these devices as expected.

(cherry picked from commit dbdcd51f78bde5e9033d98d61bbb750c868bde9d)

Gbp-Pq: Name rules-Move-ID_SMARTCARD_READER-definition-to-a-70-configu.patch

5 months agoanalyze: slightly reword PrivateTmp= message
Lennart Poettering [Wed, 10 Feb 2021 09:50:23 +0000 (10:50 +0100)]
analyze: slightly reword PrivateTmp= message

Apparently there way confusion about "does not apply". Let's say "is not
appropriate".

Fixes: #13095
(cherry picked from commit 77552b9520ba0d47cbf33cdbe1ddedb9ce9b5bf3)

Gbp-Pq: Name analyze-slightly-reword-PrivateTmp-message.patch

5 months agocore: fix mtime calculation of dropin files
Zbigniew Jędrzejewski-Szmek [Wed, 3 Mar 2021 23:36:24 +0000 (00:36 +0100)]
core: fix mtime calculation of dropin files

Nominally, the bug was in unit_load_dropin(), which just took the last mtime
instead of calculating the maximum. But instead of adding code to wrap the
loop, this patch goes in the other direction.

All (correct) callers of config_parse() followed a very similar pattern to
calculate the maximum mtime. So let's simplify things by making config_parse()
assume that mtime is initialized and update it to the maximum. This makes all
the callers that care about mtime simpler and also fixes the issue in
unit_load_dropin().

config_parse_many_nulstr() and config_parse_many() are different, because it
makes sense to call them just once, and current ret_mtime behaviour make sense.

Fixes #17730, https://bugzilla.redhat.com/show_bug.cgi?id=1933137.

(cherry picked from commit da46a1bc3cd28ac36114002c216196dae004b05c)

Gbp-Pq: Name core-fix-mtime-calculation-of-dropin-files.patch

5 months agolocaled: Run locale-gen if available to generate missing locale
Matthias Klumpp [Fri, 8 Jan 2021 22:59:38 +0000 (23:59 +0100)]
localed: Run locale-gen if available to generate missing locale

This change improves integration with distributions using locale-gen to
generate missing locale on-demand, like Debian-based distributions
(Debian/Ubuntu/PureOS/Tanglu/...) and Arch Linux.
We only ever enable new locales for generation, and never disable them.
Furthermore, we only generate UTF-8 locale.

This feature is only used if explicitly enabled at compile-time, and
will also be inert at runtime if the locale-gen binary is missing.

(cherry picked from commit 8f20232fcb52dbe6255f3df6101fc057af90bcfa)

Gbp-Pq: Name localed-Run-locale-gen-if-available-to-generate-missing-l.patch

5 months agoAdd helper for case-independent string equality checks
Matthias Klumpp [Sat, 10 Oct 2020 02:40:23 +0000 (04:40 +0200)]
Add helper for case-independent string equality checks

(cherry picked from commit bd47b0dac4a1ff6e686c99b9958693e86d44007b)

Gbp-Pq: Name Add-helper-for-case-independent-string-equality-checks.patch

5 months agosystemd (247.3-7+deb11u7) bullseye-security; urgency=medium
Carlos Henrique Lima Melara [Thu, 26 Jun 2025 00:44:53 +0000 (21:44 -0300)]
systemd (247.3-7+deb11u7) bullseye-security; urgency=medium

  * Non-maintainer upload by the LTS Team.
  * debian/patches/:
    - CVE-2025-4598-{0,1,2,3,4}.patch: import and backport patches
      from upstream to fix CVE-2025-4598.
    - fix-stack-overflow-in-coredump-filter-{0,1,2}.patch: import and
      backport patches from upstream to fix CoredumpFilter=all overflow.
  * debian/salsa-ci.yml: add (E)LTS pipeline for bullseye.

[dgit import unpatched systemd 247.3-7+deb11u7]

5 months agoImport systemd_247.3-7+deb11u7.debian.tar.xz
Carlos Henrique Lima Melara [Thu, 26 Jun 2025 00:44:53 +0000 (21:44 -0300)]
Import systemd_247.3-7+deb11u7.debian.tar.xz

[dgit import tarball systemd 247.3-7+deb11u7 systemd_247.3-7+deb11u7.debian.tar.xz]

4 years agoImport systemd_247.3.orig.tar.gz
Michael Biebl [Wed, 3 Feb 2021 16:11:39 +0000 (17:11 +0100)]
Import systemd_247.3.orig.tar.gz

[dgit import orig systemd_247.3.orig.tar.gz]