]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agoupdate TODO
Lennart Poettering [Fri, 26 Jun 2020 16:04:52 +0000 (18:04 +0200)] 
update TODO

3 years agoupdate TODO
Lennart Poettering [Fri, 26 Jun 2020 13:43:24 +0000 (15:43 +0200)] 
update TODO

3 years agoMerge pull request #16281 from poettering/logind-cache-more-efi
Lennart Poettering [Fri, 26 Jun 2020 13:12:57 +0000 (15:12 +0200)] 
Merge pull request #16281 from poettering/logind-cache-more-efi

logind: cache two more EFI variables in logind

3 years agoAdd quotes for -n
Gaoyi [Fri, 26 Jun 2020 05:55:41 +0000 (13:55 +0800)] 
Add quotes for -n

According to SC2070, -n doesn't work with unquoted arguments
https://github.com/koalaman/shellcheck/wiki/SC2070

Signed-off-by: Gaoyi <ymuemc@163.com>
3 years agoJOURNAL_FILE_FORMAT: minor markdown fixes
Lennart Poettering [Fri, 26 Jun 2020 11:55:18 +0000 (13:55 +0200)] 
JOURNAL_FILE_FORMAT: minor markdown fixes

3 years agoNEWS: add more items for 246
Lennart Poettering [Fri, 26 Jun 2020 11:54:54 +0000 (13:54 +0200)] 
NEWS: add more items for 246

3 years agologind: also cache LoaderEntryOneShot EFI variable 16281/head
Lennart Poettering [Thu, 25 Jun 2020 14:25:41 +0000 (16:25 +0200)] 
logind: also cache LoaderEntryOneShot EFI variable

With this we are now caching all EFI variables that we expose as
property in logind. Thus a client invoking GetAllProperties() should
only trgger a single read of each variable, but never repeated ones.

Obsoletes: #16190
Fixes: #14828
3 years agoefi-loader: cache LoaderConfigTimeoutOneShot too
Lennart Poettering [Thu, 25 Jun 2020 13:24:25 +0000 (15:24 +0200)] 
efi-loader: cache LoaderConfigTimeoutOneShot too

The data from this EFI variable is exposed as dbus property, and gdbus
clients are happy to issue GetAllProperties() as if it was free. Hence
make sure it's actually free and cache LoaderConfigTimeoutOneShot, since
it's easy.

3 years agotmpfile-util: typo fixes
Lennart Poettering [Thu, 25 Jun 2020 13:24:06 +0000 (15:24 +0200)] 
tmpfile-util: typo fixes

3 years agoutil: add missing header guard
Yu Watanabe [Thu, 25 Jun 2020 20:36:01 +0000 (05:36 +0900)] 
util: add missing header guard

3 years agoMerge pull request #16096 from poettering/journal-hash-fix
Zbigniew Jędrzejewski-Szmek [Fri, 26 Jun 2020 05:27:05 +0000 (07:27 +0200)] 
Merge pull request #16096 from poettering/journal-hash-fix

journal file hash table hardening + zstd support

3 years agohwdb: update for v246
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jun 2020 13:44:06 +0000 (15:44 +0200)] 
hwdb: update for v246

As usual, it seems that there are mostly additions with a smaller amount
of corrections, no big removals.

3 years agoMerge pull request #16275 from yuwata/network-deprecate-netdevsim
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jun 2020 16:41:49 +0000 (18:41 +0200)] 
Merge pull request #16275 from yuwata/network-deprecate-netdevsim

network: deprecate netdevsim support

3 years agoudev: split attribute assignment for MMC cards
Łukasz Stelmach [Wed, 24 Jun 2020 17:24:13 +0000 (19:24 +0200)] 
udev: split attribute assignment for MMC cards

Some cards have names consisting only of whitespace characters which
prevents the original rule from matching and assigning ID_SERIAL
properly. With the split rules ID_SERIAL and ID_NAME are assigned
independently and the symlink is created only if both are available the
same way it has worked for partitions.

3 years agoportabled: create temp file for unit, not directory
Luca Boccassi [Tue, 23 Jun 2020 14:56:33 +0000 (15:56 +0100)] 
portabled: create temp file for unit, not directory

