Commit graph

29920 commits

Author SHA1 Message Date
Lennart Poettering cd0ddf6f75 seccomp: add four new syscall groups
These groups should be useful shortcuts for sets of closely related
syscalls where it usually makes more sense to allow them altogether or
not at all.
2017-09-14 15:45:21 +02:00
Lennart Poettering 0963c053fa seccomp: augment the @resources group a bit
Given that sched_setattr/sched_setparam/sched_setscheduler are already
in the group the closely related nice + ioprio_set should also be
included.

Also, order things alphabetically.
2017-09-14 15:45:21 +02:00
Lennart Poettering b887d2ebfe seccomp: beef up @process group a bit
Include the waid syscalls. If we permit forking then we should also
permit waiting for a process.

Similar to that: also permit determining the usage counters for
processes.

Include calls to determine process/thread identity. They have little
impact security-wise, but are very likely used when process management
of any form is done.

Also, add rt_sigqueueinfo + rt_tgsigqueueinfo as they are similar to
kill() and friends, but permit passing along a userdata ptr.
2017-09-14 15:45:21 +02:00
Lennart Poettering 7e0c3b8fda seccomp: "idle" is another obsolete syscall 2017-09-14 15:45:21 +02:00
Lennart Poettering 215728ff39 seccomp: order the syscalls in more groups alphabetically
No changes besides reordering.
2017-09-14 15:45:21 +02:00
Lennart Poettering ceaa6aa76b seccomp: let's update @file-system a bit
Let's add fremovexattr which was the only xattr syscall so far missing
from the group, even though lremovexattr and friends where included.

Add inotify_init, which is an older (but still supported) version of
inotify_init1.

Add oldfstat, oldlstat, oldstat which are old versions of the stat
syscalls on some archs.

Add utime, which is an older more limited version of utimes and
utimensat.

Enclose the "statx" entry in some ifdeffery to ensure libseccomp
actually knows the syscall. If libseccomp doesn't know it, then we'd get
EINVAL rather than EDOM (which is what is returned if a syscall is known
but not available on the local system) when resolving the syscall name
and we really don't want that, as we use the EDOM vs. EINVAL check for
determining whether a syscall makes sense at all.

Also, order things alphabetically.
2017-09-14 15:45:21 +02:00
Lennart Poettering 648a0ed0d7 seccomp: let's update base-io a bit
Let's add _llseek which is the syscall name on some archs that on others
is simply lseek (due to 64bit vs 32bit off_t confusion). Also, let's
sort things alphabetically.
2017-09-14 15:45:21 +02:00
Lennart Poettering e41b0f42a8 seccomp: update "@default" seccomp group a bit
Let's add more of the most basic operations to "@default" as absolute
baseline needed by glibc and such to operate. Specifically:

futex, get_robust_list, get_thread_area, membarrier, set_robust_list,
set_thread_area, set_tid_address are all required to properly implement
mutexes and other thread synchronization logic. Given that a ton of
datastructures are protected by mutexes (such as stdio and such), let's
just whitelist this by default, so that things can just work.

