summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* logind: use TAKE_PTR() where we canLennart Poettering2018-10-29
| | | | (cherry picked from commit 1b88ed3b7db37241323348f640f9adb61c0df47a)
* logind: prefer strjoin() over asprintf()Lennart Poettering2018-10-29
| | | | (cherry picked from commit d5ddc930150633f9ce38ed4a6dc9accfd7ceaaac)
* logind: don't rely on downgrade-to-boolLennart Poettering2018-10-29
| | | | (cherry picked from commit 709d058756da7139181355b63cfad2288eefddfe)
* logind: voidify a few callsLennart Poettering2018-10-29
| | | | (cherry picked from commit 75bbdf478c73d78bbe5bdee6f468c2e84a1844c6)
* logind: make better use of logging functionsLennart Poettering2018-10-29
| | | | (cherry picked from commit e555d12635007da7263d0a43ed7307e70a07720d)
* logind: never elect a session that is stopping as displayLennart Poettering2018-10-29
| | | | (cherry picked from commit 04857cd801022d9f9933efb484c6253572f09870)
* logind: make unit/job active checking more debuggableLennart Poettering2018-10-29
| | | | | | Let's log the error messages if we get any at debug level. (cherry picked from commit bd26aee1f6bea13fe25b3feb2a5e9cd1be522e7e)
* man: add missing spaceLennart Poettering2018-10-29
| | | | (cherry picked from commit 74fb9617a8d1958d89b4b829a6fe544ac30bb81c)
* sd-bus: add new API call sd_bus_error_move()Lennart Poettering2018-10-29
| | | | | | | | | This new call move an sd_bus_error into another one. (cherry picked from commit 190128e407eb24a445554c0e1f956a1d51f97338) In the backport, the new function is made non-public, declared in bus-error.h not sd-bus.h.
* logind: fix bad error propagationLennart Poettering2018-10-29
| | | | (cherry picked from commit cce08496e7353e3e9903b42695aba3f9d259b90a)
* logind: correct bad clean-up pathLennart Poettering2018-10-29
| | | | (cherry picked from commit d88ffeeeefda4c3447223fd36f8e30f23c931e48)
* logind: save/restore User object's "stopping" field during restartsLennart Poettering2018-10-29
| | | | | | | Whether we are stopping or not is highly relevant, hence don't forget it across restarts. (cherry picked from commit d865bc024bf28c17120d7322a81e9a99997a59f6)
* logind: improve logging in manager_connect_console()Lennart Poettering2018-10-29
| | | | | | | | | | | | | | | | | let's make sure we log about every failure Also, complain about systems where /dev/tty0 exists but /sys/class/tty/tty0/active does not. Such systems (usually container environments) are pretty broken as they mount something that is not a VC to /dev/tty0 and they really shouldn't. Systems should either have a VC or not, but not badly fake one by mounting things wildly. This just adds a warning message, as before we'll simply turn off VC handling in this case. (cherry picked from commit 0b6d55cae9b8adc507fbea95d1b2874729a77386)
* logind: initialize Manager object with structure initialization tooLennart Poettering2018-10-29
| | | | (cherry picked from commit b25ba6cf673036e46cbaec77d3c7859ed83d3ca8)
* logind: turn of stdio locking when writing session files tooLennart Poettering2018-10-29
| | | | | | | This just copies what we already do for user and seat files to session files. (cherry picked from commit 44176400138e18d9087e0864ca97041416a90d47)
* logind: fix serialization/deserialization of user's "display session"Lennart Poettering2018-10-29
| | | | | | | | | | | Previously this was serialized as part of the user object. This didn't work however, as we load users first, and sessions seconds and hence referencing a session from the user load logic cannot work. Fix this by storing an IS_DISPLAY property along with each session, and make the session with this set display session when it is loaded. (cherry picked from commit 1c8280fd47b6561d35b15b3b6d49bdeacf891bfd)
* logind: rework Seat/Session/User object allocation and freeing a bitLennart Poettering2018-10-29
| | | | | | | | | | | | | | Let's update things a bit to follow current practices: - User structure initialization rather than zero-initialized allocation - Always propagate proper errors from allocation functions - Use _cleanup_ for freeing objects when allocation fails half-way - Make destructors return NULL (cherry picked from commit 8c29a4570993105fecc12288596d2ee77c7f82b8)
* format-table: don't use unsigned when there's no point in itLennart Poettering2018-10-29
| | | | | | CID 1394372 (cherry picked from commit ee7b9f1dfc4653cc8ce26d57cbed249d7f9cea4b)
* login: avoid leak of name returned by uid_to_name()David Tardon2018-10-29
| | | | (cherry picked from commit e99742ef3e9d847da04e71fec0eb426063b25068)
* be consistent about sun_path lengthDavid Tardon2018-10-29
| | | | | | | Most places use the whole buffer for name, without leaving extra space for the trailing NUL. (cherry picked from commit f369f47c264dd56f630e91697006efd647542feb)
* meson: fix '-Dstatic-libsystemd=true' or '-Dstatic-libudev=true'Yu Watanabe2018-10-29
| | | | | | Follow-up for a5d8835c78112206bbf0812dd4cb471f803bfe88. (cherry picked from commit be44b572f3543e589e381f8a0a04ade71c4c2e03)
* test: add test for 'thread safety' of libudevYu Watanabe2018-10-29
| | | | | | This adds a test for 715a970548d03fed18dc66c411c8b42ff21029cf. (cherry picked from commit cb3e926a5da4f73b48f71b541febe646bc1008d7)
* test: add tests for $SYSTEMD_MEMPOOL=Yu Watanabe2018-10-29
| | | | | | | This adds tests for b4f607433cac749b617e15b3d5d122322ed2bc71 and 205c085bc36c2c61a09dc40621d8561b135d9b57 (#9792). (cherry picked from commit 3ffd12bfbe9f91b392d80fbf6a8b2def2a13bf6d)
* mempool: only enable mempool use when linked to libsystemd-shared.soZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | | | | Mempool use is enabled or disabled based on the mempool_use_allowed symbol that is linked in. Should fix assert crashes in external programs caused by #9792. Replaces #10286. v2: - use two different source files instead of a gcc constructor (cherry picked from commit a5d8835c78112206bbf0812dd4cb471f803bfe88)
* meson: update bug referenceZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | https://github.com/mesonbuild/meson/issues/1644 was resolved in 0.42: https://github.com/mesonbuild/meson/pull/2191/commits/be4428005dff8b17af5696c8f05567de9af1a8c5, but still no-go. (cherry picked from commit 6939fb9eb4c76de630b71f6b2ad98686d7fbd1bf)
* meson: remove old commentZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | The linked page is gone, and I can't quite remember what the warning was about. Something about recursive copying... Everything seems to work. (cherry picked from commit c42c98192484f48342c2c032ea3d00022bd20e92)
* meson: drop workaroundZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | It was added way back, and seems to work fine now without it. (cherry picked from commit 5dbf13fa6c2d5311a9fc236a0a95c1babcc11937)
* meson: include more build settings in status outputLennart Poettering2018-10-29
| | | | (cherry picked from commit 19d8c9c9b7b3507eb2fdcf668a85456a4ae0dbeb)
* Move use_pool() to mempool.c and rename to mempool_enabled()Zbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | The only user is in hashmap.c, but it's a mempool thing. (cherry picked from commit 7c48ea02800782651b7da373c6165abb052f1382)
* hashmap: add an explicit assert() for detecting when objects migrated ↵Lennart Poettering2018-10-29
| | | | | | | | | | | | | between threads When clients don't follow protocol and use the same object from different threads, then we previously would silently corrupt memory. With this assert we'll fail with an assert(). This doesn't fix anything but certainly makes mis-uses easier to detect and debug. Triggered by https://bugzilla.redhat.com/show_bug.cgi?id=1609349 (cherry picked from commit 205c085bc36c2c61a09dc40621d8561b135d9b57)
* hashmap: add an environment variable to turn off the memory pool used by ↵Lennart Poettering2018-10-29
| | | | | | | | hashmaps Triggered by https://bugzilla.redhat.com/show_bug.cgi?id=1609349 (cherry picked from commit b4f607433cac749b617e15b3d5d122322ed2bc71)
* terminal-util: extra safety checks when parsing $COLUMNS or $LINES (#10314)Lennart Poettering2018-10-29
| | | | | | | | Let's make sure the integers we parse out are not larger than USHRT_MAX. This is a good idea as the kernel's TIOCSWINSZ ioctl for sizing terminals can't take larger values, and we shouldn't risk an overflow. (cherry picked from commit d09a71356e3ed78be7cef3cd7d9919dc77508b41)
* shared/sleep-config: add switches to kill specific sleep modesZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | | | | | /etc/systemd/sleep.conf gains four new switches: AllowSuspend=, AllowHibernation=, AllowSuspendThenHibernate=, AllowHybridSleep=. Disabling specific modes was already possible by masking suspend.target, hibernate.target, suspend-then-hibernate.target, or hybrid-sleep.target. But this is not convenient for distributions, which want to set some defaults based on what they want to support. Having those available as configuration makes it easy to put a config file in /usr/lib/systemd/sleep.conf.d/ that overrides the defaults and gives instructions how to undo that override. (cherry picked from commit e8f1d00d695f491654d50e57c82623288d3bcbeb)
* shared/sleep-config: forbid hibernation if resume= is not configuredZbigniew Jędrzejewski-Szmek2018-10-29
| | | | (cherry picked from commit 5fdf2d51c244288ac41443d1bd81365fab7b7b81)
* basic/proc-cmdline: allow parsing of cmdline from a stringZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | | Comes with tests. Also add direct test for $SYSTEMD_PROC_CMDLINE. In test-proc-cmdline, "true" was masquerading as PROC_CMDLINE_STRIP_RD_PREFIX, fix that. Also, reorder functions to match call order. (cherry picked from commit 9a135c084ae6d06734ec3380f0eafdecd7c216f8)
* Add $SYSTEMD_IN_INITRD=yes|no override for debuggingZbigniew Jędrzejewski-Szmek2018-10-29
| | | | (cherry picked from commit 0307ea49c70b1ed4f3af3c80566c8c098dc080bb)
* logind: ensure seat0 CanGraphical state is writtenRay Strode2018-10-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For non-`seat0` seats, attaching a graphics card to a seat can lead to it getting created. This is because the graphics device is a "master device" which means that device is a seat-defining device. `seat0` may get created, even before the graphics driver is loaded, though. This is because the graphics driver is loaded asynchronously at startup, and `seat0` is the primary seat of system, associated with the system VTs. When a graphics card is attached to a seat the `CanGraphical` property on that seat will flip to `true`. For seats that haven't been created yet (non-`seat0` seats), this leads to `seat_start` getting called which ultimately causes the seat to get serialized to `/run/systemd/seats`. For `seat0`, which is already created, `seat_start` will return immediately, which means the updated `CanGraphical` state will never get written to `/run/systemd/seats`. The end result is that clients querying `sd_seat_can_graphical` won't get the correct answer for `seat0` in cases where the graphics device takes a long time to load until some other peice of seat state is updated. This commit fixes the problem by calling `seat_save` explicitly for already running seats at the time a graphics device is attached. (cherry picked from commit ad1bf59c67e8d05629a4db00bbbe4d4c1c37fe46)
* * hack around deficiencies in prctl() PR_SET_MM_*Frank Schaefer2018-10-29
| | | | (cherry picked from commit 14ee72b7d8de34a6b02767b865c3c49ceef2ed84)
* fileio: fix error propagation in link_tmpfile()Lennart Poettering2018-10-29
| | | | (cherry picked from commit eaa680c09e5701a62e8ac819211e5969eda84f2d)
* basic/hexdecoct: check for overflowZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | LGTM was complaining: > Multiplication result may overflow 'int' before it is converted to 'long'. Fix this by changing all types to ssize_t and add a check for overflow while at it. (cherry picked from commit 3d6c1844744f631995af72867d5f293430d8015b)
* bus-message: avoid wrap-around when using length read from messageZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | We would read (-1), and then add 1 to it, call message_peek_body(..., 0, ...), and when trying to make use of the data. The fuzzer test case is just for one site, but they all look similar. v2: fix two UINT8_MAX/UINT32_MAX mismatches founds by LGTM (cherry picked from commit 902000c19830f5e5a96e8948d691b42e91ecb1e7)
* bus-message: return -EBADMSG not -EINVAL on invalid !gvariant messagesZbigniew Jędrzejewski-Szmek2018-10-29
| | | | (cherry picked from commit d831fb6f2bde829f9309aea242f502587662d1cc)
* bus-message: also properly copy struct signature when skippingZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | The change is similar to that in the previous commit, but I don't have a reproducer / test case case for this one, so I'm keeping it seperate. (cherry picked from commit 3d338a302f56c0ef0445660d9856794abe1af8b5)
* bus-message: fix skipping of array fields in !gvariant messagesZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | We copied part of the string into a buffer that was off by two. If the element signature had length one, we'd copy 0 bytes and crash when looking at the "first" byte. Otherwise, we would crash because strncpy would not terminate the string. (cherry picked from commit 73777ddba5100fe6c0791cd37a91f24a515f3202)
* bus-message: fix calculation of offsets table for arraysZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | This is similar to the grandparent commit 'fix calculation of offsets table', except that now the change is for array elements. Same story as before: we need to make sure that the offsets increase enough taking alignment into account. While at it, rename 'p' to 'previous' to match similar code in other places. (cherry picked from commit f88214cf9d66c93f4d22c4c8980de9ee3ff45bab)
* bus-message: fix calculation of offsets tableZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | | | | | | | | The offsets specify the ends of variable length data. We would trust the incoming data, putting the offsets specified in our message into the offsets tables after doing some superficial verification. But when actually reading the data we apply alignment, so we would take the previous offset, align it, making it bigger then current offset, and then we'd try to read data of negative length. In the attached example, the message specifies the following offsets: [1, 4] but the alignment of those items is [1, 8] so we'd calculate the second item as starting at 8 and ending at 4. (cherry picked from commit 12603b84d2fb07603e2ea94b240c6b78ad17510e)
* bus-message: do not crash on message with a string of zero lengthZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | We'd calculate the "real" length of the string as 'item_size - 1', which does not work out well when item_size == 0. (cherry picked from commit 81b6e63029eefcb0ec03a3a7c248490e38106073)
* bus-message: let's always use -EBADMSG when the message is badZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | -EINVAL means the arguments were somehow wrong, so translate the code we get internally into -EBADMSG when returning. (cherry picked from commit 69bd42ca072dfb2f7603b1f82053063293ab54b5)
* bus-message: avoid an infinite loop on empty structuresZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | The alternative would be to treat gvariant and !gvariant messages differently. But this is a problem because we check signatures is variuos places before we have an actual message, for example in sd_bus_add_object_vtable(). It seems better to treat things consistent (i.e. follow the lowest common denominator) and disallow empty structures everywhere. (cherry picked from commit ec6bda56cbca9509b1abde1122645630caca877c)
* sd-bus: unify three code-paths which free struct bus_containerZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | | | | | | | | | | | | | | | | | We didn't free one of the fields in two of the places. $ valgrind --show-leak-kinds=all --leak-check=full \ build/fuzz-bus-message \ test/fuzz/fuzz-bus-message/leak-c09c0e2256d43bc5e2d02748c8d8760e7bc25d20 ... ==14457== HEAP SUMMARY: ==14457== in use at exit: 3 bytes in 1 blocks ==14457== total heap usage: 509 allocs, 508 frees, 51,016 bytes allocated ==14457== ==14457== 3 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==14457== at 0x4C2EBAB: malloc (vg_replace_malloc.c:299) ==14457== by 0x53AFE79: strndup (in /usr/lib64/libc-2.27.so) ==14457== by 0x4F52EB8: free_and_strndup (string-util.c:1039) ==14457== by 0x4F8E1AB: sd_bus_message_peek_type (bus-message.c:4193) ==14457== by 0x4F76CB5: bus_message_dump (bus-dump.c:144) ==14457== by 0x108F12: LLVMFuzzerTestOneInput (fuzz-bus-message.c:24) ==14457== by 0x1090F7: main (fuzz-main.c:34) ==14457== ==14457== LEAK SUMMARY: ==14457== definitely lost: 3 bytes in 1 blocks (cherry picked from commit 6d1e0f4fcba8d6f425da3dc91805db95399b3c8b)