Lennart Poettering [Mon, 1 Jun 2020 17:40:30 +0000 (19:40 +0200)]
journal-file: when individual hash chains grow too large, rotate
Even with the new keyed hash table journal feature: if an attacker
manages to get access to the journal file id it could synthesize records
that result in hash collisions. Let's rotate automatically when we
notice that, so that a new journal file ID is generated, our performance
is restored and the attacker has to guess a new file ID before being
able to trigger the issue again.
That said, untrusted peers should never get access to journal files in
the first case...
Lennart Poettering [Fri, 29 May 2020 22:00:50 +0000 (00:00 +0200)]
journal: use a different hash function for each journal file
This adds a new (incompatible) feature to journal files: if enabled the
hash function used for the hash tables is no longer jenkins hash with a
zero key, but siphash keyed by the file uuid that is included in the
file header anyway. This should make our hash tables more robust against
collision attacks, as long as the attacker has no read access to the
journal files. We switch from jenkins to siphash simply because it's
more well-known and we standardize for the rest of our codebase onto it.
This is hardening in order to make collision attacks harder for clients
that can forge log messages but have no read access to the logs. It has
no effect on clients that have read access.
Lennart Poettering [Mon, 1 Jun 2020 16:50:33 +0000 (18:50 +0200)]
journal: make signature arrays const
Lennart Poettering [Mon, 1 Jun 2020 16:20:41 +0000 (18:20 +0200)]
journal: rename hash64() to jenkins_hash64()
Let's prefix this with "jenkins_" since it wraps the jenkins hash. We
want to add support for other hash functions to journald soon, hence
better be clear with what this is. In particular as all other symbols
defined by lookup3.h actually are prefixed "jenkins_".
Lennart Poettering [Mon, 1 Jun 2020 16:15:40 +0000 (18:15 +0200)]
journal-file: rename return parameters to ret_xyz
Let's clean this up a bit, following our usual nomenclature to name
return parameters ret-xyz.
This is mostly a bit of renaming, but there's also some minor other
changes: if we return a pointer to a mmap'ed object plus its offset, in
almost all cases we are happy if either parameter is NULL in case the
caller is not interested in it. Let's fix the remaining case to do this
too, to minimize surprises.
Lennart Poettering [Fri, 29 May 2020 23:29:37 +0000 (01:29 +0200)]
journal-file: also show field hash table size in debug output
Lennart Poettering [Fri, 29 May 2020 22:32:31 +0000 (00:32 +0200)]
journal-file: simplify boot ID acquiring
Lennart Poettering [Mon, 1 Jun 2020 16:06:16 +0000 (18:06 +0200)]
journal: store NE hash instead of LE hash in Match object
We keep converting forth and back though we never need it in LE. Let's
stop doing those conversions hence.
Lennart Poettering [Fri, 29 May 2020 21:35:25 +0000 (23:35 +0200)]
journal-file: use FLAGS_SET where appropriate
Lennart Poettering [Mon, 1 Jun 2020 22:26:34 +0000 (00:26 +0200)]
journal: fix definition of _OBJECT_COMPRESSED_MAX
The object flags field is a bitmask, hence don't sloppily define
_OBJECT_COMPRESSED_MAX as one mor than the previous flag. That worked OK
as long as we only had two flags, but will fall apart as soon as we have
three. Let's fix this.
(It's kinda sloppy how the string table is built here, as it will be
quite sparse as soon as we have more enum entries, but let's keep it for
now.)
Lennart Poettering [Fri, 29 May 2020 21:27:59 +0000 (23:27 +0200)]
macro: add CONST_MIN() similar to CONST_MAX()
Lennart Poettering [Thu, 25 Jun 2020 12:40:35 +0000 (14:40 +0200)]
Merge pull request #16257 from keszybz/two-fuzzer-issues
Two fuzzer issues
Lennart Poettering [Thu, 25 Jun 2020 11:53:17 +0000 (13:53 +0200)]
Merge pull request #16249 from bluca/root_verity_sig
Verity: add support for root hash signature
Evgeny Vereshchagin [Thu, 25 Jun 2020 00:46:21 +0000 (02:46 +0200)]
ci: free up some resources on Pipelines
Now that CIFuzz supports all the sanitizers we use and ALLOWED_BROKEN_TARGETS_PERCENTAGE
we no longer need that bash script.
Evgeny Vereshchagin [Wed, 24 Jun 2020 22:32:00 +0000 (00:32 +0200)]
ci: switch to Ubuntu Bionic on Semaphore
To judge from the settings page where I was kind of nudged into switching to
Ubuntu 18.04 it looks like Ubuntu Xenial is deprecated there.
Luca Boccassi [Mon, 8 Jun 2020 13:02:55 +0000 (14:02 +0100)]
core: add RootHashSignature service parameter
Allow to explicitly pass root hash signature as a unit option. Takes precedence
over implicit checks.
Luca Boccassi [Tue, 2 Jun 2020 14:35:58 +0000 (15:35 +0100)]
dissect/nspawn: add support for dm-verity root hash signature
Since cryptsetup 2.3.0 a new API to verify dm-verity volumes by a
pkcs7 signature, with the public key in the kernel keyring,
is available. Use it if libcryptsetup supports it.
Luca Boccassi [Thu, 4 Jun 2020 16:41:28 +0000 (17:41 +0100)]
veritysetup: add support for dm-verity root hash signature
Since cryptsetup 2.3.0 a new API to verify dm-verity volumes by a
pkcs7 signature, with the public key in the kernel keyring,
is available. Use it if libcryptsetup supports it in the
veritysetup helper binary.
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jun 2020 07:25:18 +0000 (09:25 +0200)]
Merge pull request #16265 from Werkov/fix-16248
cgroup: Parse infinity properly for memory protections
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jun 2020 07:06:49 +0000 (09:06 +0200)]
Merge pull request #16271 from yuwata/network-cleanups-around-link-get
network: several tiny cleanups around link_get()
Michal Koutný [Wed, 24 Jun 2020 10:43:22 +0000 (12:43 +0200)]
missing: Add new Linux capabilities
Linux kernel v5.8 adds two new capabilities. Make sure we can recongize
them even when built with older kernel.
Lennart Poettering [Tue, 23 Jun 2020 06:31:16 +0000 (08:31 +0200)]
tree-wide: avoid some loaded terms
https://tools.ietf.org/html/draft-knodel-terminology-02
https://lwn.net/Articles/823224/
This gets rid of most but not occasions of these loaded terms:
1. scsi_id and friends are something that is supposed to be removed from
our tree (see #7594)
2. The test suite defines an API used by the ubuntu CI. We can remove
this too later, but this needs to be done in sync with the ubuntu CI.
3. In some cases the terms are part of APIs we call or where we expose
concepts the kernel names the way it names them. (In particular all
remaining uses of the word "slave" in our codebase are like this,
it's used by the POSIX PTY layer, by the network subsystem, the mount
API and the block device subsystem). Getting rid of the term in these
contexts would mean doing some major fixes of the kernel ABI first.
Regarding the replacements: when whitelist/blacklist is used as noun we
replace with with allow list/deny list, and when used as verb with
allow-list/deny-list.
Zbigniew Jędrzejewski-Szmek [Wed, 24 Jun 2020 11:26:05 +0000 (13:26 +0200)]
fuzz-udev-rules: -ENOBUFS should be accepted too
In udev_rules_load(), add a debug message. Otherwise there'd be no indication
that parsing was aborted.
Zbigniew Jędrzejewski-Szmek [Tue, 23 Jun 2020 18:51:13 +0000 (20:51 +0200)]
journal: fix buffer overrun when urlifying
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21122.
message is only valid until message_len, and we need to make sure we're not
reading pass that. Bug introduced in
2108b56749ebb8d17f06d08b6ada2f79ae4f0.
Yu Watanabe [Thu, 25 Jun 2020 04:43:35 +0000 (13:43 +0900)]
network: fix typo in comment
Yu Watanabe [Thu, 25 Jun 2020 04:41:47 +0000 (13:41 +0900)]
network: do not update operstate when netdev is not ready
Yu Watanabe [Thu, 25 Jun 2020 04:17:37 +0000 (13:17 +0900)]
network: fix assertion in link_get()
Yu Watanabe [Thu, 25 Jun 2020 04:13:47 +0000 (13:13 +0900)]
network: check that received ifindex is valid
Michal Koutný [Wed, 24 Jun 2020 17:50:00 +0000 (19:50 +0200)]
test: Test memory limit parsing
This covers parsing from configuration files only. Properties set via
DBus have separate code path whose testing would require DBus setup.
Michal Koutný [Wed, 24 Jun 2020 18:40:02 +0000 (20:40 +0200)]
cgroup: Parse infinity properly for memory protections
This fixes commit
db2b8d2e2895010f3443a589c9c1f1dfb25256a6 that
rectified parsing empty values but broke parsing explicit infinity.
Intended parsing semantics will be captured in a testcase in a follow up
commit.
Ref: #16248
Evgeny Vereshchagin [Wed, 24 Jun 2020 20:45:20 +0000 (22:45 +0200)]
ci: bring back Coverity part 2
It's just a follow-up to https://github.com/systemd/systemd/pull/16266.
Currently the Coverity stage is failing with
```
Starting container systemd-fedora-latest
2db425228e1addbce607c7e47e492a0faef2c2c4e85701c6c239a50de95944eb
Error: No such container: bash
The command "$CI_MANAGERS/fedora.sh SETUP" failed and exited with 1 during .
Your build has been stopped.
```
https://travis-ci.org/github/systemd/systemd/builds/
701798193
Evgeny Vereshchagin [Wed, 24 Jun 2020 20:25:14 +0000 (22:25 +0200)]
ci: bring back Coverity
Looks like DOCKER_EXEC got lost somewhere along the way, which, in
turn, caused the "coverity" job to fail with
```
$ $DOCKER_EXEC meson cov-build -Dman=false
Command 'meson' not found, but can be installed with:
apt install meson
Please ask your administrator.
```
https://travis-ci.org/github/systemd/systemd/builds/
701705788
Lennart Poettering [Wed, 24 Jun 2020 17:07:41 +0000 (19:07 +0200)]
Merge pull request #16093 from yuwata/network-htb-add-settings-15213
network: tc: add several settings for HTB
Lennart Poettering [Wed, 24 Jun 2020 17:04:43 +0000 (19:04 +0200)]
Merge pull request #16106 from yuwata/network-tc-ets
network: tc: introduce ETS
Zbigniew Jędrzejewski-Szmek [Wed, 24 Jun 2020 15:42:13 +0000 (17:42 +0200)]
Merge pull request #16238 from keszybz/set-handling-more
Fix handling of cases where a duplicate item is added to a set and related cleanups
Filipe Brandenburger [Wed, 17 Jun 2020 19:17:54 +0000 (12:17 -0700)]
log: introduce log_parse_environment_cli() and log_setup_cli()
Presently, CLI utilities such as systemctl will check whether they have a tty
attached or not to decide whether to parse /proc/cmdline or EFI variable
SystemdOptions looking for systemd.log_* entries.
But this check will be misleading if these tools are being launched by a
daemon, such as a monitoring daemon or automation service that runs in
background.
Make log handling of CLI tools uniform by never checking /proc/cmdline or EFI
variables to determine the logging level.
Furthermore, introduce a new log_setup_cli() shortcut to set up common options
used by most command-line utilities.
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 13:53:55 +0000 (15:53 +0200)]
sysv-generator: reduce scope of variables
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 13:53:44 +0000 (15:53 +0200)]
socket-proxy: use structured initialization in one place
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 12:55:41 +0000 (14:55 +0200)]
basic/hashmap,set: propagate allocation location info in _copy()
Also use double space before the tracking args at the end. Without
the comma this looks ugly, but it's a bit better with the double space.
At least it doesn't look like a variable with a type.
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 12:40:08 +0000 (14:40 +0200)]
tree-wide: use set_ensure_consume() in various places
No funtional change.
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 12:24:57 +0000 (14:24 +0200)]
networkd: take ref immediately after storing item in set
I'm not sure if I understand the code correctly, but it seems that if
storig in the second set failed, we'd return with the first set having
no reference on the link object, and the link object could be freed in the
future, leaving the set with a dangling reference.
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 12:16:04 +0000 (14:16 +0200)]
core/bpf-firewall: use the correct cleanup function
On error, we'd just free the object, and not close the fd.
While at it, let's use set_ensure_consume() to make sure we don't leak
the object if it was already in the set. I'm not sure if that condition
can be achieved.
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 12:07:44 +0000 (14:07 +0200)]
logind: fix possible memleak of message if the message was already in the set
I'm not sure if it is actually possible to encounter this condition. But
let's make the handling correct regardless.
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 12:06:02 +0000 (14:06 +0200)]
portable: rework set handling in portable_detach()
_cleanup_set_free_ is enough for unit_files, because unit_files is
allocated in set_put_strdup(), which uses string_hash_ops_free.
This fixes a leak if marker was already present in the table.
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 12:03:30 +0000 (14:03 +0200)]
resolved: fix memleak on duplicate host lines in /etc/hosts
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 06:46:08 +0000 (08:46 +0200)]
resolved: simplify allocation failure handling in dns_stub_process_query()
Old code was correct, but let's make things more explicit.
Zbigniew Jędrzejewski-Szmek [Thu, 4 Jun 2020 17:58:18 +0000 (19:58 +0200)]
basic/set,hashmap: pass through allocation info in more cases
Zbigniew Jędrzejewski-Szmek [Thu, 4 Jun 2020 17:46:14 +0000 (19:46 +0200)]
basic/set: add set_ensure_consume()
This combines set_ensure_allocated() with set_consume(). The cool thing is that
because we know the hash ops, we can correctly free the item if appropriate.
Similarly to set_consume(), the goal is to simplify handling of the case where
the item needs to be freed on error and if already present in the set.
Jay Burger [Fri, 10 Apr 2020 21:38:42 +0000 (16:38 -0500)]
feature to honor first shutdown request to completion
Create unit tests per established norm at position 52
check in_set first before getting unit
Lennart Poettering [Wed, 24 Jun 2020 06:39:44 +0000 (08:39 +0200)]
Merge pull request #16112 from poettering/nss-systemd-block-fix
rework nss-systemd recursion lock
Lennart Poettering [Wed, 24 Jun 2020 06:39:13 +0000 (08:39 +0200)]
Merge pull request #16223 from cgzones/user_selinux
Initialize SELinux in user instances
Christian Göttsche [Tue, 23 Jun 2020 10:26:59 +0000 (12:26 +0200)]
selinux: update mac_selinux_free()
* Drop mac_selinux_use() condition from mac_selinux_free(): if the
passed pointer holds memory we want to free it even if SELinux is
disabled
* Drop NULL-check cause man:freecon(3) states that freecon(NULL) is a
well-defined NOP
* Assert that on non-SELinux builds the passed pointer is always NULL,
to avoid memory leaks
Gigadoc2 [Tue, 23 Jun 2020 23:46:46 +0000 (23:46 +0000)]
hwdb: add another Logitech G502 Hero variant (#16256)
The commit
67551ea already adds the G502 Hero mouse, but apparently
there are multiple variants with the same ID but different names.
Zbigniew Jędrzejewski-Szmek [Tue, 23 Jun 2020 19:13:07 +0000 (21:13 +0200)]
Merge pull request #16246 from benzea/benzea/xdg-autostart
Minor xdg-autostart changes
Zbigniew Jędrzejewski-Szmek [Tue, 23 Jun 2020 19:09:24 +0000 (21:09 +0200)]
Merge pull request #16213 from yuwata/network-cleanup-link-state-file
network: cleanup link state file
Luca Boccassi [Tue, 23 Jun 2020 10:45:50 +0000 (11:45 +0100)]
make-autosuspend-rules: restore compatibility with Python3 < 3.6
The f'...' format was introduced in Python 3.6 ( https://www.python.org/dev/peps/pep-0498/ )
and returns an error when systemd is built on a system with an older Python3 version:
<...>
File /home/bluca/git/systemd/tools/make-autosuspend-rules.py, line 15
print(f'pci:v{vendor:08X}d{device:08X}*')
^
SyntaxError: invalid syntax
[2/388] Generating version.h with a custom command.
ninja: build stopped: subcommand failed.
$ python3 --version
Python 3.5.6
Use an older format to keep backward compatibility.
Zbigniew Jędrzejewski-Szmek [Tue, 23 Jun 2020 16:26:01 +0000 (18:26 +0200)]
fuzz-udev-rules: rewrite to not require root privileges
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20142.
It turns out we don't need to do all this preparatory work if we want to parse
just one file.
Christian Göttsche [Fri, 19 Jun 2020 17:29:24 +0000 (19:29 +0200)]
Make failures of mac_selinux_init() fatal
Christian Göttsche [Fri, 19 Jun 2020 16:24:10 +0000 (18:24 +0200)]
Initialize SELinux in user instances
Call mac_selinux_init() to setup the label cache, so objects can be
created with default SELinux context.
Fixes: #8004
Zbigniew Jędrzejewski-Szmek [Tue, 23 Jun 2020 15:58:33 +0000 (17:58 +0200)]
udev: split rules object creation and loading
The only functional change is to downgrade the log line to avoid double
logging.
Lennart Poettering [Thu, 4 Jun 2020 09:46:36 +0000 (11:46 +0200)]
userdb: replace recursion lock
Previously we'd used the existance of a specific AF_UNIX socket in the
abstract namespace as lock for disabling lookup recursions. (for
breaking out of the loop: userdb synthesized from nss → nss synthesized
from userdb → userdb synthesized from nss → …)
I did it like that because it promised to work the same both in static
and in dynmically linked environments and is accessible easily from any
programming language.
However, it has a weakness regarding reuse attacks: the socket is
securely hashed (siphash) from the thread ID in combination with the
AT_RANDOM secret. Thus it should not be guessable from an attacker in
advance. That's only true if a thread takes the lock only once and
keeps it forever. However, if a thread takes and releases it multiple
times an attacker might monitor that and quickly take the lock
after the first iteration for follow-up iterations.
It's not a big issue given that userdb (as the primary user for this)
never released the lock and we never made the concept a public
interface, and it was only included in one release so far, but it's
something that deserves fixing. (moreover it's a local DoS only, only
permitting to disable native userdb lookups)
With this rework the libnss_systemd.so.2 module will now export two
additional symbols. These symbols are not used by glibc, but can be used
by arbitrary programs: one can be used to disable nss-systemd, the other
to check if it is currently disabled.
The lock is per-thread. It's slightly less pretty, since it requires
people to manually link against C code via dlopen()/dlsym(), but it
should work safely without the aforementioned weakness.
Lennart Poettering [Tue, 9 Jun 2020 08:47:43 +0000 (10:47 +0200)]
nss-systemd: skip /etc/gshadow look-ups when we just need the GID of a group
Lennart Poettering [Thu, 4 Jun 2020 09:25:46 +0000 (11:25 +0200)]
util: add dlfcn-util.h
This just adds a _cleanup_ helper call encapsulating dlclose().
This also means libsystemd-shared is linked against libdl now. I don't
think this is much of an issue, since libdl is part of glibc anyway, and
anything from exotic. It's not an optional part of the OS (think: NSS
requires dynamic linking), hence this pulls in no deps and is almost
certainly loaded into all process' memory anyway.
[zj: use DEFINE_TRIVIAL_CLEANUP_FUNC().]
Lennart Poettering [Tue, 23 Jun 2020 15:11:47 +0000 (17:11 +0200)]
man: replace perl bug tracker link that went away with link to paper
Fixes: #16245
Lennart Poettering [Tue, 23 Jun 2020 15:06:42 +0000 (17:06 +0200)]
man: s/PROGRAMM/PROGRAM/
Zbigniew Jędrzejewski-Szmek [Tue, 23 Jun 2020 09:35:39 +0000 (11:35 +0200)]
Revert "cgroup: Allow empty assignments of Memory{Low,Min}="
This reverts commit
53aa85af24cda4470b6750f88e181b775385e228.
The reason is that that patch changes the dbus api to be different than
the types declared by introspection api.
Replaces #16122.
Susant Sahani [Thu, 18 Jun 2020 15:01:21 +0000 (00:01 +0900)]
networkctl: display DHCPv4 server address
Yu Watanabe [Thu, 18 Jun 2020 14:59:38 +0000 (23:59 +0900)]
dhcp: fix entry name in parsing lease file
Yu Watanabe [Thu, 18 Jun 2020 14:35:09 +0000 (23:35 +0900)]
network: drop duplicated information from link state file
Those entries are already in DHCP4 lease file, and not used anymore.
Yu Watanabe [Thu, 18 Jun 2020 14:31:32 +0000 (23:31 +0900)]
sd-network: drop unused functions
Yu Watanabe [Thu, 18 Jun 2020 14:24:06 +0000 (23:24 +0900)]
networkctl: use lease file to get DHCPv4 client ID
Yu Watanabe [Thu, 18 Jun 2020 14:18:27 +0000 (23:18 +0900)]
networkctl: use lease file to get DHCPv4 address
Yu Watanabe [Thu, 18 Jun 2020 14:02:31 +0000 (23:02 +0900)]
networkctl: load DHCPv4 lease file and use timezone data from the lease file
Yu Watanabe [Thu, 18 Jun 2020 14:01:05 +0000 (23:01 +0900)]
libsystemd-network: move prototypes of dhcp_lese_save/load() to network-internal.h
Dave Reisner [Thu, 11 Jun 2020 14:34:13 +0000 (10:34 -0400)]
Revert "job: Don't mark as redundant if deps are relevant"
This reverts commit
097537f07a2fab3cb73aef7bc59f2a66aa93f533.
At least Fedora and Debian have already reverted this at the distro
level because it causes more problems than it solves. Arch is debating
reverting it as well [0] but would strongly prefer that this happens
upstream first. Fixes #15188.
[0] https://bugs.archlinux.org/task/66458
Benjamin Berg [Tue, 23 Jun 2020 08:44:50 +0000 (10:44 +0200)]
xdg-autostart: Ignore all files with GNOME autostart phase
If an autostart file for GNOME has a phase specified, then this implies
it is a session service that needs to be started at a specific time.
We have no way of handling the ordering, and while it does make sense
to explicitly hide these services with X-systemd-skip, there is no point
in even trying to handle them.
Benjamin Berg [Tue, 23 Jun 2020 08:38:08 +0000 (10:38 +0200)]
xdg-autostart: Fix info message if Type= is not Application
The message was copy-pasted and not changed to correctly specify what
the problem was.
Luca Boccassi [Wed, 3 Jun 2020 08:50:45 +0000 (09:50 +0100)]
core: add RootHash and RootVerity service parameters
Allow to explicitly pass root hash (explicitly or as a file) and verity
device/file as unit options. Take precedence over implicit checks.
Lennart Poettering [Tue, 16 Jun 2020 14:50:46 +0000 (16:50 +0200)]
nspawn: mkdir selinux mount point once, but not twice
Since #15533 we didn't create the mount point for selinuxfs anymore.
Before it we created it twice because we mount selinuxfs twice: once the
superblock, and once we remount its bind mound read-only. The second
mkdir would mean we'd chown() the host version of selinuxfs (since
there's only one selinuxfs superblock kernel-wide).
The right time to create mount point point is once: before we mount the
selinuxfs. But not a second time for the remount.
Fixes: #16032
Zbigniew Jędrzejewski-Szmek [Tue, 23 Jun 2020 08:16:18 +0000 (10:16 +0200)]
Merge pull request #16196 from mrc0mmand/travis-simplification
travis: use a matrix for similar jobs
Zbigniew Jędrzejewski-Szmek [Tue, 23 Jun 2020 08:12:47 +0000 (10:12 +0200)]
Merge pull request #16216 from nabijaczleweli/make-a-fuss
man/sd-makefs: mention that mkswap can also be run and fix deadlink to btrfs-man5(5)
Lennart Poettering [Mon, 22 Jun 2020 13:37:12 +0000 (15:37 +0200)]
selinux-util: tweak log_enforcing_errno() to return the errno passed in or 0 when in non-enforcing mode
Also, some other, minor modernizations.
Elisei Roca [Tue, 23 Jun 2020 05:42:15 +0000 (07:42 +0200)]
test-functions: read /usr/etc/nsswitch.conf if /etc/nsswitch.conf does not exist (#16195)
See this for more info why and since when this change is needed: https://build.opensuse.org/request/show/807179.
наб [Thu, 18 Jun 2020 23:55:09 +0000 (01:55 +0200)]
man/sd-makefs: link to btrfs.wiki. for btrfs-man5, since the man-pages link is dead
This also adds a <citerefentry project="url"> type,
since the other btrfs manpages use man-pages/die-net and are alive,
and btrfs.w.k.o won't be used anywhere else
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jun 2020 20:46:13 +0000 (22:46 +0200)]
Merge pull request #16237 from keszybz/revert-message-type-check
Revert "bus-message: immediately reject messages with invalid type"
Lennart Poettering [Mon, 22 Jun 2020 15:38:42 +0000 (17:38 +0200)]
Merge pull request #16179 from keszybz/auto-suspend-hwdb
Convert autosuspend rules to hwdb
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jun 2020 15:18:35 +0000 (17:18 +0200)]
bus-message: add macro for calculation of offset from the page
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jun 2020 15:09:49 +0000 (17:09 +0200)]
bus-message: avoid dereferencing a NULL pointer
We'd try to map a zero-byte buffer from a NULL pointer, which is undefined behaviour.
src/systemd/src/libsystemd/sd-bus/bus-message.c:3161:60: runtime error: applying zero offset to null pointer
#0 0x7f6ff064e691 in find_part /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:3161:60
#1 0x7f6ff0640788 in message_peek_body /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:3283:16
#2 0x7f6ff064e8db in enter_struct_or_dict_entry /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:3967:21
#3 0x7f6ff06444ac in bus_message_enter_struct /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:4009:13
#4 0x7f6ff0641dde in sd_bus_message_enter_container /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:4136:21
#5 0x7f6ff0619874 in sd_bus_message_dump /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-dump.c:178:29
#6 0x4293d9 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-bus-message.c:39:9
#7 0x441986 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:558:15
#8 0x44121e in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:470:3
#9 0x443164 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/libfuzzer/FuzzerLoop.cpp:770:7
#10 0x4434bc in fuzzer::Fuzzer::Loop(std::__1::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/libfuzzer/FuzzerLoop.cpp:799:3
#11 0x42d2bc in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:846:6
#12 0x42978a in main /src/libfuzzer/FuzzerMain.cpp:19:10
#13 0x7f6fef13c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#14 0x407808 in _start (out/fuzz-bus-message+0x407808)
Zbigniew Jędrzejewski-Szmek [Sun, 21 Jun 2020 14:15:23 +0000 (16:15 +0200)]
Revert "bus-message: immediately reject messages with invalid type"
This reverts commit
a2dd991d0fde59dc0574bd4d0c1438f01dc0b8ff.
Creation of such messages is evidently useful, and at least sdbus-c++ test
suite depends on that.
Fixes #16193.
Zbigniew Jędrzejewski-Szmek [Thu, 4 Jun 2020 15:41:18 +0000 (17:41 +0200)]
shared/bus-util: fix misleading error handling
set_put()/set_ensure_put() return 0, not -EEXIST, if the entry is already
found in the set. In this case this does not make any difference, but let's
not confuse the reader.
Zbigniew Jędrzejewski-Szmek [Thu, 4 Jun 2020 15:21:42 +0000 (17:21 +0200)]
udevadm-monitor: simplify creation of arg_tag_filter set
This version is more efficient, which doesn't matter, but it allows us
to remove a bunch of error handling, which is always nice.
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jun 2020 14:27:02 +0000 (16:27 +0200)]
fuzz-netdev-parser: add test case for earlier version of preceding patches
AddressSanitizer:DEADLYSIGNAL
=================================================================
==12==ERROR: AddressSanitizer: ABRT on unknown address 0x00000000000c (pc 0x7f0a518b3428 bp 0x7fffa463bfd0 sp 0x7fffa463be68 T0)
SCARINESS: 10 (signal)
#0 0x7f0a518b3428 in raise (/lib/x86_64-linux-gnu/libc.so.6+0x35428)
#1 0x7f0a518b5029 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x37029)
#2 0x7f0a52ca635a in log_assert_failed_realm /work/build/../../src/systemd/src/basic/log.c:819:9
#3 0x4eea92 in config_parse_wireguard_endpoint /work/build/../../src/systemd/src/network/netdev/wireguard.c:808:9
#4 0x7f0a52b2f74e in next_assignment /work/build/../../src/systemd/src/shared/conf-parser.c:133:32
#5 0x7f0a52b2954e in parse_line /work/build/../../src/systemd/src/shared/conf-parser.c:242:16
#6 0x7f0a52b28911 in config_parse /work/build/../../src/systemd/src/shared/conf-parser.c:377:21
#7 0x7f0a52b29ec6 in config_parse_many_files /work/build/../../src/systemd/src/shared/conf-parser.c:439:21
#8 0x7f0a52b2a5a6 in config_parse_many /work/build/../../src/systemd/src/shared/conf-parser.c:507:16
#9 0x4d8d6c in netdev_load_one /work/build/../../src/systemd/src/network/netdev/netdev.c:732:13
#10 0x4d3e2b in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/network/fuzz-netdev-parser.c:23:16
#11 0x6b3266 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:558:15
#12 0x6af860 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:470:3
#13 0x6b6970 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/libfuzzer/FuzzerLoop.cpp:770:7
#14 0x6b7376 in fuzzer::Fuzzer::Loop(std::__1::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/libfuzzer/FuzzerLoop.cpp:799:3
#15 0x67573f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:846:6
#16 0x667097 in main /src/libfuzzer/FuzzerMain.cpp:19:10
#17 0x7f0a5189e82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#18 0x4295a8 in _start (out/fuzz-netdev-parser+0x4295a8)
DEDUP_TOKEN: raise--abort--log_assert_failed_realm
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: ABRT (/lib/x86_64-linux-gnu/libc.so.6+0x35428) in raise
==12==ABORTING
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jun 2020 13:55:04 +0000 (15:55 +0200)]
netdev/wireguard: do not invalidate peer on invalid syntax
We would say "ignoring", but invalidate the peer anyway.
Let's only do that if we modified the peer irreperably.
Also add comments explaining allocation handling.
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 13:12:29 +0000 (15:12 +0200)]
tree-wide: use set_ensure_put()
Patch contains a coccinelle script, but it only works in some cases. Many
parts were converted by hand.
Note: I did not fix errors in return value handing. This will be done separate
to keep the patch comprehensible. No functional change is intended in this
patch.
Zbigniew Jędrzejewski-Szmek [Wed, 3 Jun 2020 12:25:18 +0000 (14:25 +0200)]
basic/set: add set_ensure_put()
It's such a common operation to allocate the set and put an item in it,
that it deserves a helper. set_ensure_put() has the same return values
as set_put().
Comes with tests!
Zbigniew Jędrzejewski-Szmek [Wed, 3 Jun 2020 12:58:01 +0000 (14:58 +0200)]
sd-device: use set_put_strdup() in one more place
Zbigniew Jędrzejewski-Szmek [Wed, 3 Jun 2020 12:25:18 +0000 (14:25 +0200)]
resolved: introduce dns_transaction_gcp()
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jun 2020 12:41:50 +0000 (14:41 +0200)]
make-autosuspend-rules: remove one instance of "whitelist"
Let's be clear what we mean exactly. Also see https://lwn.net/Articles/823224/
for general justification.
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jun 2020 12:38:01 +0000 (14:38 +0200)]
rules: remove 61-autosuspend-manual.rules
It doesn't hurt, but there's no point in keeping it now. Any changes
can be added to 60-autosuspend.hwdb.
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jun 2020 16:38:58 +0000 (18:38 +0200)]
hwdb: enable autosuspend for Wacom Pen and EMV Smartcard Reader
Replaces #16113.