Commit Graph

4768 Commits

Author SHA1 Message Date
Yu Watanabe 28423d9a75 tree-wide: fix typo 2020-12-14 12:05:55 +00:00
Yu Watanabe ba9385d91f
Merge pull request #17928 from keszybz/nss-logging
Enable logging in nss modules
2020-12-14 09:48:23 +09:00
Jinyuan Si 239952e890 cryptsetup: Fix crypto device missing issue after bootup
Normally, the udev rules operate on "change" events. But when
coldplugging, there's an "add" event present. The udev rules have to
recognize this and do some actions in this particular situation, too.
Also, we don't want the nodes to be created prematurely on "add"
events while not coldplugging. The udev rules will check
DM_UDEV_PRIMARY_SOURCE_FLAG to see if the device was activated
correctly before and if not, it ignore the "add" event totally.
This way the udev rules can support udev triggers generating "add"
events (e.g. "udevadm trigger --action=add" or
"echo add > /sys/block/<dm_device>/uevent").

In this case, the udevd service is started after
systemd-cryptsetup@config.service, is started, which will cause udevd
service to miss the "change" uevent with DM_UDEV_PRIMARY_SOURCE_FLAG
flag generated by systemd-cryptsetup@config.service. To solve this
issue, we let the cryptsetup service be started after the udevd
service.
2020-12-10 20:46:00 +01:00
Lennart Poettering 4add63c79e
Merge pull request #17903 from yuwata/udev-options-log-level
udev: introduce OPTIONS="log_level=xxx" rule
2020-12-10 20:45:32 +01:00
Greg Depoire--Ferrer 6597686865 seccomp: don't install filters for archs that can't use syscalls
When seccomp_restrict_archs is called, architectures that are blocked
are replaced by the SECCOMP_LOCAL_ARCH_BLOCKED marker so that they are
not disabled again and filters are not installed for them.

This can make some service that use SystemCallArchitecture= and
SystemCallFilter= start faster.
2020-12-10 16:13:02 +01:00
Lennart Poettering cca2da15c8 three spdx header fixes 2020-12-10 13:03:11 +01:00
Zbigniew Jędrzejewski-Szmek d401a5e411 json: log location also when there is no file
E.g. in nss-resolve it is still useful to print the location of the error:
src/test/test-nss.c:231: dlsym(0x0x1dc6fb0, _nss_resolve_gethostbyname2_r) → 0x0x7fdbfc53f626
(string):1:40: JSON field ifindex is out of bounds for an interface index.

I opted to use a partially duplicated if condition to avoid nesting. It's nice
to have the log calls vertically aligned. The compiler will optimize this nicely.
2020-12-10 13:00:02 +01:00
Yu Watanabe b2d9e58f78 udev: introduce log_device_uevent() helper function
And this drops duplicated check for seqnum and device action.
2020-12-10 12:26:19 +09:00
Lennart Poettering ad914843c6 qrcode-util: make dlopen() logic more like the other cases
Let's add a dlopen_qrencode() function that does the actual dlopen()
stuff and caches the result.

This is useful so that we later can automatically test for all dlopen
hookups to work correctly.
2020-12-09 13:34:27 +01:00
Yu Watanabe 84f9a68060 mount-util: fix typo 2020-12-09 12:55:14 +09:00
Zbigniew Jędrzejewski-Szmek 7e0079f95f Make support for nscd flushing optional
Fedora will deprecate support for nscd in the upcoming release [1] and plans to
drop it in the next one [2]. At that point we might as well build systemd
without that support too, since there'll be nothing to talk too.

