Commit graph

23475 commits

Author SHA1 Message Date
Thomas Hindoe Paaboel Andersen cf0fbc49e6 tree-wide: sort includes
Sort the includes accoding to the new coding style.
2015-11-16 22:09:36 +01:00
Thomas Hindoe Paaboel Andersen ab5dfda78f tree-wide: add missing includes
Add a few includes that we rely on to be include already.
2015-11-16 22:08:33 +01:00
David Herrmann 5cd6491b71 Merge pull request #1919 from martinpitt/master
siphash42: add tests with unaligned input pointers
2015-11-16 16:47:07 +01:00
David Herrmann f7eb988333 Merge pull request #1918 from dvdhrm/user3
login: allow re-using users (v3)
2015-11-16 16:28:25 +01:00
Martin Pitt 69b98e71b4 siphash42: add tests with unaligned input pointers
Add test case for calling siphash24 with unaligned input pointers, as we
commonly get with calling it on the result on basename() or similar.

This provides a test for PR #1916, rescued from the superseded PR #1911.

Thanks to Steve Langasek for the test!
2015-11-16 16:24:56 +01:00
David Herrmann 2f157acdae login: ignore JobRemoved of old jobs
If we requeue jobs, we are no longer interested in old jobs. Hence, we
better ignore any JobRemoved signals for old jobs and concentrate on our
replacements.
2015-11-16 16:15:42 +01:00
Tom Gundersen f5ed8d4a51 Merge pull request #1916 from zonque/align
siphash: alignment
2015-11-16 15:50:13 +01:00
David Herrmann 920a726221 Merge pull request #1915 from poettering/btrfs-root-subvol
tmpfiles: create subvolumes for "v", "q", and "Q" only if / is a subv…
2015-11-16 15:48:21 +01:00
David Herrmann 79ee4ad108 login: make sure to replace existing units
When queuing unit jobs, we should rather replace existing units than
fail. This is especially important when we queued a user-shutdown and a
new login is encountered. In this case, we better raplce the shutdown
jobs. systemd takes care of everything else.
2015-11-16 15:43:18 +01:00
David Herrmann a832ab6f99 login: fix re-use of users
If the last reference to a user is released, we queue stop-jobs for the
user-service and slice. Only once those are finished, we drop the
user-object. However, if a new session is opened before the user object is
fully dropped, we currently incorrectly re-use the object. This has the
effect, that we get stale sessions without a valid "systemd --user"
instance.

Fix this by properly allowing user_start() to be called, even if
user->stopping is true.
2015-11-16 15:34:41 +01:00
David Herrmann 090d92bd6f login: group static fields in "struct User"
Make sure to put static fields together in "struct User". This makes it
easier to figure out the lifetime of each field.
2015-11-16 15:34:41 +01:00
David Herrmann b690ef12b5 login: make user->service static
Just like user->slice, there is no reason to store the unit name in /run,
nor should we allocate it dynamically on job instantiation/removal. Just
keep it statically around at all times and rely on user->started ||
user->stopping to figure out whether the unit exists or not.
2015-11-16 15:34:41 +01:00
David Herrmann 157f50577f login: make user_new() and user_free() follow coding-style
Few changes to user_new() and user_free():
 - Use _cleanup_(user_freep) in constructor
 - return 'int' from user_new()
 - make user_free() deal with partially initialized objects
 - keep reverse-order in user_free() compared to user_new()
 - make user_free() return NULL
 - make user_free() accept NULL as no-op
2015-11-16 15:34:41 +01:00
David Herrmann 6230bf750a login: keep user->slice constant
Currently, we allocate user->slice when starting a slice, but we never
release it. This is incompatible if we want to re-use a user object once
it was stopped. Hence, make sure user->slice is allocated statically on
the user object and use "u->started || u->stopping" as an indication
whether the slice is actually available on pid1 or not.
2015-11-16 15:34:41 +01:00
David Herrmann f9e4283df3 login: simply XDG_RUNTIME_DIR management
Lets not pretend we support changing XDG_RUNTIME_DIR via logind state
files. There is no reason to ever write the string into /run, as we
allocate it statically based on the UID, anyway. Lets stop that and just
allocate the runtime_path in "struct User" at all times.

We keep writing it into the /run state to make sure pam_systemd of
previous installs can still read it. However, pam_systemd is now fixed to
allocate it statically as well, so we can safely remove that some time in
the future.