open_tmpfile_linkable is used to create a temporary file in the same
directory as the target, but portabled uses the name of the parent
directory instead of the file it intends to create.
In other words, it creats a tmp for /etc/systemd/system.attached instead
of /etc/systemd/system.attached/foo.service.
It still works because it's later moved in the right place.
But as a side effect, it tries the create the file in the parent directory
which is /etc/systemd, and it case of read-only filesystems it fails.

3 years agoselinux: check mac_selinux_init() in tests
Christian Göttsche [Thu, 25 Jun 2020 12:36:49 +0000 (14:36 +0200)] 
selinux: check mac_selinux_init() in tests

Since bc8d57f2903d mac_selinux_init() is checked and considered fatal
tree-wide.

Coverity complains about it not being checked in the test code.

Follow-up of: #16223
Fixes: CID 1429975
3 years agoMerge pull request #16278 from keszybz/fix-man-links
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jun 2020 16:38:37 +0000 (18:38 +0200)] 
Merge pull request #16278 from keszybz/fix-man-links

Fix html links

3 years agoMerge pull request #15624 from poettering/hostnamed-instant
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jun 2020 16:36:56 +0000 (18:36 +0200)] 
Merge pull request #15624 from poettering/hostnamed-instant

hostnamed: stop caching so much

3 years agoMerge pull request #15697 from OhNoMoreGit/fix-path-units
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jun 2020 16:23:47 +0000 (18:23 +0200)] 
Merge pull request #15697 from OhNoMoreGit/fix-path-units

Recheck PathExists=, PathExistsGlob=, DirectoryNotEmpty= when triggered unit terminates

3 years agoupdate TODO 16096/head
Lennart Poettering [Tue, 2 Jun 2020 08:39:19 +0000 (10:39 +0200)] 
update TODO

3 years agocompress: do something roughly reasonable when building without compressor
Lennart Poettering [Wed, 24 Jun 2020 14:35:10 +0000 (16:35 +0200)] 
compress: do something roughly reasonable when building without compressor

3 years agocoredump: use log_error_errno() where appropriate
Lennart Poettering [Wed, 24 Jun 2020 14:34:36 +0000 (16:34 +0200)] 
coredump: use log_error_errno() where appropriate

3 years agotree-wide: add new HAVE_COMPRESSION compile time flag
Lennart Poettering [Wed, 24 Jun 2020 14:33:41 +0000 (16:33 +0200)] 
tree-wide: add new HAVE_COMPRESSION compile time flag

let's simplify the checks for ZSTD/LZ4/XZ

As suggested:

https://github.com/systemd/systemd/pull/16096#discussion_r440705585

3 years agodocs: document the new journal file format additions
Lennart Poettering [Mon, 1 Jun 2020 22:13:42 +0000 (00:13 +0200)] 
docs: document the new journal file format additions

3 years agodocs: import journal file format docs from fdo wiki
Lennart Poettering [Mon, 1 Jun 2020 20:56:02 +0000 (22:56 +0200)] 
docs: import journal file format docs from fdo wiki

Just an import, with no textual changes (some fixed URLs however)

3 years agojournal: support zstd compression for large objects in journal files
Lennart Poettering [Mon, 1 Jun 2020 21:26:55 +0000 (23:26 +0200)] 
journal: support zstd compression for large objects in journal files

3 years agojournal-file: when individual hash chains grow too large, rotate
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...

3 years agojournal: use a different hash function for each journal file
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.

3 years agojournal: make signature arrays const
Lennart Poettering [Mon, 1 Jun 2020 16:50:33 +0000 (18:50 +0200)] 
journal: make signature arrays const

3 years agojournal: rename hash64() to jenkins_hash64()
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_".

3 years agojournal-file: rename return parameters to ret_xyz
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.

3 years agojournal-file: also show field hash table size in debug output
Lennart Poettering [Fri, 29 May 2020 23:29:37 +0000 (01:29 +0200)] 
journal-file: also show field hash table size in debug output

