summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* test-sizeof: another aproach to _Float128 availability detectionZbigniew Jędrzejewski-Szmek2018-08-24
|
* tree-wide: drop MSG_NOSIGNAL flag from recvmsg() invocationsLennart Poettering2018-08-24
| | | | | | | | MSG_NOSIGNAL is only defined for sendmsg(), not for recvmsg(), hence let's drop it's use, in particular as it appears to create problems on older kernels. See: https://lists.freedesktop.org/archives/systemd-devel/2018-June/040869.html
* Drop copyrights tags for "systemd authors"Zbigniew Jędrzejewski-Szmek2018-08-24
|
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* sd-bus: fix typo in commentYu Watanabe2018-08-24
|
* tree-wide: do not assign values if not usedYu Watanabe2018-08-24
|
* Correct a number of trivial typos.Chris Lamb2018-08-24
|
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-08-24
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-08-24
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* copy: rework copy_file_atomic() to copy the specified file via O_TMPFILE if ↵Lennart Poettering2018-08-24
| | | | possible
* util: allow mkdtemp_malloc() to be called with NULL patternLennart Poettering2018-08-24
| | | | In that case simply place the directory in /tmp.
* fs-util: introduce fchmod_and_chown()Yu Watanabe2018-08-24
| | | | | The new function fchmod_and_chown() is almost same as chmod_and_chown() except it takes file descriptor instead of file path.
* locale-util: on overlayfs FTW_MOUNT causes nftw(3) to not list *any* filesFranck Bui2018-08-24
| | | | | | | | | | | | | | On overlayfs, FTW_MOUNT causes nftw to not list *any* files because the condition used by glibc to verify that it's on the same mountpoint doesn't work on overlayfs, see https://bugzilla.suse.com/show_bug.cgi?id=1096807 for the details. However using FTW_MOUNT doesn't seem to be really needed when walking through the keymap directorie tree. So until the glibc or the kernel is fixed (which might take some time), let's make localectl works with overlayfs. There's a small side effect here, by which regular (non-directory) files with bind mounts will be parsed while they were skipped by the previous logic.
* timedatectl: add 'show' command to display machine-readable outputYu Watanabe2018-08-24
| | | | Closes #9249.
* test-sizeof: also print float types from ISO/IEC TS 18661-3Zbigniew Jędrzejewski-Szmek2018-08-24
|
* test-alloc-util: add casts to bools from p ointersZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | C++03: "An rvalue of arithmetic, enumeration, pointer, or pointer to member type can be converted to an rvalue of type bool. A zero value, null pointer value, or null member pointer value is converted to false; any other value is converted to true" C should behave the same because pointers are scalars in C, but let's verify that.
* tree-wide: drop !! casts to booleansZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | They are not needed, because anything that is non-zero is converted to true. C11: > 6.3.1.2: When any scalar value is converted to _Bool, the result is 0 if the > value compares equal to 0; otherwise, the result is 1. https://stackoverflow.com/questions/31551888/casting-int-to-bool-in-c-c
* test-alloc-util: add a "test" for bool castsZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | Just in case ;) There is no good place, test-alloc-util.c is as good as any, and it's quite short so far, so let's add this there.
* basic/parse-util: remove unnecessary parenthesesZbigniew Jędrzejewski-Szmek2018-08-24
|
* terminal-util: make file names in --cat-config output clickable linksLennart Poettering2018-08-24
|
* conf-parser: simplify conf_parse_path()Yu Watanabe2018-08-24
| | | | Follow-up for 97651797e83d0548aef9f808657d3518d89e5aee.
* core: when applying io/blkio per-device rules, don't remove them if they failLennart Poettering2018-08-24
| | | | | These devices might show up later, hence leave the rules as they are. Applying the limits should not alter configuration.
* tree-wide: unify how we define bit mak enumsLennart Poettering2018-08-24
| | | | | | Let's always write "1 << 0", "1 << 1" and so on, except where we need more than 31 flag bits, where we write "UINT64(1) << 0", and so on to force 64bit values.
* tree-wide: drop trailing whitespaceLennart Poettering2018-08-24
|
* tree-wide: use PATH_STARTSWITH_SET() at two more placesLennart Poettering2018-08-24
|
* core: rework how we validate DeviceAllow= settingsLennart Poettering2018-08-24
| | | | | Let's make sure we don't validate "char-*" and "block-*" expressions as paths.
* cgroup: beef up device lookup logic for block devicesLennart Poettering2018-08-24
| | | | Let's chase block devices through btrfs and LUKS like we do elsewhere.
* pid1: do not reset subtree_control on already-existing units with delegationZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | | | Fixes #8364. Reproducer: $ sudo systemd-run -t -p Delegate=yes bash # mkdir /sys/fs/cgroup/system.slice/run-u6958.service/supervisor # echo $$ > /sys/fs/cgroup/system.slice/run-u6958.service/supervisor/cgroup.procs # echo +memory > /sys/fs/cgroup/system.slice/run-u6958.service/cgroup.subtree_control # cat /sys/fs/cgroup/system.slice/run-u6958.service/cgroup.subtree_control memory # systemctl daemon-reload # cat /sys/fs/cgroup/system.slice/run-u6958.service/cgroup.subtree_control (empty) With patch, the last command shows 'memory'.
* basic/path-util: fix ordering in error messageZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | Jun 11 14:29:12 krowka systemd[1]: /etc/systemd/system/workingdir.service:6: = path is not normalizedWorkingDirectory: /../../etc ↓ Jun 11 14:32:12 krowka systemd[1]: /etc/systemd/system/workingdir.service:6: WorkingDirectory= path is not normalized: /../../etc
* core: introduce a new load state "bad-setting"Lennart Poettering2018-08-24
| | | | | | | | | | | | | | | | | | Since bb28e68477a3a39796e4999a6cbc6ac6345a9159 parsing failures of certain unit file settings will result in load failures of units. This introduces a new load state "bad-setting" that is entered in precisely this case. With this addition error messages on bad settings should be a lot more explicit, as we don't have to show some generic "errno" error in that case, but can explicitly say that a bad setting is at fault. Internally this unit load state is entered as soon as any configuration loader call returns ENOEXEC. Hence: config parser calls should return ENOEXEC now for such essential unit file settings. Turns out, they generally already do. Fixes: #9107
* conf-parser: add config_parse_permille()Marc Kleine-Budde2018-08-24
|
* parse-util: add permille parser + testsMarc Kleine-Budde2018-08-24
|
* basic/format-table: remove parameter with constant valueZbigniew Jędrzejewski-Szmek2018-08-24
|
* basic/ellipsize: do not assume the string is NUL-terminated when length is givenZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | | | | | oss-fuzz flags this as: ==1==WARNING: MemorySanitizer: use-of-uninitialized-value 0. 0x7fce77519ca5 in ascii_is_valid systemd/src/basic/utf8.c:252:9 1. 0x7fce774d203c in ellipsize_mem systemd/src/basic/string-util.c:544:13 2. 0x7fce7730a299 in print_multiline systemd/src/shared/logs-show.c:244:37 3. 0x7fce772ffdf3 in output_short systemd/src/shared/logs-show.c:495:25 4. 0x7fce772f5a27 in show_journal_entry systemd/src/shared/logs-show.c:1077:15 5. 0x7fce772f66ad in show_journal systemd/src/shared/logs-show.c:1164:29 6. 0x4a2fa0 in LLVMFuzzerTestOneInput systemd/src/fuzz/fuzz-journal-remote.c:64:21 ... I didn't reproduce the issue, but this looks like an obvious error: the length is specified, so we shouldn't use the string with any functions for normal C-strings.
* basic/utf8: add ascii_is_valid_n()Zbigniew Jędrzejewski-Szmek2018-08-24
|
* util-lib: reject too long path for timedate_is_valid()Yu Watanabe2018-08-24
| | | | This should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8827.
* sd-event: add destroy callback logic to sd-event tooLennart Poettering2018-08-24
| | | | | This adds what has been added to sd_bus_slot and sd_bus_track to sd_event too.
* sd-bus: also add destroy callbacks to sd_bus_track objectsLennart Poettering2018-08-24
| | | | | This augments previous work for this for sd_bus_slot objects, and adds the same concept to sd_bus_track objects, too.
* copy: put a depth limit on copying file system trees recursivelyLennart Poettering2018-08-24
| | | | | | | This is a safety net against bind mount cycles, as such pick it relatively high at 2048 for now. As suggested by @filbranden on #9213
* copy: extend check for mount point crossingLennart Poettering2018-08-24
| | | | | | | | | | | | We do this checks as protection against bind mount cycles on the same file system. However, the check wasn't really effective for that, as it would only detect cycles A → B → A this way. By using fs_is_mount_point() we'll also detect cycles A → A. Also, while we are at it, make these file system boundary checks optional. This is not used anywhere, but might be eventually... Most importantly though add a longer blurb explanation the why.
* copy: only check for traversing mount points on directoriesFilipe Brandenburger2018-08-24
| | | | | | | | | | | | | | | | | | This fixes the copy routines on overlay filesystem, which typically returns the underlying st_dev for files, symlinks, etc. The value of st_dev is guaranteed to be the same for directories, so checking it on directories only fixes this code on overlay filesystem and still keeps it from traversing mount points (which was the original intent.) There's a small side effect here, by which regular (non-directory) files with bind mounts will be copied by the new logic (while they were skipped by the previous logic.) Tested: ./build/test-copy with an overlay on /tmp. Fixes: #9134
* tree-wide: fix a number of log calls that use %m but have no errno setLennart Poettering2018-08-24
| | | | | | | | This is mostly fall-out from d1a1f0aaf0d2f08c60d1e0d32e646439d99f58dc, however some cases are older bugs. There might be more issues lurking, this was a simple grep for "%m" across the tree, with all lines removed that mention "errno" at all.
* udev: add helper udev_device_new_from_stat_rdev()Lennart Poettering2018-08-24
| | | | | | This is a simple wrapper around udev_device_new_from_devnum(), and uses the data from a struct stat's .st_rdev field to derive the udev_device object.
* shared/bus-util: use the new cleanup functionality to avoid a memleakZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the async callbacks didn't get a chance to finish properly, we'd leak memory. The output from test-bus-util with additional log line in the callbacks to show what is happening: $ build/test-bus-util /* test_name_async (0) */ Bus test-bus: changing state UNSET → OPENING Bus test-bus: changing state OPENING → AUTHENTICATING Bus test-bus: changing state AUTHENTICATING → HELLO Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RequestName cookie=2 reply_cookie=0 signature=su error-name=n/a error-message=n/a Got message type=method_return sender=org.freedesktop.DBus destination=:1.732 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=1 signature=s error-name=n/a error-message=n/a Bus test-bus: changing state HELLO → RUNNING Bus test-bus: changing state RUNNING → CLOSED request_name_destroy_callback n_ref=1 /* test_name_async (20) */ Bus test-bus: changing state UNSET → OPENING Bus test-bus: changing state OPENING → AUTHENTICATING Bus test-bus: changing state AUTHENTICATING → HELLO stage 0: sd_bus_process returned 1 Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RequestName cookie=2 reply_cookie=0 signature=su error-name=n/a error-message=n/a stage 1: sd_bus_process returned 1 Got message type=method_return sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=1 signature=s error-name=n/a error-message=n/a Bus test-bus: changing state HELLO → RUNNING stage 2: sd_bus_process returned 1 Got message type=signal sender=org.freedesktop.DBus.Local destination=n/a path=/org/freedesktop/DBus/Local interface=org.freedesktop.DBus.Local member=Connected cookie=4294967295 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a stage 3: sd_bus_process returned 1 Got message type=signal sender=org.freedesktop.DBus destination=:1.733 path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=NameAcquired cookie=4294967295 reply_cookie=0 signature=s error-name=n/a error-message=n/a stage 4: sd_bus_process returned 1 Got message type=error sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=2 signature=s error-name=org.freedesktop.DBus.Error.AccessDenied error-message=Request to own name refused by policy Unable to request name, will retry after reloading DBus configuration: Request to own name refused by policy Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=ReloadConfig cookie=3 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a request_name_destroy_callback n_ref=2 stage 5: sd_bus_process returned 1 Got message type=method_return sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=3 signature= error-name=n/a error-message=n/a Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RequestName cookie=4 reply_cookie=0 signature=su error-name=n/a error-message=n/a request_name_destroy_callback n_ref=1 stage 6: sd_bus_process returned 1 Got message type=error sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=4 signature=s error-name=org.freedesktop.DBus.Error.AccessDenied error-message=Request to own name refused by policy Unable to request name, failing connection: Request to own name refused by policy Bus test-bus: changing state RUNNING → CLOSING stage 7: sd_bus_process returned 1 Bus test-bus: changing state CLOSING → CLOSED stage 8: sd_bus_process returned 1 stage 9: sd_bus_process returned -104 Processing failed: Connection reset by peer
* bus: optionally call a callbacks for cleanupZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | This adds a function sd_bus_slot_set_destroy_callback() to set a function which can free userdata or perform other cleanups. sd_bus_slot_get_destory_callback() queries the callback, and is included for completeness. Without something like this, for floating asynchronous callbacks, which might be called or not, depending on the sequence of events, it's hard to perform resource cleanup. The alternative would be to always perform the cleanup from the caller too, but that requires more coordination and keeping of some shared state. It's nicer to keep the cleanup contained between the callback and the function that requests the callback.
* test-bus-util: add a simple test for bus_request_name_async_may_reload_dbus()Zbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | This shows a minor memleak: ==1883== 24 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==1883== at 0x4C2DBAB: malloc (vg_replace_malloc.c:299) ==1883== by 0x4E9D385: malloc_multiply (alloc-util.h:69) ==1883== by 0x4EA2959: bus_request_name_async_may_reload_dbus (bus-util.c:1841) ==1883== by ... The exchange of messages is truncated at two different points: once right after the first callback is requested, and the second time after the full sequence has run (usually resulting in an error because of policy).
* bus-util: avoid unneeded initalization to zeroZbigniew Jędrzejewski-Szmek2018-08-24
|
* Remove NULL terminator from two log_struct callsZbigniew Jędrzejewski-Szmek2018-08-24
| | | | Fixup for a1230ff972. I forgot to press "save" ;(