platform/upstream/systemd.git
5 years agoudevd: provide worker_hash_ops and drop manager_workers_free()
Yu Watanabe [Tue, 18 Dec 2018 06:03:50 +0000 (15:03 +0900)]
udevd: provide worker_hash_ops and drop manager_workers_free()

5 years agoudevd: use structured initializer at one more place
Yu Watanabe [Tue, 18 Dec 2018 05:50:42 +0000 (14:50 +0900)]
udevd: use structured initializer at one more place

5 years agoudevd: use worker_free() on failure in worker_new()
Yu Watanabe [Tue, 18 Dec 2018 05:49:17 +0000 (14:49 +0900)]
udevd: use worker_free() on failure in worker_new()

Otherwise, worker_monitor may not unrefed correctly.

5 years agosd-device-monitor: fix ordering of setting buffer size
Yu Watanabe [Fri, 11 Jan 2019 20:24:54 +0000 (05:24 +0900)]
sd-device-monitor: fix ordering of setting buffer size

By b1c097af8df58a94cba031a347061b7cb9b62d9b (#10239), the receive buffer
size for uevents was set by SO_RCVBUF at first, and fallback to
use SO_RCVBUFFORCE. So, as SO_RCVBUF limits to the buffer size
net.core.rmem_max, which is usually much smaller than 128MB udevd requests,
uevents buffer size was not sufficient.

This fixes the ordering of the request: SO_RCVBUFFORCE first, and
fallback to SO_RCVBUF. Then, udevd's uevent buffer size can be set to
128MB.

This also revert 903893237a2105b05671fe87b8f5d5e7417040d2.

Fixes #11314 and #10754.

5 years agoMerge pull request #11400 from ffontaine/master
Yu Watanabe [Fri, 11 Jan 2019 20:51:37 +0000 (05:51 +0900)]
Merge pull request #11400 from ffontaine/master

Fix build with older kernels

5 years agolockfile-util.c: fix build without F_OFD_SETLK
Fabrice Fontaine [Fri, 11 Jan 2019 16:30:32 +0000 (17:30 +0100)]
lockfile-util.c: fix build without F_OFD_SETLK

systemd fails to build on kernel without F_OFD_SETLK since
https://github.com/systemd/systemd/commit/9714c020fc4cda1823c2a77e3fd08aefa7d78b25

So put include missing_fcntl.h

Fixes:
 - http://autobuild.buildroot.org/results/699c078aa078240c6741da4dbd0871450ceeca92

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agomissing_syscall.h: include errno.h
Fabrice Fontaine [Fri, 11 Jan 2019 16:24:21 +0000 (17:24 +0100)]
missing_syscall.h: include errno.h

This include is needed for errno and ENOSYS

Fixes:
 - http://autobuild.buildroot.org/results/699c078aa078240c6741da4dbd0871450ceeca92

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agomissing_if_link.h: add IFLA_BOND_MODE
Fabrice Fontaine [Fri, 11 Jan 2019 16:08:48 +0000 (17:08 +0100)]
missing_if_link.h: add IFLA_BOND_MODE

systemd fails to build on kernel without IFLA_BOND_MODE (< 3.13) since
https://github.com/systemd/systemd/commit/9714c020fc4cda1823c2a77e3fd08aefa7d78b25

So put back IFLA_BOND_MODE definition

Fixes:
 - http://autobuild.buildroot.org/results/699c078aa078240c6741da4dbd0871450ceeca92

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agobasic/tmpfile-util.c: fix build without O_TMPFILE
Fabrice Fontaine [Fri, 11 Jan 2019 15:36:06 +0000 (16:36 +0100)]
basic/tmpfile-util.c: fix build without O_TMPFILE

systemd fails to build on kernel without O_TMPFILE (< 3.11) since
https://github.com/systemd/systemd/commit/dea72eda9cdbfeedd24cbe8c734ad0639bf96cde

To fix this error, include missing_fcntl.h

Fixes:
 - http://autobuild.buildroot.org/results/699c078aa078240c6741da4dbd0871450ceeca92

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agocapability: fix build without PR_CAP_AMBIENT
Fabrice Fontaine [Fri, 11 Jan 2019 15:07:00 +0000 (16:07 +0100)]
capability: fix build without PR_CAP_AMBIENT

systemd fails to build on kernel without PR_CAP_AMBIENT (< 4.3) since
https://github.com/systemd/systemd/commit/2a03bb3e65327c73008f1db485ffc75c432dc6b2

To fix this error, include missing_prctl.h in all files using
PR_CAP_AMBIENT

Fixes:
 - http://autobuild.buildroot.org/results/699c078aa078240c6741da4dbd0871450ceeca92

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agoRevert "nss: prevent PROTECT_ERRNO from squashing changes to *errnop"
Zbigniew Jędrzejewski-Szmek [Thu, 10 Jan 2019 15:09:52 +0000 (16:09 +0100)]
Revert "nss: prevent PROTECT_ERRNO from squashing changes to *errnop"

This reverts commit b26c90411343d74b15deb24bd87077848e316dab.

I don't see anythign wrong, but Ubuntu autopkgtest CI started failing fairly
consistently since this was merged. Let's see if reverting fixes things.

5 years agodocs: note that udev doesn't deal with binary attribute values (#11383)
Sam Morris [Thu, 10 Jan 2019 17:05:34 +0000 (17:05 +0000)]
docs: note that udev doesn't deal with binary attribute values (#11383)

Related to #5329.

5 years agomeson: stop setting -fPIE globally
Michael Biebl [Thu, 10 Jan 2019 11:58:27 +0000 (12:58 +0100)]
meson: stop setting -fPIE globally

Setting -fPIE globally can lead to miscompilations on certain
architectures.
This is caused by both -fPIE and -fPIC options being added to various
compilation commands. Only -fPIC is being recorded in the LTO options
section of the object. The gcc-8 LTO plugin merges -fPIC + -fPIE to
nothing. So, the compilations done by the plugin are not
position-independent and fail to link with -pie.

The simplest solution is to stop setting -fPIE globally and instead
using meson's b_pie=true option. This requires meson 0.49 or later.

Since we don't set this option in meson.build but leave it up to the
distro maintainer to set this option, do not bump the meson version
requirement.

Fixes: #10548

5 years agoRevert "logind: become the controlling terminal process before restoring VT"
Franck Bui [Thu, 10 Jan 2019 11:17:51 +0000 (12:17 +0100)]
Revert "logind: become the controlling terminal process before restoring VT"

This reverts commit ad96887a1205bad9656d280c5681f482e6d04838.

Commit adb8688 alone should be enough to fix issue #9754.

Fixes #11269

5 years agopam_systemd: reword message about not creating a session
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jan 2019 11:58:00 +0000 (12:58 +0100)]
pam_systemd: reword message about not creating a session