3 years agojournal-file: simplify boot ID acquiring
Lennart Poettering [Fri, 29 May 2020 22:32:31 +0000 (00:32 +0200)] 
journal-file: simplify boot ID acquiring

3 years agojournal: store NE hash instead of LE hash in Match object
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.

3 years agojournal-file: use FLAGS_SET where appropriate
Lennart Poettering [Fri, 29 May 2020 21:35:25 +0000 (23:35 +0200)] 
journal-file: use FLAGS_SET where appropriate

3 years agojournal: fix definition of _OBJECT_COMPRESSED_MAX
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.)

3 years agomacro: add CONST_MIN() similar to CONST_MAX()
Lennart Poettering [Fri, 29 May 2020 21:27:59 +0000 (23:27 +0200)] 
macro: add CONST_MIN() similar to CONST_MAX()

3 years agoman: reword awkward sentence 16278/head
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jun 2020 12:41:05 +0000 (14:41 +0200)] 
man: reword awkward sentence

3 years agoman: fix various internal references
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jun 2020 12:38:21 +0000 (14:38 +0200)] 
man: fix various internal references

Found with linkchecker.

3 years agoman: fix links to various external man pages
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jun 2020 12:37:24 +0000 (14:37 +0200)] 
man: fix links to various external man pages

In cases where we used both die-net and man-pages for the same reference,
I switched to use man-pages everywhere.

3 years agoMerge pull request #16257 from keszybz/two-fuzzer-issues
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

3 years agoMerge pull request #16249 from bluca/root_verity_sig
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

3 years agohostnamed: minimize caching of /etc/hostname, /etc/os-release and /etc/machine-info 15624/head
Lennart Poettering [Tue, 28 Apr 2020 15:42:46 +0000 (17:42 +0200)] 
hostnamed: minimize caching of /etc/hostname, /etc/os-release and /etc/machine-info

Instead of reading these files at startup and never again, let's read
them when we need them. As an optimization (in particular as some of
these files contain the data for many fields at once) let's cache the
results as long as the stat data (i.e. mtime) remains stable.

Also, while we are at it, if we can't read any of these props, let's not
fail everything, but continue without the data.

3 years agohostnamed: don't cache local hostname either
Lennart Poettering [Tue, 28 Apr 2020 15:34:38 +0000 (17:34 +0200)] 
hostnamed: don't cache local hostname either

Querying the current hostname is cheap, hence let's not cache it. That
way it is much less likely we'll return out-of-date data.

3 years agoci: free up some resources on Pipelines
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.

3 years agoci: switch to Ubuntu Bionic on Semaphore
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.

3 years agotest-network: remove unused config 16275/head
Yu Watanabe [Thu, 25 Jun 2020 08:30:19 +0000 (17:30 +0900)] 
test-network: remove unused config

3 years agonetwork: deprecate netdevsim support in .netdev config
Yu Watanabe [Thu, 25 Jun 2020 08:26:36 +0000 (17:26 +0900)] 
network: deprecate netdevsim support in .netdev config

Since kernel 5.2, netdevsim creation/destruction via netlink is removed.
So, let's remove the netdevsim support from our documents.

See below commit for more details.
https://github.com/torvalds/linux/commit/e05b2d141fef22cfac1928cf0eb6890e5dae4216

3 years agocore: add RootHashSignature service parameter 16249/head
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.

3 years agodissect/nspawn: add support for dm-verity root hash signature
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.

3 years agoveritysetup: add support for dm-verity root hash signature
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.

3 years agoMerge pull request #16265 from Werkov/fix-16248
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

3 years agoMerge pull request #16271 from yuwata/network-cleanups-around-link-get
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()

3 years agomissing: Add new Linux capabilities
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.

3 years agotree-wide: avoid some loaded terms
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.

3 years agofuzz-udev-rules: -ENOBUFS should be accepted too 16257/head
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.

3 years agojournal: fix buffer overrun when urlifying
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.

3 years agonetwork: fix typo in comment 16271/head
Yu Watanabe [Thu, 25 Jun 2020 04:43:35 +0000 (13:43 +0900)] 
network: fix typo in comment

