summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* set: drop unused set_make() function (#8879)Yu Watanabe2018-08-24
| | | | | The function causes compiler error when built with '-Ddebug=hashmap', and is not used anymore. Let's drop it.
* meson: drop 'name' argument in cc.has_argument() (#8878)Yu Watanabe2018-08-24
|
* add __nr_statx defines for extra architectures (#8872)Adam Duskett2018-08-24
| | | | | | | | | | | This includes: - arm - arm64 - alpha - powerpc64 - sparc Taken from kernel 4.16.6
* update TODOLennart Poettering2018-08-24
|
* logind: (void)ify all things we knowingly ignoreLennart Poettering2018-08-24
|
* logind: terminate cleanly on SIGTERM/SIGINTLennart Poettering2018-08-24
| | | | | | | Let's properly terminate on SIGTERM or SIGINT. Previously we'd just rely on the implicit process clean-up logic on UNIX. By shutting down properly on SIGTERM/SIGINT we make it easier to track down memory leaks by employing valgrind.
* logind: modernize Manager object allocation and freeingLennart Poettering2018-08-24
| | | | | | Let's propagate errors correctly, and stick to the usual naming and behaviour of these functions. Or in other words, make this closer to the matching code in machined.
* basic/log: always ignore errno from the enviornment (#8841)Zbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | 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.
* update TODOLennart Poettering2018-08-24
|
* tree-wide: use newa() rather than alloca() where we canLennart Poettering2018-08-24
|
* alloca: add an overflow check tooLennart Poettering2018-08-24
| | | | | | | | | Of course, alloca() shouldn't be used with anything that can grow without bounds anyway, but let's better safe than sorry, and catch this early. Since alloca() is not supposed to return an error we trigger an assert() instead, which is still better than heap trickery.
* tree-wide: be more careful with the type of array sizesLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we were a bit sloppy with the index and size types of arrays, we'd regularly use unsigned. While I don't think this ever resulted in real issues I think we should be more careful there and follow a stricter regime: unless there's a strong reason not to use size_t for array sizes and indexes, size_t it should be. Any allocations we do ultimately will use size_t anyway, and converting forth and back between unsigned and size_t will always be a source of problems. Note that on 32bit machines "unsigned" and "size_t" are equivalent, and on 64bit machines our arrays shouldn't grow that large anyway, and if they do we have a problem, however that kind of overly large allocation we have protections for usually, but for overflows we do not have that so much, hence let's add it. So yeah, it's a story of the current code being already "good enough", but I think some extra type hygiene is better. This patch tries to be comprehensive, but it probably isn't and I missed a few cases. But I guess we can cover that later as we notice it. Among smaller fixes, this changes: 1. strv_length()' return type becomes size_t 2. the unit file changes array size becomes size_t 3. DNS answer and query array sizes become size_t Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=76745
* login: drop unnecessary headersYu Watanabe2018-08-24
|
* logind: remove manager_start_slice()Zbigniew Jędrzejewski-Szmek2018-08-24
| | | | It is now unused.
* logind: split %t directory creation to a helper unitZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | Unfortunately this needs a new binary to do the mount because there's just too many special steps to outsource this to systemd-mount: - EPERM needs to be treated specially - UserRuntimeDir= setting must be obeyed - SELinux label must be adjusted This allows user@.service to be started independently of logind. So 'systemctl start user@nnn' will start the user manager for user nnn. Logind will start it too when the user logs in, and will stop it (unless lingering is enabled) when the user logs out. Fixes #7339.
* Use a dash-truncated drop-in for user-%j.slice configurationZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | | | | | This removes the UserTasksMax= setting in logind.conf. Instead, the generic TasksMax= setting on the slice should be used. Instead of a transient unit we use a drop-in to tweak the default definition of a .slice. It's better to use the normal unit mechanisms instead of creating units on the fly. This will also make it easier to start user@.service independently of logind, or set additional settings like MemoryMax= for user slices. The setting in logind is removed, because otherwise we would have two sources of "truth": the slice on disk and the logind config. Instead of trying to coordinate those two sources of configuration (and maintainer overrides to both), let's just convert to the new one fully. Right now now automatic transition mechanism is provided. logind will emit a hint when it encounters the setting, but otherwise it will be ignored. Fixes #2556.
* logind: move two functions to logind_core utility libZbigniew Jędrzejewski-Szmek2018-08-24
| | | | In preparation to reusing them later in other places...
* tests: add some tests for unit_name_is_valid() and related functionsZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | I was surprised to see that foo@bar@bar.service is a valid unit name. Apparently it is according to current code and docs.
* conf-parse: add a generic config_parse_mtu() conf file parser functionLennart Poettering2018-08-24
| | | | | | | It's mostly a wrapper around parse_mtu() but with some nicer logging. The address family is initialized from the "ltype" parameter, so that configuration file parser tables can be easily declare it.
* parse-util: add explicit parsers for MTU valuesLennart Poettering2018-08-24
| | | | | | | | | We use MTUs all over the place, let's add a unified, strict parser for it, that takes MTU ranges into account. We already have parse_ifindex() close-by, hence this appears to be a natural addition, in particular as the range checking is not entirely trivial to do, as it depends on the protocol used.
* missing: add IPV4_MIN_MTULennart Poettering2018-08-24
| | | | Similar to IPV6_MIN_MTU, let's add the same for IPv4.
* cgroup-util: fix enabling of controllers (#8816)Antique2018-08-24
| | | | | | | | | | | 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>
* meson: drop 'name' argument in cc.has_argument() (#8823)Yu Watanabe2018-08-24
| | | | | | | | | | | | | | | | This fixes the following warning with clang and meson-0.46.0, ``` WARNING: Passed invalid keyword argument "name". WARNING: This will become a hard error in the future. WARNING: Passed invalid keyword argument "name". WARNING: This will become a hard error in the future. Compiler for C supports arguments -Wno-typedef-redefinition: YES WARNING: Passed invalid keyword argument "name". WARNING: This will become a hard error in the future. WARNING: Passed invalid keyword argument "name". WARNING: This will become a hard error in the future. Compiler for C supports arguments -Wno-gnu-variable-sized-type-not-at-end: YES ```
* man: fix description of --value option for loginctl (#8820)Yu Watanabe2018-08-24
|
* meson: do not link libsystemd_static into libcore (#8813)Zbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (or in terms of the names of the actual files on disk, do not link libsystemd-shared-238.a into libcore.a). libsystemd_static is linked into libsystemd_shared, which in turn means that anything that links to libcore and libsystemd_shared will get libsystemd_static twice: $ cc -o systemd 'systemd@exe/src_core_main.c.o' -Wl,--no-undefined -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -pie -DVALGRIND -Wl,--start-group src/core/libcore.a src/shared/libsystemd-shared-238.a src/shared/libsystemd-shared-238.so -pthread -lrt -lseccomp -lselinux -lmount -lblkid -Wl,--end-group -lseccomp -lpam -L/lib64 -laudit -lkmod -lmount -lrt -lcap -lacl -lcryptsetup -lgcrypt -lip4tc -lip6tc -lseccomp -lselinux -lidn -llzma -llz4 -lblkid '-Wl,-rpath,$ORIGIN/src/shared' -Wl,-rpath-link,/home/zbyszek/src/systemd/build/src/shared This propagation of the dependency seems correct (in the sense that meson is doing the expected thing based on the given configuration). Linking was done this way in the original meson conversion. I was probably trying to get everything to compile and link, I'm not sure why this particular choice was made. In the meantime, meson has gotten better at propagating dependencies, so it's possible that this had slightly different effect in the original conversion, but I did not verify this. Either way, I think we should drop this. With the patch: $ cc -o systemd 'systemd@exe/src_core_main.c.o' -Wl,--no-undefined -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -pie -DVALGRIND -Wl,--start-group src/core/libcore.a src/shared/libsystemd-shared-238.so -pthread -lrt -lseccomp -lselinux -lmount -Wl,--end-group -lblkid -lrt -lseccomp -lpam -L/lib64 -laudit -lkmod -lselinux -lmount '-Wl,-rpath,$ORIGIN/src/shared' -Wl,-rpath-link,/home/zbyszek/src/systemd/build/src/shared This is more correct because we're not linking the same code twice. With the patch, libystemd_static is used in exactly four places: - src/shared/libsystemd-shared-238.so - src/udev/libudev.so.1.6.10 - pam_systemd.so - test-bus-error (compared to a bunch more executables before, including systemd, systemd-analyze, test-hostname, test-ns, etc.) Size savings are also noticable: $ size /var/tmp/inst?/usr/lib/systemd/libsystemd-shared-238.so text data bss dec hex filename 2397826 578488 15920 2992234 2da86a /var/tmp/inst1/usr/lib/systemd/libsystemd-shared-238.so 2397826 578488 15920 2992234 2da86a /var/tmp/inst2/usr/lib/systemd/libsystemd-shared-238.so $ size /var/tmp/inst?/usr/lib/systemd/systemd text data bss dec hex filename 1858790 261688 9320 2129798 207f86 /var/tmp/inst1/usr/lib/systemd/systemd 1556358 258704 8072 1823134 1bd19e /var/tmp/inst2/usr/lib/systemd/systemd $ du -s /var/tmp/inst? 52216 /var/tmp/inst1 50844 /var/tmp/inst2 https://github.com/google/oss-fuzz/issues/1330#issuecomment-384054530 might be related.
* tree-wide: drop redundant _cleanup_ macros (#8810)Lennart Poettering2018-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | This drops a good number of type-specific _cleanup_ macros, and patches all users to just use the generic ones. In most recent code we abstained from defining type-specific macros, and this basically removes all those added already, with the exception of the really low-level ones. Having explicit macros for this is not too useful, as the expression without the extra macro is generally just 2ch wider. We should generally emphesize generic code, unless there are really good reasons for specific code, hence let's follow this in this case too. Note that _cleanup_free_ and similar really low-level, libc'ish, Linux API'ish macros continue to be defined, only the really high-level OO ones are dropped. From now on this should really be the rule: for really low-level stuff, such as memory allocation, fd handling and so one, go ahead and define explicit per-type macros, but for high-level, specific program code, just use the generic _cleanup_() macro directly, in order to keep things simple and as readable as possible for the uninitiated. Note that before this patch some of the APIs (notable libudev ones) were already used with the high-level macros at some places and with the generic _cleanup_ macro at others. With this patch we hence unify on the latter.
* fileio.c: fix incorrect mtimeChris Lesiak2018-08-24
| | | | | | | | | | | | | | | 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
* update TODOLennart Poettering2018-08-24
|
* string-util: use fflush_and_check() where appropriateLennart Poettering2018-08-24
|
* string-util: teach strip_tab_ansi() to deal with CSO sequencesLennart Poettering2018-08-24
| | | | | | | | With the recent terminal_urlify() APIs we'll now sometimes generate clickable link CSO sequences. Hence we should also be able to remove them again from strings. This beefs up the logic to do so. Follow-up for: 23b27b39d2a3a002ad827a2e8a9872a51495d797
* basic/log: do not use global errno in log_*_errno()Zbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | | | | | | | | 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.
* basic/audit-util: always log the reason when disabling audit logsZbigniew Jędrzejewski-Szmek2018-08-24
| | | | This state is cached, and it's seems OK to log at least once.
* tree-wide: avoid assignment of r just to use in a comparisonZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | This changes r = ...; if (r < 0) to if (... < 0) when r will not be used again.
* fs-util: introduce fchmod_opath()Franck Bui2018-08-24
| | | | fchmod(2) still doesn't take file descriptors opened with O_PATH.
* test: drop unused variablesYu Watanabe2018-08-24
| | | | Follow-up for 49eb36596b72e568d4b9b785cd4544e58c89bdee.
* login: drop an unused variableYu Watanabe2018-08-24
| | | | Follow-up for 99f1229d76da4b805f8f6c6e5e4a878d17d42f93.
* bus-message: use streq_ptr() (#8786)Yu Watanabe2018-08-24
|
* Fix typoZbigniew Jędrzejewski-Szmek2018-08-24
|
* update TODOLennart Poettering2018-08-24
|
* nspawn: when running nspawn, set a $PATH including both bin + sbin by ↵Lennart Poettering2018-08-24
| | | | | | | | | | | default (#8756) We don't know what the container payload needs, hence default to a PATH with both bin and sbin included, as well as / and /usr. Follow-up for #8324 Fixes: #8698
* terminal: add internal API to format URLs for display in capable terminalsLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | Newer terminals (in particular gnome-terminal) understand special escape sequence for formatting clickable links. Let's support that to make our tool output more clickable where that's appropriate. For details see this: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda The one big issue is that 'less' currently doesn't grok this, and doesn't ignore sequence like regular terminal implementations do if they don't support it. Hence for now, let's disable URL output if a pager is used. We should revisit that though as soon as less added support for it and enough time passed for it to enter various distributions.
* timedate: move error mapping to bus-common-errors.[ch]Yu Watanabe2018-08-24
|
* user-util: trivial coding style fixesLennart Poettering2018-08-24
| | | | | Use C's downgrade-to-bool feature when comparing pointers against NULL, as we usually do.
* bash-completion: add completion for resolvectlYu Watanabe2018-08-24
|
* man: create man page for resolvectlYu Watanabe2018-08-24
|
* resolvectl: rename systemd-resolve to resolvectlYu Watanabe2018-08-24
| | | | | For the compatibility, `systemd-resolve` will be created as a symbolic link to `resolvectl`.
* tree-wide: drop spurious newlines (#8764)Lennart Poettering2018-08-24
| | | | | | | | | Double newlines (i.e. one empty lines) are great to structure code. But let's avoid triple newlines (i.e. two empty lines), quadruple newlines, quintuple newlines, …, that's just spurious whitespace. It's an easy way to drop 121 lines of code, and keeps the coding style of our sources a bit tigther.
* fs-util: export how many iterations chase_symlinks() executes at maxLennart Poettering2018-08-24
|
* fs-util: add new CHASE_STEP flag to chase_symlinks()Lennart Poettering2018-08-24
| | | | | | | | If the flag is set only a single step of the normalization is executed, and the resulting path is returned. This allows callers to normalize piecemeal, taking into account every single intermediary path of the normalization.
* sysusers: make sure to reset the returned value when EOF is reached in ↵Franck Bui2018-08-24
| | | | | | | | | | | | fget*ent_sane() wrappers (#8737) To indicate that the there're no more entries, these wrappers return false but did leave the passed pointed unmodified. However EOF is not an error and is a very common case so initialize the output argument to NULL even in this case so callers don't need to do that. Fixes: #8721