The message is changed from
  Cannot create session: Already running in a session...
to
  Not creating session: Already running in a session...

This is more neutral and avoids suggesting a problem.

"Will not create session: ..." was suggested, but it sounds like the action
would have yet to be performed. I think Using present continuous is better.

Fixes #10822 (for good now, I hope).

5 years agonss: prevent PROTECT_ERRNO from squashing changes to *errnop
Sam Morris [Wed, 9 Jan 2019 10:15:53 +0000 (10:15 +0000)]
nss: prevent PROTECT_ERRNO from squashing changes to *errnop

glibc passes in &errno for errnop, which means PROTECT_ERRNO ends up
squashing our intentional changes to *errnop.

Fixes #11321.

5 years agoMerge pull request #11376 from yuwata/11365-v2
Zbigniew Jędrzejewski-Szmek [Thu, 10 Jan 2019 08:08:57 +0000 (09:08 +0100)]
Merge pull request #11376 from yuwata/11365-v2

udev: initialize sockets before fork()

5 years agoMerge pull request #11350 from yuwata/logind-inhibitwhat-cleanups
Yu Watanabe [Thu, 10 Jan 2019 05:26:21 +0000 (14:26 +0900)]
Merge pull request #11350 from yuwata/logind-inhibitwhat-cleanups