3 years agonetwork: do not update operstate when netdev is not ready
Yu Watanabe [Thu, 25 Jun 2020 04:41:47 +0000 (13:41 +0900)] 
network: do not update operstate when netdev is not ready

3 years agonetwork: fix assertion in link_get()
Yu Watanabe [Thu, 25 Jun 2020 04:17:37 +0000 (13:17 +0900)] 
network: fix assertion in link_get()

3 years agonetwork: check that received ifindex is valid
Yu Watanabe [Thu, 25 Jun 2020 04:13:47 +0000 (13:13 +0900)] 
network: check that received ifindex is valid

3 years agotest: Test memory limit parsing 16265/head
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.

3 years agocgroup: Parse infinity properly for memory protections
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

3 years agoci: bring back Coverity part 2
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

3 years agoci: bring back Coverity
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

3 years agoMerge pull request #16093 from yuwata/network-htb-add-settings-15213
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

3 years agoMerge pull request #16106 from yuwata/network-tc-ets
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

3 years agoMerge pull request #16238 from keszybz/set-handling-more
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

3 years agolog: introduce log_parse_environment_cli() and log_setup_cli()
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.

3 years agosysv-generator: reduce scope of variables 16238/head
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 13:53:55 +0000 (15:53 +0200)] 
sysv-generator: reduce scope of variables

3 years agosocket-proxy: use structured initialization in one place
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jun 2020 13:53:44 +0000 (15:53 +0200)] 
socket-proxy: use structured initialization in one place

3 years agobasic/hashmap,set: propagate allocation location info in _copy()
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.

3 years agotree-wide: use set_ensure_consume() in various places
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.

3 years agonetworkd: take ref immediately after storing item in set
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.

3 years agocore/bpf-firewall: use the correct cleanup function
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.

3 years agologind: fix possible memleak of message if the message was already in the set
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.

3 years agoportable: rework set handling in portable_detach()
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.

3 years agoresolved: fix memleak on duplicate host lines in /etc/hosts
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

3 years agoresolved: simplify allocation failure handling in dns_stub_process_query()
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.

3 years agobasic/set,hashmap: pass through allocation info in more cases
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

3 years agobasic/set: add set_ensure_consume()
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.

3 years agofeature to honor first shutdown request to completion
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

3 years agoMerge pull request #16112 from poettering/nss-systemd-block-fix
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

3 years agoMerge pull request #16223 from cgzones/user_selinux
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

3 years agoselinux: update mac_selinux_free()
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

3 years agohwdb: add another Logitech G502 Hero variant (#16256)
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.

3 years agoMerge pull request #16246 from benzea/benzea/xdg-autostart
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

3 years agoMerge pull request #16213 from yuwata/network-cleanup-link-state-file
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

3 years agomake-autosuspend-rules: restore compatibility with Python3 < 3.6
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.

3 years agofuzz-udev-rules: rewrite to not require root privileges
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.

3 years agoMake failures of mac_selinux_init() fatal 16223/head
Christian Göttsche [Fri, 19 Jun 2020 17:29:24 +0000 (19:29 +0200)] 
Make failures of mac_selinux_init() fatal

3 years agoInitialize SELinux in user instances
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
3 years agoudev: split rules object creation and loading
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.

3 years agouserdb: replace recursion lock 16112/head
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.

3 years agonss-systemd: skip /etc/gshadow look-ups when we just need the GID of a group
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

3 years agoutil: add dlfcn-util.h
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().]

3 years agoman: replace perl bug tracker link that went away with link to paper
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
3 years agoman: s/PROGRAMM/PROGRAM/
Lennart Poettering [Tue, 23 Jun 2020 15:06:42 +0000 (17:06 +0200)] 
man: s/PROGRAMM/PROGRAM/

3 years agoRevert "cgroup: Allow empty assignments of Memory{Low,Min}="
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.

3 years agonetworkctl: display DHCPv4 server address 16213/head
Susant Sahani [Thu, 18 Jun 2020 15:01:21 +0000 (00:01 +0900)] 
networkctl: display DHCPv4 server address