chiark / gitweb /
elogind.git
7 years agosd-bus: extend D-Bus authentication timeout considerably (#6813)
Lennart Poettering [Wed, 13 Sep 2017 17:08:26 +0000 (19:08 +0200)]
sd-bus: extend D-Bus authentication timeout considerably (#6813)

As it turns out the authentication phase times out too often than is
good, mostly due to PRNG pools not being populated during boot. Hence,
let's increase the authentication timeout from 25s to 90s, to cover for
that.

(Note that we leave the D-Bus method call timeout at 25s, matching the
reference implementation's value. And if the auth phase managed to
complete then the pools should be populated enough and mehtod calls
shouldn't take needlessly long anymore).

Fixes: #6418
7 years agoutil: make get_block_device() available
Franck Bui [Wed, 13 Sep 2017 09:47:15 +0000 (11:47 +0200)]
util: make get_block_device() available

7 years agoconf-files: log when we skip a drop-in configuration file
Lennart Poettering [Wed, 13 Sep 2017 09:41:41 +0000 (11:41 +0200)]
conf-files: log when we skip a drop-in configuration file

7 years agoexec-util,conf-files: skip non-executable files in execute_directories()
Lennart Poettering [Tue, 12 Sep 2017 14:57:33 +0000 (16:57 +0200)]
exec-util,conf-files: skip non-executable files in execute_directories()

Fixes: #6787
7 years agopager: let's create pager fds with O_CLOEXEC first
Lennart Poettering [Wed, 13 Sep 2017 08:35:28 +0000 (10:35 +0200)]
pager: let's create pager fds with O_CLOEXEC first

We make copies (without O_CLOEXEC) of the fds anyway before using them,
hence let's be safe and create them with O_CLOEXEC first, so that we
don't run into issues should pager_open() be called in a threaded
environment where another thread fork()s at the wrong time and ends up
with fds not marked O_CLOEXEC.

7 years agosystemctl: don't do ANSI underlining on TERM=linux (#6778)
Lennart Poettering [Sat, 9 Sep 2017 20:48:35 +0000 (22:48 +0200)]
systemctl: don't do ANSI underlining on TERM=linux (#6778)

The linux console apparently can't do underlining, hence let's not do it
on the console.

Also see: #6601

7 years agoutil-lib: wrap personality() to fix up broken glibc error handling (#6766)
Lennart Poettering [Fri, 8 Sep 2017 14:16:29 +0000 (16:16 +0200)]
util-lib: wrap personality() to fix up broken glibc error handling (#6766)

glibc appears to propagate different errors in different ways, let's fix
this up, so that our own code doesn't get confused by this.

See #6752 + #6737 for details.

Fixes: #6755
7 years agoshared: allow to input empty string to config_parse_path()
Yu Watanabe [Tue, 5 Sep 2017 06:12:55 +0000 (15:12 +0900)]
shared: allow to input empty string to config_parse_path()

Fixes #6633.

7 years agobuild-sys: make nonnull warning non-fatal (#6742)
Zbigniew Jędrzejewski-Szmek [Mon, 4 Sep 2017 16:49:12 +0000 (19:49 +0300)]
build-sys: make nonnull warning non-fatal (#6742)

Seems to be some kind of confusion in gcc. Insteading of playing whack-a-mole and
adding work-arounds in code, let's adjust the compilation options instead.

Fixes #6119, replaces #6657.

7 years agotmpfiles: silently ignore any path that passes through autofs (#6506)
NeilBrown [Mon, 4 Sep 2017 13:35:07 +0000 (23:35 +1000)]
tmpfiles: silently ignore any path that passes through autofs (#6506)

If a path passes though an autofs filesystem, then accessing
the path might trigger and automount.  As elogind-tmpfiles is run before
the network is up, and as automounts are often used for networked
filesystems, this can cause a deadlock.

So chase_symlinks is enhance to accept a new flag which tells it
to check for autofs, and return -EREMOTE if autofs is found.

tmpfiles is changed to check just before acting on a path so that it
can avoid autofs even if a symlink was created earlier by tmpfiles
that would send this path through an autofs.

This fixes a deadlock that happens when /home is listed in /etc/fstab as
x-elogind.automount for an NFS directory.

7 years agoelogind-mount: allow to specify an arbitrary string for arg_mount_what when vfs is...
Yu Watanabe [Mon, 4 Sep 2017 01:55:51 +0000 (10:55 +0900)]
elogind-mount: allow to specify an arbitrary string for arg_mount_what when vfs is used

Fixes #6591.

7 years agoterminal: unify code for resetting kbd utf8 mode a bit (#6692)
Lennart Poettering [Fri, 1 Sep 2017 00:09:32 +0000 (02:09 +0200)]
terminal: unify code for resetting kbd utf8 mode a bit (#6692)

We have the same code at two places, let's unify that at one place.

Follow-up for #6606

7 years agotree-wide: use pid_is_valid() at more places
Lennart Poettering [Thu, 31 Aug 2017 08:25:06 +0000 (10:25 +0200)]
tree-wide: use pid_is_valid() at more places

7 years agosd-bus: use -- when passing arguments to ssh (#6706)
Evgeny Vereshchagin [Thu, 31 Aug 2017 08:38:30 +0000 (11:38 +0300)]
sd-bus: use -- when passing arguments to ssh (#6706)

This prevents `systemctl` from runnning /bin/touch when the following
command is used:
```
systemctl -H '-oProxyCommand=/bin/touch i-shouldnt-be-here' show-environment
```

7 years agolog: reopen log for failed assertions (#6703)
Topi Miettinen [Thu, 31 Aug 2017 08:37:32 +0000 (08:37 +0000)]
log: reopen log for failed assertions (#6703)

Reopen log so that failed and aborting assertions can be written to log.

Closes: #6658
7 years agobus-util: remove unnecessary initializations
Yu Watanabe [Thu, 31 Aug 2017 08:02:33 +0000 (17:02 +0900)]
bus-util: remove unnecessary initializations

7 years agosystemctl: show capabilities in human readable format
Yu Watanabe [Thu, 31 Aug 2017 08:07:16 +0000 (17:07 +0900)]
systemctl: show capabilities in human readable format

Follow-up for 21771f338d268e06dc9a10b9b08b14ff8217d4be.

7 years agomeson: add . to include_directories (#6634)
Davide Cavalca [Wed, 30 Aug 2017 15:34:44 +0000 (08:34 -0700)]
meson: add . to include_directories (#6634)

7 years agologind: VT_GETSTATE "cannot return state for more than 16 VTs" (#6625)
Alan Jenkins [Wed, 30 Aug 2017 15:06:12 +0000 (16:06 +0100)]
logind: VT_GETSTATE "cannot return state for more than 16 VTs" (#6625)

`vt_is_busy(16)` would always return FALSE.  So we could have started
autovt@16.service even when VT 16 was already being used for something.

7 years agomeson: use current_source_dir() to scope git invocations (#6635)
Davide Cavalca [Wed, 30 Aug 2017 15:04:53 +0000 (08:04 -0700)]
meson: use current_source_dir() to scope git invocations (#6635)

7 years agosd-bus: socket - only transmit auxillary FDs once (#6603)
Tom Gundersen [Wed, 30 Aug 2017 11:09:03 +0000 (13:09 +0200)]
sd-bus: socket - only transmit auxillary FDs once (#6603)

If a message is too large to fit into the output buffer, it will be
transmitted to the kernel in several chunks. However, the FDs must
only ever be transmitted once or they will bereceived by the remote
end repeatedly.

The D-Bus specification disallows several sets of FDs attached to
one message, however, the reference implementation of D-Bus will
not reject such a message, rather it will reassign the duplicate
FDs to subsequent FD-carrying messages.

This attaches the FD array only to the first byte of the message.

7 years agoterminal reset should honour default_utf8 kernel setting (#6606)
g0tar [Wed, 30 Aug 2017 08:00:44 +0000 (10:00 +0200)]
terminal reset should honour default_utf8 kernel setting (#6606)

terminal reset should honour default_utf8 kernel setting

7 years agoseccomp: default to something resembling the current personality when locking it
Lennart Poettering [Wed, 9 Aug 2017 18:40:26 +0000 (20:40 +0200)]
seccomp: default to something resembling the current personality when locking it

Let's lock the personality to the currently set one, if nothing is
specifically specified. But do so with a grain of salt, and never
default to any exotic personality here, but only PER_LINUX or
PER_LINUX32.

7 years agoAdded Romanian Translation (#6674)
dasj19 [Mon, 28 Aug 2017 16:24:09 +0000 (18:24 +0200)]
Added Romanian Translation (#6674)

7 years agologind: tighten assertion in execute_shutdown_or_sleep()
Alan Jenkins [Thu, 24 Aug 2017 14:21:21 +0000 (15:21 +0100)]
logind: tighten assertion in execute_shutdown_or_sleep()

Following commit b498d6ea, I belated realized we should tighten the
assertions as well, to make sure that we're setting `m->action_what` to
represent an action in progress.  (The check for an action in progress is
to compare `m->action_what` to zero)

7 years agologind: add missing resume signal when we fail to initiate sleep/shutdown
Alan Jenkins [Thu, 24 Aug 2017 09:33:24 +0000 (10:33 +0100)]
logind: add missing resume signal when we fail to initiate sleep/shutdown

This fixed https://bugzilla.redhat.com/show_bug.cgi?id=1476313
as much as I was able to reproduce it in a VM, at least.

E.g. this signal might wake the screen back up, providing a more visible
indicator of suspend failure.  In my VM testing, it was also required in
order to unblock keyboard input in gnome-shell after the failed suspend.

At the same time, fix the error handling for scheduled shutdowns.  This now
mirrors the behaviour of when you use `shutdown -k` - it sends all the
scary messages about shutting down, "but you'll have to do it [shut down
the system] yourself".  It also avoids the risk of locking out the admin
(nologin file), in case they logged out for some reason (and they use
`sudo` instead of root).

Not that I have any idea why you'd want to use `shutdown -k`, but the code
is easier to analyze if it rolls back on error (in the absence of any code
comment as to why that's not wanted).

7 years agologind: respect "delay" inhibitors in scheduled shutdowns
Alan Jenkins [Mon, 21 Aug 2017 16:28:35 +0000 (17:28 +0100)]
logind: respect "delay" inhibitors in scheduled shutdowns

There is no justification not to wait an extra (default) 5 seconds, for
a more graceful shutdown of user programs.  Again, you don't get to ignore
delay inhibitors for unscheduled shutdowns, short of
`systemctl poweroff -f`.

It is simplest if we move the test for `m->shutdown_dry_run` into
manager_scheduled_shutdown_handler().

However we need to not add such delays during a "dry run".  Otherwise, we
would still have to be considered "in progress" for some seconds after our
admin has seen the final wall message.  If they go to `poweroff`, we would
have blocked them with a misleading error message.  Note this `poweroff`
will still process delay inhibitors as needed.  If the admin planned to
use a more forceful method... eh.  It's their responsibility to assess
whether that's safe.

There is an argument that the alternative behaviour could be used (racily!)
to kludge around them not being able to shutdown to "single user mode".  If
we cared about that case, we would have easily preserved non-racy support
for it in `shutdown`.

Additionally, though I think this code does read more easily by reducing
inconsistencies, we didn't come up with any use case for delay inhibitors
v.s. shutdown.[1]  The SIGTERM v.s. SIGKILL delay is more general, and we
allow a whole 90 seconds for it, not just 5.  So I don't think keeping this
approach bears a risk of significant damage.

[1] https://www.freedesktop.org/wiki/Software/elogind/inhibit/

7 years agologind: add missing check for conflicting operation v.s. scheduled shutdown
Alan Jenkins [Mon, 21 Aug 2017 10:49:25 +0000 (11:49 +0100)]
logind: add missing check for conflicting operation v.s. scheduled shutdown

> We don't want to shutdown while a suspend is running, and vice versa.
> This would be confusing and could lead to data loss in the worst case.

https://bugs.launchpad.net/ubuntu/+source/elogind/+bug/1441253/comments/4

According to the above comment, if the conflicting operation is hung,
we don't want to force things when the admin has not passed a force option.

Similarly if you're not an admin, you probably shouldn't get to sneak
around this check by using a scheduled shutdown instead of an unscheduled
one.  (And no-one so far thought it necessary to add such a permission in
PolKit).

Note that if the conflicting operation was _not_ hung, and we lost the
race with suspend, the system might not have shut down at the scheduled
time anyway.  Which is no good if you were scheduling a power outage.
And scheduling a shutdown for an arbitrary time when the system is resumed,
does not seem a very useful semantic.  More likely, scheduled shutdowns are
useful on systems which do not use suspend, such as multi-user servers.
(In which case even PolKit defaults likely don't let the users trigger
suspend).

7 years agologind: method_schedule_shutdown() already rejects empty `type`
Alan Jenkins [Tue, 22 Aug 2017 12:54:21 +0000 (13:54 +0100)]
logind: method_schedule_shutdown() already rejects empty `type`

Don't test for an empty `type` afterwards.  This is not how you cancel
scheduled shutdowns - there's a separate method for that.

7 years agobuild-sys: don't build networkctl if networkd is disabled
Felipe Sateler [Mon, 21 Aug 2017 12:48:41 +0000 (09:48 -0300)]
build-sys: don't build networkctl if networkd is disabled

7 years agocapability: add new ambient_capabilities_supported() helper
Lennart Poettering [Wed, 9 Aug 2017 13:07:15 +0000 (15:07 +0200)]
capability: add new ambient_capabilities_supported() helper

This new function reports whether ambient caps are available, and should
be quick because the result is cached.

7 years agocapability: change capability_bounding_set_drop() to be work without privileges when...
Lennart Poettering [Wed, 9 Aug 2017 13:05:36 +0000 (15:05 +0200)]
capability: change capability_bounding_set_drop() to be work without privileges when executing a NOP

This way daemons which already dropped all caps may use the call to
drop priviliges again, which becomes a non-failing NOP.

7 years agotree-wide: use path_startswith() rather than startswith() where ever that's appropriate
Lennart Poettering [Wed, 9 Aug 2017 17:03:39 +0000 (19:03 +0200)]
tree-wide: use path_startswith() rather than startswith() where ever that's appropriate

When checking path prefixes we really should use the right APIs, just in
case people add multiple slashes to their paths...

7 years agoutil-lib: add a new skip_dev_prefix() helper
Lennart Poettering [Wed, 9 Aug 2017 17:01:18 +0000 (19:01 +0200)]
util-lib: add a new skip_dev_prefix() helper

This new helper removes a leading /dev if there is one. We have code
doing this all over the place, let's unify this, and correct it while
we are at it, by using path_startswith() rather than startswith() to
drop the prefix.

7 years agoPrep v235: Update test-login.c
shwsh [Tue, 5 Sep 2017 15:23:33 +0000 (22:23 +0700)]
Prep v235: Update test-login.c

 * Merge pull request #29 from shwsh/master

7 years agoPrep v235: Allow elogind to be auto-started by dbus requests
Sven Eden [Fri, 1 Sep 2017 11:35:48 +0000 (13:35 +0200)]
Prep v235: Allow elogind to be auto-started by dbus requests

7 years agoPrep v235: Fix pam_elogind
Sven Eden [Fri, 1 Sep 2017 11:22:46 +0000 (13:22 +0200)]
Prep v235: Fix pam_elogind

7 years agoPrep v235: systemd installs in /lib/systemd, so we install in /lib/elogind.
Sven Eden [Thu, 31 Aug 2017 15:34:31 +0000 (17:34 +0200)]
Prep v235: systemd installs in /lib/systemd, so we install in /lib/elogind.

7 years agoPrep v235: Catch and react on SIGINT, SIGQUIT and SIGTERM
Sven Eden [Thu, 31 Aug 2017 14:44:51 +0000 (16:44 +0200)]
Prep v235: Catch and react on SIGINT, SIGQUIT and SIGTERM

7 years agoPrep v235: Fix startup order and add debug logging.
Sven Eden [Thu, 31 Aug 2017 05:58:32 +0000 (07:58 +0200)]
Prep v235: Fix startup order and add debug logging.

7 years agoPrep v235: Do not write an early PID file, if elogind is going to be daemonized.
Sven Eden [Wed, 30 Aug 2017 08:59:42 +0000 (10:59 +0200)]
Prep v235: Do not write an early PID file, if elogind is going to be daemonized.

7 years agoPrep v235: Apply pending upstream updates in src/test [4/4]
Sven Eden [Wed, 30 Aug 2017 05:49:50 +0000 (07:49 +0200)]
Prep v235: Apply pending upstream updates in src/test [4/4]

7 years agoPrep v235: Apply pending upstream updates in src/login [3/4]
Sven Eden [Wed, 30 Aug 2017 05:49:50 +0000 (07:49 +0200)]
Prep v235: Apply pending upstream updates in src/login [3/4]

7 years agoPrep v235: Apply pending upstream updates in src/core [2/4]
Sven Eden [Wed, 30 Aug 2017 05:49:50 +0000 (07:49 +0200)]
Prep v235: Apply pending upstream updates in src/core [2/4]

7 years agoPrep v235: Apply pending upstream updates in src/basic [1/4]
Sven Eden [Wed, 30 Aug 2017 05:49:50 +0000 (07:49 +0200)]
Prep v235: Apply pending upstream updates in src/basic [1/4]

7 years agoPrep 235: add missing libshared.sym and remove obsolete kdbus.h
Sven Eden [Wed, 30 Aug 2017 05:48:30 +0000 (07:48 +0200)]
Prep 235: add missing libshared.sym and remove obsolete kdbus.h

7 years agoPrep v235: optimize elogind extra startup functionality
Sven Eden [Wed, 30 Aug 2017 05:47:40 +0000 (07:47 +0200)]
Prep v235: optimize elogind extra startup functionality

7 years agofileio: rename function parameter to avoid masking global symbol
Alan Jenkins [Tue, 29 Aug 2017 09:56:32 +0000 (10:56 +0100)]
fileio: rename function parameter to avoid masking global symbol

> glibc exports a function called sync(), we should probably avoid
> overloading that as a variable here locally (gcc even used to warn about
> that, not sure why it doesn't anymore), to avoid confusion around what
> "if (sync)" actually means

7 years agoshared: Add a linker script so that all functions are tagget @SD_SHARED instead of...
Felipe Sateler [Mon, 28 Aug 2017 16:49:03 +0000 (13:49 -0300)]
shared: Add a linker script so that all functions are tagget @SD_SHARED instead of @Base (#6669)

This helps prevent symbol collisions with other programs and libraries. In particular,
because PAM modules are loaded into the process that is creating the session, and
elogind creates PAM sessions, the potential for collisions is high.

Disambiguate all elogind calls by tagging a 'version' SD_SHARED.

Fixes #6624

7 years agoSupport 'rdma' as a ListenNetlink= argument (#6626)
Jason Gunthorpe [Mon, 28 Aug 2017 15:22:10 +0000 (09:22 -0600)]
Support 'rdma' as a ListenNetlink= argument (#6626)

NETLINK_RDMA has been in the kernel since v3.0.

7 years agologind: make sure we don't process the same method call twice (#6583)
Lennart Poettering [Sat, 26 Aug 2017 13:19:26 +0000 (15:19 +0200)]
logind: make sure we don't process the same method call twice (#6583)

Tiny mistake, big effect.

Fixes: #6375
7 years ago"Don't fear the fsync()"
Alan Jenkins [Thu, 17 Aug 2017 16:09:44 +0000 (17:09 +0100)]
"Don't fear the fsync()"

For files which are vital to boot

1. Avoid opening any window where power loss will zero them out or worse.
   I know app developers all coded to the ext3 implementation, but
   the only formal documentation we have says we're broken if we actually
   rely on it.  E.g.

   * `man mount`, search for `auto_da_alloc`.
   * http://www.linux-mtd.infradead.org/faq/ubifs.html#L_atomic_change
   * https://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/

2. If we tell the kernel we're interested in writing them to disk, it will
   tell us if that fails.  So at minimum, this means we play our part in
   notifying the user about errors.

I refactored error-handling in `udevadm-hwdb` a little.  It turns out I did
exactly the same as had already been done in the `elogind-hwdb` version,
i.e. commit d702dcd.

7 years agocapability: change capability_bounding_set_drop() to be work without privileges when...
Lennart Poettering [Wed, 9 Aug 2017 13:05:36 +0000 (15:05 +0200)]
capability: change capability_bounding_set_drop() to be work without privileges when executing a NOP

This way daemons which already dropped all caps may use the call to
drop priviliges again, which becomes a non-failing NOP.

7 years agomkdir: chmod_and_chown() returns errors as "return -errno", not in errno itself
Lennart Poettering [Wed, 9 Aug 2017 10:46:09 +0000 (12:46 +0200)]
mkdir: chmod_and_chown() returns errors as "return -errno", not in errno itself

7 years agopam_logind: skip leading /dev/ from PAM_TTY field before passing it on
Lennart Poettering [Wed, 9 Aug 2017 17:04:36 +0000 (19:04 +0200)]
pam_logind: skip leading /dev/ from PAM_TTY field before passing it on

Apparently, PAM documents that the PAM_TTY should come with a /dev
prefix, but we don't expect it so far, except that Wayland ends up
setting it after all, the way the docs suggest. Hence, let's simply drop
the /dev prefix if it is there.

Fixes: #6516
7 years agoPrep v235: Set defaults for the sleep config *after* loading the config file.
Sven Eden [Tue, 29 Aug 2017 14:37:03 +0000 (16:37 +0200)]
Prep v235: Set defaults for the sleep config *after* loading the config file.

7 years agoPrep v235: Fix pkgconfig/libelogind.pc
Sven Eden [Tue, 22 Aug 2017 14:55:10 +0000 (16:55 +0200)]
Prep v235: Fix pkgconfig/libelogind.pc

7 years agoPrep v235: Use the new ELOGIND_PID_FILE macro consistently
Sven Eden [Fri, 18 Aug 2017 13:00:44 +0000 (15:00 +0200)]
Prep v235: Use the new ELOGIND_PID_FILE macro consistently

7 years agoPrep v235: Allow elogind to daemonize itself with "-D|--daemon".
Sven Eden [Wed, 16 Aug 2017 08:28:51 +0000 (10:28 +0200)]
Prep v235: Allow elogind to daemonize itself with "-D|--daemon".

7 years agoPrep v235: Cleaned up a stray mask-end-start chain.
Sven Eden [Wed, 16 Aug 2017 08:19:14 +0000 (10:19 +0200)]
Prep v235: Cleaned up a stray mask-end-start chain.

7 years agoPrep v235: Update build system to fit elogind
Sven Eden [Tue, 15 Aug 2017 04:56:29 +0000 (06:56 +0200)]
Prep v235: Update build system to fit elogind

- Update man/rules/meson.build with elogind set of xml files.
- Update documentation generating tools to fit elogind.
- Follow upstream and link against libelogind-shared-<version>.so

7 years agoPrep v235: Add missing includes and dependencies.
Sven Eden [Mon, 14 Aug 2017 08:18:50 +0000 (10:18 +0200)]
Prep v235: Add missing includes and dependencies.

7 years agoPrep v235: Apply upstream fixes (10/10) [src/update-utmp]
Sven Eden [Mon, 14 Aug 2017 07:16:16 +0000 (09:16 +0200)]
Prep v235: Apply upstream fixes (10/10) [src/update-utmp]

7 years agoPrep v235: Apply upstream fixes (9/10) [src/test]
Sven Eden [Mon, 14 Aug 2017 07:16:16 +0000 (09:16 +0200)]
Prep v235: Apply upstream fixes (9/10) [src/test]

7 years agoPrep v235: Apply upstream fixes (8/10) [src/systemd]
Sven Eden [Mon, 14 Aug 2017 07:16:16 +0000 (09:16 +0200)]
Prep v235: Apply upstream fixes (8/10) [src/systemd]

7 years agoPrep v235: Apply upstream fixes (7/10) [src/shared]
Sven Eden [Mon, 14 Aug 2017 07:16:16 +0000 (09:16 +0200)]
Prep v235: Apply upstream fixes (7/10) [src/shared]

7 years agoPrep v235: Apply upstream fixes (6/10) [src/login]
Sven Eden [Mon, 14 Aug 2017 07:16:15 +0000 (09:16 +0200)]
Prep v235: Apply upstream fixes (6/10) [src/login]

7 years agoPrep v235: Apply upstream fixes (5/10) [src/libelogind]
Sven Eden [Mon, 14 Aug 2017 05:49:46 +0000 (07:49 +0200)]
Prep v235: Apply upstream fixes (5/10) [src/libelogind]

7 years agoPrep v235: Apply upstream fixes (4/10) [src/core]
Sven Eden [Mon, 14 Aug 2017 05:49:28 +0000 (07:49 +0200)]
Prep v235: Apply upstream fixes (4/10) [src/core]

7 years agoPrep v235: Apply upstream fixes (3/10) [src/basic]
Sven Eden [Mon, 14 Aug 2017 07:16:15 +0000 (09:16 +0200)]
Prep v235: Apply upstream fixes (3/10) [src/basic]

7 years agoPrep v235: Apply upstream fixes (2/10) [man]
Sven Eden [Mon, 14 Aug 2017 05:49:08 +0000 (07:49 +0200)]
Prep v235: Apply upstream fixes (2/10) [man]

7 years agoPrep v235: Apply upstream fixes (1/10) [root]
Sven Eden [Mon, 14 Aug 2017 06:49:45 +0000 (08:49 +0200)]
Prep v235: Apply upstream fixes (1/10) [root]

7 years agoPrep v235: Remove superfluous .gitignore files
Sven Eden [Mon, 14 Aug 2017 05:37:32 +0000 (07:37 +0200)]
Prep v235: Remove superfluous .gitignore files

7 years agotests: when running a manager object in a test, migrate to private cgroup subroot...
Lennart Poettering [Wed, 9 Aug 2017 13:42:49 +0000 (15:42 +0200)]
tests: when running a manager object in a test, migrate to private cgroup subroot first (#6576)

Without this "meson test" will end up running all tests in the same
cgroup root, and they all will try to manage it. Which usually isn't too
bad, except when they end up clearing up each other's cgroups. This race
is hard to trigger but has caused various CI runs to fail spuriously.

With this change we simply move every test that runs a manager object
into their own private cgroup. Note that we don't clean up the cgroup at
the end, we leave that to the cgroup manager around it.

This fixes races that become visible by test runs throwing out errors
like this:

```
exec-systemcallfilter-failing.service: Passing 0 fds to service
exec-systemcallfilter-failing.service: About to execute: /bin/echo 'This should not be seen'
exec-systemcallfilter-failing.service: Forked /bin/echo as 5693
exec-systemcallfilter-failing.service: Changed dead -> start
exec-systemcallfilter-failing.service: Failed to attach to cgroup /exec-systemcallfilter-failing.service: No such file or directory
Received SIGCHLD from PID 5693 ((echo)).
Child 5693 ((echo)) died (code=exited, status=219/CGROUP)
exec-systemcallfilter-failing.service: Child 5693 belongs to exec-systemcallfilter-failing.service
exec-systemcallfilter-failing.service: Main process exited, code=exited, status=219/CGROUP
exec-systemcallfilter-failing.service: Changed start -> failed
exec-systemcallfilter-failing.service: Unit entered failed state.
exec-systemcallfilter-failing.service: Failed with result 'exit-code'.
exec-systemcallfilter-failing.service: cgroup is empty
Assertion 'service->main_exec_status.status == status_expected' failed at ../src/src/test/test-execute.c:71, function check(). Aborting.
```

BTW, I tracked this race down by using perf:

```
        # perf record -e cgroup:cgroup_mkdir,cgroup_rmdir
        …
        # perf script
```

Thanks a lot @iaguis, @alban for helping me how to use perf for this.

Fixes #5895.

7 years agobuild-sys: fix invalid args detected by meson 0.42 (#6561)
userwithuid [Wed, 9 Aug 2017 13:41:44 +0000 (13:41 +0000)]
build-sys: fix invalid args detected by meson 0.42 (#6561)

some run_target() calls were using params from custom_target()

example message:
WARNING: Passed invalid keyword argument "input". This will become a hard error in the future.

New way to call targets:
ninja man/man
ninja man/html
ninja man/update-man-rules

7 years agosd-login: test - fix failure when run from non-graphical seat
Alan Jenkins [Tue, 8 Aug 2017 15:13:52 +0000 (16:13 +0100)]
sd-login: test - fix failure when run from non-graphical seat

Observed when running from the console of a elogind nspawn container
(see failure below).

The value of r was tested, when r was last set by
sd_session_can_graphical().  This did not correspond to the value expected.

Fix the code, so we compare relevant values now.  Hopefully :).

Test failure
------------

/* Information printed is from the live system */
sd_pid_get_unit(0, …) → "session-13.scope"
sd_pid_get_user_unit(0, …) → "n/a"
sd_pid_get_slice(0, …) → "user-1000.slice"
sd_pid_get_session(0, …) → "13"
sd_pid_get_owner_uid(0, …) → 1000
sd_pid_get_cgroup(0, …) → "/user.slice/user-1000.slice/session-13.scope"
sd_uid_get_display(1000, …) → "13"
sd_uid_get_sessions(1000, …) → [2] "15 13"
sd_uid_get_seats(1000, …) → [1] "seat0"
sd_session_is_active("13") → yes
sd_session_is_remote("13") → no
sd_session_get_state("13") → "active"
sd_session_get_uid("13") → 1000
sd_session_get_type("13") → "tty"
sd_session_get_class("13") → "user"
sd_session_get_display("13") → "n/a"
sd_session_get_remote_user("13") → "n/a"
sd_session_get_remote_host("13") → "n/a"
sd_session_get_seat("13") → "seat0"
sd_session_can_multi_seat("seat0") → no
sd_session_can_tty("seat0") → no
sd_session_can_graphical("seat0") → no
sd_uid_get_state(1000, …) → active
Assertion '!!k == !!r' failed at ../src/libelogind/sd-login/test-login.c:191, function test_login(). Aborting.

7 years agosd-login: test - fix function name in output
Alan Jenkins [Tue, 8 Aug 2017 14:54:15 +0000 (15:54 +0100)]
sd-login: test - fix function name in output

7 years agotreewide: fix typos (#6566)
Torstein Husebø [Tue, 8 Aug 2017 14:05:29 +0000 (16:05 +0200)]
treewide: fix typos (#6566)

7 years agosd-bus: free everything when bus_set_address_user fails (#6552)
Evgeny Vereshchagin [Tue, 8 Aug 2017 06:42:51 +0000 (09:42 +0300)]
sd-bus: free everything when bus_set_address_user fails (#6552)

Fixes:
```
$ env -i valgrind --leak-check=full ./build/test-bus-chat
...
==7763== 1,888 (1,824 direct, 64 indirect) bytes in 1 blocks are
definitely lost in loss record 2 of 2
==7763==    at 0x4C2FA50: calloc (vg_replace_malloc.c:711)
==7763==    by 0x4F8FF9A: sd_bus_new (sd-bus.c:175)
==7763==    by 0x4F938BF: sd_bus_open_user (sd-bus.c:1138)
==7763==    by 0x109ACD: server_init (test-bus-chat.c:70)
==7763==    by 0x10BCF8: main (test-bus-chat.c:526)
==7763==
```

Closes #6481

7 years agoprocess-util: add sched_{policy,priority}_is_valid()
Yu Watanabe [Wed, 2 Aug 2017 04:43:44 +0000 (13:43 +0900)]
process-util: add sched_{policy,priority}_is_valid()

7 years agosecurebits-util: add secure_bits_{from_string,to_string_alloc}()
Yu Watanabe [Mon, 7 Aug 2017 14:40:25 +0000 (23:40 +0900)]
securebits-util: add secure_bits_{from_string,to_string_alloc}()

7 years agocore: propagate reload from RELOADING=1 notification (#6550)
Jouke Witteveen [Mon, 7 Aug 2017 09:27:24 +0000 (11:27 +0200)]
core: propagate reload from RELOADING=1 notification (#6550)

7 years agobus-util: do not print (uint64_t) -1 as is (#6522)
Yu Watanabe [Sun, 6 Aug 2017 00:37:25 +0000 (09:37 +0900)]
bus-util: do not print (uint64_t) -1 as is (#6522)

Closes #4295 and #6511.

7 years agoprocess-util: update the end pointer of the process name on rename (#6492)
Jouke Witteveen [Wed, 2 Aug 2017 15:08:31 +0000 (17:08 +0200)]
process-util: update the end pointer of the process name on rename (#6492)

We only updated the end pointer when allocating new memory, i.e. on the first
call to rename_process.

7 years agomodprobe.d: ship drop-in to set bonding max_bonds to 0 (#6448)
Dimitri John Ledkov [Wed, 2 Aug 2017 12:41:18 +0000 (13:41 +0100)]
modprobe.d: ship drop-in to set bonding max_bonds to 0 (#6448)

This allows networkd to correctly manage bond0 using networkd, when requested
by the user.

Fixes #5971 #6184

7 years agoresolved,nss-myhostname: use _gateway for the gateway
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jul 2017 06:15:08 +0000 (02:15 -0400)]
resolved,nss-myhostname: use _gateway for the gateway

This changes the symbolic name for the default gateway from "gateway" to
"_gateway". A new configuration option -Dcompat-gateway-hostname=true|false
is added. If it is set, the old name is also supported, but the new name
is used as the canonical name in either case. This is intended as a temporary
measure to make the transition easier, and the option should be removed
after a few releases, at which point only the new name will be used.

The old "gateway" name mostly works OK, but hasn't gained widespread acceptance
because of the following (potential) conflicts:
- it is completely legal to have a host called "gateway"
- there is no guarantee that "gateway" will not be registered as a TLD, even
  though this currently seems unlikely. (Even then, there would be no
  conflict except for the case when the top-level domain itself was being resolved.
  The "gateway" or "_gateway" labels have only special meaning when the
  whole name consists of a single label, so resolution of any subdomain
  of the hypothetical gateway. TLD would still work OK. )
Moving to "_gateway" avoids those issues because underscores are not allowed
in host names (RFC 1123, §2.1) and avoids potential conflicts with local or
global names.

v2:
- simplify the logic to hardcode "_gateway" and allow
  -Dcompat-gateway-hostname=true as a temporary measure.

7 years agostring-util: optimize strshorten() a bit
Lennart Poettering [Thu, 20 Jul 2017 12:17:30 +0000 (14:17 +0200)]
string-util: optimize strshorten() a bit

There's no reason to determine the full length of the string, it's
sufficient to know whether it is larger than the intended size...

7 years agoalloc-util: add new helpers memdup_suffix0() and newdup_suffix0()
Lennart Poettering [Thu, 20 Jul 2017 12:14:55 +0000 (14:14 +0200)]
alloc-util: add new helpers memdup_suffix0() and newdup_suffix0()

These are similar to memdup() and newdup(), but reserve one extra NUL
byte at the end of the new allocation and initialize it. It's useful
when copying out data from fixed size character arrays where NUL
termination can't be assumed.

7 years agoprocess-util: slightly optimize querying of our own process metadata
Lennart Poettering [Mon, 17 Jul 2017 21:35:25 +0000 (23:35 +0200)]
process-util: slightly optimize querying of our own process metadata

When we are checking our own data, we can optimize things a bit.

7 years agocore, sd-bus, logind: make use of uid_is_valid() in more places
Lennart Poettering [Fri, 14 Jul 2017 16:57:04 +0000 (18:57 +0200)]
core, sd-bus, logind: make use of uid_is_valid() in more places

7 years agoPrep v235: Updated root files to upstream commit 7a0019d
Sven Eden [Thu, 10 Aug 2017 08:23:44 +0000 (10:23 +0200)]
Prep v235: Updated root files to upstream commit 7a0019d

7 years agobasic: cosmetic changes (#6440)
Yu Watanabe [Mon, 24 Jul 2017 23:32:34 +0000 (08:32 +0900)]
basic: cosmetic changes (#6440)

7 years agomeson: install the git hook (#6425)
Zbigniew Jędrzejewski-Szmek [Mon, 24 Jul 2017 08:41:45 +0000 (04:41 -0400)]
meson: install the git hook (#6425)

This was done autogen.sh previously and was dropped in
72cdb3e783174dcf9223a49f03e3b0e2ca95ddb8. Let's add it back.
The meson configuration step is the only reasonable place.

Note that this only works for the most standard git dirs, e.g.
the hook will not be installed if git worktree is used or if
$GIT_DIR is specified, etc. I think that's OK because most of
the time meson will be run at least once in the original cloned
dir.

7 years agoDrop kdbus bits
Zbigniew Jędrzejewski-Szmek [Sun, 23 Jul 2017 15:45:57 +0000 (11:45 -0400)]
Drop kdbus bits

Some kdbus_flag and memfd related parts are left behind, because they
are entangled with the "legacy" dbus support.

test-bus-benchmark is switched to "manual". It was already broken before
(in the non-kdbus mode) but apparently nobody noticed. Hopefully it can
be fixed later.

7 years agoDrop bus-policy bits
Zbigniew Jędrzejewski-Szmek [Sun, 23 Jul 2017 13:28:45 +0000 (09:28 -0400)]
Drop bus-policy bits

7 years agoDrop busname unit type
Zbigniew Jędrzejewski-Szmek [Sun, 23 Jul 2017 13:24:39 +0000 (09:24 -0400)]
Drop busname unit type

Since busname units are only useful with kdbus, they weren't actively
used. This was dead code, only compile-tested. If busname units are
ever added back, it'll be cleaner to start from scratch (possibly reverting
parts of this patch).

7 years agovirt: enable detecting QEMU (TCG) via CPUID (#6399)
Daniel Berrange [Wed, 19 Jul 2017 09:06:07 +0000 (10:06 +0100)]
virt: enable detecting QEMU (TCG) via CPUID (#6399)

QEMU >= 2.10 will include a CPUID leaf with value "TCGTCGTCGTCG"
on x86 when running with the TCG CPU emulator:

  https://lists.gnu.org/archive/html/qemu-devel/2017-07/msg05231.html

Existing methods of detecting QEMU are left unchanged for sake of
backcompatibility.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agobasic: use _unlocked() stdio in strip_tab_ansi() (#6385)
Vito Caputo [Mon, 17 Jul 2017 22:05:52 +0000 (15:05 -0700)]
basic: use _unlocked() stdio in strip_tab_ansi() (#6385)

Trivial performance boost by explicitly bypassing the implicit
locking of stdio.

This significantly affects common cases of `journalctl` usage:

 Before:

  # time ./journalctl -b -1 > /dev/null
   real    0m26.628s
   user    0m26.495s
   sys     0m0.125s

  # time ./journalctl -b -1 > /dev/null
   real    0m27.069s
   user    0m26.936s
   sys     0m0.134s

  # time ./journalctl -b -1 > /dev/null
   real    0m26.727s
   user    0m26.607s
   sys     0m0.119s

 After:

  # time ./journalctl -b -1 > /dev/null
   real    0m23.394s
   user    0m23.244s
   sys     0m0.142s

  # time ./journalctl -b -1 > /dev/null
   real    0m23.283s
   user    0m23.160s
   sys     0m0.121s

  # time ./journalctl -b -1 > /dev/null
   real    0m23.274s
   user    0m23.125s
   sys     0m0.144s

Fixes https://github.com/elogind/elogind/issues/6341

7 years agotest-hashmap: use $SYSTEMD_SLOW_TESTS variable
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jul 2017 20:55:00 +0000 (20:55 +0000)]
test-hashmap: use $SYSTEMD_SLOW_TESTS variable

test-hashmap is a very good test, but it gets in the way when one wants to
compile and quickly test changes.

7 years agoPrep v235: Update root files to upstream commit 896bbe7
Sven Eden [Tue, 8 Aug 2017 05:51:05 +0000 (07:51 +0200)]
Prep v235: Update root files to upstream commit 896bbe7