login: cleanups for enum InhibitWhat

5 years agoMerge pull request #11361 from yuwata/follow-up-11352
Yu Watanabe [Thu, 10 Jan 2019 05:25:58 +0000 (14:25 +0900)]
Merge pull request #11361 from yuwata/follow-up-11352

core/socket: two follow-ups for #11352

5 years agoMerge pull request #11366 from keszybz/a-few-unrelated-cleanups
Yu Watanabe [Thu, 10 Jan 2019 05:25:25 +0000 (14:25 +0900)]
Merge pull request #11366 from keszybz/a-few-unrelated-cleanups

A few unrelated cleanups

5 years agologind: do not pass negative number to strerror
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jan 2019 13:08:29 +0000 (14:08 +0100)]
logind: do not pass negative number to strerror

5 years agoudev: open control and netlink sockets before daemonization
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jan 2019 21:41:16 +0000 (22:41 +0100)]
udev: open control and netlink sockets before daemonization

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().

5 years agoudevd: drop redundant call to sd_event_get_exit_code
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jan 2019 21:56:50 +0000 (22:56 +0100)]
udevd: drop redundant call to sd_event_get_exit_code

sd_event_loop returns the same thing anyway.

5 years agoMerge pull request #11374 from keszybz/journal-fixes
Zbigniew Jędrzejewski-Szmek [Thu, 10 Jan 2019 00:12:22 +0000 (01:12 +0100)]
Merge pull request #11374 from keszybz/journal-fixes

Journal/journal-remote/coredump fixes

5 years agojournal-remote: set a limit on the number of fields in a message
Zbigniew Jędrzejewski-Szmek [Fri, 7 Dec 2018 09:48:10 +0000 (10:48 +0100)]
journal-remote: set a limit on the number of fields in a message

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).

5 years agojournal-remote: verify entry length from header
Zbigniew Jędrzejewski-Szmek [Fri, 7 Dec 2018 11:47:14 +0000 (12:47 +0100)]
journal-remote: verify entry length from header

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

5 years agoµhttpd: use a cleanup function to call MHD_destroy_response
Zbigniew Jędrzejewski-Szmek [Fri, 7 Dec 2018 11:13:10 +0000 (12:13 +0100)]
µhttpd: use a cleanup function to call MHD_destroy_response

5 years agojournald: lower the maximum entry size limit to ½ for non-sealed fds
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 21:52:53 +0000 (22:52 +0100)]
journald: lower the maximum entry size limit to ½ for non-sealed fds

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.

5 years agojournald: when processing a native message, bail more quickly on overbig messages
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 21:50:39 +0000 (22:50 +0100)]
journald: when processing a native message, bail more quickly on overbig 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.

5 years agojournald: set a limit on the number of fields (1k)
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 21:45:02 +0000 (22:45 +0100)]
journald: set a limit on the number of fields (1k)

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.

5 years agocoredump: fix message when we fail to save a journald coredump
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 20:34:24 +0000 (21:34 +0100)]
coredump: fix message when we fail to save a journald coredump

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

5 years agobasic/process-util: limit command line lengths to _SC_ARG_MAX
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 17:48:23 +0000 (18:48 +0100)]
basic/process-util: limit command line lengths to _SC_ARG_MAX

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.

5 years agojournald: do not store the iovec entry for process commandline on stack
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 17:38:39 +0000 (18:38 +0100)]
journald: do not store the iovec entry for process commandline on stack

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.

5 years agojournald: remove unnecessary {}
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 16:53:50 +0000 (17:53 +0100)]
journald: remove unnecessary {}

5 years agocoredump: remove duplicate MESSAGE= prefix from message
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 16:33:15 +0000 (17:33 +0100)]
coredump: remove duplicate MESSAGE= prefix from message

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.

5 years agocore/mount: make mount_setup_existing_unit() not drop MOUNT_PROC_JUST_MOUNTED flag...
Yu Watanabe [Tue, 8 Jan 2019 18:35:55 +0000 (03:35 +0900)]
core/mount: make mount_setup_existing_unit() not drop MOUNT_PROC_JUST_MOUNTED flag from units