[1] https://fedoraproject.org/wiki/Changes/DeprecateNSCD
[2] https://fedoraproject.org/wiki/Changes/RemoveNSCD
2020-12-07 19:46:02 +01:00
Lennart Poettering 62ea0ed08d dissect: don't declare unused variables on archs that have no GPT discovery
Fixes: #17839
2020-12-04 17:50:18 +01:00
Lennart Poettering fea909c1b9
Merge pull request #17854 from poettering/dns-domain-ret-fix
dns-domain: fix some coding style issues
2020-12-04 17:49:05 +01:00
Lennart Poettering dcbe4a6860 dns-domain: initialize return param on success 2020-12-04 11:52:22 +01:00
Lennart Poettering cb3714d100 dns-domain: follow coding style, initialize ret params on success 2020-12-04 11:07:06 +01:00
Lennart Poettering 5517e214c8 tree-wide: make use of new DLSYM_ARG() macro everywhere 2020-12-04 10:41:59 +01:00
Lennart Poettering c3a8c6aa42 local-addresses: make returning accumulated list optional 2020-12-03 23:21:53 +01:00
Lennart Poettering 61bd7d1ed5 random-util: open /dev/urandom implicitly in random_write_entropy() if needed 2020-12-03 20:14:17 +01:00
Lennart Poettering e267d76f73
Merge pull request #17836 from poettering/tpm2-condition
Add ConditionSecurity=tpm2
2020-12-03 20:13:45 +01:00
Lennart Poettering 6dd16814a5
Merge pull request #17079 from keszybz/late-exec-resolution
Resolve executable paths before execution, use fexecve()
2020-12-03 14:58:20 +01:00
Lennart Poettering bce334a31c core: add ConditionSecurity=tpm2 support 2020-12-03 12:03:58 +01:00
Florian Westphal 7509c7fdf9 fw_add_masquerade: remove unused function arguments
Similar to the previous commit.  All callers pass NULL.  This will
ease initial nftables backend implementation (less features to cover).

Add the function parameters as local variables and let compiler
remove branches.  Followup patch can remove the if (NULL) conditionals.
2020-12-03 11:05:14 +01:00
Florian Westphal 67b3732a53 fw_add_local_dnat: remove unused function arguments
All users pass a NULL/0 for those, things haven't changed since 2015
when this was added originally, so remove the arguments.

THe paramters are re-added as local function variables, initalised
to NULL or 0.  A followup patch can then manually remove all
if (NULL) rather than leaving dead-branch optimization to compiler.

Reason for not doing it here is to ease patch review.

Not requiring support for this will ease initial nftables backend
implementation.
In case a use-case comues up later this feature can be re-added.
2020-12-03 11:04:46 +01:00
Yu Watanabe 131e4deaf3 ethtool: add two new link modes 2020-12-03 11:23:50 +09:00
Yu Watanabe 89836c304b shared/kernel: update kernel headers
From kernel commit 34816d20f173a90389c8a7e641166d8ea9dce70a.
2020-12-03 11:21:13 +09:00
Lennart Poettering d80e72ec60 dns-domain: try IDN2003 rules if IDN2008 doesn't work
This follows more closely what web browsers do, and makes sure emojis in
domains work.

Fixes: #14483
2020-12-03 08:48:11 +09:00
Yu Watanabe 1f1d4d42c1 log-link: introduce log_interface_full_errno() macro 2020-12-02 18:41:01 +09:00
Zbigniew Jędrzejewski-Szmek ebef02dd8f pager: stop disabling urlification under a pager
Less 568 properly shows urlified strings.

Putative NEWS entry:
* Urlification is now enabled by default even when a pager is used.
  Previously it was disabled, because less would not show such markup
  properly. This has been fixed in less 568.
  Please either upgrade less, or use SYSTEMD_URLIFY=0 to disable the
  feature.
2020-12-02 16:50:44 +09:00
Lennart Poettering 986311c2da fileio: teach read_full_file_full() to read from offset/with maximum size 2020-12-01 14:17:47 +01:00
Lennart Poettering ae9cf30b2f dissect-image: use simple version of read_full_file() where we can 2020-12-01 14:17:46 +01:00
Yu Watanabe 75f79cd2d8 mount-util: use mfree() 2020-11-27 14:35:20 +09:00
Yu Watanabe dca63b5b46
Merge pull request #17474 from yuwata/network-drop-link-deserialization-logic
network: drop link deserialization logic
2020-11-27 09:08:01 +09:00
Yu Watanabe 0d5eb02134
Merge pull request #17478 from yuwata/split-network-internal
libsystemd-network: split network-internal.c
2020-11-27 09:04:19 +09:00
Zbigniew Jędrzejewski-Szmek d5923e38bc shared/seccomp-util: address family filtering is broken on ppc
This reverts the gist of da1921a5c3 and
0d9fca76bb (for ppc).

