1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 03:25:31 +03:00
Commit Graph

52025 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
9a797ddc41 meson: allow "soft-static" allocations for uids and gids in the initrd
The general idea with users and groups created through sysusers is that an
appropriate number is picked when the allocation is made. The number that is
selected will be different on each system based on the order of creation of
users, installed packages, etc. Since system users and groups are not shared
between installations, this generally is not an issue. But it becomes a problem
for initrd: some file systems are shared between the initrd and the host (/run
and /dev are probably the only ones that matter). If the allocations are
different in the host and the initrd, and files survive switch-root, they will
have wrong ownership.

This makes the gids build-time-configurable for all groups and users where
state may survive the switch from initrd to the host.

In particular, all "hardware access" groups are like this: files in /dev will
be owned by them.  Eventually the new udev would change ownership, but there
would be a momemnt where the files were owned by the wrong group. The
allocations are "soft-static" in the language of Fedora packaging guidelines:
the uid/gid will be used if possible, but we'll fall back to a different
one. TTY_GID is the exception, because the number is used directly.

Similarly, the possibility to configure "soft-static" uids is added for daemons
which may usefully run in the initramfs: systemd-network (lease information and
interface state is serialized to /run), systemd-resolve (stub files and
interface state), systemd-timesync (/run/systemd/timesync).

Journal files are owned by the group systemd-journal, and acls are granted
for wheel and adm.

systemd-oom and systemd-coredump are excluded from this patch: I assume that
oomd is not useful in the initrd, and coredump leaves no state (it only creates
a pipe in /run?).

The defaults are not changed: if nothing is configured, dynamic allocation will
be used. I looked at a Debian system, and the numbers are all different than
on Fedora.