This fixes a bug introduced by ec88d1ea0591beccab97d9096fd3fd7b09bc823c.

Fixes #11362.

5 years agotimesyncd,resolved,machinectl: drop calls to sd_event_get_exit_code()
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jan 2019 22:09:37 +0000 (23:09 +0100)]
timesyncd,resolved,machinectl: drop calls to sd_event_get_exit_code()

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.

5 years agoFix a few comments
Zbigniew Jędrzejewski-Szmek [Fri, 4 Jan 2019 20:46:54 +0000 (21:46 +0100)]
Fix a few comments

5 years agosd-device: modernize code a bit
Zbigniew Jędrzejewski-Szmek [Fri, 4 Jan 2019 17:30:58 +0000 (18:30 +0100)]
sd-device: modernize code a bit

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.

5 years agoudev-node: make link_find_prioritized() return negative value when nothing found
Yu Watanabe [Tue, 8 Jan 2019 17:46:03 +0000 (02:46 +0900)]
udev-node: make link_find_prioritized() return negative value when nothing found

Fixes a bug introduced by a2554acec652fc65c8ed0c6c1fede9ba8c3693b1.

Fixes RHBZ#1662303.

5 years agocore/socket: drop unnecessary assignment to 'r'
Yu Watanabe [Tue, 8 Jan 2019 17:11:15 +0000 (02:11 +0900)]
core/socket: drop unnecessary assignment to 'r'

Follow-up for e5417345289b477a70e7515c71551ad34f968a40.

As suggested in #11352.

5 years agocore/socket: use macro to define log_address_error_errno()
Yu Watanabe [Tue, 8 Jan 2019 17:08:24 +0000 (02:08 +0900)]
core/socket: use macro to define log_address_error_errno()

Then, it is not necessary to suppress warnings.

Follow-up for ae05e1b6584eb8f48a4530f963fea2c42e891034.

5 years agologin: simplify the condtion in assertion and slightly decrease binary size
Yu Watanabe [Mon, 7 Jan 2019 17:43:00 +0000 (02:43 +0900)]
login: simplify the condtion in assertion and slightly decrease binary size

5 years agologin: use free_and_strdup() at one more place
Yu Watanabe [Mon, 7 Jan 2019 17:41:15 +0000 (02:41 +0900)]
login: use free_and_strdup() at one more place

5 years agologin: adjust range of InhibitWhat in assertions
Yu Watanabe [Mon, 7 Jan 2019 17:40:33 +0000 (02:40 +0900)]
login: adjust range of InhibitWhat in assertions

5 years agozsh completion: Prevent functions from clobbering each other, &c.
dana [Mon, 24 Dec 2018 11:15:38 +0000 (05:15 -0600)]
zsh completion: Prevent functions from clobbering each other, &c.

- Don't redefine helpers on every call
- Prefix helper names with main function name
- Adjust some helper names for consistency and convention adherance

5 years agoAdd Teclast X80 PLUS (H5C5) accel mount matrix
marvelousblack [Tue, 8 Jan 2019 11:38:56 +0000 (19:38 +0800)]
Add Teclast X80 PLUS (H5C5) accel mount matrix

5 years agoMerge pull request #11355 from yuwata/rfe-11343
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jan 2019 14:07:33 +0000 (15:07 +0100)]
Merge pull request #11355 from yuwata/rfe-11343

conf-parse: accept whitespaces before comments

5 years agoMerge pull request #11352 from yuwata/rfe-11348
Lennart Poettering [Tue, 8 Jan 2019 10:43:35 +0000 (11:43 +0100)]
Merge pull request #11352 from yuwata/rfe-11348

core/socket: logs address or path which fails to be initialized

5 years agoUnchain not related mice in 70-mouse.hwdb
Claudius Ellsel [Tue, 1 Jan 2019 20:42:26 +0000 (21:42 +0100)]
Unchain not related mice in 70-mouse.hwdb