Last but not least: If software depends on systemd, they're more than free
to assume /run/user/$uid is their runtime dir. Lets not require sane
applications to query the environment to get their runtime dir. As long as
applications know their login-UID, they should be safe to deduce the
runtime dir.
2015-11-16 15:34:36 +01:00
Lennart Poettering 2904e949f2 tmpfiles: create subvolumes for "v", "q", and "Q" only if / is a subvolume
It's not a good idea to create subvolumes for parts of the OS tree (such
as /home, or /var) if the root directory is not a subvolume too. We
shouldn't assume control of "heavier" objects such as subvolumes, if the
originating object (the root directory) is a "light-weight" object, i.e.
a plain directory.

Effectively this means that chroot() environments that are run on a
plain directory do not have to deal with problems around systemd
creating subvolumes that cannot be removed with a simple "rm" anymore.
However, if the chroot manager creates a proper subvolume for such an
environment it will also get further subvolumes placed in there, under
the assumption that the manager understands the concept of subvolumes in
that case.
2015-11-16 15:25:42 +01:00
Martin Pitt dbe81cbd2a siphash24: change result argument to uint64_t
Change the "out" parameter from uint8_t[8] to uint64_t. On architectures which
enforce pointer alignment this fixes crashes when we previously cast an
unaligned array to uint64_t*, and on others this should at least improve
performance as the compiler now aligns these properly.

This also simplifies the code in most cases by getting rid of typecasts. The
only place which we can't change is struct duid's en.id, as that is _packed_
and public API, so we can't enforce alignment of the "id" field and have to
use memcpy instead.
2015-11-16 15:20:29 +01:00
Daniel Mack 8dd85afe76 siphash24: fix memory alignment
Use unaligned_read_le64() to access input buffer when reading complete
64-bit words.

This should fix memory traps on platforms with strict aliasing.
2015-11-16 15:19:23 +01:00
Daniel Mack 7f034e980d basic: add unaligned macros for little endian
Also add test code for that.
2015-11-16 15:13:33 +01:00
David Herrmann 44690833df Merge pull request #1886 from poettering/tasks-max
Enable TasksMax by default for all units
2015-11-16 15:09:55 +01:00
David Herrmann e25b5a8d73 TODO: sort 2015-11-16 15:05:00 +01:00
Lennart Poettering ab32771aa0 Merge pull request #1907 from evverx/fix-pam-install-on-debian
tests: fix pam_modules installation on Debian (and Debian-like systems)
2015-11-16 12:33:09 +01:00
Martin Pitt 9b65fd9fa9 virt: sort #includes alphabetically
nitpick from PR #1910
2015-11-16 12:01:24 +01:00
David Herrmann f56e49a989 Merge pull request #1908 from phomes/network-memleak
network: dhcp6 - fix mem leak
2015-11-16 12:00:20 +01:00
David Herrmann d6ab08f622 Merge pull request #1906 from poettering/pid-check
machined,logind: be more careful when accepting PIDs and UIDs from clients
2015-11-16 11:59:21 +01:00
Lennart Poettering 541ec33075 nspawn: set TasksMax= for containers to 8192 by default 2015-11-16 11:58:04 +01:00
Lennart Poettering a5bc6e5450 logind: change default to UserTasksMax= to 4096 2015-11-16 11:58:04 +01:00
Lennart Poettering 9ded9cd14c core: enable TasksMax= for all services by default, and set it to 512
Also, enable TasksAccounting= for all services by default, too.

See:

http://lists.freedesktop.org/archives/systemd-devel/2015-November/035006.html
2015-11-16 11:57:48 +01:00
Lennart Poettering fb917b2103 Merge pull request #1910 from martinpitt/master
virt: add missing #includes
2015-11-16 11:52:17 +01:00
Martin Pitt 6970dcb4ef virt: add missing #includes
src/basic/virt.c: In function 'detect_vm_device_tree':
src/basic/virt.c:117:17: error: unknown type name '_cleanup_closedir_'
                 _cleanup_closedir_ DIR *dir = NULL;

src/basic/virt.c:128:17: error: implicit declaration of function 'FOREACH_DIRENT' [-Werror=implicit-function-declaration]
                 FOREACH_DIRENT(dent, dir, return -errno)
2015-11-16 08:04:24 +01:00
Evgeny Vereshchagin bf3a947cb4 tests: intsall /etc/login.defs
Fixes:
systemd-testsuite login[31]: cannot open login definitions /etc/login.defs [No such file or directory]
systemd-testsuite systemd[1]: Received SIGCHLD from PID 31 (login).
systemd-testsuite systemd[1]: Child 31 (login) died (code=exited, status=1/FAILURE)
systemd-testsuite systemd[1]: console-getty.service: Child 31 belongs to console-getty.service
systemd-testsuite systemd[1]: console-getty.service: Main process exited, code=exited, status=1/FAILURE
systemd-testsuite systemd[1]: console-getty.service: Changed running -> dead

