systemd/.git
6 years agojournal: limit the number of entries in the cache based on available memory
Zbigniew Jędrzejewski-Szmek [Tue, 22 Jan 2019 15:12:52 +0000 (16:12 +0100)]
journal: limit the number of entries in the cache based on available memory

This is far from perfect, but should give mostly reasonable values. My
assumption is that if somebody has a few hundred MB of memory, they are
unlikely to have thousands of processes logging. A hundred would already be a
lot. So let's scale the cache size propritionally to the total memory size,
with clamping on both ends.

The formula gives 64 cache entries for each GB of RAM.

(cherry-picked from commit b12a480829c5ca8f4d4fa9cde8716b5f2f12a3ad)

Related: #1664976

6 years agobasic/prioq: add prioq_peek_item()
Zbigniew Jędrzejewski-Szmek [Sat, 26 Jan 2019 10:27:18 +0000 (11:27 +0100)]
basic/prioq: add prioq_peek_item()

(cherry-picked from commit ef21b3b5bf824e652addf850bcfd9374c7b33ce8)

Related: #1664976

6 years agoprocfs-util: expose functionality to query total memory
Zbigniew Jędrzejewski-Szmek [Tue, 22 Jan 2019 14:43:07 +0000 (15:43 +0100)]
procfs-util: expose functionality to query total memory

procfs_memory_get_current is renamed to procfs_memory_get_used, because
"current" can mean anything, including total memory, used memory, and free
memory, as long as the value is up to date.

No functional change.

(cherry-picked from commit c482724aa5c5d0b1391fcf958a9a3ea6ce73a085)

Related: #1664976

6 years agocoredump: fix message when we fail to save a journald coredump
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 20:34:24 +0000 (21:34 +0100)]
coredump: fix message when we fail to save a journald coredump

If creation of the message failed, we'd write a bogus entry:
systemd-coredump[1400]: Cannot store coredump of 416 (systemd-journal): No space left on device
systemd-coredump[1400]: MESSAGE=Process 416 (systemd-journal) of user 0 dumped core.
systemd-coredump[1400]: Coredump diverted to

(cherry-picked from commit f0136e09221364f931c3a3b715da4e4d3ee9f2ac)

Related: #1664976

6 years agobasic/process-util: limit command line lengths to _SC_ARG_MAX
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 17:48:23 +0000 (18:48 +0100)]
basic/process-util: limit command line lengths to _SC_ARG_MAX

This affects systemd-journald and systemd-coredump.

Example entry:
$ journalctl -o export -n1 'MESSAGE=Something logged'
__CURSOR=s=976542d120c649f494471be317829ef9;i=34e;b=4871e4c474574ce4a462dfe3f1c37f06;m=c7d0c37dd2;t=57c4ac58f3b98;x=67598e942bd23dc0
__REALTIME_TIMESTAMP=1544035467475864
__MONOTONIC_TIMESTAMP=858200964562
_BOOT_ID=4871e4c474574ce4a462dfe3f1c37f06
PRIORITY=6
_UID=1000
_GID=1000
_CAP_EFFECTIVE=0
_SELINUX_CONTEXT=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
_AUDIT_SESSION=1
_AUDIT_LOGINUID=1000
_SYSTEMD_OWNER_UID=1000
_SYSTEMD_UNIT=user@1000.service
_SYSTEMD_SLICE=user-1000.slice
_SYSTEMD_USER_SLICE=-.slice
_SYSTEMD_INVOCATION_ID=1c4a469986d448719cb0f9141a10810e
_MACHINE_ID=08a5690a2eed47cf92ac0a5d2e3cf6b0
_HOSTNAME=krowka
_TRANSPORT=syslog
SYSLOG_FACILITY=17
SYSLOG_IDENTIFIER=syslog-caller
MESSAGE=Something logged
_COMM=poc
_EXE=/home/zbyszek/src/systemd-work3/poc
_SYSTEMD_CGROUP=/user.slice/user-1000.slice/user@1000.service/gnome-terminal-server.service
_SYSTEMD_USER_UNIT=gnome-terminal-server.service
SYSLOG_PID=4108
SYSLOG_TIMESTAMP=Dec  5 19:44:27
_PID=4108
_CMDLINE=./poc AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA>
_SOURCE_REALTIME_TIMESTAMP=1544035467475848

$ journalctl -o export -n1 'MESSAGE=Something logged' --output-fields=_CMDLINE|wc
      6    2053 2097410

2MB might be hard for some clients to use meaningfully, but OTOH, it is
important to log the full commandline sometimes. For example, when the program
is crashing, the exact argument list is useful.

(cherry-picked from commit 2d5d2e0cc5171c6795d2a485841474345d9e30ab)

Related: #1664976

6 years agojournald: do not store the iovec entry for process commandline on stack
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 17:38:39 +0000 (18:38 +0100)]
journald: do not store the iovec entry for process commandline on stack

This fixes a crash where we would read the commandline, whose length is under
control of the sending program, and then crash when trying to create a stack
allocation for it.

CVE-2018-16864
https://bugzilla.redhat.com/show_bug.cgi?id=1653855

The message actually doesn't get written to disk, because
journal_file_append_entry() returns -E2BIG.

(cherry-picked from commit 084eeb865ca63887098e0945fb4e93c852b91b0f)

Resolves: #1664976