5 years agocat: add --stderr-priority option
Michael Sloan [Sat, 5 Jan 2019 07:21:19 +0000 (23:21 -0800)]
cat: add --stderr-priority option

5 years agoMerge pull request #11344 from poettering/various-fixes
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jan 2019 09:33:09 +0000 (10:33 +0100)]
Merge pull request #11344 from poettering/various-fixes

multiple trivial fixlets, across the tree

5 years agoudevadm: refuse to run trigger, control, settle and monitor commands in chroot
Yu Watanabe [Mon, 7 Jan 2019 05:30:55 +0000 (14:30 +0900)]
udevadm: refuse to run trigger, control, settle and monitor commands in chroot

Closes #11333.

5 years agoNEWS: also mention that clock file for timesyncd may need to move
Yu Watanabe [Tue, 8 Jan 2019 04:15:14 +0000 (13:15 +0900)]
NEWS: also mention that clock file for timesyncd may need to move

Follow-up for aa2437e2aee003a361debbb34b341931caf49b3b.

Closes #11329.

5 years agotest: add testcases for the lines prefixed with whitespaces
Yu Watanabe [Tue, 8 Jan 2019 05:12:22 +0000 (14:12 +0900)]
test: add testcases for the lines prefixed with whitespaces

5 years agoconf-parser: accept whitespaces before comments
Yu Watanabe [Tue, 8 Jan 2019 04:04:57 +0000 (13:04 +0900)]
conf-parser: accept whitespaces before comments

Closes #11343.

5 years agoconf-parser: mention that unknown lvalue is ignored
Yu Watanabe [Tue, 8 Jan 2019 03:50:58 +0000 (12:50 +0900)]
conf-parser: mention that unknown lvalue is ignored

5 years agoMerge pull request #11351 from yuwata/ethtool-port-table
Yu Watanabe [Tue, 8 Jan 2019 03:23:11 +0000 (12:23 +0900)]
Merge pull request #11351 from yuwata/ethtool-port-table

ethtool: cleanups for port_table

5 years agoMerge pull request #11232 from yuwata/fix-9130-alternative
Yu Watanabe [Tue, 8 Jan 2019 03:22:21 +0000 (12:22 +0900)]
Merge pull request #11232 from yuwata/fix-9130-alternative

network: always check link is ready when address is updated

5 years agocore/socket: logs address or path which fails to be initialized
Yu Watanabe [Mon, 7 Jan 2019 19:38:29 +0000 (04:38 +0900)]
core/socket: logs address or path which fails to be initialized

Closes #11348.

5 years agocore/socket: use _cleanup_ attribute for closing fds on error
Yu Watanabe [Mon, 7 Jan 2019 19:08:32 +0000 (04:08 +0900)]
core/socket: use _cleanup_ attribute for closing fds on error

5 years agocore/socket: use log_unit_*()
Yu Watanabe [Mon, 7 Jan 2019 19:01:32 +0000 (04:01 +0900)]
core/socket: use log_unit_*()

5 years agoethtool: minimize the size of port_table
Yu Watanabe [Mon, 7 Jan 2019 18:29:21 +0000 (03:29 +0900)]
ethtool: minimize the size of port_table

Note that `_NET_DEV_PORT_MAX` is 0x100.

5 years agoethtool: use kernel defined values for NET_DEV_PORT_*
Yu Watanabe [Mon, 7 Jan 2019 18:28:47 +0000 (03:28 +0900)]
ethtool: use kernel defined values for NET_DEV_PORT_*

5 years agologin: do not use cast to bool for enum
Yu Watanabe [Mon, 7 Jan 2019 17:39:31 +0000 (02:39 +0900)]
login: do not use cast to bool for enum

5 years agoudev: rework how we handle the return value from spawned programs
Zbigniew Jędrzejewski-Szmek [Sun, 6 Jan 2019 21:17:00 +0000 (22:17 +0100)]
udev: rework how we handle the return value from spawned programs

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).