restart_syscall is used to implement EAGAIN SA_RESTART stuff in some
archs, and synthesized by the kernel without any explicit user logic,
hence let's make this work out of the box.
2017-09-14 15:45:21 +02:00
Michael Grzeschik dbbf424c8b rules: ubi mtd - add link to named partitions (#6750)
[zjs:
- rebase onto recent master
- drop signed-off-by]
2017-09-14 14:53:07 +02:00
Lennart Poettering 3b22864e20 Merge pull request #6428 from boucman/device_reload
device : reload when udev generates a "changed" event
2017-09-14 12:46:23 +02:00
Lennart Poettering 9492c16031 TODO: Drop even more redundant and implemented items 2017-09-14 11:21:24 +02:00
Lennart Poettering 09624cee53 TODO: remove some items that are implemented now or otherwise obsolete 2017-09-14 11:08:59 +02:00
Zbigniew Jędrzejewski-Szmek 71e0acccfd nss: use secure_getenv for behaviour-modifying booleans (#6817)
Follow up for fe102d6ab1.
2017-09-14 09:20:27 +02:00
Lennart Poettering fe102d6ab1 nss-systemd,sysusers: make sure sysusers doesn't get confused by nss-systemd (#6812)
In nss-systemd we synthesize user entries for "nobody" and "root", as
fallback if we boot up with an entirely empty /etc. This is supposed to
be a fallback only though, and it's intended that both users exists
regularly in /etc/passwd + /etc/group. Before this patch
systemd-sysusers would never create the entries however as it notices
the synthetic entries. Let's add a way how systemd-sysusers can tell
nss-systemd not to synthesize the entries for itself.

Fixes: #6808
2017-09-14 06:20:39 +02:00
Davide Cavalca d5df18e4b6 basic: ensure O_TMPFILE is always defined (#6816) 2017-09-14 06:14:29 +02:00
Zbigniew Jędrzejewski-Szmek 6fcdcbc517 Merge pull request #6807 from poettering/service-result
man: complete and rework $SERVICE_RESULT documentation
2017-09-13 23:17:20 +02:00
Zbigniew Jędrzejewski-Szmek 111dc55baa Merge pull request #6810 from poettering/test-mode-segfault
don't crash in pager code when "systemd --test" is invoked
2017-09-13 23:13:10 +02:00
Zbigniew Jędrzejewski-Szmek e124ccdf5b man: rework grammatical form of sentences in a table in systemd.exec(5)
"Currently, the following values are defined: xxx: in case <condition>" is
awkward because "xxx" is always defined unconditionally. It is _used_ in case
<condition> is true. Correct this and a bunch of other places where the
sentence structure makes it unclear what is the subject of the sentence.
2017-09-13 23:06:20 +02:00
Zbigniew Jędrzejewski-Szmek 96b02bcdf1 Merge pull request #6775 from poettering/run-pipe2
run: add new --pipe option for "systemd-run"
2017-09-13 22:27:04 +02:00
Zbigniew Jędrzejewski-Szmek 368ebf62bf Merge pull request #6805 from poettering/exec-dir
exec-util,conf-files: skip non-executable files in execute_directories()
2017-09-13 22:26:41 +02:00
Zbigniew Jędrzejewski-Szmek 156d6036be man: fix repeated use of "use" in a sentence 2017-09-13 22:11:32 +02:00
Lennart Poettering 036d61b32e 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
2017-09-13 19:08:26 +02:00
Lennart Poettering d74edffa8b Merge pull request #6811 from fbuihuu/dont-detach-root-DM-dev
Dont try to detach DM dev hosting "/" even when it uses BTRFS
2017-09-13 15:09:25 +02:00
Lennart Poettering 44a51139b9 Merge pull request #6798 from poettering/nspawn-seccomp
nspawn seccomp improvements
2017-09-13 12:57:59 +02:00
Franck Bui 33e8d8af14 shutdown: don't be fooled when detaching DM devices with BTRFS
Otherwise we would try to detach the DM device hosting the rootfs with BTRFS
which is doomed to fail.
2017-09-13 11:59:46 +02:00
Franck Bui c43b2b9c71 util: make get_block_device() available 2017-09-13 11:49:43 +02:00
Lennart Poettering e34aa8ed09 conf-files: log when we skip a drop-in configuration file 2017-09-13 11:42:32 +02:00
Lennart Poettering b50846055e exec-util,conf-files: skip non-executable files in execute_directories()
Fixes: #6787
2017-09-13 11:42:31 +02:00
Lennart Poettering d262e99e39 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.
2017-09-13 10:37:52 +02:00
Lennart Poettering dea374e898 main: skip many initialization steps when running in --test mode
Most importantly, don't collect open socket activation fds when in
--test mode. This specifically created a problem because we invoke
pager_open() beforehand (which these days makes copies of the original
stdout/stderr in order to be able to restore them when the pager goes
away) and we might mistakenly the fd copies it creates as socket
activation fds.

Fixes: #6383
2017-09-13 10:37:52 +02:00
Lennart Poettering 3d4ec01269 shutdown: fix incorrect fscanf() result check (#6806)
A correction for 090e3c9796ef6468d4f396610804d62f6ffd797f.

Fixes: #6796
2017-09-13 10:08:37 +02:00
jonasBoss 586377fc92 hwdb: add Lenovo Yoga 510-14IKB sensor mount quirk (#6799) 2017-09-12 18:39:25 +02:00
Lukáš Nykrýn 9c63ba988d tmpfiles.d/journal-nocow: fix typo (#6804) 2017-09-12 13:28:21 -03:00
Lennart Poettering 38a7c3c0bd man: complete and rework $SERVICE_RESULT documentation
This reworks the paragraph describing $SERVICE_RESULT into a table, and
adds two missing entries: "success" and "start-limit-hit".

These two entries are then also added to the table explaining the
$EXIT_CODE + $EXIT_STATUS variables.

Fixes: #6597
2017-09-12 18:04:26 +02:00
Lennart Poettering 5dca7739e8 run: add new --pipe option for including "systemd-run" commands in shell pipelines
In this mode, we'll directly connect stdin/stdout/stderr of the invoked
service with whatever systemd-run itself is invoked on. This allows
inclusion of "systemd-run" commands in shell pipelines, as unlike
"--pty" this means EOF of stdin/stdout/stderr are propagated
independently.

If --pty and --pipe are combined systemd-run will automatically pick the
right choice for the context it is invoked in, i.e. --pty when invoked
on a TTY, and --pipe otherwise.
2017-09-12 16:28:12 +02:00
Lennart Poettering 3e2e660584 Merge pull request #6802 from systemd-mailing-devs/20170911184738.GA11495@dtor-ws
rules: load drivers only on "add" events
2017-09-12 16:15:22 +02:00
Lennart Poettering 960e4569e1 nspawn: implement configurable syscall whitelisting/blacklisting
Now that we have ported nspawn's seccomp code to the generic code in
seccomp-util, let's extend it to support whitelisting and blacklisting
of specific additional syscalls.

This uses similar syntax as PID1's support for system call filtering,
but in contrast to that always implements a blacklist (and not a
whitelist), as we prepopulate the filter with a blacklist, and the
unit's system call filter logic does not come with anything
prepopulated.

(Later on we might actually want to invert the logic here, and
whitelist rather than blacklist things, but at this point let's not do
that. In case we switch this over later, the syscall add/remove logic of
this commit should be compatible conceptually.)

Fixes: #5163

Replaces: #5944
2017-09-12 14:06:21 +02:00
Dmitry Torokhov 9b32afa9f2 rules: load drivers only on "add" events
Previously we were loading kernel modules on all device events save
for "remove". With the introduction of KOBJ_BIND/KOBJ_UNBIND this causes
issues, as driver modules that have devices bound to their drivers get
immediately reloaded, and it appears to the user that module unloading
does not work.

Let's change the rules to only load modules on "add" events instead.
2017-09-11 21:04:34 +02:00
Lennart Poettering 7609340e2f nspawn: replace homegrown seccomp filter table largely with references to the existing syscall groups
Let's shorten the table, now that we are hooked up to the syscall group
system.
2017-09-11 18:00:07 +02:00
Lennart Poettering 402530d91e nspawn: part over seccomp code to use seccomp_add_syscall_filter_item()
Let's unify a bit of the code here.
2017-09-11 18:00:07 +02:00
Lennart Poettering 69b1b241bb seccomp: split out inner loop code of seccomp_add_syscall_filter_set()
Let's add a new helper function seccomp_add_syscall_filter_item() that
contains the inner loop code of seccomp_add_syscall_filter_set(). This
helper function we can then export and make use of elsewhere.
2017-09-11 18:00:07 +02:00
Lennart Poettering 12dc378902 seccomp: drop default_action parameter from seccomp_add_syscall_filter_set()
The function doesn't actually use the parameter, hence let's drop it.
2017-09-11 18:00:07 +02:00
John Lin c13ee7cc8b units: remove unnecessary Requires= and After= in system.slice (#6794) 2017-09-11 10:35:51 +02:00
Marcus Lundblad 20d8b12256 hwdb: Add ACCEL_MOUNT_MATRIX for the Lamina T-1016B.NORD 2-in-1 tablet (#6430) 2017-09-11 09:56:57 +02:00
Thomas Sailer d74c1dea2e accelerator mount matrix for Asus TP300LD (#6789) 2017-09-11 08:36:05 +02:00
Jérémy Rosen 0ffddc6e2c device : reload when udev generates a "changed" event 2017-09-10 18:53:26 +02:00
Jérémy Rosen f54bcca5c1 unit : allow any unit which propagates reloads to be reloaded 2017-09-10 18:53:26 +02:00
Lennart Poettering 526664f627 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
2017-09-09 22:48:35 +02:00
Zbigniew Jędrzejewski-Szmek c5aaaebced Merge pull request #6780 from poettering/agent-message
Three minor fixes.
2017-09-09 22:32:37 +02:00
Lennart Poettering 309f631d41 libudev: add missing errno initialization/error propagation (#6781)
In libudev (which es much older code than the rest of systemd), we
propagate errors in functions not returning an int, via (positive) errno
(i.e. libc-style), and as negative Exyz values in those returning an int
(much preferred, i.e. Linux kernel style). Let's fix up a few place,
where this was incorrectly done, or not done at all.

Fixes: #6613
2017-09-09 22:31:09 +02:00