6 years agojournald: remove unnecessary {}
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 16:53:50 +0000 (17:53 +0100)]
journald: remove unnecessary {}

(cherry-picked from commit bc2762a309132a34db1797d8b5792d5747a94484)

Related: #1664976

6 years agocoredump: remove duplicate MESSAGE= prefix from message
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 16:33:15 +0000 (17:33 +0100)]
coredump: remove duplicate MESSAGE= prefix from message

systemd-coredump[9982]: MESSAGE=Process 771 (systemd-journal) of user 0 dumped core.
systemd-coredump[9982]: Coredump diverted to /var/lib/systemd/coredump/core...

log_dispatch() calls log_dispatch_internal() which calls write_to_journal()
which appends MESSAGE= on its own.

(cherry-picked from commit 4f62556d71206ac814a020a954b397d4940e14c3)

Related: #1664976

6 years agotravis: reboot the container before running tests
Frantisek Sumsal [Thu, 17 Jan 2019 11:03:10 +0000 (12:03 +0100)]
travis: reboot the container before running tests

6 years agotravis: fix syntax error in .travis.yml
Frantisek Sumsal [Tue, 15 Jan 2019 13:35:27 +0000 (14:35 +0100)]
travis: fix syntax error in .travis.yml

(cherry picked from commit 7f9d44f527ea214347f7d3b3b067f84df53feed7)

6 years agotravis: drop the SELinux Fedora workaround
Frantisek Sumsal [Tue, 15 Jan 2019 10:03:45 +0000 (11:03 +0100)]
travis: drop the SELinux Fedora workaround

(cherry picked from commit 90399c456fe8cf726fc04fb7be9e2a01f9ca0eae)

6 years agotravis: RHEL8 support
Frantisek Sumsal [Mon, 14 Jan 2019 13:49:32 +0000 (14:49 +0100)]
travis: RHEL8 support

(cherry picked from commit e5c78840b2b124400f56cb5fbaf2357cd8901218)

6 years agotravis: enable Travis CI on CentOS 7
Frantisek Sumsal [Mon, 7 Jan 2019 14:49:45 +0000 (15:49 +0100)]
travis: enable Travis CI on CentOS 7

(cherry picked from commit 2014cb51b6dfe1f7f0b98e62311398c2bf801c2b)

6 years agocore: enforce a limit on STATUS= texts recvd from services
Lennart Poettering [Wed, 17 Oct 2018 16:37:48 +0000 (18:37 +0200)]
core: enforce a limit on STATUS= texts recvd from services

Let's better be safe than sorry, and put a limit on what we receive.

(cherry picked from commit 3eac1bcae9284fb8b18f4b82156c0e85ddb004e5)

Related: CVE-2018-15686

6 years agocore: when deserializing state always use read_line(…, LONG_LINE_MAX, …)
Lennart Poettering [Wed, 17 Oct 2018 16:36:24 +0000 (18:36 +0200)]
core: when deserializing state always use read_line(…, LONG_LINE_MAX, …)

This should be much better than fgets(), as we can read substantially
longer lines and overly long lines result in proper errors.

Fixes a vulnerability discovered by Jann Horn at Google.

CVE-2018-15686
LP: #1796402
https://bugzilla.redhat.com/show_bug.cgi?id=1639071

(cherry picked from commit 8948b3415d762245ebf5e19d80b97d4d8cc208c1)

Resolves: CVE-2018-15686

6 years agotests: drop the precondition check for inherited flag
Frantisek Sumsal [Thu, 8 Nov 2018 08:40:13 +0000 (09:40 +0100)]
tests: drop the precondition check for inherited flag

Docker's default capability set has the inherited flag already
set - that breaks tests which expect otherwise. Let's just
drop the check and run the test anyway.

Fixes #10663

Cherry-picked from: c446b8486d9ed18d1bc780948ae9ee8a53fa4c3f

6 years agounit: don't add Requires for tmp.mount v239-11
Lukas Nykryn [Mon, 5 Sep 2016 10:47:09 +0000 (12:47 +0200)]
unit: don't add Requires for tmp.mount

rhel-only
Resolves: #1619292

6 years agomeson: check whether gnutls supports TCP fast open
Yu Watanabe [Mon, 25 Jun 2018 13:40:40 +0000 (22:40 +0900)]
meson: check whether gnutls supports TCP fast open

Fixes #9403

Cherry-picked from: f02582f69fe1e7663a87ba80bd4f90d5d23ee75f

6 years agomeson: rename -Ddebug to -Ddebug-extra
Zbigniew Jędrzejewski-Szmek [Sun, 19 Aug 2018 17:11:30 +0000 (19:11 +0200)]
meson: rename -Ddebug to -Ddebug-extra

Meson added -Doptimization and -Ddebug options, which obviously causes
a conflict with our -Ddebug options. Let's rename it.

Fixes #9883.

Cherry-picked from: 8f6b442a78d0b485f044742ad90b2e8271b4e68e

6 years agotest: Drop SKIP_INITRD for QEMU-based tests
Michael Biebl [Mon, 16 Jul 2018 09:27:44 +0000 (11:27 +0200)]
test: Drop SKIP_INITRD for QEMU-based tests

Not all distros support booting without an initrd. E.g. the Debian
kernel builds ext4 as a module and so relies on an initrd to
successfully start the QEMU-based images.

