summaryrefslogtreecommitdiffstats
path: root/src/basic (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * | basic/parse-util: remove unnecessary parenthesesZbigniew Jędrzejewski-Szmek2018-06-131-1/+1
| | |
* | | terminal-util: make file names in --cat-config output clickable linksLennart Poettering2018-06-131-1/+6
|/ /
* | tree-wide: unify how we define bit mak enumsLennart Poettering2018-06-128-43/+43
| | | | | | | | | | | | 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.
* | Merge pull request #8849 from irtimmer/feature/dns-over-tlsLennart Poettering2018-06-121-0/+8
|\ \ | | | | | | resolve: Support for DNS-over-TLS
| * | resolved: longlived TCP connectionsIwan Timmer2018-06-111-0/+8
| | | | | | | | | | | | Keep DNS over TCP connection open until it's closed by the server or after a timeout.
* | | Merge pull request #9255 from poettering/block-dev-fixesZbigniew Jędrzejewski-Szmek2018-06-125-44/+66
|\ \ \ | |/ / |/| | some block device handling fixes
| * | tree-wide: use PATH_STARTSWITH_SET() at two more placesLennart Poettering2018-06-111-4/+2
| | |
| * | core: rework how we validate DeviceAllow= settingsLennart Poettering2018-06-112-5/+28
| | | | | | | | | | | | | | | Let's make sure we don't validate "char-*" and "block-*" expressions as paths.
| * | blockdev: split out actual DM sysfs code of get_block_device_harder() into ↵Lennart Poettering2018-06-112-34/+32
| | | | | | | | | | | | | | | | | | | | | function of its own That way we can use it in code that already acquired a dev_t from some source.
| * | blockdev-util: let's initialize return parameter on successLennart Poettering2018-06-112-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | We document the rule that return values >= 0 of functions are supposed to indicate success, and that in case of success all return parameters should be initialized. Let's actually do so. Just a tiny coding style fix-up.
* | | pid1: do not reset subtree_control on already-existing units with delegationZbigniew Jędrzejewski-Szmek2018-06-111-3/+12
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-06-111-3/+3
| | | | | | | | | | | | 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
* | Merge pull request #9157 from poettering/unit-config-load-errorZbigniew Jędrzejewski-Szmek2018-06-112-2/+4
|\ \ | | | | | | introduce a new "bad-setting" unit load state in order to improve "systemctl status" output when bad settings are used
| * | core: introduce a new load state "bad-setting"Lennart Poettering2018-06-112-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge pull request #9185 from marckleinebudde/canLennart Poettering2018-06-112-0/+55
|\ \ \ | |/ / |/| | networkd: add support to configure CAN devices
| * | parse-util: add permille parser + testsMarc Kleine-Budde2018-06-092-0/+55
| | |
* | | Merge pull request #9246 from keszybz/ellipsize-invalid-mem-refLennart Poettering2018-06-114-7/+25
|\ \ \ | | | | | | | | Fix invalid memory reference in ellipsize_mem()
| * | | basic/format-table: remove parameter with constant valueZbigniew Jędrzejewski-Szmek2018-06-111-5/+4
| | | |
| * | | basic/ellipsize: do not assume the string is NUL-terminated when length is givenZbigniew Jędrzejewski-Szmek2018-06-112-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-06-092-0/+19
| | |/ | |/|
* | | util-lib: reject too long path for timedate_is_valid()Yu Watanabe2018-06-111-0/+3
| |/ |/| | | | | This should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8827.
* | Merge pull request #9213 from poettering/copy-mountLennart Poettering2018-06-082-12/+50
|\ \ | |/ |/| copy() mount detection fixes
| * copy: put a depth limit on copying file system trees recursivelyLennart Poettering2018-06-071-6/+17
| | | | | | | | | | | | | | 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-06-072-5/+33
| | | | | | | | | | | | | | | | | | | | | | | | 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-06-071-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-06-073-11/+11
|/ | | | | | | | 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.
* util: add new write_string_filef() helperLennart Poettering2018-06-063-12/+25
| | | | | This new helper combines asprintf() and write_string_file() in one, which is useful at various places to shorten the code a bit.
* main: split out reading of /proc/sys/fs/nr_open into its own functionLennart Poettering2018-06-062-0/+26
| | | | | This doesn't really reduce the code size over all, but it does make main.c shorter and more readable, and that's always a good thing.
* Merge pull request #9210 from poettering/use-delete-trailing-charsZbigniew Jędrzejewski-Szmek2018-06-062-19/+3
|\ | | | | make use of delete_trailing_chars() more
| * string-util: put together strstrip() from skip_leading_chars() and ↵Lennart Poettering2018-06-061-13/+2
| | | | | | | | delete_trailing_chars()
| * process-util: make use of delete_trailing_chars() in get_process_cmdline()Lennart Poettering2018-06-061-6/+1
| |
* | time-util: introduce common implementation of TFD_TIMER_CANCEL_ON_SET client ↵Lennart Poettering2018-06-062-0/+26
|/ | | | | | code We now use pretty much the same code at three places, let's unify that.
* util: tighten on_tty() check a bit, also check stderrLennart Poettering2018-06-061-1/+10
| | | | | | | Let's detect output redirection a bit better, cover both stdout and stderr. Fixes: #9192
* basic/log: add the log_struct terminator to macroZbigniew Jędrzejewski-Szmek2018-06-041-1/+1
| | | | | This way all callers do not need to specify it. Exhaustively tested by running test-log under valgrind ;)
* Merge pull request #9176 from keszybz/flags-setLennart Poettering2018-06-047-10/+10
|\ | | | | Macro to check if flags are set
| * basic/path-util: use FLAGS_SET in one more placeZbigniew Jędrzejewski-Szmek2018-06-041-4/+2
| |
| * Add macro for checking if some flags are setZbigniew Jędrzejewski-Szmek2018-06-046-6/+8
| | | | | | | | | | | | | | | | | | This way we don't need to repeat the argument twice. I didn't replace all instances. I think it's better to leave out: - asserts - comparisons like x & y == x, which are mathematically equivalent, but here we aren't checking if flags are set, but if the argument fits in the flags.
* | Merge pull request #9167 from keszybz/ellipsizationLennart Poettering2018-06-042-31/+42
|\ \ | |/ |/| Ellipsization fixes based on unit-testing and fuzzing
| * test-ellipsize: add tests for ellipsize_mem, fix bugsZbigniew Jędrzejewski-Szmek2018-06-021-23/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | First, ellipsize() and ellipsize_mem() should not read past the input buffer. Those functions take an explicit length for the input data, so they should not assume that the buffer is terminated by a nul. Second, ellipsization was off in various cases where wide on multi-byte characters were used. We had some basic test for ellipsize(), but apparently it wasn't enough to catch more serious cases. Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8686.
| * basic/string-util: make ellipsize() inlineZbigniew Jędrzejewski-Szmek2018-06-022-8/+4
| | | | | | | | | | Once the redundant check is removed, it's a very simple wrapper around ellipsize_mem().
* | path-util: introduce path_simplify_and_warn()Yu Watanabe2018-06-032-0/+58
| |
* | path-util: make path_make_relative() support path including dotsYu Watanabe2018-06-031-36/+32
| |
* | path-util: introduce path_simplify()Yu Watanabe2018-06-036-31/+47
| | | | | | | | | | | | | | | | The function is similar to path_kill_slashes() but also removes initial './', trailing '/.', and '/./' in the path. When the second argument of path_simplify() is false, then it behaves as the same as path_kill_slashes(). Hence, this also replaces path_kill_slashes() with path_simplify().
* | Merge pull request #9156 from shr-project/jansa/gcc8Zbigniew Jędrzejewski-Szmek2018-06-021-1/+1
|\ \ | |/ |/| time-util: fix build with gcc8 -Werror=format-truncation=
| * time-util: fix build with gcc8 -Werror=format-truncation=Martin Jansa2018-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * it fails with gcc8 when -O1 or -Os is used (and -ftree-vrp which is added by -O2 and higher isn't used) ../git/src/basic/time-util.c: In function 'format_timespan': ../git/src/basic/time-util.c:508:46: error: '%0*llu' directive output between 1 and 2147483647 bytes may cause result to exceed 'INT_MAX' [-Werror=format-truncation=] "%s"USEC_FMT".%0*"PRI_USEC"%s", ^~~~ ../git/src/basic/time-util.c:508:60: note: format string is defined here "%s"USEC_FMT".%0*"PRI_USEC"%s", ../git/src/basic/time-util.c:508:46: note: directive argument in the range [0, 18446744073709551614] "%s"USEC_FMT".%0*"PRI_USEC"%s", ^~~~ ../git/src/basic/time-util.c:507:37: note: 'snprintf' output 4 or more bytes (assuming 2147483651) into a destination of size 4294967295 k = snprintf(p, l, ^~~~~~~~~~~~~~ "%s"USEC_FMT".%0*"PRI_USEC"%s", ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p > buf ? " " : "", ~~~~~~~~~~~~~~~~~~~ a, ~~ j, ~~ b, ~~ table[i].suffix); ~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors [zj: change 'char' to 'signed char']
* | basic: set errno in raw_clone() on sparcMike Gilbert2018-06-021-6/+12
| | | | | | | | | | | | | | | | sparc sets the carry bit when a syscall fails. Use this information to set errno and return -1 as appropriate. The added test case calls raw_clone() with flags known to be invalid according to the clone(2) manpage.
* | process-util: also filter non-printable characters in get_process_com()Lennart Poettering2018-06-011-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | We already do that in get_process_cmdline(), which is very similar in behaviour otherwise. Hence, let's be safe and also filter them in get_process_comm(). Let's try to retain as much information as we can though and escape rather than suppress unprintable characters. Let's not increase comm names beyond the kernel limit on such names however. Also see discussion about this here: https://marc.info/?l=linux-api&m=152649570404881&w=2
* | string-util: tweak cellescape() a bitLennart Poettering2018-06-011-12/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | For short buffer sizes cellescape() was a bit wasteful, as it might suffice to to drop a single character to find enough place for the full four byte ellipsis, if that one character was a four character escape. With this rework we'll guarantee to drop the minimum number of characters from the end to fit in the ellipsis. If the buffers we write to are large this doesn't matter much. However, if they are short (as they are when talking about the process comm field) then it starts to matter that we put as much information as we can in the space we get.
* | escape: add an explanatory comment about buffer sizesLennart Poettering2018-06-011-0/+2
| |
* | missing: define kernel internal limit TASK_COMM_LEN in userspace tooLennart Poettering2018-06-012-1/+8
| | | | | | | | | | We already use it at two places, and we are about to add one too. Arbitrary literally hardcoded limits suck.