1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00
Commit Graph

58181 Commits

Author SHA1 Message Date
Michael Biebl
5fb225615b meson: install libsystemd-shared into rootpkglibdir
Introduce rootpkglibdir for installing libsystemd-{shared,core}.so.
The benefit over using rootlibexecdir is that this path can be
multiarch aware, i.e. this path can be architecture qualified.

This is something we'd like to make use of in Debian/Ubuntu to make
libsystemd-shared co-installable, e.g. for i386 the path would be
/usr/lib/i386-linux-gnu/systemd/libsystemd-shared-*.so and for amd64
/usr/lib/x86_64-linux-gnu/systemd/libsystemd-shared-*.so.
This will allow for example to install and run systemd-boot/i386 on an
amd64 host. It also simplifies/enables cross-building/bootstrapping.

For more infos about Multi-Arch see https://wiki.debian.org/Multiarch.

See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990547
2022-06-07 10:04:43 +02:00
Topi Miettinen
3cf63830ac networkd: NetLabel integration
New directive `NetLabel=` provides a method for integrating dynamic network
configuration into Linux NetLabel subsystem rules, used by Linux security
modules (LSMs) for network access control. The option expects a whitespace
separated list of NetLabel labels. The labels must conform to lexical
restrictions of LSM labels. When an interface is configured with IP addresses,
the addresses and subnetwork masks will be appended to the NetLabel Fallback
Peer Labeling rules. They will be removed when the interface is
deconfigured. Failures to manage the labels will be ignored.

Example:
```
[DHCP]
NetLabel=system_u:object_r:localnet_peer_t:s0
```

With the above rules for interface `eth0`, when the interface is configured with
an IPv4 address of 10.0.0.0/8, `systemd-networkd` performs the equivalent of
`netlabelctl` operation

```
$ sudo netlabelctl unlbl add interface eth0 address:10.0.0.0/8 label:system_u:object_r:localnet_peer_t:s0
```

Result:
```
$ sudo netlabelctl -p unlbl list
...
 interface: eth0
   address: 10.0.0.0/8
    label: "system_u:object_r:localnet_peer_t:s0"
...
```
2022-06-06 18:24:10 +00:00
Maccraft123
cc9e3a55d3 hwdb: Add accel orientation quirk for the Aya Neo Next 2022-06-06 16:35:17 +02:00
Shreenidhi Shedi
41abd7f6df execute: fix resource leak
CID#1431998
2022-06-06 16:34:37 +02:00
Zbigniew Jędrzejewski-Szmek
369151c9c7
Merge pull request #23621 from evverx/clang-release
ci: build systemd with clang with -Dmode=release --optimization=2
2022-06-06 12:17:48 +02:00
Zbigniew Jędrzejewski-Szmek
789431f9f4
Merge pull request #23626 from sshedi/retval-fixes
Retval fixes
2022-06-06 09:41:12 +02:00
Evgeny Vereshchagin
2cfb790391 Revert "Support -D_FORTIFY_SOURCE=3 by using __builtin_dynamic_object_size."
This reverts commit 0bd292567a.

It isn't guaranteed anywhere that __builtin_dynamic_object_size can
always deduce the size of every object passed to it so systemd
can end up using either malloc_usable_size or
__builtin_dynamic_object_size when pointers are passed around,
which in turn can lead to actual segfaults like the one mentioned in
https://github.com/systemd/systemd/issues/23619.

Apparently __builtin_object_size can return different results for
pointers referring to the same memory as well but somehow it hasn't
caused any issues yet. Looks like this whole
malloc_usable_size/FORTIFY_SOURCE stuff should be revisited.

Closes https://github.com/systemd/systemd/issues/23619 and
https://github.com/systemd/systemd/issues/23150.

Reopens https://github.com/systemd/systemd/issues/22801
2022-06-05 19:13:17 +00:00
Shreenidhi Shedi
5c95eb2888 manager: ignore return value of unit_watch_pid()
Also, explicitly ignore return value of service_set_main_pid() calls in
few places.

Fixes: CID#1474975
2022-06-05 22:58:01 +05:30
Shreenidhi Shedi
8d862fd39d machinectl: ignore return value of get_process_comm()
Fixes: CID#1469720
2022-06-05 22:58:01 +05:30
Shreenidhi Shedi
a30c9e7176 polkit: explicitly ignore fd_wait_for_event()'s return value
Fixes: CID#1469718
2022-06-05 22:58:01 +05:30
Evgeny Vereshchagin
36cb69fc43 ci: build systemd with clang with -Dmode=release --optimization=2
This is what's most likely used to build systemd with clang in
practice so let's test it as well.