5 years agotree-wide: always declare bitflag enums the same way
Lennart Poettering [Mon, 7 Jan 2019 16:48:28 +0000 (17:48 +0100)]
tree-wide: always declare bitflag enums the same way

let's always use the 1 << x syntax. No change of behaviour or even of
the compiled binary.

5 years agojson: handle NULL explicitly in json_variant_has_type()
Lennart Poettering [Fri, 4 Jan 2019 12:24:18 +0000 (13:24 +0100)]
json: handle NULL explicitly in json_variant_has_type()

5 years agojson: fix typo
Lennart Poettering [Fri, 4 Jan 2019 12:24:40 +0000 (13:24 +0100)]
json: fix typo

5 years agojson: teach json_log() the new SYNTHETIC_ERRNO() logic
Lennart Poettering [Thu, 3 Jan 2019 11:19:10 +0000 (12:19 +0100)]
json: teach json_log() the new SYNTHETIC_ERRNO() logic

5 years agoloop-util: tweak codepath when a loopback file is "created" from an existing block...
Lennart Poettering [Mon, 31 Dec 2018 16:00:10 +0000 (17:00 +0100)]
loop-util: tweak codepath when a loopback file is "created" from an existing 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.

5 years agoloop-util: minor simplification
Lennart Poettering [Mon, 31 Dec 2018 15:56:06 +0000 (16:56 +0100)]
loop-util: minor simplification

5 years agofsck: use symbolic names where we have them
Lennart Poettering [Sun, 23 Dec 2018 18:24:40 +0000 (19:24 +0100)]
fsck: use symbolic names where we have them

5 years agostat-util: remove spurious newline
Lennart Poettering [Fri, 28 Dec 2018 18:02:05 +0000 (19:02 +0100)]
stat-util: remove spurious newline

5 years agoenv-util: normalize one more flags enum
Lennart Poettering [Thu, 3 Jan 2019 11:18:47 +0000 (12:18 +0100)]
env-util: normalize one more flags enum

5 years agoMerge pull request #11327 from keszybz/revert-dbus-address
Lennart Poettering [Mon, 7 Jan 2019 15:14:07 +0000 (16:14 +0100)]
Merge pull request #11327 from keszybz/revert-dbus-address

Revert "pam_systemd: drop setting DBUS_SESSION_BUS_ADDRESS"

5 years agoMerge pull request #11252 from evverx/use-asan-wrapper-on-travis-ci
Frantisek Sumsal [Sun, 6 Jan 2019 17:48:38 +0000 (18:48 +0100)]
Merge pull request #11252 from evverx/use-asan-wrapper-on-travis-ci

travis: run PID1, journald and everything else under ASan+UBsan

5 years agoMerge pull request #11241 from bengal/lldp-802-3-subtypes
Lennart Poettering [Sun, 6 Jan 2019 17:15:51 +0000 (18:15 +0100)]
Merge pull request #11241 from bengal/lldp-802-3-subtypes

lldp: add 802.3 OUI subtype definitions

5 years agopam_systemd: set $DBUS_SESSION_BUS_ADDRESS unconditionally
Zbigniew Jędrzejewski-Szmek [Sun, 6 Jan 2019 16:37:00 +0000 (17:37 +0100)]
pam_systemd: set $DBUS_SESSION_BUS_ADDRESS unconditionally

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.

5 years agoMerge pull request #11328 from keszybz/static-array-size-declarations
Lennart Poettering [Sun, 6 Jan 2019 13:06:59 +0000 (14:06 +0100)]
Merge pull request #11328 from keszybz/static-array-size-declarations

Use a c99 feature for additional code analysis

5 years agoman: systemctl: document effect of --all on journal output
Lucas Werkmeister [Sat, 5 Jan 2019 14:41:31 +0000 (15:41 +0100)]
man: systemctl: document effect of --all on journal output

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).

5 years agoPrint the systemd version in a format that dracut likes
Zbigniew Jędrzejewski-Szmek [Fri, 4 Jan 2019 14:07:43 +0000 (15:07 +0100)]
Print the systemd version in a format that dracut likes