Cherry-picked from: c2d4da002095fe6f86f89a508a81e48fb6d3196f

6 years agonspawn: beef up netns checking a bit, for compat with old kernels
Lennart Poettering [Wed, 31 Oct 2018 12:04:20 +0000 (13:04 +0100)]
nspawn: beef up netns checking a bit, for compat with old kernels

Fixes: #10544

Cherry-picked from: 6619ad889da260cf83079cc74a85d571acd1df5a

6 years agotests: explicitly enable user namespaces for TEST-13-NSPAWN-SMOKE
Frantisek Sumsal [Sat, 15 Dec 2018 19:22:31 +0000 (20:22 +0100)]
tests: explicitly enable user namespaces for TEST-13-NSPAWN-SMOKE

Cherry-picked from: 67f5c0c776ce9449ad21e9854665573a05141fd4

6 years agosysctl.d: switch net.ipv4.conf.all.rp_filter from 1 to 2 v239-10
Lubomir Rintel [Wed, 28 Nov 2018 10:44:20 +0000 (11:44 +0100)]
sysctl.d: switch net.ipv4.conf.all.rp_filter from 1 to 2

This switches the RFC3704 Reverse Path filtering from Strict mode to Loose
mode. The Strict mode breaks some pretty common and reasonable use cases,
such as keeping connections via one default route alive after another one
appears (e.g. plugging an Ethernet cable when connected via Wi-Fi).

The strict filter also makes it impossible for NetworkManager to do
connectivity check on a newly arriving default route (it starts with a
higher metric and is bumped lower if there's connectivity).

Kernel's default is 0 (no filter), but a Loose filter is good enough. The
few use cases where a Strict mode could make sense can easily override
this.

The distributions that don't care about the client use cases and prefer a
strict filter could just ship a custom configuration in
/usr/lib/sysctl.d/ to override this.

Cherry-picked from: 230450d4e4f1f5fc9fa4295ed9185eea5b6ea16e
Resolves: #1653824

6 years agorules: watch metadata changes on DASD devices
Vojtech Trefny [Tue, 4 Dec 2018 15:47:36 +0000 (16:47 +0100)]
rules: watch metadata changes on DASD devices

To make sure the change event is emitted and udev db is updated
after metadata changes.

(cherry picked from commit 38397c8ce044fdc0138c9919168a856c0e16f720)

Resolves: #1638676

6 years agocryptsetup-generator: allow whitespace characters in keydev specification
Michal Sekletar [Tue, 4 Sep 2018 18:03:34 +0000 (20:03 +0200)]
cryptsetup-generator: allow whitespace characters in keydev specification

For example, <luks.uuid>=/keyfile:LABEL="KEYFILE FS" previously wouldn't
work, because we truncated label at the first whitespace character,
i.e. LABEL="KEYFILE".

(cherry-picked from commit 7949dfa73a44ae6524779689483d12243dfbcfdf)

Related: #1656869

6 years agocryptsetup-generator: don't return error if target directory already exists
Michal Sekletar [Tue, 4 Sep 2018 17:51:14 +0000 (19:51 +0200)]
cryptsetup-generator: don't return error if target directory already exists

(cherry-picked from commit 579875bc4a59b917fa32519e3d96d56dc591ad1e)

Related: #1656869

6 years agocryptsetup: don't use %m if there's no error to show
Lennart Poettering [Fri, 5 Oct 2018 20:37:37 +0000 (22:37 +0200)]
cryptsetup: don't use %m if there's no error to show

We are not the ones receiving an error here, but the ones generating it,
hence we shouldn't show it with %m, that's just confusing, as it
suggests we received an error from some other call.

(cherry-picked from commit 2abe64666e544be6499f870618185f8819b4c152)

Related: #1656869

6 years agocryptsetup-generator: introduce basic keydev support
Michal Sekletar [Thu, 30 Aug 2018 08:45:11 +0000 (08:45 +0000)]
cryptsetup-generator: introduce basic keydev support

Dracut has a support for unlocking encrypted drives with keyfile stored
on the external drive. This support is included in the generated initrd
only if systemd module is not included.

When systemd is used in initrd then attachment of encrypted drives is
handled by systemd-cryptsetup tools. Our generator has support for
keyfile, however, it didn't support keyfile on the external block
device (keydev).

This commit introduces basic keydev support. Keydev can be specified per
luks.uuid on the kernel command line. Keydev is automatically mounted
during boot and we look for keyfile in the keydev
mountpoint (i.e. keyfile path is prefixed with the keydev mount point
path). After crypt device is attached we automatically unmount
where keyfile resides.

Example:
        rd.luks.key=70bc876b-f627-4038-9049-3080d79d2165=/key:LABEL=KEYDEV

(cherry-picked from commit 70f5f48eb891b12e969577b464de61e15a2593da)

Resolves: #1656869

7 years agosd-bus: properly initialize containers v239-9
Jan Synacek [Wed, 31 Oct 2018 11:50:19 +0000 (12:50 +0100)]
sd-bus: properly initialize containers

Fixes a SIGSEGV introduced by commit 38a5315a3a6fab745d8c86ff9e486faaf50b28d1.
The same problem doesn't exist upstream, as the container structure
there is initialized using a compound literal, which is zeroed out by
default.

Related: #1635435

7 years agosd-bus: unify three code-paths which free struct bus_container
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 06:06:28 +0000 (08:06 +0200)]
sd-bus: unify three code-paths which free struct bus_container