Preparation for reverting 0bd292567a
(which replaced bogus buffer overflow found with _FORTIFY_SOURCE=3
with actual segfaults).
2022-06-05 16:26:54 +00:00
Zbigniew Jędrzejewski-Szmek
b547241728 shared/microhttp-util: silence gcc warning
../src/journal-remote/microhttpd-util.c: In function ‘check_permissions’:
../src/journal-remote/microhttpd-util.c:301:5: error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn]
  301 | int check_permissions(struct MHD_Connection *connection, int *code, char **hostname) {
      |     ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Fixes #23630.
2022-06-05 15:57:39 +00:00
Daan De Meyer
c9bd01ae90 meson: Switch default-locale default to C.UTF-8
We're already using C.UTF-8 as the default locale for nspawn. Let's
make the same change for the default-locale option instead of deciding
what to use based on the locale used by the host system. Users can
still override the locale using the default-locale option if needed.
2022-06-04 05:08:37 +09:00
Zbigniew Jędrzejewski-Szmek
ea4f2d5fb7 core: suppress message about missing libbpf if in initrd()
It is quite likely that libbpf is not present in the initrd, and
there isn't much reason to use the bpf filters there.

https://bugzilla.redhat.com/show_bug.cgi?id=2084955#c25
2022-06-04 03:20:47 +09:00
Antonio Alvarez Feijoo
d48cfc98eb cryptenroll: fix typo 2022-06-03 17:27:22 +02:00
Zbigniew Jędrzejewski-Szmek
3a2a0806f5
Merge pull request #23297 from medhefgo/trivial-auto-var-init
meson: Compile with -ftrivial-auto-var-init
2022-06-03 15:27:51 +02:00
Yu Watanabe
a71278840b test: add dlopen test for pam_systemd_home 2022-06-03 13:40:14 +01:00
Zbigniew Jędrzejewski-Szmek
38c87ca2ab sha256: fix compilation on efi-ia32
/usr/bin/gcc -c ../src/fundamental/sha256.c -o src/boot/efi/sha256.c.o -Wno-format-signedness -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wno-unused-result -fno-stack-protector -fno-strict-aliasing -fpic -fwide-exec-charset=UCS2 -Wall -Wextra -Wsign-compare -nostdlib -std=gnu99 -ffreestanding -fshort-wchar -fvisibility=hidden -isystem /usr/include/efi -isystem /usr/include/efi/ia32 -I /builddir/build/BUILD/systemd-stable-250.7/src/fundamental -DSD_BOOT -DGNU_EFI_USE_MS_ABI -include src/boot/efi/efi_config.h -include version.h -mno-sse -mno-mmx -flto -O2 -flto=auto
../src/fundamental/sha256.c: In function ‘sha256_finish_ctx’:
../src/fundamental/sha256.c:61:25: error: ‘false’ undeclared (first use in this function)
   61 | # define UNALIGNED_P(p) false
      |                         ^~~~~
../src/fundamental/sha256.c:136:21: note: in expansion of macro ‘UNALIGNED_P’
  136 |                 if (UNALIGNED_P(resbuf))
      |                     ^~~~~~~~~~~
../src/fundamental/sha256.c:32:1: note: ‘false’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’?
   31 | #include "sha256.h"
  +++ |+#include <stdbool.h>
   32 |
...
2022-06-03 19:09:54 +09:00
Yu Watanabe
311f57a402
Merge pull request #23583 from yuwata/boot-efi-string-follow-ups
boot: follow-ups for efi-string functions
2022-06-03 10:23:24 +09:00
Christian Hesse
d6e2c2d34d shared/utmp-wtmp: fix build without utmp
Commit 1661833238 changed a function to
add an extra argument. The data types used when building without utmp
missed the change.
2022-06-03 05:00:50 +09:00
Yu Watanabe
0a11366280 login: fix typo
Follow-up for ea74f39c24.
2022-06-03 04:28:01 +09:00
Yu Watanabe
095e173a04 boot: use CMP() macro for safety 2022-06-03 04:20:46 +09:00
Yu Watanabe
42e785d096 boot: make several functions inline
Follow-ups for #23512.
2022-06-03 04:20:46 +09:00
Yu Watanabe
a54e635d02 boot: fix typo 2022-06-03 04:20:46 +09:00
Zbigniew Jędrzejewski-Szmek
e78bd91e55
Merge pull request #23596 from keszybz/bpf-messages-more
Silence messages from libbpf
2022-06-02 19:48:01 +02:00
Franck Bui
4d5d28e9a6 test: enable virtio-rng device for QEMU guests
If rngd is included in the host initrd, QEMU guests need at least one source of
entropy otherwise rngd will refuse to start. Hence this patch enables the
virtio RNG device in QEMU guests (exposed as a HW RNG device available at
/dev/hwrng).

As a safety measure, the patch limits the data sent to the guest to 1KB per
second in order to not let the guest starve the host entropy.
2022-06-03 01:52:28 +09:00
Zbigniew Jędrzejewski-Szmek
4c989f89b6 core: rework variable initialization to avoid gcc warning
In file included from ../src/basic/siphash24.h:11,
                 from ../src/basic/hash-funcs.h:6,
                 from ../src/basic/hashmap.h:8,
                 from ../src/shared/fdset.h:6,
                 from ../src/shared/bpf-program.h:9,
                 from ../src/core/unit.h:11,
                 from ../src/core/all-units.h:4,
                 from ../src/core/manager.c:23:
../src/basic/time-util.h: In function 'manager_dispatch_jobs_in_progress':
../src/basic/time-util.h:140:38: error: 'x' may be used uninitialized [-Werror=maybe-uninitialized]
  140 | #define FORMAT_TIMESPAN(t, accuracy) format_timespan((char[FORMAT_TIMESPAN_MAX]){}, FORMAT_TIMESPAN_MAX, t, accuracy)
      |                                      ^~~~~~~~~~~~~~~
In function 'manager_print_jobs_in_progress',
    inlined from 'manager_dispatch_jobs_in_progress' at ../src/core/manager.c:3007:9:
../src/core/manager.c:219:18: note: 'x' was declared here
  219 |         uint64_t x;
      |                  ^
cc1: all warnings being treated as errors

For some reason this (false positive) warning starts appearing after
-ftrivial-auto-var-init is used.
2022-06-02 17:31:55 +02:00
Zbigniew Jędrzejewski-Szmek
6a9f3cef8c
Merge pull request #23576 from yuwata/network-erspan-version
network: support erspan version 0 and 2
2022-06-02 16:58:55 +02:00
Zbigniew Jędrzejewski-Szmek
7e5c7522e8
Merge pull request #23579 from yuwata/sha256-unaligned
sha256: use memcpy() to accept unaligned result buffer
2022-06-02 16:38:19 +02:00
Antonio Alvarez Feijoo
5ad0109cd8 man: add missing arguments to systemd-creds synopsis 2022-06-02 16:35:36 +02:00
Zbigniew Jędrzejewski-Szmek
d7cf4ba6f3
Merge pull request #23582 from bnf/dns-proxy-stub-ifindex
resolved: define source address for proxy-only stub replies
2022-06-02 16:34:55 +02:00
Zbigniew Jędrzejewski-Szmek
b1acbc08e2 core/bpf: prefix log messages from different bpf subsystems
When something goes awry, we would get identical log messages from all the
bpf subsystems. E.g. "Failed to load BPF object: %m" appeared 5 times in the
sources. But it is very important to know *which* object we failed to load.
This could be guessed, e.g. from surroudning messages or from filename/line
metadata, but when we get log messages in bug reports, this might not be
available. Let's make the messages distinguishable.

While at it, some messages were adjusted a bit. In particular, we shouldn't use
internal names like BPFProgram which have no meaning outside of the codebase.
2022-06-02 15:59:41 +02:00
Zbigniew Jędrzejewski-Szmek
bb0b01ed20 core: define a helper function for basic bpf checks 2022-06-02 15:59:41 +02:00
Zbigniew Jędrzejewski-Szmek
62b045b45c test-socket-bind: fix comment 2022-06-02 10:48:31 +02:00
Zbigniew Jędrzejewski-Szmek
b1fdcda876 tests: drop pointless checks for root
Testing the error paths is very important. If we are not root, we should
try and get a failure, which we should report nicely and mark the test
as skipped. After those checks are removed, this is what seems to happen.
This way we can see what will happen e.g. in the user manager when we try
to perform some bpf ops.
2022-06-02 10:48:31 +02:00
Zbigniew Jędrzejewski-Szmek
44005a5778 shared/bpf: install log callback and suppress most messages from libbpf
$ build/test-socket-bind
...
libbpf: load bpf program failed: Operation not permitted
libbpf: failed to load program 'sd_bind4'
libbpf: failed to load object 'socket_bind_bpf'
libbpf: failed to load BPF skeleton 'socket_bind_bpf': -1
Failed to load BPF object: Operation not permitted

Now all lines with "libbpf:" are at debug level and will be hidden by
default.

Partially fixes https://bugzilla.redhat.com/show_bug.cgi?id=2084955#c14
(i.e. the error that was exposed when the initial error was fixed.)
2022-06-02 10:48:31 +02:00
Zbigniew Jędrzejewski-Szmek
386b8026e5 meson: use files() for libcore_sources too
C.f. f1b98127ff.
2022-06-02 07:53:14 +02:00
Zbigniew Jędrzejewski-Szmek
c6cb9d9074 userwork: use a better errno value
ESRCH is literally "No such process".
2022-06-02 07:53:14 +02:00
Zbigniew Jędrzejewski-Szmek
2e09b2235a various: add %m in messages
Sometimes we want to suppress strerror() message because the are providing
something better. But in those cases, it seems it was just forgotten.
2022-06-02 07:53:14 +02:00
Yu Watanabe
93d13a7dff test: fix indentation 2022-06-02 14:14:22 +09:00
Yu Watanabe
3bccc736c6 test: add test for sha256 2022-06-02 14:14:22 +09:00
Yu Watanabe
c7a5eabeba sha256: use memcpy() when result buffer is unaligned
Fixes #23578.
2022-06-02 14:14:22 +09:00
Steve Ramage
39a742888b
Documents the AssertCPUFeature= flag (#23594)
Fixes #23593
2022-06-02 13:16:48 +09:00
Zbigniew Jędrzejewski-Szmek
af72f975fe Move basic/recovery-key.* to shared/
No particular reason to have it in basic/. We should let homectl
and other users share the single copy through libsystemd-shared.
2022-06-02 13:09:09 +09:00
Zbigniew Jędrzejewski-Szmek
14c811ff4a
Merge pull request #23575 from keszybz/logind-wall-message-cleanup
Cleanup wall messages emitted by logind and systemctl
2022-06-01 16:26:29 +02:00
Zbigniew Jędrzejewski-Szmek
d5254fa2f6
Merge pull request #23574 from keszybz/logind-pty-wall
Do not print logind wall message to local terminals
2022-06-01 16:26:03 +02:00
Benjamin Franzke
de777ffae8 resolved: choose correct file descriptor for proxy stub replies
find_socket_fd() does not expect the sender address, but the
listen-address. This is in fact the destination of the DNS packet.
Matching via sender address caused a fallback to the default stub
listener in manager_dns_stub_fd() as the sender address can never
match the proxy stub listen address.

Note that manager_dns_stub_fd() is only used for the default
listener stub and the proxy stub, that means *extra* listeners
stubs (DNSStubListenerExtra=…) have not been affected as
`struct DnsStubListenerExtra` provides a direct link to the event
source.

By using the correct fd we ensure the correct socket options
(like TTL) are used and prevent issues like #23495 in case ifindex
could not be determined.
2022-06-01 15:08:33 +02:00
dependabot[bot]
2f9e3d5f50 build(deps): bump actions/upload-artifact from 2.3.1 to 3.1.0
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2.3.1 to 3.1.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](82c141cc51...3cea537223)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-01 15:32:03 +03:00
dependabot[bot]
db361cdabd build(deps): bump github/super-linter from 4.9.3 to 4.9.4
Bumps [github/super-linter](https://github.com/github/super-linter) from 4.9.3 to 4.9.4.
- [Release notes](https://github.com/github/super-linter/releases)
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md)
- [Commits](431ee7836e...a320804d31)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-01 11:09:45 +00:00
Li kunyu
b278cf2efd src: The return value of server_vacuum () is not used and could be modified to void type 2022-06-01 09:32:22 +02:00