Quoting #17559:
> libseccomp 2.5 added socket syscall multiplexing on ppc64(el):
> https://github.com/seccomp/libseccomp/pull/229
>
> Like with i386, s390 and s390x this breaks socket argument filtering, so
> RestrictAddressFamilies doesn't work.
>
> This causes the unit test to fail:
> /* test_restrict_address_families */
> Operating on architecture: ppc
> Failed to install socket family rules for architecture ppc, skipping: Operation canceled
> Operating on architecture: ppc64
> Failed to add socket() rule for architecture ppc64, skipping: Invalid argument
> Operating on architecture: ppc64-le
> Failed to add socket() rule for architecture ppc64-le, skipping: Invalid argument
> Assertion 'fd < 0' failed at src/test/test-seccomp.c:424, function test_restrict_address_families(). Aborting.
>
> The socket filters can't be added so `socket(AF_UNIX, SOCK_DGRAM, 0);` still
> works, triggering the assertion.

Fixes #17559.
2020-11-26 14:23:15 +01:00
Yu Watanabe e93387f38b tree-wide: sort specifiers and move common comments to specifier.h 2020-11-25 15:12:27 +09:00
Lennart Poettering 2824aa0796 specifiers: introduce common macros for generating specifier tables
In many cases the tables are largely the same, hence define a common set
of macros to generate the common parts.

This adds in a couple of missing specifiers here and there, so is more
thant just refactoring: it actually fixes accidental omissions.

Note that some entries that look like they could be unified under these
macros can't really be unified, since they are slightly different. For
example in the DNSSD service logic we want to use the DNSSD hostname for
%H rather than the unmodified kernel one.
2020-11-25 14:13:02 +09:00
Yu Watanabe 11b9105dfd seccomp: also move munmap into @default syscall filter set
Follow-up for 5abede3247.
2020-11-24 16:18:34 +01:00
Lennart Poettering e3650d619a
Merge pull request #17676 from yuwata/lgtm-fixes
tree-wide: several fixes prompted by LGTM
2020-11-23 22:18:28 +01:00
Dimitri John Ledkov 499f0f8209 gpt: add RISC-V GPT partition typecode uuid 2020-11-23 22:15:36 +01:00
Yu Watanabe f9c443b7a4 logs-show: use localtime_or_gmtime_r() 2020-11-21 04:38:41 +09:00
Yu Watanabe 48b11b09ab ask-passwd: drop a condition which is always false 2020-11-20 19:42:38 +09:00
Lennart Poettering 5abede3247 seccomp: move brk+mmap+mmap2 into @default syscall filter set
These three syscalls are internally used by libc's memory allocation
logic, i.e. ultimately back malloc(). Allocating a bit of memory is so
basic, it should just be in the default set.

This fixes a couple of issues with asan/msan and the seccomp tests: when
asan/msan is used some additional, large memory allocations take place
in the background, and unless mmap/mmap2/brk are allowlisted these will
fail, aborting the test prematurely.
2020-11-19 16:44:50 +01:00
Yu Watanabe 273d76f4f8 tree-wide: update "that that" 2020-11-18 17:23:00 +09:00
Zbigniew Jędrzejewski-Szmek 40ebe49259
Merge pull request #17597 from yuwata/fix-typo
tree-wide: Fix typo
2020-11-17 10:06:58 +01:00
Yu Watanabe ca39a3cef9 bpf: do not call log_oom() in library function 2020-11-13 19:30:57 +09:00
Yu Watanabe d51c4fca29 tree-wide: fix "a the" or "the a" 2020-11-13 16:28:47 +09:00
Yu Watanabe 9429ee6a89
Merge pull request #17567 from keszybz/various-small-cleanups
Various small cleanups
2020-11-12 16:30:06 +09:00
Zbigniew Jędrzejewski-Szmek 063f9f0da9 basic/env-util: add little helper to call setenv or unsetenv 2020-11-10 15:48:14 +01:00
Lennart Poettering 394131d5be
Merge pull request #17497 from anitazha/randomizeonce
timer: add new feature FixedRandomDelay=
2020-11-10 13:29:04 +01:00
Yu Watanabe 861de64e68 ethtool: make ethtool_get_driver() return -ENODATA if ioctl succeeds but driver name is empty
Inspired by #17532.
2020-11-10 01:14:42 +09:00