- systemd 240-63-g4199f68+
+ systemd 240 (240-63-g4199f68+)

Sad, but easy.

Fixes #11330.

5 years agoMerge pull request #11337 from keszybz/build-version-h
Lennart Poettering [Sun, 6 Jan 2019 12:55:10 +0000 (13:55 +0100)]
Merge pull request #11337 from keszybz/build-version-h

meson: declare version.h as dep for libbasic

5 years agoDisable tools/choose-default-locale.sh when cross compiling
James Hilliard [Sat, 5 Jan 2019 03:28:59 +0000 (11:28 +0800)]
Disable tools/choose-default-locale.sh when cross compiling

5 years agoRevert "meson: declare version.h as dep for fuzzers"
Zbigniew Jędrzejewski-Szmek [Sat, 5 Jan 2019 12:20:52 +0000 (13:20 +0100)]
Revert "meson: declare version.h as dep for fuzzers"

This reverts commit 0c2e93b863f8ec164e7e9e119ab127a752cb1331.

This should not be necessary anymore after previous commit.
I don't quite remember what sequence of steps was failing, but right now
"meson build -Dslow-tests=true && ninja -C build fuzzers" work fine.

5 years agomeson: declare version.h as dep for libbasic
Zbigniew Jędrzejewski-Szmek [Sat, 5 Jan 2019 12:20:37 +0000 (13:20 +0100)]
meson: declare version.h as dep for libbasic

"meson build && ninja -C build systemd-cat" would fail on missing version.h.

Fixes #11335.

5 years agoUse c99 static array size declarations in exported functions too
Zbigniew Jędrzejewski-Szmek [Fri, 4 Jan 2019 11:37:10 +0000 (12:37 +0100)]
Use c99 static array size declarations in exported functions too

It seems quite useful to provide this additional information in public exported
functions.

This is a c99 feature, not supported in C++. Without the check in _sd-common.h:
FAILED: test-bus-vtable-cc@exe/src_libsystemd_sd-bus_test-bus-vtable-cc.cc.o
...
In file included from ../src/libsystemd/sd-bus/test-bus-vtable-cc.cc:9:
In file included from ../src/systemd/sd-bus-vtable.h:26:
In file included from ../src/systemd/sd-bus.h:26:
../src/systemd/sd-id128.h:38:47: error: static array size is a C99 feature, not permitted in C++
char *sd_id128_to_string(sd_id128_t id, char s[static SD_ID128_STRING_MAX]);
                                              ^

In .c files, I opted to use the define for consistency, even though we don't support
compilation with a C++ compiler, so the unconditional keyword would work too.

5 years agotree-wide: use c99 static for array size declarations
Zbigniew Jędrzejewski-Szmek [Fri, 4 Jan 2019 11:30:45 +0000 (12:30 +0100)]
tree-wide: use c99 static for array size declarations

https://hamberg.no/erlend/posts/2013-02-18-static-array-indices.html

This only works with clang, unfortunately gcc doesn't seem to implement the check
(tested with gcc-8.2.1-5.fc29.x86_64).

Simulated error:
[2/3] Compiling C object 'systemd-nspawn@exe/src_nspawn_nspawn.c.o'.
../src/nspawn/nspawn.c:3179:45: warning: array argument is too small; contains 15 elements, callee requires at least 16 [-Warray-bounds]
                        candidate = (uid_t) siphash24(arg_machine, strlen(arg_machine), hash_key);
                                            ^                                           ~~~~~~~~
../src/basic/siphash24.h:24:64: note: callee declares array parameter as static here
uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[static 16]);
                                                               ^~~~~~~~~~~~

5 years agoRevert "pam_systemd: drop setting DBUS_SESSION_BUS_ADDRESS"
Zbigniew Jędrzejewski-Szmek [Fri, 4 Jan 2019 10:19:10 +0000 (11:19 +0100)]
Revert "pam_systemd: drop setting DBUS_SESSION_BUS_ADDRESS"

This reverts commit 2b2b7228bffef626fe8e9f131095995f3d50ee3b.

Fixes #11293.

