Commit Graph
34349 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 9c6535367d basic,shared: move make_mount_point_inode_*() to shared/
Those pull in selinux for labelling, and we should avoid selinux in basic/.
2021-06-23 10:34:58 +02:00
Zbigniew Jędrzejewski-Szmek f69c2926f8 meson: sort file list
At least emacs thinks this is the right way.
2021-06-23 10:29:37 +02:00
Yu Watanabe ea0f4578a7 udev: replace unsafe characters on assigning ENV{key}="val" when OPTIONS="string_escape=replace" is set
Strictly speaking, this breaks backward compatibility, as previously
`ENV{key}="val"` ignored `string_escape=` option. But, introducing
a new option such as `string_escape=hoge` sounds overkill for me.
The default escape mode is `ESCAPE_UNSET`, so I hope this merely break
existing rules.
2021-06-23 16:40:52 +09:00
Yu Watanabe 51c2f543d1 udev: fix key name in debug log 2021-06-23 16:33:14 +09:00
Yu Watanabe 068b0f7728 udev: refuse invalid ifname earlier 2021-06-23 16:32:42 +09:00
Yu Watanabe b4d885f0e8 udev: introduce new netif naming scheme flag to strictly replace ifname 2021-06-23 16:10:26 +09:00
Yu Watanabe d37f3e3ec5 udev: only network interface can be renamed 2021-06-23 16:02:43 +09:00
Yu Watanabe e1ecfef16f udev-util: introduce udev_replace_ifname() 2021-06-23 16:02:05 +09:00
Yu Watanabe 5a3586db9a socket-util: split out checking valid character for ifname into ifname_valid_char() 2021-06-23 15:59:44 +09:00
Lennart Poettering abfbfee36c Merge pull request #19986 from keszybz/test-mount-util-more
Add smoke test for mount_flags_to_string()
2021-06-22 15:03:57 +02:00
Hristo Venev 2e8a32afbc networkd: Permit all-zero RoutingPolicyRule prefixes
For example this `From` address range is no longer ignored:

    [RoutingPolicyRule]
    From=0.0.0.0/8
2021-06-22 20:19:12 +09:00
Zbigniew Jędrzejewski-Szmek 51bb6a103e test-mount-util: add output test for mount_flags_to_string() 2021-06-22 14:42:03 +09:00
Zbigniew Jędrzejewski-Szmek 917578880f test-mount-util: add usual print headers 2021-06-22 14:42:03 +09:00
Yu Watanabe 4bee2333cf mount-util: add one more assertion 2021-06-22 14:42:03 +09:00
Zbigniew Jędrzejewski-Szmek b5ce2feebc Merge pull request #19977 from yuwata/nspawn-fix-strextend
nspawn: replace strextend_with_separator() -> strextendf_with_separator()
2021-06-21 19:24:39 +02:00
Lennart Poettering 6e766d9874 cryptenroll: fix minor typo in --help (#19985)
We use "+" as separator for PCR indexes now, but we forgot to replace
one "," by "+"
2021-06-22 00:56:52 +09:00
Yu Watanabe 9b23679e53 mount-util: use EXTRACT_KEEP_QUOTE to handle mount options
Otherwise, the quotes which wrap SELinux options are dropped.
2021-06-21 21:34:50 +09:00
Yu Watanabe 25086b4c17 mount-util: reduce scope of variable 2021-06-21 21:34:10 +09:00
Yu Watanabe f59551f18e test: add test cases for EXTRACT_KEEP_QUOTE and EXTRACT_UNQUOTE 2021-06-21 21:34:07 +09:00
Yu Watanabe 1104d11429 extract-word: introduce EXTRACT_KEEP_QUOTE flag 2021-06-21 21:14:20 +09:00
Yu Watanabe 1c092b62db mount-util: make mount_flags_to_string() show flag name instead of number
This also adds missing MS_NOSYMFOLLOW flag. Moreover, this makes the
function always add unhandled flags in number.
2021-06-21 21:14:20 +09:00
Yu Watanabe d3d1559435 nspawn: replace strextend_with_separator() -> strextendf_with_separator()
Fixes a bug introduced by cfea7618f2.

Before this commit:
mode=1777,size=10%,nr_inodes=400k,uid=496107520,gid=496107520,context=,sys.id:sys.role:systemd.nspawn.container.fs:s0,
After this commit:
mode=1777,size=10%,nr_inodes=400k,uid=496107520,gid=496107520,context=sys.id:sys.role:systemd.nspawn.container.fs:s0

Fixes #19976.
2021-06-21 21:14:20 +09:00
Yu Watanabe f75817172f time-util: coding style fixes
Follow-ups for 45eb4d2261.
2021-06-21 13:00:10 +01:00
Yu Watanabe 932feb79b3 virt: improve log message when we cannot read /sys/firmware/dmi/entries/0-0/raw
As the file is usually readable by only root.

Prompted by https://github.com/systemd/systemd/issues/19978#issuecomment-864561357.
2021-06-21 12:12:07 +01:00
Anders Wenhaug 45eb4d2261 time-util: don't use plural units indiscriminately
format_timestamp_relative currently returns the plural form of
years and months no matter the quantity, and in many cases (for
durations > 1 week) this is the same with days.

This patch changes this so that the function takes the quantity into account,
returning "1 month 1 week ago" instead of "1 months 1 weeks ago".
2021-06-20 21:54:37 +02:00
Lennart Poettering ff0771bfc8 repart: make No-Auto GPT partition flag configurable too
This is useful for provisioning initially empty secondary A/B root file
systems. We don't want those to ever be considered for automatic
mounting, for example in "systemd-nspawn --image=", hence we should
create them with the No-Auto flag turned on. Once a file system image is
dropped into the partition the flag may be turned off by the updater
tool, so that it is considered from then on.

Thew new option for this is called NoAuto. I dislike negated options
like this, but this is taken from the naming in the spec, which in turn
inherited the name from the same flag for Microsoft Data Partitions. To
minimize confusion, let's stick to the name hence.
2021-06-18 14:34:01 +09:00
Lennart Poettering 1a27c323dd path-util: make path_equal() an inline wrapper around path_compare()
The two are completely identical, only the return code is inverted.
let's hence make it easy for the compiler to make it the same function
call even in lowest optimization modes.
2021-06-18 13:46:43 +09:00
Jan Macku edf2ee22f5 core: Hide "Deactivated successfully" message
Show message "Deactivated successfully" in debug mode (when manager is
user) rather than in info mode. This message has low information value
for regular users and it might be a bit overwhelming on a system with
a lot of devices.
2021-06-17 13:10:30 +01: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
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 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
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 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 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
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