chiark / gitweb /
elogind.git
7 years agoman/loginctl.xml: Added check_tree.pl compatible elogind masking.
Sven Eden [Thu, 19 Apr 2018 16:15:56 +0000 (18:15 +0200)]
man/loginctl.xml: Added check_tree.pl compatible elogind masking.

7 years agoman/elogind.xml: Added check_tree.pl compatible elogind masking.
Sven Eden [Thu, 19 Apr 2018 16:15:56 +0000 (18:15 +0200)]
man/elogind.xml: Added check_tree.pl compatible elogind masking.

7 years agocheck_tree.pl : Enhance XML handling.
Sven Eden [Thu, 19 Apr 2018 16:14:50 +0000 (18:14 +0200)]
check_tree.pl : Enhance XML handling.

7 years agoManpages: update elogind refentry for better handling through check_tree.pl
Sven Eden [Wed, 18 Apr 2018 15:09:23 +0000 (17:09 +0200)]
Manpages: update elogind refentry for better handling through check_tree.pl

7 years agoPrepare src/libelogind/libelogind.pc.in for better handling through check_tree.pl
Sven Eden [Wed, 18 Apr 2018 15:08:42 +0000 (17:08 +0200)]
Prepare src/libelogind/libelogind.pc.in for better handling through check_tree.pl