We didn't free one of the fields in two of the places.

$ valgrind --show-leak-kinds=all --leak-check=full \
  build/fuzz-bus-message \
  test/fuzz/fuzz-bus-message/leak-c09c0e2256d43bc5e2d02748c8d8760e7bc25d20
...
==14457== HEAP SUMMARY:
==14457==     in use at exit: 3 bytes in 1 blocks
==14457==   total heap usage: 509 allocs, 508 frees, 51,016 bytes allocated
==14457==
==14457== 3 bytes in 1 blocks are definitely lost in loss record 1 of 1
==14457==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==14457==    by 0x53AFE79: strndup (in /usr/lib64/libc-2.27.so)
==14457==    by 0x4F52EB8: free_and_strndup (string-util.c:1039)
==14457==    by 0x4F8E1AB: sd_bus_message_peek_type (bus-message.c:4193)
==14457==    by 0x4F76CB5: bus_message_dump (bus-dump.c:144)
==14457==    by 0x108F12: LLVMFuzzerTestOneInput (fuzz-bus-message.c:24)
==14457==    by 0x1090F7: main (fuzz-main.c:34)
==14457==
==14457== LEAK SUMMARY:
==14457==    definitely lost: 3 bytes in 1 blocks

(cherry picked from commit 6d1e0f4fcba8d6f425da3dc91805db95399b3c8b)
Resolves: #1635435

7 years agodetect-virt: do not try to read all of /proc/cpuinfo
Zbigniew Jędrzejewski-Szmek [Thu, 13 Sep 2018 07:24:36 +0000 (09:24 +0200)]
detect-virt: do not try to read all of /proc/cpuinfo

Quoting https://github.com/systemd/systemd/issues/10074:
> detect_vm_uml() reads /proc/cpuinfo with read_full_file()
> read_full_file() has a file max limit size of READ_FULL_BYTES_MAX=(4U*1024U*1024U)
> Unfortunately, the size of my /proc/cpuinfo is bigger, approximately:
> echo $(( 4* $(cat /proc/cpuinfo | wc -c)))
9918072
> This causes read_full_file() to fail and the Condition test fallout.

Let's just read line by line until we find an intersting line. This also
helps if not running under UML, because we avoid reading as much data.

(cherry picked from commit 6058516a14ada1748313af6783f5b4e7e3006654)

Resolves: #1631532

7 years agoRevert "sysctl.d: request ECN on both in and outgoing connections"
Thomas Hindoe Paaboel Andersen [Fri, 17 Aug 2018 19:31:05 +0000 (21:31 +0200)]
Revert "sysctl.d: request ECN on both in and outgoing connections"

Turning on ECN still causes slow or broken network on linux. Our tcp
is not yet ready for wide spread use of ECN.

This reverts commit 919472741dba6ad0a3f6c2b76d390a02d0e2fdc3.

(cherry picked from commit 1e190dfd5bb95036f937ef1dc46f43eb0a146612)

Resolves: #1619790

7 years agotest: add test case for recursive chown()ing
Lennart Poettering [Fri, 19 Oct 2018 09:31:37 +0000 (11:31 +0200)]
test: add test case for recursive chown()ing

[msekleta: I removed call to log_test_skipped() and replaced it with older construct log_info() + return EXIT_TEST_SKIP]

(cherry-picked from commit cb9e44db36caefcbb8ee7a12e14217305ed69ff2)

Related: #1643368

7 years agochown-recursive: TAKE_FD() is your friend
Lennart Poettering [Fri, 19 Oct 2018 09:42:11 +0000 (11:42 +0200)]
chown-recursive: TAKE_FD() is your friend

(cherry-picked from commit cd6b7d50c337b3676a3d5fc2188ff298dcbdb939)

Related: #1643368

7 years agochown-recursive: also drop ACLs when recursively chown()ing
Lennart Poettering [Fri, 19 Oct 2018 09:28:40 +0000 (11:28 +0200)]
chown-recursive: also drop ACLs when recursively chown()ing

Let's better be safe than sorry and also drop ACLs.

(cherry-picked from commit f89bc84f3242449cbc308892c87573b131f121df)

Related: #1643368

7 years agochown-recursive: let's rework the recursive logic to use O_PATH
Lennart Poettering [Fri, 19 Oct 2018 09:26:59 +0000 (11:26 +0200)]
chown-recursive: let's rework the recursive logic to use O_PATH

That way we can pin a specific inode and analyze it and manipulate it
without it being swapped out beneath our hands.

Fixes a vulnerability originally found by Jann Horn from Google.

CVE-2018-15687
LP: #1796692
https://bugzilla.redhat.com/show_bug.cgi?id=1639076

(cherry-picked from commit 5de6cce58b3e8b79239b6e83653459d91af6e57c)

Resolves: #1643368

7 years agodebug-generator: introduce rd.* version of all options
Lukas Nykryn [Thu, 25 Oct 2018 14:34:00 +0000 (16:34 +0200)]
debug-generator: introduce rd.* version of all options

(cherry picked from commit a7dd6d04b07f58df5c0294743d76df0be0b4b928)

Resolves: #1643429

