platform/upstream/systemd.git
8 years agoMerge pull request #3988 from keszybz/journald-dynamic-users
Lennart Poettering [Fri, 19 Aug 2016 08:41:26 +0000 (10:41 +0200)]
Merge pull request #3988 from keszybz/journald-dynamic-users

Journald dynamic users

8 years agohwdb: add resolution for the Dell Precision 5510 (#3989)
Peter Hutterer [Fri, 19 Aug 2016 08:25:53 +0000 (18:25 +1000)]
hwdb: add resolution for the Dell Precision 5510 (#3989)

https://bugs.freedesktop.org/show_bug.cgi?id=97347

8 years agojournald: do not create split journals for dynamic users
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 03:19:10 +0000 (23:19 -0400)]
journald: do not create split journals for dynamic users

Dynamic users should be treated like system users, and their logs
should end up in the main system journal.

8 years agocore/dynamic-users: warn when creation of symlinks for dynamic users fails
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 03:09:29 +0000 (23:09 -0400)]
core/dynamic-users: warn when creation of symlinks for dynamic users fails

Also return the first error, since it's most likely to be interesting.
If unlink fails, symlink will usually return EEXIST.

8 years agologind: update empty and "infinity" handling for [User]TasksMax (#3835)
Tejun Heo [Fri, 19 Aug 2016 02:57:53 +0000 (22:57 -0400)]
logind: update empty and "infinity" handling for [User]TasksMax (#3835)

The parsing functions for [User]TasksMax were inconsistent.  Empty string and
"infinity" were interpreted as no limit for TasksMax but not accepted for
UserTasksMax.  Update them so that they're consistent with other knobs.

* Empty string indicates the default value.
* "infinity" indicates no limit.

While at it, replace opencoded (uint64_t) -1 with CGROUP_LIMIT_MAX in TasksMax
handling.

v2: Update empty string to indicate the default value as suggested by Zbigniew
    Jędrzejewski-Szmek.

v3: Fixed empty UserTasksMax handling.

8 years agoMerge pull request #3986 from whot/wip/click-wheel-angle-horiz
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 02:53:12 +0000 (22:53 -0400)]
Merge pull request #3986 from whot/wip/click-wheel-angle-horiz

Add udev property for horizontal wheel click angles

8 years agoMerge pull request #3865 from poettering/remove-ipc
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 02:52:13 +0000 (22:52 -0400)]
Merge pull request #3865 from poettering/remove-ipc

add RemoveIPC= service file setting

8 years agohwdb: add a udev property for a wheel click angle on horiz wheels
Peter Hutterer [Tue, 16 Aug 2016 05:23:42 +0000 (15:23 +1000)]
hwdb: add a udev property for a wheel click angle on horiz wheels

The Logitech MX Master has a horizontal scroll wheel with a different click
angle than the vertical one. Add a new property for this case, we can't add
values to the normal one without risking upsetting existing parsers.

Fixes #3947

8 years agolibudev: fix typo in comment
Peter Hutterer [Mon, 15 Aug 2016 03:22:12 +0000 (13:22 +1000)]
libudev: fix typo in comment

