summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* Prep v238: Remove getnameinfo_pretty(), it is no longer used.Sven Eden2018-06-29
|
* Prep v238: Mask cg_trim() call in manager_shutdown_cgroup() as elogind is ↵Sven Eden2018-06-28
| | | | not init.
* basic/fs-util: skip fsync_directory_of_file() if /proc/self/fd/ is not ↵Zbigniew Jędrzejewski-Szmek2018-06-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | available (#8386) When systemd is running under lorax (in Fedora compose process), it'd think that it failed to write /etc/machine-id, even though the write succeeded, because fsync_directory_of_file() would fail, because /proc/self/fd/ is not available. fsync_directory_of_file() is mostly an additional safety net, so I think it's best to just silently ignore the error. Strace of pid1: 35791 stat("/etc", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 35791 openat(AT_FDCWD, "/etc/machine-id", O_RDWR|O_CREAT|O_NOCTTY|O_CLOEXEC, 0444) = 3 35791 umask(022) = 000 35791 read(3, "", 38) = 0 35791 openat(AT_FDCWD, "/var/lib/dbus/machine-id", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file o r directory) 35791 openat(AT_FDCWD, "/sys/class/dmi/id/product_name", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) 35791 openat(AT_FDCWD, "/sys/class/dmi/id/sys_vendor", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) 35791 openat(AT_FDCWD, "/sys/class/dmi/id/board_vendor", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) 35791 openat(AT_FDCWD, "/sys/class/dmi/id/bios_vendor", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) 35791 access("/proc/xen", F_OK) = -1 ENOENT (No such file or directory) 35791 openat(AT_FDCWD, "/sys/hypervisor/type", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) 35791 openat(AT_FDCWD, "/proc/cpuinfo", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) 35791 getrandom("\xb8\x82\xed\xd4\x35\x11\xd0\xeb\xa6\x79\xd7\x31\x6e\x7b\x99\xce", 16, GRND_NONBLOCK) = 16 35791 writev(2, [{iov_base="Initializing machine ID from random generator.", iov_len=46}, {iov_base="\n", iov_len=1}], 2) = 47 35791 lseek(3, 0, SEEK_SET) = 0 35791 ftruncate(3, 0) = 0 35791 write(3, "b882edd4351140eba679d7316e7b99ce\n", 33) = 33 35791 fsync(3) = 0 35791 fstat(3, {st_mode=S_IFREG|0444, st_size=33, ...}) = 0 35791 readlinkat(AT_FDCWD, "/proc/self/fd/3", 0x564df8c694c0, 99) = -1 ENOENT (No such file or directory) 35791 close(3) = 0 35791 umask(022) = 022 35791 openat(AT_FDCWD, "/run/machine-id", O_WRONLY|O_CREAT|O_NOCTTY|O_TRUNC|O_CLOEXEC, 0444) = 3 35791 write(3, "b882edd4351140eba679d7316e7b99ce\n", 33) = 33 35791 close(3) = 0 35791 umask(022) = 022 35791 mount("/run/machine-id", "/etc/machine-id", NULL, MS_BIND, NULL) = 0 35791 writev(2, [{iov_base="Installed transient /etc/machine-id file.", iov_len=41}, {iov_base="\n", iov_len=1}], 2) = 42 35791 mount(NULL, "/etc/machine-id", NULL, MS_RDONLY|MS_REMOUNT|MS_BIND, NULL) = 0 https://bugzilla.redhat.com/show_bug.cgi?id=1552843 (cherry picked from commit 3ceae1bc14d2da3fc1fe4753d6657759012256dc)
* core: dont't remount /sys/fs/cgroup for relabel if not needed (#8595)Krzysztof Nowicki2018-06-28
| | | | | | | | | | | | | | | | | | | | | | | | | | The initial fix for relabelling the cgroup filesystem for SELinux delivered in commit 8739f23e3 was based on the assumption that the cgroup filesystem is already populated once mount_setup() is executed, which was true for my system. What I wasn't aware is that this is the case only when another instance of systemd was running before this one, which can happen if systemd is used in the initrd (for ex. by dracut). In case of a clean systemd start-up the cgroup filesystem is actually being populated after mount_setup() and does not need relabelling as at that moment the SELinux policy is already loaded. Since however the root cgroup filesystem was remounted read-only in the meantime this operation will now fail. To fix this check for the filesystem mount flags before relabelling and only remount ro->rw->ro if necessary and leave the filesystem read-write otherwise. Fixes #7901. (cherry picked from commit 6f7729c1767998110c4460c85c94435c5782a613) Also https://bugzilla.redhat.com/show_bug.cgi?id=1576240.
* conf-parser: accept trailing backslash at the end of the file (#8941)Filipe Brandenburger2018-06-28
| | | | | | | | | | | | This makes it behave the same whether there is a blank line or not at the end of the file. This is also consistent with the behavior of the shell on a shell script that ends on a trailing backslash at the last line. Added tests to test_config_parse(), which only pass if the corresponding change to config_parse() is included. (cherry picked from commit 4f29e0db127dce9e1a28af4d7bf88c124ba257b7)
* login: do not wall message on cancelling shutdown when ↵Yu Watanabe2018-06-28
| | | | | | | | Manager.enable_wall_messages is false Fixes #8904. (cherry picked from commit 6e78fa4afd474dae984f3ee4a8477c623296a519)
* virt: if we detect Xen by DMI, trust that over CPUIDLennart Poettering2018-06-28
| | | | | | | | Apparently Xen sometimes lies about its identity when queried via CPUID. Let's hence prefer DMI tests for CPUID Fixes: #8844 (cherry picked from commit f2fe2865cd19cd4318b82d01b9b62d22b1697b3a)
* add __nr_statx defines for extra architectures (#8872)Adam Duskett2018-06-28
| | | | | | | | | | | | | This includes: - arm - arm64 - alpha - powerpc64 - sparc Taken from kernel 4.16.6 (cherry picked from commit 773c84349d80c7a6f818f5909a160ddb7337987f)
* basic/log: always ignore errno from the enviornment (#8841)Zbigniew Jędrzejewski-Szmek2018-06-28
| | | | | | | | | | | | | This extends the change done in b29f6480ec to other logging functions. This actually fixes some bugs in callers of log_struct(), for example config_parse_alias() called 'return log_syntax(..., 0, ...)' which could result in a bogus non-zero return value. Calls to log_object() and log_format_iovec() — which is only used by server_driver_message() — appear correct. (cherry picked from commit d1a1f0aaf0d2f08c60d1e0d32e646439d99f58dc)
* cgroup-util: fix enabling of controllers (#8816)Antique2018-06-28
| | | | | | | | | | | | If enabling controller for some reason fails we need to clear error for the FILE stream. Enabling remaining controllers would otherwise fail because write_string_stream_ts() checks for ferror(f) and returns -EIO if there is one. Broken by commit <77fa610b22>. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> (cherry picked from commit 96aa6591d1103b8cca9a4db80ba478a18bdf3e9a)
* fileio.c: fix incorrect mtimeChris Lesiak2018-06-28
| | | | | | | | | | | | | | | | | A regression was introduced that caused the mtime of /etc/.updated and /var/.updated to be the current time when systemd-update-done ran instead of being copied from /usr. This was nearly fixed, but due to fflush being called after mtime was carefully set, it was overwritten with the current time. Regression introduced in 872c40396384f9fa89b01baf4e739d28ed590299 A fix was just missed in 39c38d773fbe2b4f76ff29ecd3344640efb9a86c Fixes #8806 (cherry picked from commit be83711c7eb6a09e0d0c529c427cebcae87c0c1f)
* basic/log: do not use global errno in log_*_errno()Zbigniew Jędrzejewski-Szmek2018-06-28
| | | | | | | | | | | | | | | | | | | | | | | | Quoting https://github.com/systemd/systemd/pull/8760#discussion_r183321060: > When we originally added the errno patching we went for a "best of both > worlds" approach, i.e. that we override errno if an error is specified, but > if no error is specified (i.e. 0 is passed as error code) then we use the > previously set errno, similar in style how plain `printf()` would do it. In > retrospect I think we almost never purposefully made use of the second, > i.e. the plain `printf()` logic, but we multiple times ran into this case > accidentally and introduced a bug. Hence yes, it probably makes sense to > switch this over, and consistently ignore the `errno` already set and always > override it with the error passed in. The only problem I see with that is: I > wonder if there might be a case or two lurking somewhere where we actually > made use of the "best of both worlds" approach, and if so, if we can detect > where... (But then again, even if there is, and we fail to find those cases, > maybe that's not all bad, as it's just a few new bugs against probably fixing > many more old and future bugs, if you follow what I mean). I scanned our codebase, and found some bugs in the value passed to log_*_errno, but no intentional cases of error=0 being passed. (cherry picked from commit b29f6480eca0550ba65d30fbece8dd4d4bfe666d)
* basic/audit-util: always log the reason when disabling audit logsZbigniew Jędrzejewski-Szmek2018-06-28
| | | | | | This state is cached, and it's seems OK to log at least once. (cherry picked from commit 13bb68bbe37f0b39cd45234b09fb1a1da8302020)
* ISO-C compatibility: Remove empty initializer (#8713)Leonard2018-06-28
| | | | | | | | | | ISO-C doesn't allow empty initializers, so replace it by explicitly initializing to zero. Also add braces because x is a union and we initialize a subobject, so a compiler might warn about suggesting braces. Shut that up. (cherry picked from commit d579a56c397a1aeaa490032a9f7aabd82124f1c8)
* tmpfiles: add a new return code for "operational failure" when processingZbigniew Jędrzejewski-Szmek2018-06-28
| | | | | | | | | | Things can fail, and we have no control over it: - file system issues (immutable bits, file system errors, MAC refusals, etc) - kernel refusing certain arguments when writing to /proc/sys or /sys Let's add a new code for the case where we parsed configuration but failed to execute it because of external errors. (cherry picked from commit bb9947be2fa308d198b63b30e494ade5d68e5109)
* core: skip the removal of cgroups in the TEST_RUN_MINIMAL mode (#8622)Evgeny Vereshchagin2018-06-28
| | | | | | | | | When `systemd` is run in the TEST_RUN_MINIMAL mode, it doesn't really set up cgroups, so it shouldn't try to remove anything. Closes https://github.com/systemd/systemd/issues/8474. (cherry picked from commit f6c63f6fc90040f0017a7cc37f3a05d5b86226d7)
* systemd-inhibit: ignore signal interrupt from keyboard (#8569)Christian Hesse2018-06-28
| | | | | | | | | | | | | By default both processes, systemd-inhibit and the forked one, receive the signals. Pressing Ctrl+C on the keyboard results in SIGINT being sent to the processes, followed by SIGTERM being sent to the forked process when systemd-inhibit exits. This can cause trouble when the forked process does not clean up properly but exit immediately. Instead make systemd-inhibit ignore SIGINT, leaving it to the forked process to clean up and exit. (cherry picked from commit 106f12a08fcacef713438fc055872592399deeed)
* stat-util: fix fd_is_network_ns()Lennart Poettering2018-06-28
| | | | | | | This was broken in 77f9fa3b8ea46c27e5a5e9270f71bf1b4000c3e0. My fault. Fixes: #8543 (cherry picked from commit 29f74559d4dc6ea41232233d32f1a92bcee43626)
* sd-bus: drop fd_nonblock() calls that are implied by rearrange_stdio() (#8514)Lennart Poettering2018-06-28
| | | | (cherry picked from commit 68b525d1d1e8153cbc2e2354fa650aa165f7a434)
* basic/macros: rename noreturn into _noreturn_ (#8456)Franck Bui2018-06-28
| | | | | | | | | | | | | | | "noreturn" is reserved and can be used in other header files we include: [ 16s] In file included from /usr/include/gcrypt.h:30:0, [ 16s] from ../src/journal/journal-file.h:26, [ 16s] from ../src/journal/journal-vacuum.c:31: [ 16s] /usr/include/gpg-error.h:1544:46: error: expected ‘,’ or ‘;’ before ‘)’ token [ 16s] void gpgrt_log_bug (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2); Here we include grcrypt.h (which in turns include gpg-error.h) *after* we "noreturn" was defined in macro.h. (cherry picked from commit 848e863acc51ecfb0f3955c498874588201d9130)
* tests: make / private after creating a mount namespaceEvegeny Vereshchagin2018-06-28
| | | | | | so that the test never affects the root namespace. (cherry picked from commit c58fd466a313a1f93df1792822e358c67990bcdf)
* core: ignore errors from cg_create_and_attach() in test mode (#8401)Michal Sekletar2018-06-28
| | | | | | | | | | | | | | | | | | | | | | | | Reproducer: $ meson build && cd build $ ninja $ sudo useradd test $ sudo su test $ ./systemd --system --test ... Failed to create /user.slice/user-1000.slice/session-6.scope/init.scope control group: Permission denied Failed to allocate manager object: Permission denied Above error message is caused by the fact that user test didn't have its own session and we tried to set up init.scope already running as user test in the directory owned by different user. Let's try to setup cgroup hierarchy, but if that fails return error only when not running in the test mode. Fixes #8072 (cherry picked from commit aa77e234fce7413b7dd64f99ea51450f2e2e9dbd)
* basic/cgroup-util: remove unused variableZbigniew Jędrzejewski-Szmek2018-06-28
| | | | (cherry picked from commit eef03d70c1bedb3aabd4e2bcf10ab1f2678443bf)
* core: do not free heap-allocated strings (#8391)Yu Watanabe2018-06-28
| | | | | | Fixes #8387. (cherry picked from commit 5cbaad2f6795088db56063d20695c6444595822f)
* sd-bus: do not try to close already closed fd (#8392)Yu Watanabe2018-06-28
| | | | | | Fixes #8376, which is introduced by 2b33ab0957f453a06b58e4bee482f2c2d4e100c1. (cherry picked from commit 280029d18f470a64403d68717eef1be5274ff8af)
* Add locale.h header, needed by freelocale()Danilo Spinella2018-06-22
| | | | | Without locale.h, there is an implicit declaration of function `freelocale`, which is reported as error by -Werror=implicit-function-declaration.
* Prep v238: Make a real distinction between 'halt' and 'poweroff'.Sven Eden2018-06-12
|
* Prep v238: Fix cg_path_decode_unit() to understand elogind session naming.Sven Eden2018-06-11
| | | | (cherry picked from commit d8949c3072a4b984d6fa964178a2d8d945ecbcb6)
* Prep v238: Fix elogind_daemonize(), it failed due to some misunderstandings ↵Sven Eden2018-06-08
| | | | | | on my side. (cherry picked from commit 1c9629692145891f10a36227749470d87979dd0b)
* logind-user.c: As we need special.h elsewhere now, use it here, too.Sven Eden2018-06-08
| | | | (cherry picked from commit a96cb75c17b008312fca8f81bc2a126f8a87850c)
* pam_elogind.c: Remove renames by mask, check_tree.pl can handle this now.Sven Eden2018-06-08
| | | | (cherry picked from commit 6964ec46218d41d699690ed590026249969b2257)
* Prep v238: Uncomment now needed headers and unmask now needed functions in ↵Sven Eden2018-06-05
| | | | src/test (6/6)
* Prep v238: Uncomment now needed headers and unmask now needed functions in ↵Sven Eden2018-06-05
| | | | src/shared (5/6)
* Prep v238: Uncomment now needed headers and unmask now needed functions in ↵Sven Eden2018-06-05
| | | | src/login (4/6)
* Prep v238: Uncomment now needed headers and unmask now needed functions in ↵Sven Eden2018-06-05
| | | | src/libelogind (3/6)
* Prep v238: Uncomment now needed headers and unmask now needed functions in ↵Sven Eden2018-06-05
| | | | src/core (2/6)
* Prep v238: Uncomment now needed headers and unmask now needed functions in ↵Sven Eden2018-06-05
| | | | src/basic (1/6)
* Prep v238: Remove obsolete sources and add missing new ones.Sven Eden2018-06-05
|
* Prep v238: Fixed meson.build files in src/shared and src/testSven Eden2018-06-04
|
* Prep v238: Applied some upstream updates to src/libelogind (5/5)Sven Eden2018-06-04
|
* Prep v238: Applied some upstream updates to src/core (4/5)Sven Eden2018-06-04
|
* Prep v238: Applied some upstream updates to src/basic (3/5)Sven Eden2018-06-04
|
* login: remember that fds received from PID1 need to be removed eventuallyAlan Jenkins2018-05-30
| | | | | Remember to set sd->pushed_fd when we receive an fd from PID1 on startup, the same as we set it when we send an fd to PID1.
* login: fix FDNAME in call to sd_pid_notify_with_fds()Alan Jenkins2018-05-30
| | | | | | | | | | | | | | | $ git grep FDNAME logind-session-device.c: ... "FDNAME=session-", sd->session->id); logind-session-device.c: ... "FDNAME=session", sd->session->id); Oops. Fixes #8343. Or at least a more minimal reproducer. Xorg still dies when logind is restarted, but the Xorg message says this is entirely deliberate. (This could also be the reason I hit #8035, instead of the race condition I originally suggested).
* fd-util: drop stdio_unset_cloexec(), it's not used anymoreLennart Poettering2018-05-30
|
* sd-bus: let's better not invade stdio territory when duplicating fdsLennart Poettering2018-05-30
|
* tree-wide: port various places over to use new rearrange_stdio()Lennart Poettering2018-05-30
|
* terminal-util: port some generic code over to rearrange_stdio()Lennart Poettering2018-05-30
|
* fd-util: add new call rearrange_stdio()Lennart Poettering2018-05-30
| | | | | | | | | | | | | | | | | | | Quite often we need to set up a number of fds as stdin/stdout/stderr of a process we are about to start. Add a generic implementation for a routine doing that that takes care to do so properly: 1. Can handle the case where stdin/stdout/stderr where previously closed, and the fds to set as stdin/stdout/stderr hence likely in the 0..2 range. handling this properly is nasty, since we need to first move the fds out of this range in order to later move them back in, to make things fully robust. 2. Can optionally open /dev/null in case for one or more of the fds, in a smart way, sharing the open file if possible between multiple of the fds. 3. Guarantees that O_CLOEXEC is not set on the three fds, even if the fds already were in the 0..2 range and hence possibly weren't moved.
* coccinelle: add reallocarray() coccinelle scriptLennart Poettering2018-05-30
| | | | | Let's systematically make use of reallocarray() whereever we invoke realloc() with a product of two values.