7 years agoproc-cmdline: introduce PROC_CMDLINE_RD_STRICT
Lukas Nykryn [Thu, 25 Oct 2018 14:21:26 +0000 (16:21 +0200)]
proc-cmdline: introduce PROC_CMDLINE_RD_STRICT

Our current set of flags allows an option to be either
use just in initrd or both in initrd and normal system.
This new flag is intended to be used in the case where
you want apply some settings just in initrd or just
in normal system.

(cherry picked from commit ed58820d7669971762dd887dc117d922c23f2543)

Related: #1643429

7 years agocore: make sure we don't throttle change signal generator when a reload is pending
Lennart Poettering [Tue, 13 Nov 2018 11:48:49 +0000 (12:48 +0100)]
core: make sure we don't throttle change signal generator when a reload is pending

Fixes: #10627
(cherry picked from commit b8d381c47776ea0440af175cbe0c02cb743bde08)

Resolves: #1647359

7 years agocore: when we can't send the pending reload message, say we ignore it in the warning...
Lennart Poettering [Tue, 13 Nov 2018 11:00:42 +0000 (12:00 +0100)]
core: when we can't send the pending reload message, say we ignore it in the warning we log

No change in behaviour, just better wording.

(cherry picked from commit 4b66bccab004221b903b43b4c224442bfa3e9ac7)

Resolves: #1647359

7 years agocore: rename queued_message → pending_reload_message
Lennart Poettering [Tue, 13 Nov 2018 10:59:06 +0000 (11:59 +0100)]
core: rename queued_message → pending_reload_message

This field is only used for pending Reload() replies, hence let's rename
it to be more descriptive and precise.

No change in behaviour.

(cherry picked from commit 209de5256b7ba8600c3e73a85a43b86708998d65)

Resolves: #1647359

7 years agodhcp6: make sure we have enough space for the DHCP6 option header
Lennart Poettering [Fri, 19 Oct 2018 10:12:33 +0000 (12:12 +0200)]
dhcp6: make sure we have enough space for the DHCP6 option header

Fixes a vulnerability originally discovered by Felix Wilhelm from
Google.

CVE-2018-15688
LP: #1795921
https://bugzilla.redhat.com/show_bug.cgi?id=1639067

(cherry-picked from commit 4dac5eaba4e419b29c97da38a8b1f82336c2c892)

Resolves: #1643363

7 years agojournal-file: avoid calling ftruncate with invalid fd
David Tardon [Wed, 10 Oct 2018 11:56:54 +0000 (13:56 +0200)]
journal-file: avoid calling ftruncate with invalid fd

This can happen if journal_file_close is called from the failure
handling code of journal_file_open before f->fd was established.

(cherry picked from commit c52368509f48e556be5a4c7a171361b656a25e02)

Resolves: #1602706

7 years agofirewall-util: add an assert that we're not overwriting a buffer
David Tardon [Wed, 10 Oct 2018 07:33:28 +0000 (09:33 +0200)]
firewall-util: add an assert that we're not overwriting a buffer

... like commit f28501279d2c28fdbb31d8273b723e9bf71d3b98 does for
out_interface.

(cherry picked from commit 0b777d20e9a3868b12372ffce8040d1be063cec7)

Resolves: #1602706

7 years agologin: avoid leak of name returned by uid_to_name()
David Tardon [Tue, 9 Oct 2018 15:26:19 +0000 (17:26 +0200)]
login: avoid leak of name returned by uid_to_name()

(cherry picked from commit e99742ef3e9d847da04e71fec0eb426063b25068)

Resolves: #1602706

7 years agodissect-image: use right comparison function
David Tardon [Tue, 9 Oct 2018 11:50:55 +0000 (13:50 +0200)]
dissect-image: use right comparison function

fstype can be NULL here.

(cherry picked from commit 4db1879acdc0b853e1a7e6e650b6feb917175fac)

Resolves: #1602706

7 years agoresolved: create /etc/resolv.conf symlink at runtime v239-8
Zbigniew Jędrzejewski-Szmek [Fri, 11 Mar 2016 22:06:17 +0000 (17:06 -0500)]
resolved: create /etc/resolv.conf symlink at runtime

If the symlink doesn't exists, and we are being started, let's
create it to provie name resolution.

If it exists, do nothing. In particular, if it is a broken symlink,
we cannot really know if the administator configured it to point to
a location used by some service that hasn't started yet, so we
don't touch it in that case either.

https://bugzilla.redhat.com/show_bug.cgi?id=1313085

7 years agojournal: change support URL shown in the catalog entries
Michal Sekletar [Mon, 15 Oct 2018 10:55:50 +0000 (10:55 +0000)]
journal: change support URL shown in the catalog entries

Resolves: #1550548

7 years agotests: backport test_setup_logging()
Michal Sekletar [Mon, 15 Oct 2018 10:54:11 +0000 (10:54 +0000)]
tests: backport test_setup_logging()

Related: #1635428

7 years agoIntroduce free_and_strndup and use it in bus-message.c
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 05:03:01 +0000 (07:03 +0200)]
Introduce free_and_strndup and use it in bus-message.c

v2: fix error in free_and_strndup()

When the orignal and copied message were the same, but shorter than specified
length l, memory read past the end of the buffer would be performed. A test
case is included: a string that had an embedded NUL ("q\0") is used to replace
"q".

v3: Fix one more bug in free_and_strndup and add tests.

v4: Some style fixed based on review, one more use of free_and_replace, and
make the tests more comprehensive.

