summaryrefslogtreecommitdiffstats
path: root/test (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-01-10udev: open control and netlink sockets before daemonizationZbigniew Jędrzejewski-Szmek1-33/+34
c4b69e990f962128cc6975e36e91e9ad838fa2c4 effectively moved the initalization of socket. Before that commit: run → listen_fds → udev_ctrl_new → udev_ctrl_new_from_fd → socket() After: run → main_loop → manager_new → udev_ctrl_new_from_fd → socket() The problem is that main_loop was called after daemonization. Move manager_new out of main_loop and before daemonization. Fixes #11314 (hopefully ;)). v2: Yu Watanabe sd_event is initialized in main_loop().
2019-01-10udevd: drop redundant call to sd_event_get_exit_codeZbigniew Jędrzejewski-Szmek1-12/+3
sd_event_loop returns the same thing anyway.
2019-01-09journal-remote: set a limit on the number of fields in a messageZbigniew Jędrzejewski-Szmek3-3/+12
Existing use of E2BIG is replaced with ENOBUFS (entry too long), and E2BIG is reused for the new error condition (too many fields). This matches the change done for systemd-journald, hence forming the second part of the fix for CVE-2018-16865 (https://bugzilla.redhat.com/show_bug.cgi?id=1653861).
2019-01-09journal-remote: verify entry length from headerZbigniew Jędrzejewski-Szmek1-10/+24
Calling mhd_respond(), which ulimately calls MHD_queue_response() is ineffective at point, becuase MHD_queue_response() immediately returns MHD_NO signifying an error, because the connection is in state MHD_CONNECTION_CONTINUE_SENT. As Christian Grothoff kindly explained: > You are likely calling MHD_queue_repsonse() too late: once you are > receiving upload_data, HTTP forces you to process it all. At this time, > MHD has already sent "100 continue" and cannot take it back (hence you > get MHD_NO!). > > In your request handler, the first time when you are called for a > connection (and when hence *upload_data_size == 0 and upload_data == > NULL) you must check the content-length header and react (with > MHD_queue_response) based on this (to prevent MHD from automatically > generating 100 continue). If we ever encounter this kind of error, print a warning and immediately abort the connection. (The alternative would be to keep reading the data, but ignore it, and return an error after we get to the end of data. That is possible, but of course puts additional load on both the sender and reciever, and doesn't seem important enough just to return a good error message.) Note that sending of the error does not work (the connection is always aborted when MHD_queue_response is used with MHD_RESPMEM_MUST_FREE, as in this case) with libµhttpd 0.59, but works with 0.61: https://src.fedoraproject.org/rpms/libmicrohttpd/pull-request/1
2019-01-09µhttpd: use a cleanup function to call MHD_destroy_responseZbigniew Jędrzejewski-Szmek3-47/+18
2019-01-09journald: lower the maximum entry size limit to ½ for non-sealed fdsZbigniew Jędrzejewski-Szmek1-2/+4
We immediately read the whole contents into memory, making thigs much more expensive. Sealed fds should be used instead since they are more efficient on our side.
2019-01-09journald: when processing a native message, bail more quickly on overbig ↵Zbigniew Jędrzejewski-Szmek1-28/+37
messages We'd first parse all or most of the message, and only then consider if it is not too large. Also, when encountering a single field over the limit, we'd still process the preceding part of the message. Let's be stricter, and check size limits early, and let's refuse the whole message if it fails any of the size limits.
2019-01-09journald: set a limit on the number of fields (1k)Zbigniew Jędrzejewski-Szmek2-0/+8
We allocate a iovec entry for each field, so with many short entries, our memory usage and processing time can be large, even with a relatively small message size. Let's refuse overly long entries. CVE-2018-16865 https://bugzilla.redhat.com/show_bug.cgi?id=1653861 What from I can see, the problem is not from an alloca, despite what the CVE description says, but from the attack multiplication that comes from creating many very small iovecs: (void* + size_t) for each three bytes of input message.
2019-01-09coredump: fix message when we fail to save a journald coredumpZbigniew Jędrzejewski-Szmek1-2/+2
If creation of the message failed, we'd write a bogus entry: systemd-coredump[1400]: Cannot store coredump of 416 (systemd-journal): No space left on device systemd-coredump[1400]: MESSAGE=Process 416 (systemd-journal) of user 0 dumped core. systemd-coredump[1400]: Coredump diverted to
2019-01-09basic/process-util: limit command line lengths to _SC_ARG_MAXZbigniew Jędrzejewski-Szmek1-48/+25
This affects systemd-journald and systemd-coredump. Example entry: $ journalctl -o export -n1 'MESSAGE=Something logged' __CURSOR=s=976542d120c649f494471be317829ef9;i=34e;b=4871e4c474574ce4a462dfe3f1c37f06;m=c7d0c37dd2;t=57c4ac58f3b98;x=67598e942bd23dc0 __REALTIME_TIMESTAMP=1544035467475864 __MONOTONIC_TIMESTAMP=858200964562 _BOOT_ID=4871e4c474574ce4a462dfe3f1c37f06 PRIORITY=6 _UID=1000 _GID=1000 _CAP_EFFECTIVE=0 _SELINUX_CONTEXT=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 _AUDIT_SESSION=1 _AUDIT_LOGINUID=1000 _SYSTEMD_OWNER_UID=1000 _SYSTEMD_UNIT=user@1000.service _SYSTEMD_SLICE=user-1000.slice _SYSTEMD_USER_SLICE=-.slice _SYSTEMD_INVOCATION_ID=1c4a469986d448719cb0f9141a10810e _MACHINE_ID=08a5690a2eed47cf92ac0a5d2e3cf6b0 _HOSTNAME=krowka _TRANSPORT=syslog SYSLOG_FACILITY=17 SYSLOG_IDENTIFIER=syslog-caller MESSAGE=Something logged _COMM=poc _EXE=/home/zbyszek/src/systemd-work3/poc _SYSTEMD_CGROUP=/user.slice/user-1000.slice/user@1000.service/gnome-terminal-server.service _SYSTEMD_USER_UNIT=gnome-terminal-server.service SYSLOG_PID=4108 SYSLOG_TIMESTAMP=Dec 5 19:44:27 _PID=4108 _CMDLINE=./poc AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA> _SOURCE_REALTIME_TIMESTAMP=1544035467475848 $ journalctl -o export -n1 'MESSAGE=Something logged' --output-fields=_CMDLINE|wc 6 2053 2097410 2MB might be hard for some clients to use meaningfully, but OTOH, it is important to log the full commandline sometimes. For example, when the program is crashing, the exact argument list is useful.
2019-01-09journald: do not store the iovec entry for process commandline on stackZbigniew Jędrzejewski-Szmek4-30/+38
This fixes a crash where we would read the commandline, whose length is under control of the sending program, and then crash when trying to create a stack allocation for it. CVE-2018-16864 https://bugzilla.redhat.com/show_bug.cgi?id=1653855 The message actually doesn't get written to disk, because journal_file_append_entry() returns -E2BIG.
2019-01-09journald: remove unnecessary {}Zbigniew Jędrzejewski-Szmek1-3/+1
2019-01-09coredump: remove duplicate MESSAGE= prefix from messageZbigniew Jędrzejewski-Szmek1-2/+3
systemd-coredump[9982]: MESSAGE=Process 771 (systemd-journal) of user 0 dumped core. systemd-coredump[9982]: Coredump diverted to /var/lib/systemd/coredump/core... log_dispatch() calls log_dispatch_internal() which calls write_to_journal() which appends MESSAGE= on its own.
2019-01-09core/mount: make mount_setup_existing_unit() not drop ↵Yu Watanabe1-3/+3
MOUNT_PROC_JUST_MOUNTED flag from units This fixes a bug introduced by ec88d1ea0591beccab97d9096fd3fd7b09bc823c. Fixes #11362.
2019-01-08timesyncd,resolved,machinectl: drop calls to sd_event_get_exit_code()Zbigniew Jędrzejewski-Szmek3-9/+4
In all three cases, sd_event_loop() will return the exit code anyway. If sd_event_loop() returns negative, failure is logged and results in an immediate return. Otherwise, we don't care if sd_event_loop() returns 0 or positive, because the return value feeds into DEFINE_MAIN_FUNCTION(), which doesn't make the distinction.
2019-01-08Fix a few commentsZbigniew Jędrzejewski-Szmek3-8/+6
2019-01-08sd-device: modernize code a bitZbigniew Jędrzejewski-Szmek1-53/+18
Empty line between setting the output parameter and return is removed. I like to think about both steps as part of returning from the function, and there's no need to separate them. Similarly, if we need to unset a pointer after successfully passing ownership, use TAKE_PTR and do it immediately after the ownership change, without an empty line inbetween.
2019-01-08udev-node: make link_find_prioritized() return negative value when nothing foundYu Watanabe1-0/+3
Fixes a bug introduced by a2554acec652fc65c8ed0c6c1fede9ba8c3693b1. Fixes RHBZ#1662303.
2019-01-08core/socket: drop unnecessary assignment to 'r'Yu Watanabe1-23/+15
Follow-up for e5417345289b477a70e7515c71551ad34f968a40. As suggested in #11352.
2019-01-08core/socket: use macro to define log_address_error_errno()Yu Watanabe1-10/+7
Then, it is not necessary to suppress warnings. Follow-up for ae05e1b6584eb8f48a4530f963fea2c42e891034.
2019-01-08login: simplify the condtion in assertion and slightly decrease binary sizeYu Watanabe1-10/+2
2019-01-08login: use free_and_strdup() at one more placeYu Watanabe1-7/+2
2019-01-08login: adjust range of InhibitWhat in assertionsYu Watanabe1-1/+1
2019-01-08zsh completion: Prevent functions from clobbering each other, &c.dana19-82/+147
- Don't redefine helpers on every call - Prefix helper names with main function name - Adjust some helper names for consistency and convention adherance
2019-01-08Add Teclast X80 PLUS (H5C5) accel mount matrixmarvelousblack1-0/+4
2019-01-08Unchain not related mice in 70-mouse.hwdbClaudius Ellsel1-0/+36
2019-01-08cat: add --stderr-priority optionMichael Sloan2-16/+57
2019-01-08udevadm: refuse to run trigger, control, settle and monitor commands in chrootYu Watanabe4-0/+24
Closes #11333.
2019-01-08NEWS: also mention that clock file for timesyncd may need to moveYu Watanabe1-0/+2
Follow-up for aa2437e2aee003a361debbb34b341931caf49b3b. Closes #11329.
2019-01-08test: add testcases for the lines prefixed with whitespacesYu Watanabe1-5/+17
2019-01-08conf-parser: accept whitespaces before commentsYu Watanabe1-1/+1
Closes #11343.
2019-01-08conf-parser: mention that unknown lvalue is ignoredYu Watanabe1-1/+1
2019-01-07core/socket: logs address or path which fails to be initializedYu Watanabe1-8/+19
Closes #11348.
2019-01-07core/socket: use _cleanup_ attribute for closing fds on errorYu Watanabe1-29/+28
2019-01-07core/socket: use log_unit_*()Yu Watanabe1-4/+4
2019-01-07ethtool: minimize the size of port_tableYu Watanabe1-3/+3
Note that `_NET_DEV_PORT_MAX` is 0x100.
2019-01-07ethtool: use kernel defined values for NET_DEV_PORT_*Yu Watanabe1-8/+8
2019-01-07login: do not use cast to bool for enumYu Watanabe2-3/+3
2019-01-07udev: rework how we handle the return value from spawned programsZbigniew Jędrzejewski-Szmek2-30/+20
When running PROGRAM="...", we would log systemd-udevd[447]: Failed to wait spawned command '...': Input/output error no matter why the program actually failed, at error level. The code wouldn't distinguish between an internal failure and a failure in the program being called and run sd_event_exit(..., -EIO) on any kind of error. EIO is rather misleading here, becuase it suggests a serious error. on_spawn_sigchld is updated to set the return code to distinguish failure to spawn, including the program being killed by a signal (a negative return value), and the program failing (positive return value). The logging levels are adjusted, so that for PROGRAM= calls, which are essentially "if" statements, we only log at debug level (unless we get a timeout or segfault or another unexpected error).
2019-01-07tree-wide: always declare bitflag enums the same wayLennart Poettering8-44/+44
let's always use the 1 << x syntax. No change of behaviour or even of the compiled binary.
2019-01-07json: handle NULL explicitly in json_variant_has_type()Lennart Poettering1-0/+2
2019-01-07json: fix typoLennart Poettering1-1/+1
2019-01-07json: teach json_log() the new SYNTHETIC_ERRNO() logicLennart Poettering2-5/+1
2019-01-07loop-util: tweak codepath when a loopback file is "created" from an existing ↵Lennart Poettering1-2/+2
block device Be more careful with initialized of the 'relinquished' boolean field, and let's return the fd, like we do for the regular codepath, too.
2019-01-07loop-util: minor simplificationLennart Poettering1-2/+1
2019-01-07fsck: use symbolic names where we have themLennart Poettering1-1/+1
2019-01-07stat-util: remove spurious newlineLennart Poettering1-1/+0
2019-01-07env-util: normalize one more flags enumLennart Poettering1-3/+3
2019-01-06pam_systemd: set $DBUS_SESSION_BUS_ADDRESS unconditionallyZbigniew Jędrzejewski-Szmek1-12/+0
There's very little lost if the variable is set for a socket that isn't connectible, but a lot lost (races, ...) if it's not set but the socket exists. Also, drop the FIXME note, since we don't plan to revert this revert any time soon.
2019-01-06man: systemctl: document effect of --all on journal outputLucas Werkmeister1-0/+4
Based on the journalctl documentation of this option added in 23ad99b519 (#10527), but with the first reference to “fields” replaced by “journal messages”, since I think it’s less common to show other fields with `systemctl status` (though it’s possible with the `-o` option).