7 years agomissing_syscall: when adding syscall replacements, use different names (#8229)
Zbigniew Jędrzejewski-Szmek [Wed, 21 Feb 2018 13:04:50 +0000 (14:04 +0100)]
missing_syscall: when adding syscall replacements, use different names (#8229)

In meson.build we check that functions are available using:
    meson.get_compiler('c').has_function('foo')
which checks the following:
- if __stub_foo or __stub___foo are defined, return false
- if foo is declared (a pointer to the function can be taken), return true
- otherwise check for __builtin_memfd_create

_stub is documented by glibc as
   It defines a symbol '__stub_FUNCTION' for each function
   in the C library which is a stub, meaning it will fail
   every time called, usually setting errno to ENOSYS.

So if __stub is defined, we know we don't want to use the glibc version, but
this doesn't tell us if the name itself is defined or not. If it _is_ defined,
and we define our replacement as an inline static function, we get an error:

In file included from ../src/basic/missing.h:1358:0,
                 from ../src/basic/util.h:47,
                 from ../src/basic/calendarspec.h:29,
                 from ../src/basic/calendarspec.c:34:
../src/basic/missing_syscall.h:65:19: error: static declaration of 'memfd_create' follows non-static declaration
 static inline int memfd_create(const char *name, unsigned int flags) {
                   ^~~~~~~~~~~~
.../usr/include/bits/mman-shared.h:46:5: note: previous declaration of 'memfd_create' was here
 int memfd_create (const char *__name, unsigned int __flags) __THROW;
     ^~~~~~~~~~~~

To avoid this problem, call our inline functions different than glibc,
and use a #define to map the official name to our replacement.

Fixes #8099.

v2:
- use "missing_" as the prefix instead of "_"

v3:
- rebase and update for statx()

  Unfortunately "statx" is also present in "struct statx", so the define
  causes issues. Work around this by using a typedef.

I checked that systemd compiles with current glibc
(glibc-devel-2.26-24.fc27.x86_64) if HAVE_MEMFD_CREATE, HAVE_GETTID,
HAVE_PIVOT_ROOT, HAVE_SETNS, HAVE_RENAMEAT2, HAVE_KCMP, HAVE_KEYCTL,
HAVE_COPY_FILE_RANGE, HAVE_BPF, HAVE_STATX are forced to 0.

Setting HAVE_NAME_TO_HANDLE_AT to 0 causes an issue, but it's not because of
the define, but because of struct file_handle.

7 years agoPrep v236.1: To catch up with upstream, already branch out v236-stable.
Sven Eden [Thu, 29 Mar 2018 05:53:20 +0000 (07:53 +0200)]
Prep v236.1: To catch up with upstream, already branch out v236-stable.

7 years agoPrep v236: Adapt elogind parts in the build system to upstream changes.
Sven Eden [Mon, 26 Mar 2018 16:22:06 +0000 (18:22 +0200)]
Prep v236: Adapt elogind parts in the build system to upstream changes.

7 years agocheck_tree.pl: Added *.sym and *.in file handling.
Sven Eden [Fri, 16 Mar 2018 06:59:32 +0000 (07:59 +0100)]
check_tree.pl: Added *.sym and *.in file handling.

7 years agocheck_tree.pl: Do not remove empty lines prior masks/inserts. Do not rename 'systemd...
Sven Eden [Fri, 16 Mar 2018 05:56:25 +0000 (06:56 +0100)]
check_tree.pl: Do not remove empty lines prior masks/inserts. Do not rename 'systemd' in mask blocks.

7 years agocheck_tree.pl: chomp git rev-parse results.
Sven Eden [Thu, 15 Mar 2018 05:12:03 +0000 (06:12 +0100)]
check_tree.pl: chomp git rev-parse results.

7 years agoPrep v236: Update root build files.
Sven Eden [Thu, 15 Mar 2018 05:03:12 +0000 (06:03 +0100)]
Prep v236: Update root build files.

7 years agoPrep v236 : Add missing SPDX-License-Identifier (9/9) tools
Sven Eden [Tue, 13 Mar 2018 18:20:00 +0000 (19:20 +0100)]
Prep v236 : Add missing SPDX-License-Identifier (9/9) tools

7 years agoPrep v236 : Add missing SPDX-License-Identifier (8/9) src/test
Sven Eden [Tue, 13 Mar 2018 18:19:10 +0000 (19:19 +0100)]
Prep v236 : Add missing SPDX-License-Identifier (8/9) src/test

7 years agoPrep v236 : Add missing SPDX-License-Identifier (7/9) src/systemd
Sven Eden [Tue, 13 Mar 2018 18:18:29 +0000 (19:18 +0100)]
Prep v236 : Add missing SPDX-License-Identifier (7/9) src/systemd

7 years agoPrep v236 : Add missing SPDX-License-Identifier (6/9) src/shared
Sven Eden [Tue, 13 Mar 2018 18:17:48 +0000 (19:17 +0100)]
Prep v236 : Add missing SPDX-License-Identifier (6/9) src/shared

7 years agoPrep v236 : Add missing SPDX-License-Identifier (5/9) src/login
Sven Eden [Tue, 13 Mar 2018 18:14:05 +0000 (19:14 +0100)]
Prep v236 : Add missing SPDX-License-Identifier (5/9) src/login

7 years agoPrep v236 : Add missing SPDX-License-Identifier (4/9) src/libelogind
Sven Eden [Tue, 13 Mar 2018 18:12:55 +0000 (19:12 +0100)]
Prep v236 : Add missing SPDX-License-Identifier (4/9) src/libelogind

7 years agoPrep v236 : Add missing SPDX-License-Identifier (3/9) src/core
Sven Eden [Tue, 13 Mar 2018 18:12:26 +0000 (19:12 +0100)]
Prep v236 : Add missing SPDX-License-Identifier (3/9) src/core

7 years agoPrep v236 : Add missing SPDX-License-Identifier (2/9) src/basic
Sven Eden [Tue, 13 Mar 2018 18:11:43 +0000 (19:11 +0100)]
Prep v236 : Add missing SPDX-License-Identifier (2/9) src/basic

7 years agoPrep v236 : Add missing SPDX-License-Identifier (1/9) shell-completion
Sven Eden [Tue, 13 Mar 2018 18:10:50 +0000 (19:10 +0100)]
Prep v236 : Add missing SPDX-License-Identifier (1/9) shell-completion

7 years agoPrep v236: Remove obsolete files that have slithered in.
Sven Eden [Tue, 13 Mar 2018 18:16:48 +0000 (19:16 +0100)]
Prep v236: Remove obsolete files that have slithered in.

7 years agoPrep v236: Update build system and adapt to eloginds needs.
Sven Eden [Tue, 13 Mar 2018 18:05:56 +0000 (19:05 +0100)]
Prep v236: Update build system and adapt to eloginds needs.

7 years agoPrep v236: Apply missing upstream updates to the build system
Sven Eden [Tue, 13 Mar 2018 07:17:29 +0000 (08:17 +0100)]
Prep v236: Apply missing upstream updates to the build system

7 years agoNew: pwx/update_po_files.pl : Coment out all translations to non-existent files.
Sven Eden [Tue, 13 Mar 2018 07:16:23 +0000 (08:16 +0100)]
New: pwx/update_po_files.pl : Coment out all translations to non-existent files.

 => Update po translation files

7 years agocheck_tree.pl: Added the possibility to (manualy) check root files and enhanced shell...
Sven Eden [Tue, 13 Mar 2018 06:55:12 +0000 (07:55 +0100)]
check_tree.pl: Added the possibility to (manualy) check root files and enhanced shell mask handling.

7 years agoPrep v236: Update root level files
Sven Eden [Mon, 12 Mar 2018 05:59:45 +0000 (06:59 +0100)]
Prep v236: Update root level files

7 years agoUpdate TODO
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 13:12:39 +0000 (14:12 +0100)]
Update TODO

7 years agoMake taint message structured and add catalog entry
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 09:15:41 +0000 (10:15 +0100)]
Make taint message structured and add catalog entry

Dec 14 14:10:54 krowka elogind[1]: System is tainted: overflowgid-not-65534
-- Subject: The system is configured in a way that might cause problems
-- Defined-By: elogind
-- Support: https://lists.freedesktop.org/mailman/listinfo/elogind-devel
--
-- The following "tags" are possible:
-- - "split-usr" — /usr is a separate file system and was not mounted when elogind
--   was booted
-- - "cgroups-missing" — the kernel was compiled without cgroup support or access
--   to expected interface files is resticted
-- - "var-run-bad" — /var/run is not a symlink to /run
-- - "overflowuid-not-65534" — the kernel user ID used for "unknown" users (with
--   NFS or user namespaces) is not 65534
-- - "overflowgid-not-65534" — the kernel group ID used for "unknown" users (with
--   NFS or user namespaces) is not 65534
-- Current system is tagged as overflowgid-not-65534.

7 years agomeson: increase version numbers
Lennart Poettering [Mon, 11 Dec 2017 15:10:25 +0000 (16:10 +0100)]
meson: increase version numbers

7 years agocore: add EXTEND_TIMEOUT_USEC={usec} - prevent timeouts in startup/runtime/shutdown...
Daniel Black [Thu, 14 Dec 2017 11:17:43 +0000 (22:17 +1100)]
core: add EXTEND_TIMEOUT_USEC={usec} - prevent timeouts in startup/runtime/shutdown (#7214)

With Type=notify services, EXTEND_TIMEOUT_USEC= messages will delay any startup/
runtime/shutdown timeouts.

A service that hasn't timed out, i.e, start time < TimeStartSec,
runtime < RuntimeMaxSec and stop time < TimeoutStopSec, may by sending
EXTEND_TIMEOUT_USEC=, allow the service to continue beyond the limit for
the execution phase (i.e TimeStartSec, RunTimeMaxSec and TimeoutStopSec).

EXTEND_TIMEOUT_USEC= must continue to be sent (in the same way as
WATCHDOG=1) within the time interval specified to continue to reprevent
the timeout from occuring.

Watchdog timeouts are also extended if a EXTEND_TIMEOUT_USEC is greater
than the remaining time on the watchdog counter.

Fixes #5868.

7 years agoman: elogind.unit: move note about clearing lists (#7621)
Daniel Black [Thu, 14 Dec 2017 04:51:23 +0000 (15:51 +1100)]
man: elogind.unit: move note about clearing lists (#7621)

This is mainly for drop-in files.

7 years agosysctl: disable buffer while writing to /proc
Tiago Salem Herrmann [Tue, 12 Dec 2017 15:52:45 +0000 (13:52 -0200)]
sysctl: disable buffer while writing to /proc

fputs() writes only first 2048 bytes and fails
to write to /proc when values are larger than that.
This patch adds a new flag to WriteStringFileFlags
that make it possible to disable the buffer under
specific cases.

7 years agotree-wide: use STRLEN() to allocate buffer of constant size
Thomas Haller [Wed, 13 Dec 2017 07:41:11 +0000 (08:41 +0100)]
tree-wide: use STRLEN() to allocate buffer of constant size

Using strlen() to declare a buffer results in a variable-length array,
even if the compiler likely optimizes it to be a compile time constant.

When building with -Wvla, certain versions of gcc complain about such
buffers. Compiling with -Wvla has the advantage of preventing variably
length array, which defeat static asserts that are implemented by
declaring an array of negative length.

7 years agobasic/macros: add STRLEN() to get length of string literal as constant expression
Thomas Haller [Wed, 13 Dec 2017 07:17:07 +0000 (08:17 +0100)]
basic/macros: add STRLEN() to get length of string literal as constant expression

While the compiler likely optimizes strlen(x) for string literals,
it is not a constant expression.

Hence,

  char buffer[strlen("OPTION_000") + 1];

declares a variable-length array. STRLEN() can be used instead
when a constant espression is needed.

It's not entirely identical to strlen(), as STRLEN("a\0") counts 2.
Also, it only works with string literals and the macro enforces
that the argument is a literal.

7 years agomeson: link NSS modules with -z nodelete (#7607)
Lennart Poettering [Tue, 12 Dec 2017 19:13:16 +0000 (20:13 +0100)]
meson: link NSS modules with -z nodelete (#7607)

We might end up allocating mempools, and when we are unloaded we might
orphan them, thus leaking them. Hence, let's just stick around for good,
so the mempools remain referenced continously and for good, and thus no
memory is leaked (though the memory isn't cleaned up either).

Fixes: #7596
7 years agoverbs: add a new VERB_MUSTBEROOT flag
Lennart Poettering [Mon, 11 Dec 2017 22:10:11 +0000 (23:10 +0100)]
verbs: add a new VERB_MUSTBEROOT flag

Given that we regularly have verbs that require privileges, let's just
make this a flag of the verb.

7 years agotree-wide: drop a few == NULL and != NULL comparison
Lennart Poettering [Fri, 8 Dec 2017 19:52:38 +0000 (20:52 +0100)]
tree-wide: drop a few == NULL and != NULL comparison

Our CODING_STYLE suggests not comparing with NULL, but relying on C's
downgrade-to-bool feature for that. Fix up some code to match these
guidelines. (This is not comprehensive, the coccinelle output for this
is unfortunately kinda borked)

7 years agovirt: use XENFEAT_dom0 to detect the hardware domain (#6442, #6662) (#7581)
Olaf Hering [Fri, 8 Dec 2017 21:21:42 +0000 (22:21 +0100)]
virt: use XENFEAT_dom0 to detect the hardware domain (#6442, #6662) (#7581)

The detection of ConditionVirtualisation= relies on the presence of
/proc/xen/capabilities. If the file exists and contains the string
"control_d", the running system is a dom0 and VIRTUALIZATION_NONE should
be set. In case /proc/xen exists, or some sysfs files indicate "xen",
VIRTUALIZATION_XEN should be set to indicate the system is a domU.

With an (old) xenlinux based kernel, /proc/xen/capabilities is always
available and the detection described above works always. But with a
pvops based kernel, xenfs must be mounted on /proc/xen to get
"capabilities". This is done by a proc-xen.mount unit, which is part of
xen.git. Since the mounting happens "late", other units may be scheduled
before "proc-xen.mount". If these other units make use of
"ConditionVirtualisation=", the virtualization detection returns
incorect results. detect_vm() will set VIRTUALIZATION_XEN because "xen"
is found in sysfs. This value will be cached. Once xenfs is mounted, the
next process that runs detect_vm() will get VIRTUALIZATION_NONE.

This misdetection can be fixed by using
/sys/hypervisor/properties/features, which exports the value returned by
the "XENVER_get_features" hypercall. If the bit XENFEAT_dom0 is set, the
domain is the "hardware domain". It is supposed to have permissions to
access all hardware. The used sysfs file is available since v2.6.31.

The commonly used term "dom0" refers to the control domain which runs
the toolstack and has access to all hardware. But the virtualization
host may be configured such that one dedicated domain becomes the
"hardware domain", and another one the "toolstack domain".

7 years agoacl: fix typo in comment (#7580)
Yu Watanabe [Fri, 8 Dec 2017 12:34:25 +0000 (21:34 +0900)]
acl: fix typo in comment (#7580)

7 years agoresolved: implement D-Bus API for DNS-SD
Dmitry Rozhkov [Mon, 23 Oct 2017 11:46:13 +0000 (14:46 +0300)]
resolved: implement D-Bus API for DNS-SD

7 years agoman: missing whitespace (#7579)
Clinton Roy [Fri, 8 Dec 2017 02:44:20 +0000 (15:44 +1300)]
man: missing whitespace (#7579)

7 years agovirt: propagate errors in detect_vm_xen_dom0 (#7553)
Olaf Hering [Thu, 7 Dec 2017 20:09:32 +0000 (21:09 +0100)]
virt: propagate errors in detect_vm_xen_dom0 (#7553)

Update detect_vm_xen_dom0 to propagate errors in case reading
/proc/xen/capabilites fails. This does not fix any bugs, it just makes
it consistent with other functions called by detect_vm.

7 years agomeson: place elogind-sulogin-shell in build/
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 09:44:43 +0000 (10:44 +0100)]
meson: place elogind-sulogin-shell in build/

We do that will all executables so that it's easy to call them.

7 years agomeson: warn if nobody-user and nobody-group are set to different name
Yu Watanabe [Thu, 7 Dec 2017 08:19:11 +0000 (17:19 +0900)]
meson: warn if nobody-user and nobody-group are set to different name

It may work, but is very strange. So, let's warn about that.

v2:
Debian uses nobody and nogroup. Do not warn such case.

7 years agosysusers: use NOBODY_USER_NAME
Yu Watanabe [Thu, 7 Dec 2017 06:49:16 +0000 (15:49 +0900)]
sysusers: use NOBODY_USER_NAME

7 years agovirt: remove triple spurious newline
Lennart Poettering [Wed, 6 Dec 2017 19:16:30 +0000 (20:16 +0100)]
virt: remove triple spurious newline

7 years agovirt: use /proc/xen as indicator for a Xen domain (#6442, #6662) (#7555)
Olaf Hering [Wed, 6 Dec 2017 18:59:30 +0000 (19:59 +0100)]
virt: use /proc/xen as indicator for a Xen domain (#6442, #6662) (#7555)

The file /proc/xen/capabilities is only available if xenfs is mounted.

With a classic xenlinux based kernel that file is available
unconditionally. But with a modern pvops based kernel, xenfs must be
mounted before the "capabilities" may appear. xenfs is mounted very late
via .services files provided by the Xen toolstack. Other units may be
scheduled before xenfs is mounted, which will confuse the detection of
VIRTUALIZATION_XEN.

In all Xen enabled kernels, and if that kernel is actually running on
the Xen hypervisor, the "/proc/xen" directory is the reliable indicator
that this instance runs in a "Xen guest".

Adjust the code to check for /proc/xen instead of
/proc/xen/capabilities.

Fixes commit 3f61278b5 ("basic: Bugfix Detect XEN Dom0 as no virtualization")

7 years agoSet secure_boot flag in Kernel Zero-Page (#7482)
Max Resch [Wed, 6 Dec 2017 14:29:52 +0000 (15:29 +0100)]
Set secure_boot flag in Kernel Zero-Page (#7482)

Setting the secure_boot flag, avoids getting the printout
"EFI stub: UEFI Secure Boot is enabled." when booting
a Linux kernel with linuxx64.efi.stub and EFI SecureBoot enabled.

This is mainly a cosmetic fixup, as the "quiet" kernel parameter does
not silence pr_efi printouts in the linux kernel (this only works using
the efi stub from the linux source tree)

7 years agoAdded some missing Swedish Strings (#7552)
hanklank [Wed, 6 Dec 2017 12:52:25 +0000 (13:52 +0100)]
Added some missing Swedish Strings (#7552)

7 years agomeson: print warnings if the "nobody" user/group name is not compatible with the...
Lennart Poettering [Tue, 5 Dec 2017 10:00:24 +0000 (11:00 +0100)]
meson: print warnings if the "nobody" user/group name is not compatible with the local system

At least on Fedora and Debian systems this not obvious to get right,
hence warn.

7 years agouser-util: add UID_NOBODY defines that resolve to (uid_t) 65534
Lennart Poettering [Mon, 4 Dec 2017 16:06:56 +0000 (17:06 +0100)]
user-util: add UID_NOBODY defines that resolve to (uid_t) 65534

We use it all over the place, let's add a #define for it. Makes things
easier greppable, and more explanatory I think.

7 years agonss-elogind: tweak checks when we consult PID 1 for dynamic UID/GID lookups
Lennart Poettering [Sat, 2 Dec 2017 12:07:18 +0000 (13:07 +0100)]
nss-elogind: tweak checks when we consult PID 1 for dynamic UID/GID lookups

Instead of contacting PID 1 for dynamic UID/GID lookups for all
UIDs/GIDs that do not qualify as "system" do the more precise check
instead: check if they actually qualify for the "dynamic" range.

7 years agouser-util: add new uid_is_system() helper
Lennart Poettering [Sat, 2 Dec 2017 11:59:21 +0000 (12:59 +0100)]
user-util: add new uid_is_system() helper

This adds uid_is_system() and gid_is_system(), similar in style to
uid_is_dynamic(). That a helper like this is useful is illustrated by
the fact that test-condition.c didn't get the check right so far, which
this patch fixes.

7 years agobuild-sys: make the dynamic UID range, and the container UID range configurable
Lennart Poettering [Sat, 2 Dec 2017 11:48:31 +0000 (12:48 +0100)]
build-sys: make the dynamic UID range, and the container UID range configurable

Also, export these ranges in our pkg-config files.

7 years agoutil-lib: kill duplicate slashes in lookup paths
Zbigniew Jędrzejewski-Szmek [Thu, 23 Nov 2017 12:02:21 +0000 (13:02 +0100)]
util-lib: kill duplicate slashes in lookup paths

Since we're munging the array anyway, we can make the output a bit
nicer too.

7 years agohexdecoct: fix comment typo (#7548)
Lennart Poettering [Tue, 5 Dec 2017 15:42:58 +0000 (16:42 +0100)]
hexdecoct: fix comment typo (#7548)

7 years agostring-util: rework strextend() to optionally inset separators between each appended...
Lennart Poettering [Tue, 28 Nov 2017 15:37:53 +0000 (16:37 +0100)]
string-util: rework strextend() to optionally inset separators between each appended string

This adds a new flavour of strextend(), called
strextend_with_separator(), which takes an optional separator string. If
specified, the separator is inserted between each appended string, as
well as before the first one, but only if the original string was
non-empty.

This new call is particularly useful when appending new options to mount
option strings and suchlike, which need to be comma-separated, and
initially start out from an empty string.

7 years agomeson: fix indentation
Yu Watanabe [Tue, 5 Dec 2017 05:01:39 +0000 (14:01 +0900)]
meson: fix indentation

7 years agoutil-lib,tests: rework unbase64 so that we skip over whitespace automatically (#7522)
Lennart Poettering [Sun, 3 Dec 2017 19:57:24 +0000 (20:57 +0100)]
util-lib,tests: rework unbase64 so that we skip over whitespace automatically (#7522)

Let's optimize things a bit, and instead of having to strip whitespace
first before decoding base64, let's do that implicitly while doing so.
Given that base64 was designed the way it was designed specifically to
be tolerant to whitespace changes, it's a good idea to do this
automatically and implicitly.

7 years agosysusers: Provide meson argument to set gid for 'users' group (#7533)
Ikey Doherty [Sun, 3 Dec 2017 12:28:23 +0000 (12:28 +0000)]
sysusers: Provide meson argument to set gid for 'users' group (#7533)

To allow better integration with distributions requiring an explicitly
set gid for the `users` group, provide the new `-Dusers-gid` option to
set to a new numeric value.

In the absence of a specified gid, we'll fallback to the default existing
behaviour of `-` as the gid value, to automatically assign the next available
gid on the system.

7 years agofs-util: remove comment about non-existing function
Yu Watanabe [Thu, 30 Nov 2017 16:15:42 +0000 (01:15 +0900)]
fs-util: remove comment about non-existing function

7 years agofs-util: chase_symlinks(): remove unnecessary slash at the head
Yu Watanabe [Thu, 30 Nov 2017 17:19:44 +0000 (02:19 +0900)]
fs-util: chase_symlinks(): remove unnecessary slash at the head

Before this, chase_symlinks("/../../foo/bar",...) returns //foo/bar.
This removes the unnecessary slash at the head.

7 years ago*: fix some inconsistent control statement style
Vito Caputo [Sat, 2 Dec 2017 00:49:52 +0000 (16:49 -0800)]
*: fix some inconsistent control statement style

7 years agoNEWS: update the text a bit (#7524)
Zbigniew Jędrzejewski-Szmek [Fri, 1 Dec 2017 15:25:19 +0000 (16:25 +0100)]
NEWS: update the text a bit (#7524)

This fixes various typos, removes some duplications, and adds a bit more
detail in the few places which are potential pitfalls for users.
Also change the way the paragraphs about new options begin, because having
a paragraph saying "Two new options have been added", and then bit lower
again "Two new options have been added" is confusing.

7 years agoAdd x-elogind.growfs option for fstab
Zbigniew Jędrzejewski-Szmek [Wed, 29 Nov 2017 19:02:11 +0000 (20:02 +0100)]
Add x-elogind.growfs option for fstab

7 years agoAdd x-elogind.makefs option for fstab
Zbigniew Jędrzejewski-Szmek [Tue, 21 Nov 2017 22:18:05 +0000 (23:18 +0100)]
Add x-elogind.makefs option for fstab

I opted to completely generate a unit for both mount points and swaps. For
swaps, it would be possible to use fixed template unit like elogind-mkswap@.service,
because there's no information passed except the device name. For mount points,
that's not possible because both the device name and file system type need to
be passed. Nevertheless, I expect that options will need to passed to both mkfs
and mkswap, in which case it'll be necessary to create units of both types
anyway.

7 years agoAdd mkfs wrapper which first checks if the partition is empty
Zbigniew Jędrzejewski-Szmek [Sun, 26 Nov 2017 21:51:29 +0000 (22:51 +0100)]
Add mkfs wrapper which first checks if the partition is empty

7 years agogrowfs: add support for resizing encrypted partitions
Zbigniew Jędrzejewski-Szmek [Tue, 21 Nov 2017 17:56:52 +0000 (18:56 +0100)]
growfs: add support for resizing encrypted partitions

7 years agoAdd elogind-growfs tool
Zbigniew Jędrzejewski-Szmek [Mon, 23 Oct 2017 11:40:38 +0000 (13:40 +0200)]
Add elogind-growfs tool

7 years agotest-mount-util: move test_path_is_mount_point here
Zbigniew Jędrzejewski-Szmek [Tue, 31 Oct 2017 09:52:30 +0000 (10:52 +0100)]
test-mount-util: move test_path_is_mount_point here

path-util.c and mount-util.c are intertwined, but path_is_mount_point() is
defined in mount-util.c.

No functional difference.

7 years agoFix SELinux labels in cgroup filesystem root directory (#7496)
Krzysztof Nowicki [Thu, 30 Nov 2017 10:59:29 +0000 (11:59 +0100)]
Fix SELinux labels in cgroup filesystem root directory (#7496)

When using SELinux with legacy cgroups the tmpfs on /sys/fs/cgroup is by
default labelled as tmpfs_t. This label is also inherited by the "cpu"
and "cpuacct" symbolic links. Unfortunately the policy expects them to
be labelled as cgroup_t, which is used for all the actual cgroup
filesystems. Failure to do so results in a stream of denials.

This state cannot be fixed reliably when the cgroup filesystem structure
is set-up as the SELinux policy is not yet loaded at this
moment. It also cannot be fixed later as the root of the cgroup
filesystem is remounted read-only. In order to fix it the root of the
cgroup filesystem needs to be temporary remounted read-write, relabelled
and remounted back read-only.

7 years agomeson: emit a warning if rootprefix is set
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 20:46:53 +0000 (21:46 +0100)]
meson: emit a warning if rootprefix is set

It's printed at the end because it's the easiest to spot there.

When meson is upgraded to 0.43.1, we'll be able to use warning() instead.

7 years agofileio: document why fileio-label.c and fileio.c are two different modules
Lennart Poettering [Mon, 27 Nov 2017 15:06:39 +0000 (16:06 +0100)]
fileio: document why fileio-label.c and fileio.c are two different modules

7 years agologind: fix sysfs change trigger code
Lennart Poettering [Wed, 22 Nov 2017 11:10:39 +0000 (12:10 +0100)]
logind: fix sysfs change trigger code

We can't create files in sysfs, hence don't bother. Also if we ignore
the return value, do so explicitly by casting to void.

7 years agospecifier: add helper for escaping '%' characters to avoid making them subject for...
Lennart Poettering [Tue, 21 Nov 2017 16:52:31 +0000 (17:52 +0100)]
specifier: add helper for escaping '%' characters to avoid making them subject for expansion

This is ultimately just a wrapper around strreplace(), but it makes
things a bit more self-descriptive.

7 years agostring-util: update strreplace() a bit, use GREEDY_REALLOC()
Lennart Poettering [Tue, 21 Nov 2017 18:38:49 +0000 (19:38 +0100)]
string-util: update strreplace() a bit, use GREEDY_REALLOC()

7 years agoAdd set/hashmap helpers for non-trivial freeing and use where straighforward
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 11:35:49 +0000 (12:35 +0100)]
Add set/hashmap helpers for non-trivial freeing and use where straighforward

A macro is needed because otherwise we couldn't ensure type safety.
Some simple tests are included.
No functional change intended.

7 years agoRevert "meson: drop rootprefix option"
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 19:00:10 +0000 (20:00 +0100)]
Revert "meson: drop rootprefix option"

This reverts commit ee4bfa21f62dbf4d8f2be27d3c763c3c16743bfd.

Also add comment so that this doesn't get deleted again by mistake.

Replaces #7461.

7 years agocap-list: check range of numeric value
Yu Watanabe [Tue, 28 Nov 2017 13:06:34 +0000 (22:06 +0900)]
cap-list: check range of numeric value

7 years agoalloc-util: coding style fix
Yu Watanabe [Tue, 28 Nov 2017 09:11:58 +0000 (18:11 +0900)]
alloc-util: coding style fix

7 years agotest-process-util: add (void) cast to make coverity happy
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 21:52:32 +0000 (21:52 +0000)]
test-process-util: add (void) cast to make coverity happy

The intent is for the call to succeed only when privileged, so make
that clear.

7 years agosd-resolve: propagate timeouts in sd_resolve_wait() the same way as in sd_bus_wait...
Lennart Poettering [Mon, 27 Nov 2017 15:28:53 +0000 (16:28 +0100)]
sd-resolve: propagate timeouts in sd_resolve_wait() the same way as in sd_bus_wait(): ETIMEDOUT

Thankfully this is an internal API still, so we can mkae changes like
this.

7 years agologind: use the new FDSTOREREMOVE=1 sd_notify() message
Lennart Poettering [Mon, 13 Nov 2017 18:06:11 +0000 (19:06 +0100)]
logind: use the new FDSTOREREMOVE=1 sd_notify() message

Let's explicitly tell PID 1 that we don't need an fd anymore, instead of
relying exclusively on POLLERR/POLLHUP for it to be removed.

Fixes: #6908
7 years agocore: add a new sd_notify() message for removing fds from the FD store again
Lennart Poettering [Mon, 13 Nov 2017 17:26:04 +0000 (18:26 +0100)]
core: add a new sd_notify() message for removing fds from the FD store again

Currenly the only way to remove fds from the fdstore is to fully
stop the service, or to somehow trigger POLLERR/POLLHUP on the fd, in
which case elogind will remove the fd automatically.

Let's add another way: a new message that can be sent to remove fds
explicitly, given their name.

7 years agoman: slightly improve the sd_notify() documentation regarding READY=1
Lennart Poettering [Mon, 13 Nov 2017 17:19:53 +0000 (18:19 +0100)]
man: slightly improve the sd_notify() documentation regarding READY=1

READY=1 may be used to signal when a service finished startup, but also
when it finished reloading. Say so.

7 years agocore: only process one of READY=1, STOPPING=1 or RELOADING=1 in sd_notify() handling
Lennart Poettering [Mon, 13 Nov 2017 17:14:20 +0000 (18:14 +0100)]
core: only process one of READY=1, STOPPING=1 or RELOADING=1 in sd_notify() handling

Of course, it's not really a valid sd_notify() message if multiple of
these fields are used in one, but let's handle this somewhat gracefully,
by only processing one of them, and ignoring the rest.

7 years agoservice: reorder sd_notify() handling a bit
Lennart Poettering [Mon, 13 Nov 2017 17:06:09 +0000 (18:06 +0100)]
service: reorder sd_notify() handling a bit

Let's keep handling of WATCHDOG= and WATCHDOG_USEC= together. No
functional changes.

7 years agologind: make sure we don't acces m->action_what if it's not initialized (#7475)
Lennart Poettering [Mon, 27 Nov 2017 07:15:07 +0000 (08:15 +0100)]
logind: make sure we don't acces m->action_what if it's not initialized (#7475)

Fixes: #7466
7 years agoexec-util: initialize `new` before using it (#7471)
Evgeny Vereshchagin [Sun, 26 Nov 2017 11:46:56 +0000 (14:46 +0300)]
exec-util: initialize `new` before using it (#7471)

CID #1383004

7 years agofileio: include sys/mman.h
Yu Watanabe [Sat, 25 Nov 2017 17:40:23 +0000 (02:40 +0900)]
fileio: include sys/mman.h

7 years agomeson: update header file to detect memfd_create()
Yu Watanabe [Sat, 25 Nov 2017 17:17:06 +0000 (02:17 +0900)]
meson: update header file to detect memfd_create()

7 years agocore: warn about left-over processes in cgroup on unit start
Lennart Poettering [Fri, 24 Nov 2017 21:02:22 +0000 (22:02 +0100)]
core: warn about left-over processes in cgroup on unit start

Now that we don't kill control processes anymore, let's at least warn
about any processes left-over in the unit cgroup at the moment of
starting the unit.

7 years agounit: initialize bpf cgroup realization state properly
Lennart Poettering [Fri, 24 Nov 2017 18:51:36 +0000 (19:51 +0100)]
unit: initialize bpf cgroup realization state properly

Before this patch, the bpf cgroup realization state was implicitly set
to "NO", meaning that the bpf configuration was realized but was turned
off. That means invalidation requests for the bpf stuff (which we issue
in blanket fashion when doing a daemon reload) would actually later
result in a us re-realizing the unit, under the assumption it was
already realized once, even though in reality it never was realized
before.

This had the effect that after each daemon-reload we'd end up realizing
*all* defined units, even the unloaded ones, populating cgroupfs with
lots of unneeded empty cgroups.

With this fix we properly set the realiazation state to "INVALIDATED",
i.e. indicating the bpf stuff was never set up for the unit, and hence
when we try to invalidate it later we won't do anything.

7 years agocgroup: when dispatching the cgroup realization queue, check again if we shall actual...
Lennart Poettering [Fri, 24 Nov 2017 18:48:38 +0000 (19:48 +0100)]
cgroup: when dispatching the cgroup realization queue, check again if we shall actually realize

We add units to the cgroup realization queue when propagating realizing
requests to sibling units, and when invalidating cgroup settings because
some cgroup setting changed. In the time between where we add the unit
to the queue until the cgroup is actually dispatched the unit's state
might have changed however, so that the unit doesn't actually need to be
realized anymore, for example because the unit went down. To handle
that, check the unit state again, if realization makes sense.

Redundant realization is usually not a problem, except when the unit is
not actually running, hence check exactly for that.

7 years agocgroup: drop unused parameter from function
Lennart Poettering [Fri, 24 Nov 2017 18:37:01 +0000 (19:37 +0100)]
cgroup: drop unused parameter from function

7 years agotest: set log_level to info in test-hwdb and check-help-*
Yu Watanabe [Sat, 25 Nov 2017 15:01:55 +0000 (00:01 +0900)]
test: set log_level to info in test-hwdb and check-help-*

These tests check the stderr. So, if the elogind.log_level=debug
is set in the kernel command line, then these tests fail.
This set log_level to info in hwdb-test.sh and meson-check-help.sh,
the kernel command line not to change the output of the target
programs.

Fixes #7362.

7 years agomeson: remove abbreviations in status
Yu Watanabe [Sat, 25 Nov 2017 11:35:24 +0000 (20:35 +0900)]
meson: remove abbreviations in status

7 years agomeson: restore building of man pages on demand even if -Dman=false
Zbigniew Jędrzejewski-Szmek [Fri, 24 Nov 2017 13:00:29 +0000 (14:00 +0100)]
meson: restore building of man pages on demand even if -Dman=false

I want to configure -Dman=false for speed, but be able to build a specific
man page sometimes to check my edits. Commit 5b316b9ea6c broke this by mistake.
Let's adjust the condition to better match the logic of disabling tests only
if xsltproc is really not found.

7 years agoReplace use of snprintf with xsprintf
Daniel Lockyer [Fri, 24 Nov 2017 10:36:04 +0000 (10:36 +0000)]
Replace use of snprintf with xsprintf