For Fedora, see the list of uids and gids at https://pagure.io/setup/blob/master/f/uidgid.
In particular, systemd-network and systemd-resolve got soft-static numbers to
make it easy to transition from a non-host-specific initrd to a host system
already a few years back (https://bugzilla.redhat.com/show_bug.cgi?id=1102002).

I also requested static allocations for sgx, input, render in
https://pagure.io/packaging-committee/issue/1078,
https://pagure.io/setup/pull-request/27.
2021-06-17 09:48:28 +02:00
Luca Boccassi
798d7d0a8a
Merge pull request #19948 from keszybz/set-driver-refactoring
A minor refactoring to sd-device internals
2021-06-16 13:48:18 +01:00
Luca Boccassi
aeffa4c3ed
Merge pull request #19947 from yuwata/network-dad-tiny-fixes
network: tiny fixes about IPv4ACD
2021-06-16 09:45:42 +01:00
Zbigniew Jędrzejewski-Szmek
ca0176fa6b sd-device: let device_set_driver() accept NULL too
Like previous commit, but for driver not subsystem.
2021-06-16 08:54:16 +02:00
Zbigniew Jędrzejewski-Szmek
df49a7323a sd-device: let device_set_subsystem() accept NULL
This makes device_shallow_clone() simpler.

Follow-up for 2255e8adee.
2021-06-16 08:54:16 +02:00
Yu Watanabe
1cf4ed142d network: always enable IPv4 ACD for statically configured IPv4LL address 2021-06-16 13:19:26 +09:00
Yu Watanabe
f4c48492fe man: fix RFC number and its title 2021-06-16 10:32:28 +09:00
Yu Watanabe
bd5146c67e network: IFA_F_NODAD flag is only for IPv6 addresses 2021-06-16 08:33:54 +09:00
Lennart Poettering
ad64e3e8d6
Merge pull request #19942 from wat-ze-hex/socket-bind-ip-proto-2021-06-10
dbus: extend SocktBind{Allow|Deny}= with ip proto
2021-06-16 00:24:54 +02:00
Frantisek Sumsal
e7848266da test: add a testcase for issue #19895 2021-06-15 23:18:06 +01:00
Lennart Poettering
8f12ee7178
Merge pull request #19896 from keszybz/systemd-efi-options-hint
Print hint in bootctl when systemd-efi-options output is out-of-date
2021-06-16 00:03:08 +02:00
Lennart Poettering
fe1f0129e1
Merge pull request #19943 from poettering/v249rc1-rep
prepare v249-rc1
2021-06-16 00:02:31 +02:00
Zbigniew Jędrzejewski-Szmek
e9bbb6ef04
Merge pull request #19945 from yuwata/news
update NEWS
2021-06-15 23:04:39 +02:00
Yu Watanabe
566c8176da NEWS: fix typo 2021-06-16 06:01:25 +09:00
Yu Watanabe
2568bb1085 NEWS: drop journal file truncation feature
Follow-up for 0aa649b11d.
2021-06-16 05:54:02 +09:00
Julia Kartseva
a5f19be8b1 dbus: update SocketBind{Allow|Deny}= doc 2021-06-15 13:51:33 -07:00
Julia Kartseva
4883a04fe1 dbus: extend SocktBind{Allow|Deny}= with ip proto
Support filtering by ip protocol (L4) in SocketBind{Allow|Deny}=
properties.
The signature of dbus methods must be finalized before new release is
cut, hence reserve a parameter for ip protocol.
Implementation will follow.

Closes https://github.com/systemd/systemd/issues/19891
2021-06-15 13:45:20 -07:00
Zbigniew Jędrzejewski-Szmek
ad2d6880ea bootctl: print SystemdOptions from efivarfs if newer than our cache
The logic is that if the options are updated after boot, we *don't* use
the new value. But we still want to print out the changed contents in
bootctl as to not confuse people.

Fixes #19597.
Also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=988450.

$ build/bootctl systemd-efi-options
quiet
Note: SystemdOptions EFI variable has been modified since boot. New value: debug

The hint is printed to stderr, so scripts should not be confused.
2021-06-15 22:01:42 +02:00
Zbigniew Jędrzejewski-Szmek
c67bd42b71 Inline some inerator variables 2021-06-15 22:01:42 +02:00
Zbigniew Jędrzejewski-Szmek
e6f055cbc4 basic/efivars: replace dynanamic creation of efivar names with static strings
Creating those string dynamically at runtime is slow and unnecessary.
Let's use static strings with a bit of macro magic and the let the compiler
coalesce as much as possible.

$ size build/src/shared/libsystemd-shared-248.so{.old,}
   text	   data	    bss	    dec	    hex	filename
2813453	  94572	   4584	2912609	 2c7161	build/src/shared/libsystemd-shared-248.so.old
2812309	  94564	   4584	2911457	 2c6ce1	build/src/shared/libsystemd-shared-248.so

A nice side-effect is that the same form is used everywhere, so it's easier to
figure out all variables that are used, and where each specific variable is
used.

C.f. 2b0445262a.

Note: 'const char *foo = alloca(…);' seems OK. Our coding style document and
alloca(3) only warn against using alloca() in function invocations. Declaring
both stack variable and alloca at the same time should be fine: no matter in
which order they happen, i.e. if the pointer variable is above the contents,
or the contents are above the pointer, or even if the pointer is elided by the
compiler, everything should be fine.
2021-06-15 22:01:42 +02:00
Zbigniew Jędrzejewski-Szmek
7c7683f36c sd-id128: add SD_ID128_MAKE_UUID_STR
It's like SD_ID128_MAKE_STR, but with hyphens.
2021-06-15 22:01:39 +02:00
Lennart Poettering
ca1e8584c6 meson: bump version for 249-rc1 release 2021-06-15 21:59:44 +02:00
Lennart Poettering
558a9af70f hwbd: run "ninja -C build update-hwdb" again 2021-06-15 21:59:44 +02:00
Lennart Poettering
8156422c8f seccomp: drop quotactl_path() again from filter sets
In the light of https://lwn.net/Articles/859679/ let's drop
quotactl_path() again from the filter set list, as it got backed out
again in 5.13-rc3.

It's likely going to be replaced by quotactl_fd() eventually, but that
hasn't made its way into the tree yet, hence let's not replace the entry
for now.

This partially reverts 34254e599a.
2021-06-15 21:30:36 +02:00
Yu Watanabe
7422405623 test: fix syscall existence check
Follow-up for 0643eb47a0.

This also drops errnously introduced hashmap_put() in the commit.
2021-06-15 21:00:51 +02:00
Lennart Poettering
cf2ab2e7ea update TODO 2021-06-15 20:58:56 +02:00
Lennart Poettering
39d02a175f sd-id128: document everywhere that we treat all UUIDs as Variant 1
So in theory UUID Variant 2 (i.e. microsoft GUIDs) are supposed to be
displayed in native endian. That is of course a bad idea, and Linux
userspace generally didn't implement that, i.e. uuidd and similar.
Hence, let's not bother either, but let's document that we treat
everything the same as Variant 1, even if it declares something else.
2021-06-15 20:58:56 +02:00
Yu Watanabe
9b682672e4 network: use void* to correctly store SetLinkOperation in Request
Previously, when `link_request_queue()` is called in link_request_set_link(),
`SetLinkOperation` is casted with INT_TO_PTR(), and the value is assigned to
`void *object`. However the value was read directly through the member
`SetLinkOperation set_link_operation` of the union which `object`
beloging to. Thus, read value was always 0 on big-endian systems.

Fixes configuring link issue on s390x systems.
2021-06-15 20:58:20 +02:00
Michal Sekletár
b428efa54b udev: add basic set of user-space defined tracepoints (USDT)
Debugging udev issues especially during the early boot is fairly
difficult. Currently, you need to enable (at least) debug logging and
start monitoring uevents, try to reproduce the issue and then analyze
and correlate two (usually) huge log files. This is not ideal.

This patch aims to provide much more focused debugging tool,
tracepoints. More often then not we tend to have at least the basic idea
about the issue we are trying to debug further, e.g. we know it is
storage related. Hence all of the debug data generated for network
devices is useless, adds clutter to the log files and generally
slows things down.

Using this set of tracepoints you can start asking very specific
questions related to event processing for given device or subsystem.
Tracepoints can be used with various tracing tools but I will provide
examples using bpftrace.

Another important aspect to consider is that using tracepoints you can
debug production systems. There is no need to install test packages with
added logging, no debuginfo packages, etc...

Example usage (you might be asking such questions during the debug session),

Q: How can I list all tracepoints?
A: bpftrace -l 'usdt:/usr/lib/systemd/systemd-udevd:udev:*'

Q: What are the arguments for each tracepoint?
A: Look at the code and search for use of DEVICE_TRACE_POINT macro.

Q: How many times we have executed external binary?
A: bpftrace -e 'usdt:/usr/lib/systemd/systemd-udevd:udev:spawn_exec { @cnt = count(); }'

Q: What binaries where executed while handling events for "dm-0" device?
A  bpftrace -e 'usdt:/usr/lib/systemd/systemd-udevd:udev:spawn_exec / str(arg1) == "dm-0"/ { @cmds[str(arg4)] = count(); }'

Thanks to Thomas Weißschuh <thomas@t-8ch.de> for reviewing this patch
and contributions that allowed us to drop the dependency on dtrace tool
and made the resulting code much more concise.
2021-06-15 18:28:28 +02:00
Yu Watanabe
b2e8fdc896
Merge pull request #19928 from yuwata/riscv32
riscv32 support
2021-06-16 00:53:30 +09:00
Yu Watanabe
0aa649b11d Revert "journal-file: truncate archived journals"
This reverts commit 592d419ce6.

The commit makes journald unstable, and is just an optimization
for the size of journal. Hence, it is safe to revert the commit.

Fixes #19895.
2021-06-15 15:50:36 +02:00
Luca Boccassi
e4948b0f0a
Merge pull request #19921 from yuwata/service-verify-bus-type
core/service: fix assertion when Type=dbus but BusName= is not specified
2021-06-15 12:21:53 +01:00
Yu Watanabe
e19b0746f1 unit: use alias name of man page 2021-06-15 12:14:26 +01:00
Matt Johnston
e65357b658 man: fix sd_bus_add_node_enumerator() ret_nodes
ret_nodes is NULL terminated, the return value isn't a count.
2021-06-15 11:29:44 +01:00
Yu Watanabe
21d03e6c63 man: add an example to configure default route on device with table
Prompted by #19911.
2021-06-15 11:29:20 +01:00
Luca Boccassi
c35949a51c
Merge pull request #19930 from yuwata/update-comments
Update comments
2021-06-15 11:28:51 +01:00
Yu Watanabe
fc75007b32 missing_syscall: add riscv32 support 2021-06-15 19:07:36 +09:00
Yu Watanabe
18adce1566 syscalls: add riscv32 2021-06-15 19:07:32 +09:00
Yu Watanabe
d34e3b76e5 syscalls: update tables 2021-06-15 19:07:11 +09:00
Yu Watanabe
a3f5f4a5c0 fix typo 2021-06-15 14:19:30 +09:00
Yu Watanabe
7802194ac0 tree-wide: add missing whitespace at the end of comments 2021-06-15 14:09:29 +09:00
Yu Watanabe
f7bef77a16
Merge pull request #19924 from yuwata/sd-event-fix-assertion
sd-event: fix assrtion in sleep_between()
2021-06-15 13:34:03 +09:00
Khem Raj
0643eb47a0
test-seccomp: Check for __NR_ppoll before use (#19858)
some newer architectures like riscv32 do not have __NR_ppoll from get go
2021-06-15 13:12:30 +09:00
Yu Watanabe
9868493e17
Merge pull request #19913 from yuwata/network-fix-counter
network: add missing increment of Link::set_flags_messages
2021-06-15 10:51:24 +09:00
Lennart Poettering
05a2166a06 repart: show partitions we don't grow/create as "unchanged"
The previous string was "unknown", but that's wrong, because we *do*
know what we are going to do with those partitions: we leave them
unmodified, hence say "unchanged" in the output, to be clearer.
2021-06-15 05:39:33 +09:00
Lennart Poettering
9c07c9ec0e repart: align all sizes in table to the right 2021-06-15 05:39:33 +09:00
Frantisek Sumsal
785256a320 test: correctly configure the NUMA node memory pool
The currently hardcoded value works with the default configuration, but
breaks when QEMU_MEM != 512M (in sanitizer runs, for example).

```
# QEMU_MEM=1G make -C test/TEST-36-NUMAPOLICY/ run
make: Entering directory '/home/fsumsal/repos/@systemd/systemd/test/TEST-36-NUMAPOLICY'
TEST-36-NUMAPOLICY RUN: test NUMAPolicy= and NUMAMask= options
+ /bin/qemu-kvm -smp 8 -net none -m 1G -nographic -kernel /boot/vmlinuz-5.12.5-300.fc34.x86_64 -drive format=raw'
qemu-kvm: total memory for NUMA nodes (0x20000000) should equal RAM size (0x40000000)
E: QEMU failed with exit code 1
```
2021-06-15 05:37:28 +09:00
Yu Watanabe
2502e7befe
Merge pull request #19905 from yuwata/network-set-mac-try-again
network: try to bring down interface before setting MAC address
2021-06-15 05:35:45 +09:00
Yu Watanabe
710fa1b3fb network: update wlan information when IFF_LOWER_UP flag is gained
Fixes the issue mentioned at
https://github.com/systemd/systemd/issues/19832#issuecomment-860269320.
2021-06-15 05:14:22 +09:00
Yu Watanabe
7f80fa12c2 network: add brief comment about reconfiguring interfaces
This also renames link_reconfigure_internal() -> link_reconfigure_impl().
2021-06-15 05:12:25 +09:00