8 years agohostnamectl: rework pretty hostname validation (#3985)
Lennart Poettering [Fri, 19 Aug 2016 01:16:16 +0000 (03:16 +0200)]
hostnamectl: rework pretty hostname validation (#3985)

Rework 17eb9a9ddba3f03fcba33445c1c1eedeb948da04 a bit.

Let's make sure we don't clobber the input parameter args[1], following our
coding style to not clobber parameters unless explicitly indicated. (in
particular, as we don't want to have our changes appear in the command line
shown in "ps"...)

No functional change.

8 years agonss-mymachines: avoid connecting to dbus from inside dbus-daemon
Lennart Poettering [Thu, 18 Aug 2016 22:35:05 +0000 (00:35 +0200)]
nss-mymachines: avoid connecting to dbus from inside dbus-daemon

Inspired from the new logic in nss-systemd let's make sure we don't end up
deadlocking in nss-mymachines either in case dbus-daemon tries to a look up a
name and we want to connect to the bus.

This case is much simpler though, as there's no point in resolving virtual
machine UIDs by dbus-daemon as those should never be able to connect to the
host's busses.

8 years agocore: bypass dynamic user lookups from dbus-daemon
Lennart Poettering [Tue, 2 Aug 2016 10:28:51 +0000 (12:28 +0200)]
core: bypass dynamic user lookups from dbus-daemon

dbus-daemon does NSS name look-ups in order to enforce its bus policy. This
might dead-lock if an NSS module use wants to use D-Bus for the look-up itself,
like our nss-systemd does. Let's work around this by bypassing bus
communication in the NSS module if we run inside of dbus-daemon. To make this
work we keep a bit of extra state in /run/systemd/dynamic-uid/ so that we don't
have to consult the bus, but can still resolve the names.

Note that the normal codepath continues to be via the bus, so that resolving
works from all mount namespaces and is subject to authentication, as before.

This is a bit dirty, but not too dirty, as dbus daemon is kinda special anyway
for PID 1.

8 years agoclean-ipc: debug log about all remove IPC objects
Lennart Poettering [Tue, 2 Aug 2016 09:14:56 +0000 (11:14 +0200)]
clean-ipc: debug log about all remove IPC objects

8 years agocore: add RemoveIPC= setting
Lennart Poettering [Mon, 1 Aug 2016 17:24:40 +0000 (19:24 +0200)]
core: add RemoveIPC= setting

This adds the boolean RemoveIPC= setting to service, socket, mount and swap
units (i.e.  all unit types that may invoke processes). if turned on, and the
unit's user/group is not root, all IPC objects of the user/group are removed
when the service is shut down. The life-cycle of the IPC objects is hence bound
to the unit life-cycle.

This is particularly relevant for units with dynamic users, as it is essential
that no objects owned by the dynamic users survive the service exiting. In
fact, this patch adds code to imply RemoveIPC= if DynamicUser= is set.

In order to communicate the UID/GID of an executed process back to PID 1 this
adds a new "user lookup" socket pair, that is inherited into the forked
processes, and closed before the exec(). This is needed since we cannot do NSS
from PID 1 due to deadlock risks, However need to know the used UID/GID in
order to clean up IPC owned by it if the unit shuts down.

8 years agocore: move obsolete properties to the end of vtables
Lennart Poettering [Mon, 1 Aug 2016 15:40:37 +0000 (17:40 +0200)]
core: move obsolete properties to the end of vtables

This makes it easier to discern the relevant and obsolete parts of the vtables,
and in particular helps when comparing introspection data with the actual
vtable definitions.

8 years agocore: make use of uid_is_valid() when checking for UID validity
Lennart Poettering [Fri, 29 Jul 2016 14:22:30 +0000 (16:22 +0200)]
core: make use of uid_is_valid() when checking for UID validity

8 years agoclean-ipc: shorten code a bit
Lennart Poettering [Thu, 28 Jul 2016 07:51:47 +0000 (09:51 +0200)]
clean-ipc: shorten code a bit

8 years agoclean-ipc: don't filter out '.' and '..' twice
Lennart Poettering [Thu, 28 Jul 2016 07:51:25 +0000 (09:51 +0200)]
clean-ipc: don't filter out '.' and '..' twice

8 years agounit: remove orphaned cgroup_netclass_id field
Lennart Poettering [Thu, 28 Jul 2016 07:50:28 +0000 (09:50 +0200)]
unit: remove orphaned cgroup_netclass_id field

8 years agoMerge pull request #3946 from keszybz/open-journal-root
Lennart Poettering [Wed, 17 Aug 2016 18:28:45 +0000 (20:28 +0200)]
Merge pull request #3946 from keszybz/open-journal-root

Make journalctl more flexible

8 years agosysv-generator: better error reporting (#3977)
Felipe Sateler [Wed, 17 Aug 2016 18:11:27 +0000 (15:11 -0300)]
sysv-generator: better error reporting (#3977)

Currently in the journal you get messages without context like:
systemd-sysv-generator[$pid]: Failed to build name: Invalid argument

When parsing the init script, show the file and line number where the
error was found. At the same time, add more context information if
available.

Thus turning the message into something like:
systemd-sysv-generator[$pid]: [/etc/init.d/root-system-proofd:13] Could not build name for facility $network,: Invalid argument

8 years agojournal: ensure open journals from find_journal() (#3973)
Vito Caputo [Wed, 17 Aug 2016 12:51:07 +0000 (05:51 -0700)]
journal: ensure open journals from find_journal() (#3973)

If journals get into a closed state like when rotate fails due to
ENOSPC, when space is made available it currently goes unnoticed leaving
the journals in a closed state indefinitely.

By calling system_journal_open() on entry to find_journal() we ensure
the journal has been opened/created if possible.

Also moved system_journal_open() up to after open_journal(), before
find_journal().

Fixes https://github.com/systemd/systemd/issues/3968

8 years agorules: introduce disk/by-id (model_serial) symlinks for NVMe drives (#3974)
Michal Sekletar [Wed, 17 Aug 2016 12:10:28 +0000 (14:10 +0200)]
rules: introduce disk/by-id (model_serial) symlinks for NVMe drives (#3974)

$ ls -l /dev/disk/by-id/nvme*
lrwxrwxrwx. 1 root root 13 Aug 17 04:25 /dev/disk/by-id/nvme-HUSPR3216AHP301_STM0001B6780 -> ../../nvme0n1
lrwxrwxrwx. 1 root root 15 Aug 17 04:25 /dev/disk/by-id/nvme-HUSPR3216AHP301_STM0001B6780-part1 -> ../../nvme0n1p1

https://github.com/systemd/systemd/issues/1453
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=779ff75617099f4defe14e20443b95019a4c5ae8

8 years agoMerge pull request #3960 from keszybz/efi-option-description
Ronny Chevalier [Tue, 16 Aug 2016 19:22:50 +0000 (21:22 +0200)]
Merge pull request #3960 from keszybz/efi-option-description

build-sys: clarify that --disable-efi is about sd-boot and bootctl

8 years agozsh: _journalctl: also handle --root arg and --key=value style (#3956)
Daniel Hahler [Tue, 16 Aug 2016 16:47:39 +0000 (18:47 +0200)]
zsh: _journalctl: also handle --root arg and --key=value style (#3956)

This will now also handle `journalctl --directory=/var/log/journal`
properly.

8 years agozsh: _journalctl: do not complete exclusive modes (#3957)
Daniel Hahler [Tue, 16 Aug 2016 16:42:41 +0000 (18:42 +0200)]
zsh: _journalctl: do not complete exclusive modes (#3957)

After `journalctl -D /var/log/journal` "--directory", "--file",
"--machine" and "--root" should not be available for completion, because
they are exclusive.  But multiple `--file` arguments are allowed.

8 years agoMerge pull request #3905 from htejun/cgroup-v2-cpu
Zbigniew Jędrzejewski-Szmek [Sun, 14 Aug 2016 22:03:35 +0000 (18:03 -0400)]
Merge pull request #3905 from htejun/cgroup-v2-cpu

core: add cgroup CPU controller support on the unified hierarchy

(zj: merging not squashing to make it clear against which upstream this patch was developed.)

8 years agobuild-sys: clarify that --disable-efi is about sd-boot and bootctl
Zbigniew Jędrzejewski-Szmek [Sun, 14 Aug 2016 19:24:33 +0000 (15:24 -0400)]
build-sys: clarify that --disable-efi is about sd-boot and bootctl

If wasn't obvious what the effect of --disable-efi was without
going through Makefile.am.

Fixes #3959.

8 years agounits: do not start load-random-seed in containers (#3941)
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 15:15:19 +0000 (11:15 -0400)]
units: do not start load-random-seed in containers (#3941)

Random numbers are provided by the host kernel, we don't need to do anything.

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

8 years agohwdb: normalize spacing in 60-keyboard.hwdb (#3954)
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 15:14:58 +0000 (11:14 -0400)]
hwdb: normalize spacing in 60-keyboard.hwdb (#3954)

8 years agozsh: _systemctl: do not attempt to use "--system" by default (#3951)
Daniel Hahler [Sat, 13 Aug 2016 14:42:55 +0000 (16:42 +0200)]
zsh: _systemctl: do not attempt to use "--system" by default (#3951)

In 68c4f6d the following was added:

    local -a _modes; _modes=("--user" "--system")
    local _sys_service_mgr=${${words:*_modes}[(R)(${(j.|.)_modes})]:---system}

With the following comment:

> If neither are on the line, --system is set; for system services to be
> completed.

But it does not work as documented:

    % _modes=(--user --system)
    % words=()
    % echo ${${words:*_modes}[(R)(${(j.|.)_modes})]:---system}

However, it should not use `--system` in that case anyway, so this patch
removes the part that should cause a default to be used and adds some
comments.

8 years agozsh: _journalctl: improve support for handling mode args (#3952)
Daniel Hahler [Sat, 13 Aug 2016 14:41:22 +0000 (16:41 +0200)]
zsh: _journalctl: improve support for handling mode args (#3952)

This only completes fields from `journalctl --user` in _journal_fields when `--user`
is used.

It also changes $_sys_service_mgr to include both `--system` and `--user`,
because `journalctl` behaves different from `systemctl` in this regard.
No attempt is made to filter out invalid combinations, e.g. when using both
`--directory` and `--system` (see https://github.com/systemd/systemd/issues/3949).

8 years agojournalctl: allow --root argument for journal watching
Zbigniew Jędrzejewski-Szmek [Fri, 12 Aug 2016 04:34:45 +0000 (00:34 -0400)]
journalctl: allow --root argument for journal watching

It is useful to look at a (possibly inactive) container or other os tree
with --root=/path/to/container. This is similar to specifying
--directory=/path/to/container/var/log/journal --directory=/path/to/container/run/systemd/journal
(if using --directory multiple times was allowed), but doesn't require
as much typing.

8 years agosd-journal: fix sd_journal_open_directory with SD_JOURNAL_OS_ROOT
Zbigniew Jędrzejewski-Szmek [Fri, 12 Aug 2016 04:32:10 +0000 (00:32 -0400)]
sd-journal: fix sd_journal_open_directory with SD_JOURNAL_OS_ROOT

The directory argument that is given to sd_j_o_d was ignored when
SD_JOURNAL_OS_ROOT was given, and directories relative to the root of the host
file system were used. With that flag, sd_j_o_d should do the same as
sd_j_open_container: use the path as "prefix", i.e. the directory relative to
which everything happens.

Instead of touching sd_j_o_d, journal_new is fixed to do what sd_j_o_c
was doing, and treat the specified path as prefix when SD_JOURNAL_OS_ROOT is
specified.

8 years agosd-journal: allow SYSTEM and CURRENT_USER flags with sd_j_open_directory[_fd]
Zbigniew Jędrzejewski-Szmek [Fri, 12 Aug 2016 02:48:58 +0000 (22:48 -0400)]
sd-journal: allow SYSTEM and CURRENT_USER flags with sd_j_open_directory[_fd]

There is no reason not to. This makes journalctl -D ... --system work,
useful for example when viewing files from a deactivated container.

8 years agosd-journal: split out flags into separate defines for legibility
Zbigniew Jędrzejewski-Szmek [Fri, 12 Aug 2016 02:43:07 +0000 (22:43 -0400)]
sd-journal: split out flags into separate defines for legibility

… in preparation for future changes.

8 years agoMerge pull request #3942 from blueyed/zsh-respect-user-more
Zbigniew Jędrzejewski-Szmek [Thu, 11 Aug 2016 19:39:15 +0000 (15:39 -0400)]
Merge pull request #3942 from blueyed/zsh-respect-user-more

zsh completion: handle --user mode when filtering by state and in journalctl commands

8 years agozsh: _journalctl: handle --user in _journal_none
Daniel Hahler [Thu, 11 Aug 2016 16:52:13 +0000 (18:52 +0200)]
zsh: _journalctl: handle --user in _journal_none

This uses the same mechanism from _systemctl to inject `--user` into the
`journalctrl -F _EXE` call to list executables.
Before this patch the "commands" section would list executables from
system units always.

8 years agozsh: _filter_units_by_property: respect --user
Daniel Hahler [Thu, 11 Aug 2016 16:46:31 +0000 (18:46 +0200)]
zsh: _filter_units_by_property: respect --user

Use `$_sys_service_mgr` to handle `--user`, so that `systemctl --user
stop` will correctly filter the active (user) units.  Before this patch,
only user units that also exist as system units and are stoppable there
would be listed.

8 years agoman: add "timeout" to status table (#3919)
Zbigniew Jędrzejewski-Szmek [Thu, 11 Aug 2016 08:51:49 +0000 (04:51 -0400)]
man: add "timeout" to status table (#3919)

8 years agocoredump: treat RLIMIT_CORE below page size as disabling coredumps (#3932)
Zbigniew Jędrzejewski-Szmek [Thu, 11 Aug 2016 08:51:00 +0000 (04:51 -0400)]
coredump: treat RLIMIT_CORE below page size as disabling coredumps (#3932)

The kernel treats values below a certain threshold (minfmt->min_coredump
which is initialized do ELF_EXEC_PAGESIZE, which varies between architectures,
but is usually the same as PAGE_SIZE) as disabling coredumps [1].
Any core image below ELF_EXEC_PAGESIZE will yield an invalid backtrace anyway [2],
so follow the kernel and not try to parse or store such images.

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/coredump.c#n660
[2] systemd-coredump[16260]: Process 16258 (sleep) of user 1002 dumped core.
                                Stack trace of thread 16258:
                                #0  0x00007f1d8b3d3810 n/a (n/a)

https://bugzilla.redhat.com/show_bug.cgi?id=1309172#c19

8 years agoMerge pull request #3933 from keszybz/hwdb-parser
Lennart Poettering [Thu, 11 Aug 2016 08:49:57 +0000 (10:49 +0200)]
Merge pull request #3933 from keszybz/hwdb-parser

Add hwdb parser to check for inconsistencies

8 years agoinstall: follow config_path symlink (#3362)
Rhys [Tue, 9 Aug 2016 13:33:46 +0000 (23:33 +1000)]
install: follow config_path symlink (#3362)

Under NixOS, the config_path /etc/systemd/system is a symlink to
/etc/static/systemd/system. Commands such as `systemctl list-unit-files`
and `systemctl is-enabled` did not work as the symlink was not followed.

This does not affect how symlinks are treated within the config_path
directory.

8 years agosd-journal: watch logs below container's /{var,run}/log/journal (instead of the ...
Evgeny Vereshchagin [Tue, 9 Aug 2016 12:49:32 +0000 (15:49 +0300)]
sd-journal: watch logs below container's /{var,run}/log/journal (instead of the /) (#3934)

Fixes #3927.

8 years agoadded Zelotes gaming mouse (#3925)
romanstingler [Tue, 9 Aug 2016 04:51:38 +0000 (06:51 +0200)]
added Zelotes gaming mouse (#3925)

8 years agobuild-sys: hook up the hwdb parser to check
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 19:07:41 +0000 (15:07 -0400)]
build-sys: hook up the hwdb parser to check

8 years agohwdb: comment out a duplicated key for the XO
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 17:36:26 +0000 (13:36 -0400)]
hwdb: comment out a duplicated key for the XO

It's hard to say which one of the two mappings should stay. But the later
one would win (when both very present), and nobody complained, so let's
assume that that's the one.

8 years agohwdb: use lowercase hex for key numbers
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 17:31:37 +0000 (13:31 -0400)]
hwdb: use lowercase hex for key numbers

It seems awkward to have both cases mixes. Note that the real parser
accepts both cases, and this only standarizes the usage in the systemd
database.

8 years agohwdb: remove duplicated matches for old Logitech unifying receiver
Zbigniew Jędrzejewski-Szmek [Thu, 4 Aug 2016 19:31:05 +0000 (15:31 -0400)]
hwdb: remove duplicated matches for old Logitech unifying receiver

Quoting https://github.com/systemd/systemd/pull/3906#discussion_r73828368:
> According to
> http://support.logitech.com/en_us/product/v220-cordless-optical-mouse-for-notebooks
> it seems the mouse is using a pre-version of the small unifying receiver we
> know now. If there are 2 mice with the same receiver, that means that the
> values should both be dropped IMO.

8 years agotests: add python parser for hwdb grammar
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 14:53:06 +0000 (10:53 -0400)]
tests: add python parser for hwdb grammar

This works for hwdb/[67]0-*.hwdb. I also added code to parse hwdb/20-*, but those
files are huge, and parsing them using this parser is annoyingly slow (about one
minute for the biggest files). So I removed the support for hwdb/20-*, a much simpler
hand-generated parser should suffice for those.

Current output:

hwdb/60-evdev.hwdb: 24 match groups, 35 matches, 88 properties, 0.19323015213012695s to parse
Match 'evdev:input:b0003v05ACp0259*' is duplicated
Match 'evdev:input:b0003v05ACp025A*' is duplicated
Match 'evdev:input:b0003v05ACp025B*' is duplicated
hwdb/60-keyboard.hwdb: 122 match groups, 188 matches, 638 properties, 1.0906572341918945s to parse
Failed to parse: 'KEYBOARD_KEY_8F=switchvideomode'
Failed to parse: 'KEYBOARD_KEY_C0183=media'
Failed to parse: 'KEYBOARD_KEY_C0201=new'
Failed to parse: 'KEYBOARD_KEY_C0289=reply'
Failed to parse: 'KEYBOARD_KEY_C028B=forwardmail'
Failed to parse: 'KEYBOARD_KEY_C028C=send'
Failed to parse: 'KEYBOARD_KEY_C021A=undo'
Failed to parse: 'KEYBOARD_KEY_C0279=redo'
Failed to parse: 'KEYBOARD_KEY_C0208=print'
Failed to parse: 'KEYBOARD_KEY_C0207=save'
Failed to parse: 'KEYBOARD_KEY_C0194=file'
Failed to parse: 'KEYBOARD_KEY_C01A7=documents'
Failed to parse: 'KEYBOARD_KEY_C01B6=images'
Failed to parse: 'KEYBOARD_KEY_C01B7=sound'
Property KEYBOARD_KEY_c7 is duplicated
Failed to parse: 'KEYBOARD_KEY_cF=end'
hwdb/70-mouse.hwdb: 62 match groups, 93 matches, 68 properties, 0.34186625480651855s to parse
Match 'mouse:usb:v046dpc51b:name:Logitech USB Receiver:' is duplicated
hwdb/70-pointingstick.hwdb: 5 match groups, 14 matches, 7 properties, 0.06518816947937012s to parse
hwdb/70-touchpad.hwdb: 3 match groups, 5 matches, 3 properties, 0.039690494537353516s to parse

Subsequest commits will clean those issues up.

8 years agohwdb: indent commented properties
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 17:33:22 +0000 (13:33 -0400)]
hwdb: indent commented properties

This way it's clear that the property block does not end at the comment.
The python checker will complain if this is not the case.
We had a few bugs before where two match blocks were merged by mistake,
and this change should help avoid that.

8 years agohwdb: remove extra spaces
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 14:52:21 +0000 (10:52 -0400)]
hwdb: remove extra spaces

8 years agojournal-gatewayd: fix typo; s/Certificat/Certificate/ (#3931)
Vito Caputo [Tue, 9 Aug 2016 04:35:07 +0000 (21:35 -0700)]
journal-gatewayd: fix typo; s/Certificat/Certificate/ (#3931)

8 years agohwdb: fix duplicate entry for Apple touchpads (#3921)
Peter Hutterer [Mon, 8 Aug 2016 22:58:19 +0000 (08:58 +1000)]
hwdb: fix duplicate entry for Apple touchpads (#3921)

Copy-paste error, correct IDs from the kernel's drivers/input/mouse/bcm5974.c

Fixes: https://github.com/systemd/systemd/pull/3906/

8 years agocore: amend policy to open up dynamic user queries (#3920)
Zbigniew Jędrzejewski-Szmek [Mon, 8 Aug 2016 21:39:16 +0000 (17:39 -0400)]
core: amend policy to open up dynamic user queries (#3920)

8 years agohwdb: add multimedia keys for Medion Akoya series (#3918)
romanstingler [Sun, 7 Aug 2016 15:45:44 +0000 (17:45 +0200)]
hwdb: add multimedia keys for Medion Akoya series (#3918)

8 years agocore: add cgroup CPU controller support on the unified hierarchy
Tejun Heo [Sun, 7 Aug 2016 13:45:39 +0000 (09:45 -0400)]
core: add cgroup CPU controller support on the unified hierarchy

Unfortunately, due to the disagreements in the kernel development community,
CPU controller cgroup v2 support has not been merged and enabling it requires
applying two small out-of-tree kernel patches.  The situation is explained in
the following documentation.

 https://git.kernel.org/cgit/linux/kernel/git/tj/cgroup.git/tree/Documentation/cgroup-v2-cpu.txt?h=cgroup-v2-cpu

While it isn't clear what will happen with CPU controller cgroup v2 support,
there are critical features which are possible only on cgroup v2 such as
buffered write control making cgroup v2 essential for a lot of workloads.  This
commit implements systemd CPU controller support on the unified hierarchy so
that users who choose to deploy CPU controller cgroup v2 support can easily
take advantage of it.

On the unified hierarchy, "cpu.weight" knob replaces "cpu.shares" and "cpu.max"
replaces "cpu.cfs_period_us" and "cpu.cfs_quota_us".  [Startup]CPUWeight config
options are added with the usual compat translation.  CPU quota settings remain
unchanged and apply to both legacy and unified hierarchies.

v2: - Error in man page corrected.
    - CPU config application in cgroup_context_apply() refactored.
    - CPU accounting now works on unified hierarchy.

8 years agonetworkd: remove duplicate call to manager_dirty (#3917)
Susant Sahani [Sun, 7 Aug 2016 09:23:32 +0000 (14:53 +0530)]
networkd: remove duplicate call to manager_dirty (#3917)

since link_dirty itself calls manager_dirty no need to
call it separately .

8 years agoMerge pull request #3914 from keszybz/fix-man-links
Lennart Poettering [Sun, 7 Aug 2016 09:17:56 +0000 (11:17 +0200)]
Merge pull request #3914 from keszybz/fix-man-links

Fix man links

8 years agoman: add a table of possible exit statuses (#3910)
Zbigniew Jędrzejewski-Szmek [Sun, 7 Aug 2016 09:14:40 +0000 (05:14 -0400)]
man: add a table of possible exit statuses (#3910)

8 years agoMerge pull request #3884 from poettering/private-users
Zbigniew Jędrzejewski-Szmek [Sat, 6 Aug 2016 20:41:35 +0000 (16:41 -0400)]
Merge pull request #3884 from poettering/private-users

8 years agoman: fix some internal man page references
Zbigniew Jędrzejewski-Szmek [Sat, 6 Aug 2016 20:38:09 +0000 (16:38 -0400)]
man: fix some internal man page references

sd_journal-query_enumerate was an early draft, the name was changed
to sd_j_enumerate_fields.

8 years agoman: provide html links to a bunch of external man pages
Zbigniew Jędrzejewski-Szmek [Sat, 6 Aug 2016 20:36:51 +0000 (16:36 -0400)]
man: provide html links to a bunch of external man pages

8 years agojournal-gatewayd: fix segfault with certain request (#3893)
Yi EungJun [Sat, 6 Aug 2016 20:39:13 +0000 (05:39 +0900)]
journal-gatewayd: fix segfault with certain request (#3893)

When client requests to get logs with `follow` and `KEY=match` that
doesn't match any log entry, journal-gatewayd segfaulted.

Make request_reader_entries to return zero in such case to wait for
matching entries.

This fixes https://github.com/systemd/systemd/issues/3873.

8 years agojournal-gatewayd: add --directory option (#3913)
Yi EungJun [Sat, 6 Aug 2016 17:00:31 +0000 (02:00 +0900)]
journal-gatewayd: add --directory option (#3913)

Serve journals in the specified directory instead of default journals.

8 years agoMerge pull request #3911 from crrodriguez/asan-fixes
Lennart Poettering [Sat, 6 Aug 2016 15:02:17 +0000 (17:02 +0200)]
Merge pull request #3911 from crrodriguez/asan-fixes

Asan fixes

8 years agobuildsys,journal: allow -fsanitize=address without VALGRIND defined
Cristian Rodríguez [Fri, 5 Aug 2016 16:10:41 +0000 (16:10 +0000)]
buildsys,journal: allow -fsanitize=address without VALGRIND defined

Fixed (master) versions of libtool pass -fsanitize=address correctly
into CFLAGS and LDFLAGS allowing ASAN to be used without any special
configure tricks..however ASAN triggers in lookup3.c for the same
reasons valgrind does. take the alternative codepath if
__SANITIZE_ADDRESS__ is defined as well.

8 years agotest: fix stack overflow reported by ASAN
Cristian Rodríguez [Fri, 5 Aug 2016 16:07:49 +0000 (16:07 +0000)]
test: fix stack overflow reported by ASAN

It was meant to write to q instead of t
FAIL: test-id128
================

=================================================================
==125770==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffd4615bd31 at pc 0x7a2f41b1bf33 bp 0x7ffd4615b750 sp 0x7ffd4615b748
WRITE of size 1 at 0x7ffd4615bd31 thread T0
    #0 0x7a2f41b1bf32 in id128_to_uuid_string src/libsystemd/sd-id128/id128-util.c:42
    #1 0x401f73 in main src/test/test-id128.c:147
    #2 0x7a2f41336341 in __libc_start_main (/lib64/libc.so.6+0x20341)
    #3 0x401129 in _start (/home/crrodriguez/scm/systemd/.libs/test-id128+0x401129)

Address 0x7ffd4615bd31 is located in stack of thread T0 at offset 1409 in frame
    #0 0x401205 in main src/test/test-id128.c:37

  This frame has 23 object(s):
    [32, 40) 'b'
    [96, 112) 'id'
    [160, 176) 'id2'
    [224, 240) 'a'
    [288, 304) 'b'
    [352, 368) 'a'
    [416, 432) 'b'
    [480, 496) 'a'
    [544, 560) 'b'
    [608, 624) 'a'
    [672, 688) 'b'
    [736, 752) 'a'
    [800, 816) 'b'
    [864, 880) 'a'
    [928, 944) 'b'
    [992, 1008) 'a'
    [1056, 1072) 'b'
    [1120, 1136) 'a'
    [1184, 1200) 'b'
    [1248, 1264) 'a'
    [1312, 1328) 'b'
    [1376, 1409) 't' <== Memory access at offset 1409 overflows this variable
    [1472, 1509) 'q'
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow src/libsystemd/sd-id128/id128-util.c:42 in id128_to_uuid_string
Shadow bytes around the buggy address:
  0x100028c23750: f2 f2 00 00 f4 f4 f2 f2 f2 f2 00 00 f4 f4 f2 f2
  0x100028c23760: f2 f2 00 00 f4 f4 f2 f2 f2 f2 00 00 f4 f4 f2 f2
  0x100028c23770: f2 f2 00 00 f4 f4 f2 f2 f2 f2 00 00 f4 f4 f2 f2
  0x100028c23780: f2 f2 00 00 f4 f4 f2 f2 f2 f2 00 00 f4 f4 f2 f2
  0x100028c23790: f2 f2 00 00 f4 f4 f2 f2 f2 f2 00 00 f4 f4 f2 f2
=>0x100028c237a0: f2 f2 00 00 00 00[01]f4 f4 f4 f2 f2 f2 f2 00 00
  0x100028c237b0: 00 00 05 f4 f4 f4 00 00 00 00 00 00 00 00 00 00
  0x100028c237c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100028c237d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100028c237e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100028c237f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==125770==ABORTING
FAIL test-id128 (exit status: 1)

8 years agotest: test-sigbus must be skipped when -fsanitize=address is used
Cristian Rodríguez [Thu, 4 Aug 2016 16:49:19 +0000 (16:49 +0000)]
test: test-sigbus must be skipped when -fsanitize=address is used

ASAN is unable to handle it.

8 years agoMerge pull request #3818 from poettering/exit-status-env
Zbigniew Jędrzejewski-Szmek [Sat, 6 Aug 2016 00:55:08 +0000 (20:55 -0400)]
Merge pull request #3818 from poettering/exit-status-env

beef up /var/tmp and /tmp handling; set $SERVICE_RESULT/$EXIT_CODE/$EXIT_STATUS on ExecStop= and make sure root/nobody are always resolvable

8 years agonetworkd: add support to set STP (#3903)
Susant Sahani [Fri, 5 Aug 2016 23:44:57 +0000 (05:14 +0530)]
networkd: add support to set STP (#3903)

fixes #3881

8 years agoMerge pull request #3900 from keszybz/fix-3607
Lennart Poettering [Fri, 5 Aug 2016 15:03:09 +0000 (17:03 +0200)]
Merge pull request #3900 from keszybz/fix-3607

Fix 3607

8 years agosocket: add helper function to remove code duplication
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 12:24:00 +0000 (08:24 -0400)]
socket: add helper function to remove code duplication

8 years agocore/socket: include remote address in the message when dropping connection
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 03:51:47 +0000 (23:51 -0400)]
core/socket: include remote address in the message when dropping connection

Without the address the message is not very useful.

Aug 04 23:52:21 rawhide systemd[1]: testlimit.socket: Too many incoming connections (4) from source ::1, dropping connection.

8 years agosystemd: do not serialize peer, bump count when deserializing socket instead
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 03:42:27 +0000 (23:42 -0400)]
systemd: do not serialize peer, bump count when deserializing socket instead

8 years agocore/service: serialize and deserialize accept_socket
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 03:26:31 +0000 (23:26 -0400)]
core/service: serialize and deserialize accept_socket

This fixes an issue during reexec — the count of connections would be lost:

[zbyszek@fedora-rawhide ~]$ systemctl status testlimit.socket | grep Connected
 Accepted: 1; Connected: 1

[zbyszek@fedora-rawhide ~]$ sudo systemctl daemon-reexec
[zbyszek@fedora-rawhide ~]$ systemctl status testlimit.socket | grep Connected
 Accepted: 1; Connected: 0

With the patch, Connected count is preserved.

Also add "Accept Socket" to the dump output for services.

8 years agocore/socket: rework SocketPeer refcounting
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 01:42:23 +0000 (21:42 -0400)]
core/socket: rework SocketPeer refcounting

Make functions and definitions that don't need to be shared local to
socket.c.

8 years agoMerge pull request #3902 from poettering/parse-nice
Ronny Chevalier [Fri, 5 Aug 2016 11:35:52 +0000 (13:35 +0200)]
Merge pull request #3902 from poettering/parse-nice

util-lib: unify parsing of nice level values

8 years agoutil-lib: unify parsing of nice level values
Lennart Poettering [Fri, 5 Aug 2016 09:17:08 +0000 (11:17 +0200)]
util-lib: unify parsing of nice level values

This adds parse_nice() that parses a nice level and ensures it is in the right
range, via a new nice_is_valid() helper. It then ports over a number of users
to this.

No functional changes.

8 years agonetworkd: do not set NOARP unconditionally (#3891)
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 08:37:10 +0000 (04:37 -0400)]
networkd: do not set NOARP unconditionally (#3891)

Fixes #3890.

8 years agofileio: fix MIN/MAX mixup (#3896)
Vito Caputo [Fri, 5 Aug 2016 04:09:23 +0000 (21:09 -0700)]
fileio: fix MIN/MAX mixup (#3896)

The intention is to clamp the value to READ_FULL_BYTES_MAX, which
would be the minimum of the two.

8 years agojournal-remote: remove unnecessary gnutls includes (#3895)
Vito Caputo [Fri, 5 Aug 2016 04:05:34 +0000 (21:05 -0700)]
journal-remote: remove unnecessary gnutls includes (#3895)

journal-(gatewayd,remote).c don't actually utilize libgnutls even when
HAVE_GNUTLS is defined.

8 years agosystemd: convert peers_by_address to a set
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 00:55:45 +0000 (20:55 -0400)]
systemd: convert peers_by_address to a set

8 years agobasic/set: remove some spurious spaces
Zbigniew Jędrzejewski-Szmek [Fri, 5 Aug 2016 00:36:10 +0000 (20:36 -0400)]
basic/set: remove some spurious spaces

8 years agocore: only set the watchdog variables in ExecStart= lines
Lennart Poettering [Thu, 4 Aug 2016 20:11:29 +0000 (22:11 +0200)]
core: only set the watchdog variables in ExecStart= lines

8 years agocore: remember first unit failure, not last unit failure
Lennart Poettering [Thu, 4 Aug 2016 19:14:27 +0000 (21:14 +0200)]
core: remember first unit failure, not last unit failure

Previously, the result value of a unit was overriden with each failure that
took place, so that the result always reported the last failure that took
place.

With this commit this is changed, so that the first failure taking place is
stored instead. This should normally not matter much as multiple failures are
sufficiently uncommon. However, it improves one behaviour: if we send SIGABRT
to a service due to a watchdog timeout, then this currently would be reported
as "coredump" failure, rather than the "watchodg" failure it really is. Hence,
in order to report information about the type of the failure, and not about
the effect of it, let's change this from all unit type to store the first, not
the last failure.

This addresses the issue pointed out here:

https://github.com/systemd/systemd/pull/3818#discussion_r73433520

8 years agoupdate TODO
Lennart Poettering [Wed, 27 Jul 2016 11:30:58 +0000 (13:30 +0200)]
update TODO

8 years agonss-systemd: resolve root/nobody statically
Lennart Poettering [Wed, 27 Jul 2016 11:14:01 +0000 (13:14 +0200)]
nss-systemd: resolve root/nobody statically

Let's extend nss-systemd to also synthesize user/group entries for the
UIDs/GIDs 0 and 65534 which have special kernel meaning. Given that nss-systemd
is listed in /etc/nsswitch.conf only very late any explicit listing in
/etc/passwd or /etc/group takes precedence.

This functionality is useful in minimal container-like setups that lack
/etc/passwd files (or only have incompletely populated ones).

8 years agocore: set $SERVICE_RESULT, $EXIT_CODE and $EXIT_STATUS in ExecStop=/ExecStopPost...
Lennart Poettering [Wed, 27 Jul 2016 09:51:11 +0000 (11:51 +0200)]
core: set $SERVICE_RESULT, $EXIT_CODE and $EXIT_STATUS in ExecStop=/ExecStopPost= commands

This should simplify monitoring tools for services, by passing the most basic
information about service result/exit information via environment variables,
thus making it unnecessary to retrieve them explicitly via the bus.

8 years agomain: use pager for --dump-configuration-items (#3894)
0xAX [Thu, 4 Aug 2016 20:52:24 +0000 (23:52 +0300)]
main: use pager for --dump-configuration-items (#3894)

8 years agofileio: fix read_full_stream() bugs (#3887)
Vito Caputo [Thu, 4 Aug 2016 20:52:02 +0000 (13:52 -0700)]
fileio: fix read_full_stream() bugs (#3887)

read_full_stream() _always_ allocated twice the memory needed, due to
only breaking the realloc() && fread() loop when fread() returned 0,
requiring another iteration and exponentially enlarged buffer just to
discover the EOF condition.

This also caused file sizes >2MiB && <= 4MiB to erroneously be treated
as E2BIG, due to the inappropriately doubled buffer size exceeding
4*1024*1024.

Also made the 4*1024*1024 magic number a READ_FULL_BYTES_MAX constant.

8 years agoMerge pull request #3892 from toanju/fix-brvlan-error-on-normal-bridge
Lennart Poettering [Thu, 4 Aug 2016 18:39:57 +0000 (20:39 +0200)]
Merge pull request #3892 from toanju/fix-brvlan-error-on-normal-bridge

networkd: apply bridge vlan configuration correct

8 years agonetworkd: apply bridge vlan configuration correct
Tobias Jungel [Thu, 4 Aug 2016 15:11:13 +0000 (17:11 +0200)]
networkd: apply bridge vlan configuration correct

bridge vlan configuration was applied even if it wasn't configured.

fixes #3876

8 years agocore: use the correct APIs to determine whether a dual timestamp is initialized
Lennart Poettering [Wed, 27 Jul 2016 09:50:37 +0000 (11:50 +0200)]
core: use the correct APIs to determine whether a dual timestamp is initialized

8 years agocore: move masking of chroot/permission masking into service_spawn()
Lennart Poettering [Tue, 26 Jul 2016 15:53:07 +0000 (17:53 +0200)]
core: move masking of chroot/permission masking into service_spawn()

Let's fix up the flags fields in service_spawn() rather than its callers, in
order to simplify things a bit.

8 years agocore: turn various execution flags into a proper flags parameter
Lennart Poettering [Tue, 26 Jul 2016 15:40:35 +0000 (17:40 +0200)]
core: turn various execution flags into a proper flags parameter

The ExecParameters structure contains a number of bit-flags, that were so far
exposed as bool:1, change this to a proper, single binary bit flag field. This
makes things a bit more expressive, and is helpful as we add more flags, since
these booleans are passed around in various callers, for example
service_spawn(), whose signature can be made much shorter now.

Not all bit booleans from ExecParameters are moved into the flags field for
now, but this can be added later.

8 years agoutil-lib: rework /tmp and /var/tmp handling code
Lennart Poettering [Tue, 26 Jul 2016 15:23:28 +0000 (17:23 +0200)]
util-lib: rework /tmp and /var/tmp handling code

Beef up the existing var_tmp() call, rename it to var_tmp_dir() and add a
matching tmp_dir() call (the former looks for the place for /var/tmp, the
latter for /tmp).

Both calls check $TMPDIR, $TEMP, $TMP, following the algorithm Python3 uses.
All dirs are validated before use. secure_getenv() is used in order to limite
exposure in suid binaries.

This also ports a couple of users over to these new APIs.

The var_tmp() return parameter is changed from an allocated buffer the caller
will own to a const string either pointing into environ[], or into a static
const buffer. Given that environ[] is mostly considered constant (and this is
exposed in the very well-known getenv() call), this should be OK behaviour and
allows us to avoid memory allocations in most cases.

Note that $TMPDIR and friends override both /var/tmp and /tmp usage if set.

8 years agoMerge pull request #2471 from michaelolbrich/transient-mounts
Lennart Poettering [Thu, 4 Aug 2016 14:16:04 +0000 (16:16 +0200)]
Merge pull request #2471 from michaelolbrich/transient-mounts

allow transient mounts and automounts

8 years agoMerge pull request #3885 from keszybz/help-output
Lennart Poettering [Thu, 4 Aug 2016 14:11:38 +0000 (16:11 +0200)]
Merge pull request #3885 from keszybz/help-output

Update help for "short-full" and shorten to 80 columns

8 years agonetworkd: add support to configure NOARP/ARP for interface (#3854)
Susant Sahani [Thu, 4 Aug 2016 14:00:58 +0000 (19:30 +0530)]
networkd: add support to configure NOARP/ARP for interface (#3854)

https://lists.freedesktop.org/archives/systemd-devel/2016-August/037268.html