summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Introduce _cleanup_(unit_freep)Zbigniew Jędrzejewski-Szmek2018-03-114-17/+11
|
* Introduce _cleanup_(manager_freep)Zbigniew Jędrzejewski-Szmek2018-03-1110-52/+29
|
* shared/sleep-config: fix unitialized variable and use STR_IN_SET (#8416)Zbigniew Jędrzejewski-Szmek2018-03-111-10/+7
|
* Merge pull request #8403 from evverx/test-mount-utilZbigniew Jędrzejewski-Szmek2018-03-103-6/+6
|\ | | | | tests: skip the rest of test_mnt_id after getting any error
| * tests: skip g_dbus_message_new_from_blob under asanEvegeny Vereshchagin2018-03-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some versions of asan report the following false positive when strict_string_checks=1 is passed: ================================================================= ==3297==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f64e4090286 bp 0x7ffe46acd9a0 sp 0x7ffe46acd118 T0) ==3297==The signal is caused by a READ memory access. ==3297==Hint: address points to the zero page. #0 0x7f64e4090285 in __strlen_sse2 (/lib64/libc.so.6+0xaa285) #1 0x7f64e5a51e46 (/lib64/libasan.so.4+0x41e46) #2 0x7f64e4e5e3a0 (/lib64/libglib-2.0.so.0+0x383a0) #3 0x7f64e4e5e536 in g_dgettext (/lib64/libglib-2.0.so.0+0x38536) #4 0x7f64e48fac5f (/lib64/libgio-2.0.so.0+0xc1c5f) #5 0x7f64e4c03978 in g_type_class_ref (/lib64/libgobject-2.0.so.0+0x30978) #6 0x7f64e4be9567 in g_object_new_with_properties (/lib64/libgobject-2.0.so.0+0x16567) #7 0x7f64e4be9fd0 in g_object_new (/lib64/libgobject-2.0.so.0+0x16fd0) #8 0x7f64e48fd43e in g_dbus_message_new_from_blob (/lib64/libgio-2.0.so.0+0xc443e) #9 0x564a6aa0de52 in main ../src/libsystemd/sd-bus/test-bus-marshal.c:228 #10 0x7f64e4007009 in __libc_start_main (/lib64/libc.so.6+0x21009) #11 0x564a6aa0a569 in _start (/home/vagrant/systemd/build/test-bus-marshal+0x5569) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV (/lib64/libc.so.6+0xaa285) in __strlen_sse2 ==3297==ABORTING It's an external library and errors in external libraries are generally not very useful for looking for internal bugs. It would be better not to change the code and use standard suppression techinques decribed at https://clang.llvm.org/docs/AddressSanitizer.html#suppressing-reports-in-external-libraries, but, unfortunaley, none of them seems to be able to suppress fatal errors in asan intself.
| * tests: make / private after creating a mount namespaceEvegeny Vereshchagin2018-03-091-0/+2
| | | | | | | | so that the test never affects the root namespace.
| * tests: skip the rest of test_mnt_id after getting any errorEvegeny Vereshchagin2018-03-091-6/+2
| | | | | | | | | | | | | | | | | | This mainly gets around a kernel bug making it possible to have non-existent paths in /proc/self/mountinfo, but it should also prevent flaky failures that can happen if something changes immediately after or during reading /proc/self/mountinfo. Closes https://github.com/systemd/systemd/issues/8286.
* | core: ignore errors from cg_create_and_attach() in test mode (#8401)Michal Sekletar2018-03-091-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | meson: use triple-quote delimition in one more placeZbigniew Jędrzejewski-Szmek2018-03-091-2/+2
| |
* | core/socket: support binary inside chroot when looking for SELinux label (#8405)Filipe Brandenburger2018-03-091-2/+6
| | | | | | | | | | Otherwise having a .socket unit start a .service running a binary under a chroot fails as the unit is unable to determine the SELinux label of the binary.
* | core/cgroup: accepts MemorySwapMax=0 (#8366)Yu Watanabe2018-03-093-89/+127
|/ | | | | | Also, this moves two macros from dbus-util.h to dbus-cgroup.c, as they are only used in dbus-cgroup.c. Fixes #8363.
* Merge pull request #8372 from keszybz/two-cleanupsLennart Poettering2018-03-089-44/+21
|\ | | | | Two cleanups
| * core: drop unnecessary __useless_struct_to_allow_trailing_semicolon__Zbigniew Jędrzejewski-Szmek2018-03-068-43/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ISO C does not allow empty statements outside of functions, and gcc will warn the trailing semicolons when compiling with -pedantic: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic] But our code cannot compile with -pedantic anyway, at least because warning: ISO C does not support ‘__PRETTY_FUNCTION__’ predefined identifier [-Wpedantic] Without -pedatnic, clang and even old gcc (3.4) generate no warnings about those semicolons, so let's just drop __useless_struct_to_allow_trailing_semicolon__.
| * basic/cgroup-util: remove unused variableZbigniew Jędrzejewski-Szmek2018-03-061-1/+0
| |
* | core: do not free heap-allocated strings (#8391)Yu Watanabe2018-03-081-2/+4
| | | | | | Fixes #8387.
* | sd-bus: do not try to close already closed fd (#8392)Yu Watanabe2018-03-081-2/+0
| | | | | | Fixes #8376, which is introduced by 2b33ab0957f453a06b58e4bee482f2c2d4e100c1.
* | Introduce suspend-to-hibernate (#8274)Mario Limonciello2018-03-0810-32/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Suspend to Hibernate is a new sleep method that invokes suspend for a predefined period of time before automatically waking up and hibernating the system. It's similar to HybridSleep however there isn't a performance impact on every suspend cycle. It's intended to use with systems that may have a higher power drain in their supported suspend states to prevent battery and data loss over an extended suspend cycle. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
* | Revert "core: don't setup init.scope in test mode (#8380)" (#8390)Yu Watanabe2018-03-081-5/+3
| | | | | | | | | | | | This reverts commit a9e8ecf0374c675831208559ba37749a8f9719ef, as it breaks test-path. Fixes #8389.
* | test-cgroup-util: bail out when running under mock (#8365)Zbigniew Jędrzejewski-Szmek2018-03-081-2/+8
| | | | | | | | | | | | The builds were failing in Fedora koji, where something strange is mounted on /sys/fs/cgroup. Also closes https://github.com/systemd/systemd/issues/8383.
* | core: don't setup init.scope in test mode (#8380)Michal Sekletar2018-03-071-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 skip setting up init.scope altogether since we won't be launching processes anyway.
* | Merge pull request #8378 from evverx/get-around-freopenZbigniew Jędrzejewski-Szmek2018-03-071-4/+8
|\ \ | | | | | | tests: stop using `freopen` in `test-fileio`
| * | tests: close a leftover file descriptor in `test-fileio`Evegeny Vereshchagin2018-03-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should make it a bit easier to search for real file descriptor leaks. ``` $ valgrind --leak-check=full --track-fds=yes ./build/test-fileio ... ==29457== ==29457== FILE DESCRIPTORS: 4 open at exit. ==29457== Open file descriptor 3: /tmp/test-systemd_writing_tmpfile.lyV5Rc ==29457== at 0x4B9AD9E: open (open.c:43) ==29457== by 0x4B19B24: __gen_tempname (tempname.c:261) ==29457== by 0x4BA5CC3: mkostemp64 (mkostemp64.c:32) ==29457== by 0x48F739B: mkostemp_safe (fileio.c:1206) ==29457== by 0x10D968: test_writing_tmpfile (test-fileio.c:620) ==29457== by 0x10E930: main (test-fileio.c:767) ==29457== ```
| * | tests: stop using `freopen` in `test-fileio`Evegeny Vereshchagin2018-03-051-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This helps get around a bug confusing `glibc` and making the test bail out with the following error under `asan` on `x86`: Fatal error: glibc detected an invalid stdio handle Aborted (core dumped) The bug has been reported in https://github.com/google/sanitizers/issues/778, but it is unlikely to be fixed anytime soon.
* | | Merge pull request #8086 from hdante/sdboot-setmode-v2Zbigniew Jędrzejewski-Szmek2018-03-076-1/+152
|\ \ \
| * | | bootctl: synchronize bootctl code with sd-boot codeHenrique Dante de Almeida2018-02-033-0/+4
| | | | | | | | | | | | | | | | | | | | This patch adds a line with "#console-mode keep" as a documentation for the console mode feature and duplicates console-mode parsing to bootctl.
| * | | boot/efi: improve automatic mode handlingHenrique Dante de Almeida2018-02-031-2/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch improves the automatic console mode switching by avoiding changing the mode if it can verify that the text is readable in the default mode. The implementation avoids changing mode if we're using a low resolution device (fixed to be smaller than 1920x1080) because we assume the text is readable, so the initial mode should be a good one. Also, the mode is not changed when in high resolution mode if the text viewport area is larger than 10% of the screen. The conclusion is that only if the text viewport is calculated to occupy less than 10% of the screen area it is assumed to be hard to read and a new mode is selected. With this patch the auto mode will typically avoid changing mode hopefully in most of the cases, only changing it if completely necessary.
| * | | boot/efi: add console-mode boot option to change resolutionHenrique Dante de Almeida2018-02-033-1/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new boot option allows changing the display console mode to some new display resolution. Usage: in systemd-boot configuration file loader/loader.conf add one of: console-mode <number> console-mode auto console-mode max console-mode keep Where number can be: 1) 0: UEFI standard 80x25 mode 2) 1: 80x50 mode, if supported by device 3) 2 or greater: some non-standard device mode, if supported When using the auto mode, systemd-boot will try to find a reasonable mode automatically using some heuristic. Current implementation tries to switch console mode to mode 2 if it exists, mode 1 if it exists, else mode 0. Mode 2 is the first non standard mode provided by the firmware developer and it's assumed to be a reasonable mode. The max mode adds support for switching to the highest numbered console mode, whatever mode that would be in the system. The maximum mode being the last one implemented by the firmware provider should be a reasonable mode. The keep mode is the default and is only included for completeness. With this parameter, the user explicitly states and can be assured that systemd-boot will not change console mode. Note: patch includes a workaround for mode 1, that may not exist in EDK2 OVFM and results in a buggy text mode when requested.
* | | | Merge pull request #7817 from medhefgo/systemd-bootZbigniew Jędrzejewski-Szmek2018-03-076-124/+184
|\ \ \ \ | |_|/ / |/| | | systemd-boot improvements
| * | | systemd-boot: fix off-by-one buffer overrunZbigniew Jędrzejewski-Szmek2018-03-071-3/+2
| | | | | | | | | | | | | | | | We'd allocate a buffer of some size and then write zero to the byte one after.
| * | | systemd-boot: reduce indentation in config_entry_add_linux()Zbigniew Jędrzejewski-Szmek2018-03-071-94/+95
| | | | | | | | | | | | | | | | No functional change.
| * | | systemd-boot: Try harder not to add ourselves to the listJan Janssen2018-03-071-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to check if we are adding ourselves to the list if we know that it's the windows or EFI shell loaders. If we are adding the EFI default loader, additionally try to see if we can find the systemd-boot magic string and skip this entry if we do.
| * | | systemd-boot: Make automatic entries configurableJan Janssen2018-01-283-6/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hiding automatic entries allows for giving custom entry names like "Windows 10" instead of "Windows Boot Manager" by creating an appropriate loader file in the loader/entries folder. Note that it is already doable by renaming bootmgfw.efi (or the other auto-detected boot loaders) and then using the renamed file for a custom entry. But windows will automatically recreate the boot loader on updates, including the default EFI bootloader entry if that one is missing. Make hiding EFI reboot a separate option because there is no simple way to create it with a custom loader entry and people may still want that around while still hiding the other auto entries. Also, turn no_editor into a positive boolean name while we're touching this code.
| * | | systemd-boot: Return EFI_STATUS instead of INTN for file_read()Jan Janssen2018-01-284-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | file_read() wants to return both a EFI_STATUS (INTN) and a file length (UINTN). This seems rather fishy for either large files or when returning errors (which are defined as positive numbers). Let's just be more clear and return EFI_STATUS and let the file length be a pointer.
* | | | rpm: add missing '-p <lua>' in trigger script (#8367)Yu Watanabe2018-03-061-6/+6
| |_|/ |/| | | | | Follow-up for 32a00a9c097cf04ec2b0fcbf9b73eba188318424 (#8090).
* | | tmpfiles: don't resolve pathnames when traversing recursively through ↵Franck Bui2018-03-051-124/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | directory trees Otherwise we can be fooled if one path component is replaced underneath us. The patch achieves that by always operating at file descriptor level (by using *at() helpers) and by making sure we do not any path resolution when traversing direcotry trees. However this is not always possible, for instance when listing the content of a directory or some operations don't provide the *at() helpers or others (such as fchmodat()) don't have the AT_EMPTY_PATH flag. In such cases we operate on /proc/self/fd/%i pseudo-symlink instead, which works the same for all kinds of objects and requires no checking of type beforehand. Also O_PATH flag is used when opening file objects in order to prevent undesired behaviors: device nodes from reacting, automounts from triggering, etc... Fixes: #7986 Fixes: CVE-2018-6954
* | | tmpfiles: fstat() works with fd opened with O_PATH since Linux 3.6Franck Bui2018-03-051-2/+2
| | |
* | | tmpfiles: make hardlink_vulnerable() argument constantFranck Bui2018-03-051-1/+1
| | |
* | | Merge pull request #8341 from yuwata/test-execute-ambientZbigniew Jędrzejewski-Szmek2018-03-051-21/+35
|\ \ \ | | | | | | | | test-execute: check capabilities before runnig tests
| * | | test-execute: use CAP_CHOWN instead of CAP_NET_ADMINYu Watanabe2018-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | CAP_NET_ADMIN is somtrimes dropped by container runtime. This changes to use CAP_CHOWN instead of CAP_NET_ADMIN, as it is less likely to be dropped.
| * | | test-execute: check capabilities before running testsYu Watanabe2018-03-051-0/+14
| | | | | | | | | | | | | | | | Fixes #8193.
| * | | test-execute: change log level from error to noticeYu Watanabe2018-03-041-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | Skipping some tests due to the missing e.g., capsh binary or kernel support, are not error. This changes the log level for such messages.
| * | | test-execute: rename tests for AmbientCapabilities=Yu Watanabe2018-03-041-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unit files for test-execute are named like `exec-(setting-name-in-lower-character)-(optional-text).service`. However, test units for AmbientCapabilities= are not following this. So, let's rename them for the consistency. This does not change anything in the functionality of the test.
* | | | Merge pull request #8345 from ↵Zbigniew Jędrzejewski-Szmek2018-03-051-1/+2
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | sourcejedi/logind_restart_is_sorely_lacking_in_testing login: fix for #8343
| * | | | login: remember that fds received from PID1 need to be removed eventuallyAlan Jenkins2018-03-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ 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).
* | | | | Merge pull request #8354 from keszybz/new-NEWSZbigniew Jędrzejewski-Szmek2018-03-052-4/+4
|\ \ \ \ \ | | | | | | | | | | | | NEWS for v238
| * | | | | basic/glob-util: do not use names with "_" prefixZbigniew Jędrzejewski-Szmek2018-03-052-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Names starting with _ or __ are reserved by the standard, better to avoid them.
* | | | | | coredump: do not leak memory (#8352)Yu Watanabe2018-03-051-4/+1
| | | | | | | | | | | | | | | | | | Fixes #8351.
* | | | | | fixed 3 occurences of 'Failed top open' (#8349)SjonHortensius2018-03-043-4/+4
| |_|/ / / |/| | | |
* | | | | Merge pull request #8314 from poettering/rearrange-stdioLennart Poettering2018-03-0217-215/+232
|\ \ \ \ \ | | | | | | | | | | | | refactor how we rearrange fds for stdin/stdout/stderr