(cherry picked from commit 7f546026abbdc56c453a577e52d57159458c3e9c)

Resolves: #1635428

7 years agobus-message: do not crash on message with a string of zero length
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 11:21:44 +0000 (13:21 +0200)]
bus-message: do not crash on message with a string of zero length

We'd calculate the "real" length of the string as 'item_size - 1', which does
not work out well when item_size == 0.

(cherry picked from commit 81b6e63029eefcb0ec03a3a7c248490e38106073)

Resolves: #1635439

7 years agounits: don't enable per-service IP firewall by default
Michal Sekletar [Fri, 12 Oct 2018 14:50:09 +0000 (14:50 +0000)]
units: don't enable per-service IP firewall by default

Resolves: #1630219

7 years agocryptsetup: do not define arg_sector_size if libgcrypt is v1.x (#9990)
Yu Watanabe [Sat, 1 Sep 2018 14:47:46 +0000 (23:47 +0900)]
cryptsetup: do not define arg_sector_size if libgcrypt is v1.x (#9990)

Follow-up for #9936.

(cherry picked from commit 645461f0cf6ec91e5b0b571559fb4cc4898192bc)

Related: #1572563

7 years agocryptsetup: add support for sector-size= option (#9936)
Dimitri John Ledkov [Wed, 29 Aug 2018 14:38:09 +0000 (15:38 +0100)]
cryptsetup: add support for sector-size= option (#9936)

Bug-Ubuntu: https://launchpad.net/bugs/1776626

Closes #8881.

(cherry picked from commit a9fc640671ef60ac949f1ace6fa687ff242fc233)

Resolves: #1572563

7 years agorandom-seed: raise POOL_SIZE_MIN constant to 1024
Michal Sekletar [Fri, 12 Oct 2018 13:58:34 +0000 (13:58 +0000)]
random-seed: raise POOL_SIZE_MIN constant to 1024

Resolves: #1619268

7 years agobus: move BUS_DONT_DESTROY calls after asserts
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jul 2018 10:16:33 +0000 (12:16 +0200)]
bus: move BUS_DONT_DESTROY calls after asserts

It's not useful to bump the reference count before checking if the object is
NULL. Thanks to d40f5cc498 we can do this ;).

Related to https://bugzilla.redhat.com/show_bug.cgi?id=1576084,
https://bugzilla.redhat.com/show_bug.cgi?id=1575340,
https://bugzilla.redhat.com/show_bug.cgi?id=1575350. I'm not sure why those two
people hit this code path, while most people don't. At least we won't abort.

(cherry picked from commit 7ae8edcd03f74da123298330b76c3fc5425042ef)

Resolves: #1610397

7 years agojournal: remove journal audit socket
Michal Sekletar [Thu, 9 Aug 2018 21:23:00 +0000 (23:23 +0200)]
journal: remove journal audit socket

Resolves: #1614554

7 years agounits: drop DynamicUser=yes from systemd-resolved.service
Michal Sekletar [Thu, 9 Aug 2018 13:28:44 +0000 (15:28 +0200)]
units: drop DynamicUser=yes from systemd-resolved.service

We don't really need DynamicUser since we add systemd-resolve user
from rpm script

7 years agonet_setup_link: allow renaming interfaces that were renamed previously
Michal Sekletar [Tue, 7 Aug 2018 08:38:33 +0000 (10:38 +0200)]
net_setup_link: allow renaming interfaces that were renamed previously

7 years agoRevert "udev: remove WAIT_FOR key"
Michal Sekletar [Thu, 2 Aug 2018 11:16:49 +0000 (13:16 +0200)]
Revert "udev: remove WAIT_FOR key"

This reverts commit f2b8052fb648b788936dd3e85be6a9aca90fbb2f.

Resolves: #1523213

7 years agorules: introduce old-style by-path symlinks for FCP based SCSI devices
Michal Sekletar [Wed, 28 Mar 2018 15:22:30 +0000 (17:22 +0200)]
rules: introduce old-style by-path symlinks for FCP based SCSI devices

Related: #1523227

7 years agorules: disable auto-online of hot-plugged memory on IBM z Systems
Michal Sekletar [Fri, 16 Sep 2016 12:45:01 +0000 (14:45 +0200)]
rules: disable auto-online of hot-plugged memory on IBM z Systems

Related: #1523227

7 years agorules: don't hoplug memory on s390x
Lukas Nykryn [Tue, 13 Sep 2016 11:18:38 +0000 (13:18 +0200)]
rules: don't hoplug memory on s390x

Related: #1523227

7 years agorules: load sg driver also when scsi_target appears (#45)
Lukáš Nykrýn [Thu, 18 Aug 2016 12:51:19 +0000 (14:51 +0200)]
rules: load sg driver also when scsi_target appears (#45)

Related: #1523227

7 years agorules: prandom character device node permissions
Lukas Nykryn [Tue, 22 Sep 2015 10:28:28 +0000 (12:28 +0200)]
rules: prandom character device node permissions

Related: #1523227

7 years agorules: load sg module
Lukas Nykryn [Wed, 20 May 2015 10:34:18 +0000 (12:34 +0200)]
rules: load sg module

Related: #1523227

7 years agorules: reload sysctl settings when the bridge module is loaded
Lukas Nykryn [Wed, 13 May 2015 15:11:48 +0000 (17:11 +0200)]
rules: reload sysctl settings when the bridge module is loaded

Related: #1523227

7 years agorules: enable memory hotplug
Lukas Nykryn [Wed, 13 May 2015 14:56:44 +0000 (16:56 +0200)]
rules: enable memory hotplug

Related: #1523227

7 years agorules: add rule for naming Dell iDRAC USB Virtual NIC as 'idrac'
Michal Sekletar [Mon, 22 Sep 2014 05:53:52 +0000 (07:53 +0200)]
rules: add rule for naming Dell iDRAC USB Virtual NIC as 'idrac'

Related: #1523227

7 years agorules: automatically online hot-plugged CPUs
Michal Sekletar [Mon, 22 Sep 2014 05:41:06 +0000 (07:41 +0200)]
rules: automatically online hot-plugged CPUs

Related: #1523227

7 years agopid1: bump maximum number of process in user slice to 80% of pid_max
rpm-build [Wed, 1 Aug 2018 15:17:07 +0000 (17:17 +0200)]
pid1: bump maximum number of process in user slice to 80% of pid_max

Related: #1523236

7 years agoAvoid /tmp being mounted as tmpfs without the user's will
Jan Synacek [Tue, 15 May 2018 07:24:20 +0000 (09:24 +0200)]
Avoid /tmp being mounted as tmpfs without the user's will

Ensure PrivateTmp doesn't require tmpfs through tmp.mount, but rather
adds an After relationship.

rhel-only

Resolves: #1578772

7 years agopid1: bump DefaultTasksMax to 80% of the kernel pid.max value
rpm-build [Wed, 1 Aug 2018 11:19:39 +0000 (13:19 +0200)]
pid1: bump DefaultTasksMax to 80% of the kernel pid.max value

This should be hopefully high enough even for the very big deployments.

Resolves: #1523236

7 years agologind: set RemoveIPC to false by default
rpm-build [Wed, 1 Aug 2018 08:58:28 +0000 (10:58 +0200)]
logind: set RemoveIPC to false by default

Resolves: #1523233

7 years agobuild-sys: Detect whether struct statx is defined in sys/stat.h
Filipe Brandenburger [Mon, 16 Jul 2018 05:43:35 +0000 (22:43 -0700)]
build-sys: Detect whether struct statx is defined in sys/stat.h

Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a
definition for struct statx, in which case include file linux/stat.h should be
avoided, in order to prevent a duplicate definition.

    In file included from ../src/basic/missing.h:18,
     from ../src/basic/util.h:28,
     from ../src/basic/hashmap.h:10,
     from ../src/shared/bus-util.h:12,
     from ../src/libsystemd/sd-bus/bus-creds.c:11:
    /usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’
     struct statx {
    ^~~~~
    In file included from /usr/include/sys/stat.h:446,
     from ../src/basic/util.h:19,
     from ../src/basic/hashmap.h:10,
     from ../src/shared/bus-util.h:12,
     from ../src/libsystemd/sd-bus/bus-creds.c:11:
    /usr/include/bits/statx.h:36:8: note: originally defined here
     struct statx
    ^~~~~

Extend our meson.build to look for struct statx when only sys/stat.h is
included and, in that case, do not include linux/stat.h anymore.

Tested that systemd builds correctly when using a glibc version that includes a
definition for struct statx.

glibc Fedora RPM update:
https://src.fedoraproject.org/rpms/glibc/c/28cb5d31fc1e5887912283c889689c47076278ae

glibc upstream commit:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd

7 years agomeson: bump package and library version v239
Lennart Poettering [Fri, 22 Jun 2018 11:03:47 +0000 (13:03 +0200)]
meson: bump package and library version

7 years agofinal touches to NEWS
Lennart Poettering [Fri, 22 Jun 2018 10:57:54 +0000 (12:57 +0200)]
final touches to NEWS

7 years agoman: small fixups for systemd-boot(8)
Zbigniew Jędrzejewski-Szmek [Fri, 22 Jun 2018 11:03:21 +0000 (13:03 +0200)]
man: small fixups for systemd-boot(8)

- "UEFI firmware" is a name, no need for an article
- The specification is more than "recommendation"

7 years agoman: correct the meaning of TimeoutStopSec= (#9325)
Jan Synacek [Fri, 22 Jun 2018 07:11:49 +0000 (09:11 +0200)]
man: correct the meaning of TimeoutStopSec= (#9325)

Fixes: #9325

7 years agotmpfile: do not specify mode and owner to /run/systemd/netif
Yu Watanabe [Fri, 22 Jun 2018 03:32:28 +0000 (12:32 +0900)]
tmpfile: do not specify mode and owner to /run/systemd/netif

Fixes #9369.

7 years agojournalctl: handle inotify exhaustion nicer
Kevin Kuehler [Tue, 19 Jun 2018 20:56:36 +0000 (13:56 -0700)]
journalctl: handle inotify exhaustion nicer

Instead of failing, log that inotify wds
are exhausted and fallback to -n switch.

Fixes #1296.

7 years agoudev: exclude DRBD from block device ownership event locking
Roland Kammerer [Thu, 21 Jun 2018 09:32:32 +0000 (11:32 +0200)]
udev: exclude DRBD from block device ownership event locking

It does not make sense for udev to even open DRBD block devices
(/dev/drbdX). It is on one hand not necessary as DRBD is controlled by
something else in the stack (e.g., pacemaker), and it even can get
cumbersome in various scenarios (e.g., DRBD9 auto-promote).

Closes: #9371

Signed-off-by: Roland Kammerer <roland.kammerer@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
7 years agoman: systemd.offline-updates: Document system-update-pre.target usage
Hans de Goede [Tue, 19 Jun 2018 12:33:59 +0000 (14:33 +0200)]
man: systemd.offline-updates: Document system-update-pre.target usage

7 years agoMerge pull request #9368 from yuwata/bash-completion-timedate
Zbigniew Jędrzejewski-Szmek [Thu, 21 Jun 2018 04:57:45 +0000 (06:57 +0200)]
Merge pull request #9368 from yuwata/bash-completion-timedate

follow-ups for 'timedatectl show'

7 years agoNEWS: mention 'timedatectl show'
Yu Watanabe [Thu, 21 Jun 2018 01:51:35 +0000 (10:51 +0900)]
NEWS: mention 'timedatectl show'

7 years agobash-completion: support 'timedatectl show'
Yu Watanabe [Thu, 21 Jun 2018 01:47:51 +0000 (10:47 +0900)]
bash-completion: support 'timedatectl show'

7 years agoNEWS: mention %E
Zbigniew Jędrzejewski-Szmek [Wed, 20 Jun 2018 22:08:36 +0000 (00:08 +0200)]
NEWS: mention %E

7 years agoMerge pull request #9366 from poettering/udev-wants-dep-fix
Zbigniew Jędrzejewski-Szmek [Wed, 20 Jun 2018 22:04:03 +0000 (00:04 +0200)]
Merge pull request #9366 from poettering/udev-wants-dep-fix

udev SYSTEMD_WANTS property fix

7 years agocore: explicitly trigger changing udev SYSTEMD_WANTS properties
Lennart Poettering [Wed, 20 Jun 2018 20:54:55 +0000 (22:54 +0200)]
core: explicitly trigger changing udev SYSTEMD_WANTS properties

This compensates for the unsynchronized reload cycles of systemd and
udev: we manually trigger the deps listed in SYSTEMD_WANTS properties if
they change for device units that are already up. That way all deps
defined that way will be triggered at least once: the first time the
unit goes up by the usual dependency logic, and if it already is up by
the device.c specific logic.

Fixes: #9323

7 years agoanalyze: use _cleanup_ for freeing the manager object
Lennart Poettering [Wed, 20 Jun 2018 20:22:22 +0000 (22:22 +0200)]
analyze: use _cleanup_ for freeing the manager object

7 years agoanalyze: use log_unit_error_errno()'s return value where we can
Lennart Poettering [Wed, 20 Jun 2018 20:22:03 +0000 (22:22 +0200)]
analyze: use log_unit_error_errno()'s return value where we can

7 years agotree-wide: pass NULL arguments to manager_startup() directly, avoid declaring unneede...
Lennart Poettering [Wed, 20 Jun 2018 20:19:26 +0000 (22:19 +0200)]
tree-wide: pass NULL arguments to manager_startup() directly, avoid declaring unneeded variables

7 years agounits: let's use two ExecStart= lines instead of ;
Lennart Poettering [Wed, 20 Jun 2018 19:39:28 +0000 (21:39 +0200)]
units: let's use two ExecStart= lines instead of ;

7 years agocore: use fflush_and_check() where appropriate
Lennart Poettering [Wed, 20 Jun 2018 17:38:30 +0000 (19:38 +0200)]
core: use fflush_and_check() where appropriate

7 years agoupdate TODO
Lennart Poettering [Wed, 20 Jun 2018 17:36:06 +0000 (19:36 +0200)]
update TODO

7 years agoMerge pull request #9365 from keszybz/condition-security-followup
Lennart Poettering [Wed, 20 Jun 2018 21:10:18 +0000 (23:10 +0200)]
Merge pull request #9365 from keszybz/condition-security-followup

ConditionSecurity= followup

7 years agotest-condition: extend tests to all ConditionSecurity= values
Zbigniew Jędrzejewski-Szmek [Wed, 20 Jun 2018 20:46:13 +0000 (22:46 +0200)]
test-condition: extend tests to all ConditionSecurity= values

Also print out what we detect, for manual verification.

7 years agoNEWS: mention ConditionSecurity=uefi-secureboot
Zbigniew Jędrzejewski-Szmek [Wed, 20 Jun 2018 20:35:36 +0000 (22:35 +0200)]
NEWS: mention ConditionSecurity=uefi-secureboot

Follow-up for be405b909e5d78b43e3af47e0d10cd84c714e2f3.

7 years agocondition: add new conditon ConditionSecurity=uefi-secureboot
Lennart Poettering [Wed, 20 Jun 2018 16:52:52 +0000 (18:52 +0200)]
condition: add new conditon ConditionSecurity=uefi-secureboot

We have the detector call for this anyway, and it's useful for
conditioning out dbxtool.service, hence let's add this tiny new option.

7 years agoMerge pull request #9363 from yuwata/specifier-config-dir
Zbigniew Jędrzejewski-Szmek [Wed, 20 Jun 2018 20:30:18 +0000 (22:30 +0200)]
Merge pull request #9363 from yuwata/specifier-config-dir

core: add unit specifier for configuration directory root