Removing the environment variable causes problems, e.g. Xfce and Chromium and
... don't communicate with the running dbus instance. If they attempt to start their
own instance, things become even more confusing. Those packages could be fixed
one by one, but removing the variable right now is causing too many problems.

5 years agoMerge pull request #11317 from filbranden/docs1
Zbigniew Jędrzejewski-Szmek [Thu, 3 Jan 2019 17:38:57 +0000 (18:38 +0100)]
Merge pull request #11317 from filbranden/docs1

Improvements to systemd.io generation

5 years agoMerge pull request #11244 from yuwata/revert-udev-changes
Zbigniew Jędrzejewski-Szmek [Thu, 3 Jan 2019 15:28:30 +0000 (16:28 +0100)]
Merge pull request #11244 from yuwata/revert-udev-changes

udev: revert bind/unbind patch and one more

5 years agoMerge pull request #11250 from yuwata/dhcp-coding-style-fixes
Zbigniew Jędrzejewski-Szmek [Thu, 3 Jan 2019 14:12:12 +0000 (15:12 +0100)]
Merge pull request #11250 from yuwata/dhcp-coding-style-fixes

dhcp,network: trivial coding style fixes

5 years agolibudev-util: make util_replace_whitespace() read only len characters
Yu Watanabe [Tue, 25 Dec 2018 03:56:48 +0000 (12:56 +0900)]
libudev-util: make util_replace_whitespace() read only len characters

This effectively reverts df8ba4fa0e8be1ff7899d08a4b6be0196c8405a0.

Fixes #11264.

5 years agoPass separate dev_t var to device_path_parse_major_minor
YunQiang Su [Tue, 25 Dec 2018 11:01:17 +0000 (19:01 +0800)]
Pass separate dev_t var to device_path_parse_major_minor

MIPS/O32's st_rdev member of struct stat is unsigned long, which
is 32bit, while dev_t is defined as 64bit, which make some problems
in device_path_parse_major_minor.

Don't pass st.st_rdev, st_mode to device_path_parse_major_minor,
while pass 2 seperate variables. The result of stat is alos copied
out into these 2 variables. Fixes: #11247

5 years agoMerge pull request #11273 from pseyfert/zsh-debugger-completion
Zbigniew Jędrzejewski-Szmek [Thu, 3 Jan 2019 14:00:26 +0000 (15:00 +0100)]
Merge pull request #11273 from pseyfert/zsh-debugger-completion

zsh/coredumpctl: additional completions

5 years agohwdb: Add Lenovo IdeaPad D330 accel mount matrix
howl [Tue, 25 Dec 2018 22:09:52 +0000 (23:09 +0100)]
hwdb: Add Lenovo IdeaPad D330 accel mount matrix

I have the fhd screen with pentium without lte model. Don't know if other models could differ in the accelerometer.

5 years agopo: update Italian translation
Daniele Medri [Wed, 2 Jan 2019 12:52:26 +0000 (13:52 +0100)]
po: update Italian translation

5 years agosleep: install default sleep.conf
Yu Watanabe [Wed, 2 Jan 2019 17:32:57 +0000 (02:32 +0900)]
sleep: install default sleep.conf

Closes #11310.

5 years agotest-json: check absolute and relative difference in floating point test
Zbigniew Jędrzejewski-Szmek [Fri, 21 Dec 2018 21:49:53 +0000 (22:49 +0100)]
test-json: check absolute and relative difference in floating point test

The test fails under valgrind, so there was an exception for valgrind.
Unfortunately that check only works when valgrind-devel headers are
available during build. But it is possible to have just valgrind installed,
or simply install it after the build, and then "valgrind test-json" would
fail.

It also seems that even without valgrind, this fails on some arm32 CPUs.
Let's do the usual-style test for absolute and relative differences.

5 years agoMerge pull request #11230 from keszybz/version-string-alt
Yu Watanabe [Thu, 3 Jan 2019 12:33:55 +0000 (21:33 +0900)]
Merge pull request #11230 from keszybz/version-string-alt

Generate version string from git describe (alternative approach)