platform/upstream/systemd.git
8 years agodoc: clarify systemd.exec's paths definition (#3368)
Alessandro Puccetti [Mon, 30 May 2016 14:37:07 +0000 (16:37 +0200)]
doc: clarify systemd.exec's paths definition (#3368)

Definitions of ReadWriteDirectories=, ReadOnlyDirectories=, InaccessibleDirectories=,
WorkingDirectory=, and RootDirecory= were not clear. This patch specifies when
they are relative to the host's root directory and when they are relative to the service's
root directory.

Fixes #3248

8 years agoudevd: try close ctrl connection blocking socket only once when spawning a new worker...
Franck Bui [Mon, 30 May 2016 14:35:34 +0000 (16:35 +0200)]
udevd: try close ctrl connection blocking socket only once when spawning a new worker (#3387)

8 years agoMerge pull request #3389 from lucab/to-upstream/man-typos
Ronny Chevalier [Mon, 30 May 2016 11:57:38 +0000 (12:57 +0100)]
Merge pull request #3389 from lucab/to-upstream/man-typos

man: fix recurring typo

8 years agoman: fix recurring typo
Luca Bruno [Mon, 30 May 2016 11:43:53 +0000 (13:43 +0200)]
man: fix recurring typo

8 years agoutil-lib: Add sparc64 support for process creation (#3348)
Michael Karcher [Mon, 30 May 2016 00:03:51 +0000 (02:03 +0200)]
util-lib: Add sparc64 support for process creation (#3348)

The current raw_clone function takes two arguments, the cloning flags and
a pointer to the stack for the cloned child. The raw cloning without
passing a "thread main" function does not make sense if a new stack is
specified, as it returns in both the parent and the child, which will fail
in the child as the stack is virgin. All uses of raw_clone indeed pass NULL
for the stack pointer which indicates that both processes should share the
stack address (so you better don't pass CLONE_VM).

This commit refactors the code to not require the caller to pass the stack
address, as NULL is the only sensible option. It also adds the magic code
needed to make raw_clone work on sparc64, which does not return 0 in %o0
for the child, but indicates the child process by setting %o1 to non-zero.
This refactoring is not plain aesthetic, because non-NULL stack addresses
need to get mangled before being passed to the clone syscall (you have to
apply STACK_BIAS), whereas NULL must not be mangled. Implementing the
conditional mangling of the stack address would needlessly complicate the
code.

raw_clone is moved to a separete header, because the burden of including
the assert machinery and sched.h shouldn't be applied to every user of
missing_syscalls.h

8 years agoMerge pull request #3378 from keszybz/unit-write-drop-in-newline-removal
Lennart Poettering [Sun, 29 May 2016 16:42:40 +0000 (18:42 +0200)]
Merge pull request #3378 from keszybz/unit-write-drop-in-newline-removal

Remove newlines from drop in format strings + some formatting fixes

8 years agoFix FS_EXTENT_FL description (#3381)
kpengboy [Sun, 29 May 2016 15:31:14 +0000 (08:31 -0700)]
Fix FS_EXTENT_FL description (#3381)

8 years agoman: cite systemd.offline-updates(7) instead of linking to old wiki page
Zbigniew Jędrzejewski-Szmek [Sat, 28 May 2016 20:49:43 +0000 (16:49 -0400)]
man: cite systemd.offline-updates(7) instead of linking to old wiki page

8 years agoman: punctuation fixes
Zbigniew Jędrzejewski-Szmek [Sat, 28 May 2016 20:43:22 +0000 (16:43 -0400)]
man: punctuation fixes

Fixes #3376.

8 years agotree-wide: remove newlines from unit_write_drop_in
Zbigniew Jędrzejewski-Szmek [Sat, 28 May 2016 20:21:47 +0000 (16:21 -0400)]
tree-wide: remove newlines from unit_write_drop_in

This reverts part of #3329, but all for a good cause.

8 years agocore/unit: append newline when writing drop ins
Zbigniew Jędrzejewski-Szmek [Sat, 28 May 2016 20:06:44 +0000 (16:06 -0400)]
core/unit: append newline when writing drop ins

unit_write_drop_in{,_private}{,_format} are all affected.

We already append a header to the file (and section markers), so those functions
can only be used to write a whole file at once. Including the newline at
the end feels natural.

After this commit newlines will be duplicated. They will be removed in
subsequent commit.

Also, rewrap the "autogenerated" header to fit within 80 columns.

8 years agoMerge pull request #3326 from tomty89/update-2
Zbigniew Jędrzejewski-Szmek [Sat, 28 May 2016 19:28:51 +0000 (15:28 -0400)]
Merge pull request #3326 from tomty89/update-2

networkd: IPv6 fixes

8 years agoMerge pull request #3360 from glaubitz/master
Zbigniew Jędrzejewski-Szmek [Sat, 28 May 2016 19:02:05 +0000 (15:02 -0400)]
Merge pull request #3360 from glaubitz/master

Fix multiple unaligned accesses in test-dns-packet and sd-dhcp-server.

8 years agoTypo fix: s/advertisment/advertisement/
Zbigniew Jędrzejewski-Szmek [Sat, 28 May 2016 15:50:37 +0000 (11:50 -0400)]
Typo fix: s/advertisment/advertisement/

8 years agosystemctl: remove empty line between comment and action
Zbigniew Jędrzejewski-Szmek [Sat, 28 May 2016 14:50:36 +0000 (10:50 -0400)]
systemctl: remove empty line between comment and action

It's harder to miss the comment without the newline ;)
See https://github.com/systemd/systemd/pull/3336#issuecomment-221749423
for context.

8 years agoMerge pull request #3328 from poettering/ipv4ll-ipv4acd-fixes
Zbigniew Jędrzejewski-Szmek [Sat, 28 May 2016 15:48:37 +0000 (11:48 -0400)]
Merge pull request #3328 from poettering/ipv4ll-ipv4acd-fixes

various sd-Ipv4ll/sd-ipv4acd fixes

8 years agoMerge pull request #3336 from eworm-de/systemctl-set-default
Zbigniew Jędrzejewski-Szmek [Sat, 28 May 2016 14:52:06 +0000 (10:52 -0400)]
Merge pull request #3336 from eworm-de/systemctl-set-default

systemctl: return success for set-default, add-wants, add-requires...

8 years agologin: Fix policy for org.freedesktop.login1.set-self-linger (#3365) (#3373)
Michael Biebl [Sat, 28 May 2016 09:03:03 +0000 (11:03 +0200)]
login: Fix policy for org.freedesktop.login1.set-self-linger (#3365) (#3373)

We need to explicitly define authorizations for allow_inactive and
allow_active. Otherwise one is getting "Access denied" when run from a
local console:

$ loginctl enable-linger
Could not enable linger: Access denied

8 years agonetworkd: disable IPv6 for bridge slave
Tom Yan [Sat, 28 May 2016 05:35:01 +0000 (13:35 +0800)]
networkd: disable IPv6 for bridge slave

If an interface is managed as a bridge slave, we don't want any IP configuration for it. Therefore, disable IPv6 in such case.

8 years agonetworkd: unset master if not enslaved with networkd
Tom Yan [Sat, 28 May 2016 05:31:41 +0000 (13:31 +0800)]
networkd: unset master if not enslaved with networkd

When we manage an interface with networkd but not as a slave (i.e. no `Bridge=` or `Bond=` set in its .network), we do not want it to remain slaved.

8 years agonetworkd/sd-dhcp-server: Fix unaligned access in parse_request().
John Paul Adrian Glaubitz [Thu, 26 May 2016 21:48:04 +0000 (23:48 +0200)]
networkd/sd-dhcp-server: Fix unaligned access in parse_request().

8 years agocore: add cgroup memory controller support on the unified hierarchy (#3315)
Tejun Heo [Fri, 27 May 2016 16:10:18 +0000 (09:10 -0700)]
core: add cgroup memory controller support on the unified hierarchy (#3315)

On the unified hierarchy, memory controller implements three control knobs -
low, high and max which enables more useable and versatile control over memory
usage.  This patch implements support for the three control knobs.

* MemoryLow, MemoryHigh and MemoryMax are added for memory.low, memory.high and
  memory.max, respectively.

* As all absolute limits on the unified hierarchy use "max" for no limit, make
  memory limit parse functions accept "max" in addition to "infinity" and
  document "max" for the new knobs.

* Implement compatibility translation between MemoryMax and MemoryLimit.

v2:

- Fixed missing else's in config_parse_memory_limit().
- Fixed missing newline when writing out drop-ins.
- Coding style updates to use "val > 0" instead of "val".
- Minor updates to documentation.

8 years agoMerge pull request #3329 from htejun/dbus-cgroup-fixes
Lennart Poettering [Fri, 27 May 2016 16:06:18 +0000 (18:06 +0200)]
Merge pull request #3329 from htejun/dbus-cgroup-fixes

dbus-cgroup fixes

8 years agocore: fix missing newline when writing drop-in for WorkingDirectory (#3337)
Tejun Heo [Fri, 27 May 2016 15:41:45 +0000 (08:41 -0700)]
core: fix missing newline when writing drop-in for WorkingDirectory (#3337)

8 years agoMerge pull request #3356 from OpenDZ/tixxdz/nspawn-quick-v1
Lennart Poettering [Fri, 27 May 2016 15:37:19 +0000 (17:37 +0200)]
Merge pull request #3356 from OpenDZ/tixxdz/nspawn-quick-v1

nspawn: filesystem uid patching fixes and other minor improvments

8 years agosystemctl: fix code path (and memory leak) on error
Christian Hesse [Fri, 27 May 2016 07:33:27 +0000 (09:33 +0200)]
systemctl: fix code path (and memory leak) on error

8 years agosystemctl: fix return values on success
Christian Hesse [Fri, 27 May 2016 07:32:41 +0000 (09:32 +0200)]
systemctl: fix return values on success

8 years agosystemctl: remove extra comma
Christian Hesse [Fri, 27 May 2016 07:21:02 +0000 (09:21 +0200)]
systemctl: remove extra comma

8 years agoresolve/test-dns-packet: Fix unaligned access in test_packet_from_file().
John Paul Adrian Glaubitz [Thu, 26 May 2016 21:32:25 +0000 (23:32 +0200)]
resolve/test-dns-packet: Fix unaligned access in test_packet_from_file().

8 years agonspawn: rename arg_retain to arg_caps_retain
Djalal Harouni [Thu, 26 May 2016 11:06:55 +0000 (13:06 +0200)]
nspawn: rename arg_retain to arg_caps_retain

The argument is about capabilities.

8 years agonspawn: split out seccomp call into nspawn-seccomp.[ch]
Djalal Harouni [Thu, 26 May 2016 20:42:29 +0000 (22:42 +0200)]
nspawn: split out seccomp call into nspawn-seccomp.[ch]

Split seccomp into nspawn-seccomp.[ch]. Currently there are no changes,
but this will make it easy in the future to share or use the seccomp logic
from systemd core.

8 years agonspawn: rename is_procfs_sysfs_or_suchlike() to is_fs_fully_userns_compatible()
Djalal Harouni [Thu, 26 May 2016 10:59:49 +0000 (12:59 +0200)]
nspawn: rename is_procfs_sysfs_or_suchlike() to is_fs_fully_userns_compatible()

Rename is_procfs_sysfs_or_suchlike() to is_fs_fully_userns_compatible()
to give it the real meaning. This may prevent future modifications that
may introduce bugs.

8 years agonspawn: a bench of special fileystems that should not be shifted
Djalal Harouni [Thu, 26 May 2016 20:38:25 +0000 (22:38 +0200)]
nspawn: a bench of special fileystems that should not be shifted

Add some special filesystems that should not be shifted, most of them
relate to the host and not to containers.

8 years ago{machine,system}ctl: always pass &changes and &n_changes (#3350)
Christian Hesse [Thu, 26 May 2016 13:57:37 +0000 (15:57 +0200)]
{machine,system}ctl: always pass &changes and &n_changes (#3350)

We have to pass addresses of changes and n_changes to
bus_deserialize_and_dump_unit_file_changes(). Otherwise we are hit by
missing information (subsequent calls to unit_file_changes_add() to
not add anything).

Also prevent null pointer dereference in
bus_deserialize_and_dump_unit_file_changes() by asserting.

Fixes #3339

8 years agoipv4ll: shorten some checks by using IN_SET a bit
Lennart Poettering [Thu, 26 May 2016 13:32:23 +0000 (15:32 +0200)]
ipv4ll: shorten some checks by using IN_SET a bit

As suggested:

https://github.com/systemd/systemd/pull/3328#discussion-diff-64285764

8 years agosd-ndisc: small coding style fixes
Lennart Poettering [Tue, 24 May 2016 19:34:48 +0000 (21:34 +0200)]
sd-ndisc: small coding style fixes

Let's use usec_t internally always, when dealing with time values.

Let's use uint8_t* pointers if we are dealing with generic byte pointers.

8 years agosd-ndisc: add more whitespace
Lennart Poettering [Tue, 24 May 2016 19:34:25 +0000 (21:34 +0200)]
sd-ndisc: add more whitespace

Whitespace doesn't hurt and helps structuring things.

8 years agosd-ndisc: stop discovery properly when something fails
Lennart Poettering [Tue, 24 May 2016 19:32:33 +0000 (21:32 +0200)]
sd-ndisc: stop discovery properly when something fails

8 years agosd-ndisc: rework size checking in ndisc_ra_parse()
Lennart Poettering [Tue, 24 May 2016 19:28:11 +0000 (21:28 +0200)]
sd-ndisc: rework size checking in ndisc_ra_parse()

Let's better check the size before we subtract. Also, let's change the size
argument to size_t, as it cannot be signed anyway.

Finally, use EBADMSG for indicating invalid packets, like we do everywhere
else.

8 years agosd-ndisc: simplify clamping of router "pref" parameter
Lennart Poettering [Tue, 24 May 2016 19:24:43 +0000 (21:24 +0200)]
sd-ndisc: simplify clamping of router "pref" parameter

8 years agosd-ndisc: append "event_source" to event source objects stored in structures
Lennart Poettering [Tue, 24 May 2016 19:23:04 +0000 (21:23 +0200)]
sd-ndisc: append "event_source" to event source objects stored in structures

Otherwise it gets too confusing whether "timeout" refers to an event source or
just a timeout time specification.

8 years agosd-ndisc: add log_ndisc_errno() macro, to complement log_ndisc() like elsewhere
Lennart Poettering [Tue, 24 May 2016 19:20:30 +0000 (21:20 +0200)]
sd-ndisc: add log_ndisc_errno() macro, to complement log_ndisc() like elsewhere

Also make use of it where appropriate.

8 years agosd-ndisc: use the right object to pass to log_ndisc()
Lennart Poettering [Tue, 24 May 2016 19:16:36 +0000 (21:16 +0200)]
sd-ndisc: use the right object to pass to log_ndisc()

There's no "client" object, in both cases. There's only "nd".

This wasn't noticed before, as the context object is currently not actually
used by the log macros.

8 years agosd-ndisc: Typo fix: s/advertisment/advertisement/
Lennart Poettering [Tue, 24 May 2016 19:15:49 +0000 (21:15 +0200)]
sd-ndisc: Typo fix: s/advertisment/advertisement/

8 years agoipv4acd: rename "ll" parameter to "acd" everywhere
Lennart Poettering [Mon, 23 May 2016 17:39:44 +0000 (19:39 +0200)]
ipv4acd: rename "ll" parameter to "acd" everywhere

Appears to be a (confusing) left-over from copy/paste when this still was
ipv4ll code.

8 years agosd-ipv4ll: add a bit of logging to IPv4LL too
Lennart Poettering [Mon, 23 May 2016 17:35:54 +0000 (19:35 +0200)]
sd-ipv4ll: add a bit of logging to IPv4LL too

8 years agosd-ipv4acd: drop IPV4ACD_NETWORK definition
Lennart Poettering [Mon, 23 May 2016 17:35:18 +0000 (19:35 +0200)]
sd-ipv4acd: drop IPV4ACD_NETWORK definition

Appears to be a copy/paste mistake from sd-ipv4ll. Let's get rid of this.

8 years agoipv4acd: rework how we pick ipv4ll addresses
Lennart Poettering [Mon, 23 May 2016 17:24:21 +0000 (19:24 +0200)]
ipv4acd: rework how we pick ipv4ll addresses

Let's make the seed actually work as stable seed, and use siphash24 to generate
the series of addresses, instead of the opaque libc random_r().

This not only makes the seed truly work as stable, portable seed, but also
makes the code quite a bit shorter, and removes a couple of memory allocations.

8 years agoipv4ll: change "seed" parameter to be uint64_t
Lennart Poettering [Mon, 23 May 2016 16:33:17 +0000 (18:33 +0200)]
ipv4ll: change "seed" parameter to be uint64_t

Let's make clear this always has the same size, since otherwise it's not useful
for reproducible runs, which this is really about however.

8 years agoipv4acd: make sure our event handler callbacks never check uninitialized "r" for...
Lennart Poettering [Mon, 23 May 2016 16:26:49 +0000 (18:26 +0200)]
ipv4acd: make sure our event handler callbacks never check uninitialized "r" for errors

8 years agoipv4acd: normalize time types to usec_t
Lennart Poettering [Mon, 23 May 2016 16:18:04 +0000 (18:18 +0200)]
ipv4acd: normalize time types to usec_t

We try to stick to usec_t for encoding time information, do that here too. In
particular, get rid of "int" second specifications, since signed timespans are
a weird thing.

8 years agoipv4acd: in case the state engine is reused, reset n_conflict timer to 0
Lennart Poettering [Mon, 23 May 2016 16:07:51 +0000 (18:07 +0200)]
ipv4acd: in case the state engine is reused, reset n_conflict timer to 0

8 years agoipv4acd: no need to memcpy() where assignment suffices
Lennart Poettering [Mon, 23 May 2016 16:07:42 +0000 (18:07 +0200)]
ipv4acd: no need to memcpy() where assignment suffices

8 years agoipv4acd: introduce new "started" state
Lennart Poettering [Mon, 23 May 2016 16:06:33 +0000 (18:06 +0200)]
ipv4acd: introduce new "started" state

This state is active immediately after the state engine was started, but before
the first timer hits.

This way multiple _start() invocations on the same object are always detected
correctly.

8 years agoipv4acd: rename ipv4acd_stop() → ipv4acd_reset()
Lennart Poettering [Mon, 23 May 2016 15:52:08 +0000 (17:52 +0200)]
ipv4acd: rename ipv4acd_stop() → ipv4acd_reset()

This is much less confusing, since there's also sd_ipv4acd_stop(), which was
idfferent from ipv4acd_stop().

After renaming it, let's also use the funciton when destroying ipv4acd objects,
as the code is pretty much the same for that.

8 years agoipv4acd: add "_event_source" suffix to event source objects
Lennart Poettering [Mon, 23 May 2016 15:32:18 +0000 (17:32 +0200)]
ipv4acd: add "_event_source" suffix to event source objects

Otherwise the field "receive_message" is a bit too confusing, as it suggests it
actually stores a message object of some kind.

8 years agoipv4acd: make the iteration and conflict fields unsigned
Lennart Poettering [Mon, 23 May 2016 15:23:40 +0000 (17:23 +0200)]
ipv4acd: make the iteration and conflict fields unsigned

They are counters after all, and can never go below zero, hence don't pretend
with the chose type that they could.

Also, prefix their name with "n_", to indicate that they are counters.

8 years agoipv4l-{acd,ll}: make sure ipv4 addresses are unsigned
Lennart Poettering [Mon, 23 May 2016 15:19:35 +0000 (17:19 +0200)]
ipv4l-{acd,ll}: make sure ipv4 addresses are unsigned

And some other minor fixes.

8 years agoipv4acd: library code should never log
Lennart Poettering [Mon, 23 May 2016 15:18:58 +0000 (17:18 +0200)]
ipv4acd: library code should never log

Or actually, not at any level higher than debug.

8 years agosd-ipv4{acl,ll}: don't make use of RefCnt objects
Lennart Poettering [Mon, 23 May 2016 15:17:37 +0000 (17:17 +0200)]
sd-ipv4{acl,ll}: don't make use of RefCnt objects

These objects are only useful when multiple threads are involved, as they
operate with atomic operations. Given that our libraries are explicitly not
thread-safe don't make use of RefCnt here, and make things a bit simpler.

8 years agosd-network: don't needlessly abbreviate "callback" as "cb" in struct members
Lennart Poettering [Mon, 23 May 2016 14:48:56 +0000 (16:48 +0200)]
sd-network: don't needlessly abbreviate "callback" as "cb" in struct members

It's OK to abbreviate this in the local scope, but otherwise, let's not be
needlessly terse.

8 years agodhcp: fix operator precedence issue with macro
Lennart Poettering [Mon, 23 May 2016 14:46:50 +0000 (16:46 +0200)]
dhcp: fix operator precedence issue with macro

8 years agosd-ndisc: make the _stop() call idempotent
Lennart Poettering [Mon, 23 May 2016 14:27:59 +0000 (16:27 +0200)]
sd-ndisc: make the _stop() call idempotent

It's a good idea to make stopcalls idempotent, so that they become nops if the
object is already stopped.

8 years agosd-network: fix up assertion chaos
Lennart Poettering [Mon, 23 May 2016 14:27:05 +0000 (16:27 +0200)]
sd-network: fix up assertion chaos

assert_return() should only be used to validate user-facing parameters and
state, assert() should be used for checking our own internal state and
parameters.

8 years agosd-ndisc: rename sd_ndisc_init() to sd_ndisc_reset()
Lennart Poettering [Mon, 23 May 2016 14:15:04 +0000 (16:15 +0200)]
sd-ndisc: rename sd_ndisc_init() to sd_ndisc_reset()

After all, it's actually used for resetting the state, not only for the initial
initialization.

While we are at it, also simplify the error path for
sd_ndisc_discovery_start().

8 years agosd-network: rename "index" field of the various clients to "ifindex"
Lennart Poettering [Mon, 23 May 2016 14:13:18 +0000 (16:13 +0200)]
sd-network: rename "index" field of the various clients to "ifindex"

A field "index" is not particularly precise and also might conflict with libc's
index() function definition. Also, pretty much everywhere else we call this
concept "ifindex", including in networkd, the primary user of these libraries.
Hence, let's fix this up and call this "ifindex" everywhere here too.

8 years agosd-ndisc: properly make various parameters unsigned
Lennart Poettering [Mon, 23 May 2016 13:57:39 +0000 (15:57 +0200)]
sd-ndisc: properly make various parameters unsigned

8 years agosd-dhcp: shorten NUL initialization a bit
Lennart Poettering [Mon, 23 May 2016 13:57:31 +0000 (15:57 +0200)]
sd-dhcp: shorten NUL initialization a bit

8 years agomanager: remove spurious newline
Lennart Poettering [Mon, 23 May 2016 13:57:18 +0000 (15:57 +0200)]
manager: remove spurious newline

8 years agosd-network: unify packet processing logic a bit
Lennart Poettering [Mon, 23 May 2016 13:56:01 +0000 (15:56 +0200)]
sd-network: unify packet processing logic a bit

Let's always check for errno being EAGAIN/EINTR the same way, and always log if
we receive weirdly short packets.

8 years agoTypo: systemd-nspaw -> systemd-nspawn (#3354)
Ansgar Burchardt [Thu, 26 May 2016 08:44:35 +0000 (10:44 +0200)]
Typo: systemd-nspaw -> systemd-nspawn (#3354)

8 years agonetworkd: Disable IPv6 when DHCPv6 is only enabled
Tom Yan [Wed, 25 May 2016 12:40:48 +0000 (20:40 +0800)]
networkd: Disable IPv6 when DHCPv6 is only enabled

DHCPv6 requires an IPv6 link-local address to work. The client will not be started (even when enabled explicitly with `DHCP=`) if none is configured (either by autoconfiguration or manually). Therefore, disable IPv6 in such case.

8 years agonetworkd: set IFLA_INET6_ADDR_GEN_MODE as per stable_secret
Tom Yan [Wed, 25 May 2016 12:04:01 +0000 (20:04 +0800)]
networkd: set IFLA_INET6_ADDR_GEN_MODE as per stable_secret

Although networkd has option (LinkLocalAddressing=) to toggle IPv6LL autoconfiguration, when it is enabled, the address is autoconfigured by the kernel, but not networkd.

Therefore, we do not statically set IFLA_INET6_ADDR_GEN_MODE to IN6_ADDR_GEN_MODE_EUI64, but dynamically depending on whether stable_secret is set, just as what the kernel does by default.

Note that this does NOT affect the global addresses configured by networkd.

8 years agoMerge pull request #3247 from fbuihuu/ask-passowrd-on-all-consoles
Lennart Poettering [Tue, 24 May 2016 10:14:21 +0000 (12:14 +0200)]
Merge pull request #3247 from fbuihuu/ask-passowrd-on-all-consoles

ask-password: ask for passphrases not only on the first console

8 years agoUdevadm trivial cleanups (#3331)
Zbigniew Jędrzejewski-Szmek [Tue, 24 May 2016 10:07:42 +0000 (06:07 -0400)]
Udevadm trivial cleanups (#3331)

* udevadm-info: use _cleanup_

* udevadm-info: propagate return value from export_devices()

* sd-device: add comment and remove unnecessary braces

8 years agoask-password: ask for passphrases not only on the first console of /dev/console
Werner Fink [Wed, 18 Nov 2015 11:28:30 +0000 (12:28 +0100)]
ask-password: ask for passphrases not only on the first console of /dev/console

but also on all other consoles.  This does help on e.g. mainframes
where often a serial console together with other consoles are
used.  Even rack based servers attachted to both a serial console
as well as having a virtual console do sometimes miss a connected
monitor.

To be able to ask on all terminal devices of /dev/console the devices
are collected. If more than one device are found, then on each of the
terminals a inquiring task for passphrase is forked and do not return
to the caller.

Every task has its own session and its own controlling terminal.
If one of the tasks does handle a password, the remaining tasks
will be terminated.

Also let contradictory options on the command of
systemd-tty-ask-password-agent fail.

Spwan for each device of the system console /dev/console a own process.
Replace the system call wait() with with system call waitid().
Use SIGTERM instead of SIGHUP to get unresponsive childs down.

Port the collect_consoles() function forward to a pulbic and strv
based function "get_kernel_consoles()" in terminal-util.c and use this
in tty-ask-password-agent.c.

8 years agoRevert "rules: allow users to access frame buffer devices" (#3333)
Zbigniew Jędrzejewski-Szmek [Tue, 24 May 2016 09:32:30 +0000 (05:32 -0400)]
Revert "rules: allow users to access frame buffer devices" (#3333)

This reverts commit 483d8bbb4c0190f419bf9fba57fb0feb1a56bea6.

In [1] Michel Dänzer and Daniel Vetter wrote:
>> The scenario you describe isn't possible if the Wayland compositor
>> directly uses the KMS API of /dev/dri/card*, but it may be possible if
>> the Wayland compositor uses the fbdev API of /dev/fb* instead (e.g. if
>> weston uses its fbdev backend).
>
> Yeah, if both weston and your screen grabber uses native fbdev API you can
> now screenshot your desktop. And since fbdev has no concept of "current
> owner of the display hw" like the drm master, I think this is not fixable.
> At least not just in userspace. Also even with native KMS compositors
> fbdev still doesn't have the concept of ownership, which is why it doesn't
> bother clearing it's buffer before KMS takes over. I agree that this
> should be reverted or at least hidden better.

TBH, I think that privilege separation between processes running under the same
UID is tenuous. Even with drm, in common setups any user process can ptrace the
"current owner of the display" and call DROP_MASTER or do whatever. It *is*
possible to prevent that, e.g. by disabling ptrace using yama.ptrace_scope, or
selinux, and so on, but afaik this is not commonly done. E.g. all Fedora
systems pull in elfutils-default-yama-scope.rpm through dependencies which sets
yama.ptrace_scope=0. And even assuming that ptrace was disabled, it is trivial
to modify files on disk, communicate through dbus, etc; there is just to many
ways for a non-sandboxed process to interact maliciously with the display shell
to close them all off. To achieve real protection, some sort of sandboxing
must be implemented, and in that case there is no need to rely on access mode
on the device files, since much more stringent measures have to be implemented
anyway.

The situation is similar for framebuffer devices. It is common to add
framebuffer users to video group to allow them unlimited access to /dev/fb*.
Using uaccess would be better solution in that case. Also, since there is no
"current owner" limitation like in DRM, processes running under the same UID
should be able to access /proc/<pid-of-display-server>/fd/* and gain access to
the devices. Nevertheless, weston implements a suid wrapper to access the
devices and then drop privileges, and this patch would make this daemon
pointless. So if the weston developers feel that this change reduces security,
I prefer to revert it.

[1] https://lists.freedesktop.org/archives/wayland-devel/2016-May/029017.html

8 years agosd-device: udev-db - handle properties with empty value (#3330)
Tom Gundersen [Mon, 23 May 2016 23:34:29 +0000 (01:34 +0200)]
sd-device: udev-db - handle properties with empty value (#3330)

The statemachine was unable to parse properties with empty values,
reported in [0].

When reaching the start of the KEY, we would unconditionally read
one more character before starting to look for the end-of-line.
Simply look for the end-of-line from the first character.

[0]: <https://bugzilla.redhat.com/show_bug.cgi?id=1338823>

8 years agocore: fix missing newlines when writing out drop-ins for cgroup settings
Tejun Heo [Mon, 23 May 2016 20:48:46 +0000 (16:48 -0400)]
core: fix missing newlines when writing out drop-ins for cgroup settings

Except for per-device BlockIO, IO and DeviceAllow/Deny settings, all were
missing newline causing the next drop-in to be concatenated at the end of the
line.  Fix it.

8 years agocore: fix the reversed sanity check when setting StartupBlockIOWeight over dbus
Tejun Heo [Mon, 23 May 2016 20:48:46 +0000 (16:48 -0400)]
core: fix the reversed sanity check when setting StartupBlockIOWeight over dbus

bus_cgroup_set_property() was rejecting if the input value was in range.
Reverse it.

8 years agoman: explain what list-units does a bit better (#3324)
Zbigniew Jędrzejewski-Szmek [Mon, 23 May 2016 13:33:44 +0000 (09:33 -0400)]
man: explain what list-units does a bit better (#3324)

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

8 years agonetworkd: networkd: ndisc set SO_BINDTODEVICE on socket (#3294)
Susant Sahani [Mon, 23 May 2016 09:13:57 +0000 (14:43 +0530)]
networkd: networkd: ndisc set SO_BINDTODEVICE on socket (#3294)

From the issue #2004 we are receiving packet even if this
packet is not intended for this interface.

This can be reproduced.

lp3s0: Updating address: 2001:db8:1:0:7e7a:91ff:fe6d:ffe2/64 (valid for 1d)
wlp3s0: Updating address: fe80::7e7a:91ff:fe6d:ffe2/64 (valid forever)
NDisc CLIENT: Received RA from non-link-local address ::. Ignoring.
NDisc CLIENT: Received RA on wrong interface: 2 != 6. Ignoring.
NDisc CLIENT: Received RA on wrong interface: 2 != 3. Ignoring.
enp0s25: Updating address: 2001:db8:1:0:2ad2:44ff:fe6a:ae07/64 (valid for 1d)
enp0s25: Updating address: fe80::2ad2:44ff:fe6a:ae07/64 (valid forever)
NDisc CLIENT: Sent Router Solicitation
NDisc CLIENT: Sent Router Solicitation
NDisc CLIENT: Sent Router Solicitation
NDisc CLIENT: Received RA on wrong interface: 3 != 2. Ignoring.
NDisc CLIENT: Received RA on wrong interface: 3 != 6. Ignoring.
NDisc CLIENT: Received RA from non-link-local address ::. Ignoring.
NDisc CLIENT: Received RA on wrong interface: 2 != 6. Ignoring.
NDisc CLIENT: Received RA on wrong interface: 2 != 3. Ignoring.
enp0s25: Updating address: 2001:db8:1:0:2ad2:44ff:fe6a:ae07/64 (valid for 1d)
enp0s25: Updating address: fe80::2ad2:44ff:fe6a:ae07/64 (valid forever)

Add SO_BINDTODEVICE to socket
fixes #2004

8 years agoMention initrd-root-device.target in NEWS (#3325)
Dave Reisner [Mon, 23 May 2016 08:31:47 +0000 (10:31 +0200)]
Mention initrd-root-device.target in NEWS (#3325)

8 years agoresolved: don't stop handle messages after receiving a zero length UDP packet (#3323)
Evgeny Vereshchagin [Mon, 23 May 2016 08:19:14 +0000 (11:19 +0300)]
resolved: don't stop handle messages after receiving a zero length UDP packet (#3323)

Fixes:

-bash-4.3# ss --udp -l -p
State      Recv-Q Send-Q Local Address:Port                 Peer Address:Port
UNCONN     0      0          *:5355                     *:* users:(("systemd-resolve",pid=601,fd=12))
UNCONN     0      0         :::5355                    :::* users:(("systemd-resolve",pid=601,fd=14))

-bash-4.3# nping --udp -p 5355 --data-length 0 -c 1 localhost

-bash-4.3# journalctl -u systemd-resolved -b --no-hostname
...
May 21 14:59:22 systemd-resolved[601]: Event source llmnr-ipv4-udp (type io) returned error, disabling: Input/output error
...

-bash-4.3# nping --udp -p 5355 --data-length 1000 -c 1 localhost

-bash-4.3# ss --udp -l
State      Recv-Q Send-Q Local Address:Port                 Peer Address:Port
UNCONN     2304   0          *:5355                     *:*
UNCONN     0      0         :::5355                    :::*

8 years agoMerge pull request #3322 from poettering/random-ipv4acd-fixes
Tom Gundersen [Sun, 22 May 2016 22:16:28 +0000 (00:16 +0200)]
Merge pull request #3322 from poettering/random-ipv4acd-fixes

Random ipv4acd fixes

8 years agoipv4acd/ipv4ll: stop using read() on SOCK_DGRAM sockets
Lennart Poettering [Sun, 22 May 2016 12:26:36 +0000 (14:26 +0200)]
ipv4acd/ipv4ll: stop using read() on SOCK_DGRAM sockets

This is a follow-up to cf447cb62d01137f4cbd1cd14b83b88823542bbf.

Let's generally follow the rule to not use read() on SOCK_DGRAM sockets, let's
always use recv() on that.

Also, don't abort IPV4ACD logic in case we read a short packet. Simply log and
ignore.

8 years agosd-ipv4acd: do not define ether_addr_is_nul() redundantly
Lennart Poettering [Sun, 22 May 2016 12:26:06 +0000 (14:26 +0200)]
sd-ipv4acd: do not define ether_addr_is_nul() redundantly

we already have ether_addr_is_null() in ether-addr-util.h, let's use it here,
too.

8 years agosd-ipv4acd: drop HASH_KEY definition, as it is unused
Lennart Poettering [Sun, 22 May 2016 12:25:02 +0000 (14:25 +0200)]
sd-ipv4acd: drop HASH_KEY definition, as it is unused

8 years agonspawn: remove unreachable return statement (#3320)
Zbigniew Jędrzejewski-Szmek [Sun, 22 May 2016 11:02:41 +0000 (07:02 -0400)]
nspawn: remove unreachable return statement (#3320)

8 years agonetworkd-ndisc: do not return value from void function
Zbigniew Jędrzejewski-Szmek [Sat, 21 May 2016 22:12:17 +0000 (18:12 -0400)]
networkd-ndisc: do not return value from void function

Fixup for #3304.

Only warn, and not return, because that's what sd_dhcp6_client_start()
does right below the call to sd_dhcp6_client_set_local_address().

8 years agobuild-sys: bump so version
Zbigniew Jędrzejewski-Szmek [Sat, 21 May 2016 21:58:30 +0000 (17:58 -0400)]
build-sys: bump so version

8 years agoNEWS: final updates for v230
Zbigniew Jędrzejewski-Szmek [Sat, 21 May 2016 21:51:13 +0000 (17:51 -0400)]
NEWS: final updates for v230

8 years agorun: do not try to use reply after freeing it (#3318)
Zbigniew Jędrzejewski-Szmek [Sat, 21 May 2016 22:30:33 +0000 (18:30 -0400)]
run: do not try to use reply after freeing it (#3318)

We'd call sd_bus_message_unref and then proceed to use
variables pointing into the reply buffer (fd and char*).
dup the fd and copy the string before destorying the reply.

This makes systemd-run run again for me.

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

8 years agounits: restore ConditionNeesUpdate=/etc in ldconfig.service (#3311)
Lennart Poettering [Sat, 21 May 2016 21:09:18 +0000 (23:09 +0200)]
units: restore ConditionNeesUpdate=/etc in ldconfig.service (#3311)

In order to support stateless systems that support offline /usr updates
properly, let's restore the ConditionNeesUpdate=/etc line that makes sure we
are run when /usr is updated and this update needs to be propagated to the
/etc/ld.so.conf file stored in /etc.

This reverts part of #2859, which snuck this change in, but really shouldn't
have.

8 years agolibsystemd-network: use recv(..., 0) instead of read(...) (#3317)
Tom Gundersen [Sat, 21 May 2016 21:00:32 +0000 (23:00 +0200)]
libsystemd-network: use recv(..., 0) instead of read(...) (#3317)

According to recv(2) these should be the same, but that is not true.
Passing a buffer of length 0 to read is defined to be a noop according
to read(2), but passing a buffer of length 0 to recv will discard the
pending pacet.

We can easily hit this as we allocate our buffer size depending on
the size of the incoming packet (using FIONREAD). As pointed out in
issue #3299 simply sending an empty UDP packet to the DHCP client
port will trigger a busy loop in networkd as we are polling on the
socket but never discarding the empty packet.

This reverts ad5ae47a0d159ea473c9730d7e0298a3e5d31cf6 but fixes the
same issue.

8 years agocore: set all log fds to -1 when freezing (#3314)
Evgeny Vereshchagin [Sat, 21 May 2016 16:40:34 +0000 (19:40 +0300)]
core: set all log fds to -1 when freezing (#3314)

Fixes:
-bash-4.3# echo core >/proc/sys/kernel/core_pattern
-bash-4.3# kill -ABRT 1
-bash-4.3# kill -ABRT 1
[   61.373922] systemd[1]: segfault at 7fff1d0a8f48 ip 00007fc9ca91b1c3 sp 00007fff1d0a8f50 error 6 in libc-2.23.so[7fc9ca8ce000+1c0000]
[   61.768017] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000008b
[   61.768017]
...

Recursive ABRT and segfault:
PID 1 - core
TID 1:
...
 #153905 0x00005575fc3f829d log_dispatch
 #153906 0x00005575fc3f8aa3 log_assert
 #153907 0x00005575fc3f8ae9 log_assert_failed
 #153908 0x00005575fc3e7eb1 safe_close
 #153909 0x00005575fc3f6d5e log_close_journal
 #153910 0x00005575fc3f829d log_dispatch
 #153911 0x00005575fc3f85a1 log_internalv
 #153912 0x00005575fc3f86a1 log_internal
 #153913 0x00005575fc31c4c1 crash
 #153914 0x00007fb26f2cf3d0 __restore_rt
 #153915 0x00007fb26f2ced00 pause
 #153916 0x00005575fc403944 freeze
 #153917 0x00005575fc31bf7b freeze_or_reboot
...

8 years agocore: put opening curly braces on the same line as function names (#3313)
Tejun Heo [Fri, 20 May 2016 20:46:42 +0000 (13:46 -0700)]
core: put opening curly braces on the same line as function names (#3313)

Recently added cgroup helper functions break the style convention.  Fix them
up.

8 years agoRevert "core/dbus: further simplify branch code" (#3307)
Lennart Poettering [Fri, 20 May 2016 20:36:22 +0000 (22:36 +0200)]
Revert "core/dbus: further simplify branch code" (#3307)

8 years agoMerge pull request #3304 from tomty89/master
Tom Gundersen [Fri, 20 May 2016 17:00:08 +0000 (19:00 +0200)]
Merge pull request #3304 from tomty89/master

[networkd] ndisc DHCPv6 triggering fixes

8 years agoMerge pull request #3276 from ssahani/issue-3264
Tom Gundersen [Fri, 20 May 2016 16:54:49 +0000 (18:54 +0200)]
Merge pull request #3276 from ssahani/issue-3264

networkd: Drop IPv6LL address when link is down.