on Debian/Ubuntu

Useful on other distros
2015-11-16 03:15:10 +00:00
Thomas Hindoe Paaboel Andersen a2f46e8495 network: dhcp6 - fix mem leak
from 7a695d8e
CID#1338679
2015-11-15 23:10:28 +01:00
Evgeny Vereshchagin 0fe15dc8dd tests: fix pam_modules installation on Debian (and Debian-like systems)
libpam_modules installs modules into /lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/security
on Debian

Fixes:
systemd-testsuite login[36]: PAM unable to dlopen(pam_group.so): /lib/security/pam_group.so: cannot open shared object file: No such file or directory
systemd-testsuite login[36]: PAM adding faulty module: pam_group.so
systemd-testsuite login[36]: PAM unable to dlopen(pam_limits.so): /lib/security/pam_limits.so: cannot open shared object file: No such file or directory
systemd-testsuite login[36]: PAM adding faulty module: pam_limits.so
...
etc
2015-11-15 21:21:18 +00:00
Lennart Poettering 06820eafdb machined,logind: be more careful when accepting PIDs and UIDs from clients
Always validate first before we start processing the data.
2015-11-15 22:00:47 +01:00
Lennart Poettering 7ad8eb8d84 Merge pull request #1903 from phomes/gitignore
gitignore: add test-install-root
2015-11-15 20:42:26 +01:00
Thomas Hindoe Paaboel Andersen 23bfbe7fdb gitignore: add test-install-root 2015-11-15 20:36:22 +01:00
Lennart Poettering 1418ee7598 Merge pull request #1901 from evverx/various-fixes
Various fixes
2015-11-15 19:46:00 +01:00
Lennart Poettering 7ee598b450 Merge pull request #1899 from phomes/NEWS-typo
NEWS: typo fixes
2015-11-15 19:44:55 +01:00
Evgeny Vereshchagin c7eda0133b tests: install execs from user units too
Fixes:
systemd[39]: systemd-exit.service: Executing: /bin/kill -s 58 29
systemd[39]: systemd-exit.service: Failed at step EXEC spawning /bin/kill: No such file or directory
systemd[29]: Received SIGCHLD from PID 39 ((kill)).
systemd[29]: Child 39 ((kill)) died (code=exited, status=203/EXEC)
2015-11-15 18:30:37 +00:00
Evgeny Vereshchagin db260eedc2 firstboot: log on take_etc_passwd_lock error too 2015-11-15 18:30:26 +00:00
Lennart Poettering 4e8ebb6f91 Merge pull request #1898 from marcosfrm/journalctl-shell-completion-2
shell-completion: journalctl: add --sync
2015-11-15 19:28:13 +01:00
Thomas Hindoe Paaboel Andersen 815bb5bd56 NEWS: typo fixes 2015-11-15 17:30:33 +01:00
Marcos Mello 1a51b1b1c2 shell-completion: journalctl: add --sync
From 94b6551
2015-11-15 14:04:15 -02:00
Daniel Mack f978cf31ec Merge pull request #1896 from phomes/install-wrong-enum
install: don't mix state and type enums
2015-11-15 16:51:51 +01:00
Thomas Hindoe Paaboel Andersen d986e364c4 install: don't mix state and type enums
from 0ec0deaa
2015-11-15 14:45:24 +01:00
Kay Sievers eee15abcdb hwdb: update 2015-11-14 09:54:17 +01:00
Lennart Poettering 702d4e6f14 core: now that .snapshot unit are gone, we don't need the per-type .no_gc bool anymore 2015-11-13 19:50:52 +01:00
Lennart Poettering 700e2d63b7 core: simplify scope unit GC checking code a bit 2015-11-13 19:50:52 +01:00
Lennart Poettering 90558f3158 logind: add a new UserTasksMax= setting to logind.conf
This new setting configures the TasksMax= field for the slice objects we
create for each user.

This alters logind to create the slice unit as transient unit explicitly
instead of relying on implicit generation of slice units by simply
starting them. This also enables us to set a friendly description for
slice units that way.
2015-11-13 19:50:52 +01:00
Lennart Poettering 38599489e4 logind: don't assert if the slice is missing
After all, we don't actually really need the slice to work, it's just
nice to have it.
2015-11-13 19:50:52 +01:00