]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 years agonetworkd-link: link_configure(); factor out link_configure_can() into separate function
Marc Kleine-Budde [Wed, 30 May 2018 09:47:23 +0000 (11:47 +0200)] 
networkd-link: link_configure(); factor out link_configure_can() into separate function

5 years agoconf-parser: add config_parse_permille()
Marc Kleine-Budde [Tue, 5 Jun 2018 14:08:29 +0000 (16:08 +0200)] 
conf-parser: add config_parse_permille()

5 years agoparse-util: add permille parser + tests
Marc Kleine-Budde [Tue, 5 Jun 2018 13:15:33 +0000 (15:15 +0200)] 
parse-util: add permille parser + tests

5 years agonetworkd: tunnel ignore wrong conf rather than assert
Susant Sahani [Fri, 8 Jun 2018 12:32:21 +0000 (18:02 +0530)] 
networkd: tunnel ignore wrong conf rather than assert

Closes #9234

5 years agoanalyze: use _cleanup_ for struct unit_times
Filipe Brandenburger [Wed, 6 Jun 2018 16:43:37 +0000 (09:43 -0700)] 
analyze: use _cleanup_ for struct unit_times

This introduces a has_data boolean field in struct unit_files which can
be used to detect the end of the array.

Use a _cleanup_ for struct unit_files in acquire_time_data and its
callers. Code for acquire_time_data is also simplified by replacing
goto's with straight returns.

Tested: By running the commands below, also checking them under valgrind.
  - build/systemd-analyze blame
  - build/systemd-analyze critical-chain
  - build/systemd-analyze plot

Fixes: Coverity finding CID 996464.
5 years agoMerge pull request #9221 from poettering/bus-track-destroy
Zbigniew Jędrzejewski-Szmek [Fri, 8 Jun 2018 13:35:45 +0000 (15:35 +0200)] 
Merge pull request #9221 from poettering/bus-track-destroy

add sd_bus_track and sd_event_source destroy callbacks too

5 years agoresolved: whenever a link starts/stops being relevant flush global DNS caches
Lennart Poettering [Fri, 8 Jun 2018 10:04:49 +0000 (12:04 +0200)] 
resolved: whenever a link starts/stops being relevant flush global DNS caches

Let's add some protection for split horizon setups, where different
zones are visible on the same global DNS servers depending on where you
come from.

Fixes: #9196
5 years agoscsi_id: use _cleanup_free_ on buffer allocated by get_file_options
Filipe Brandenburger [Thu, 7 Jun 2018 21:32:07 +0000 (14:32 -0700)] 
scsi_id: use _cleanup_free_ on buffer allocated by get_file_options

This simplifies the code a bit and hopefully fixes Coverity finding
CID 1382966. There was not actually a resource leak here (Coverity
seemed to be confused by thinking log_oom() could actually return 0),
but the fix doesn't hurt and should make this code more resilient to
future refactorings.

Tested: builds fine, manually called scsi_id, seems to work ok.

5 years agoresolved: document .local domain routing a bit more in detail
Lennart Poettering [Fri, 8 Jun 2018 09:36:11 +0000 (11:36 +0200)] 
resolved: document .local domain routing a bit more in detail

Inspired by the discussions in #8851, even though the issue appears to
be entirely unrelated to the .local domain in the end.

5 years agoMerge pull request #9213 from poettering/copy-mount
Lennart Poettering [Fri, 8 Jun 2018 10:09:23 +0000 (12:09 +0200)] 
Merge pull request #9213 from poettering/copy-mount

copy() mount detection fixes

5 years agolldp: check that lldp neighbor raw data size is in expected range
Filipe Brandenburger [Thu, 7 Jun 2018 20:46:32 +0000 (13:46 -0700)] 
lldp: check that lldp neighbor raw data size is in expected range

This fixes an insecure use of tainted data as argument to functions that
allocate memory and read from files, which could be tricked into getting
networkctl to allocate a large amount of memory and fill it with file
data.

This was uncovered by Coverity. Fixes CID 1393254.

5 years agonetworkd: add missing _cleanup_ in prefix_new
Filipe Brandenburger [Thu, 7 Jun 2018 21:37:30 +0000 (14:37 -0700)] 
networkd: add missing _cleanup_ in prefix_new

This should fix a leak of the allocated Prefix if sd_radv_prefix_new
fails for some reason.

The code was already initializing prefix to NULL and using TAKE_PTR to
return it, so only the _cleanup_ was missing.

Fixes Coverity finding CID 1382976.

5 years agoudev-builtin-usb_id: Check full range of size returned by read()
Filipe Brandenburger [Thu, 7 Jun 2018 21:11:51 +0000 (14:11 -0700)] 
udev-builtin-usb_id: Check full range of size returned by read()

This shouldn't be necessary, since read() should never return a size
larger than the size of the buffer passed in, but Coverity doesn't seem
to understand that.

We could possibly fix this with a model file for Coverity, but given
changing the code is not that much of a biggie, let's just do that
instead.

Fixes CID 996458: Overflowed or truncated value (or a value computed
from an overflowed or truncated value) `pos` used as array index.

Tested: `ninja -C build/ test`, builds without warnings, test cases pass.

5 years agoudev: fix usage of udev_device_new_from_stat_rdev() in journalctl
Filipe Brandenburger [Thu, 7 Jun 2018 20:07:56 +0000 (13:07 -0700)] 
udev: fix usage of udev_device_new_from_stat_rdev() in journalctl

The refactor in #9200 inadvertently dropped the variable assignment to
traverse the device and its hierarchy in add_matches_for_device().

This was uncovered by Coverity (CID #1393310).

Fix that by restoring the assignment.

Tested: `journalctl /dev/sda` now filters journalctl output again.

5 years agoMerge pull request #9218 from systemd/finalize-coverity
Zbigniew Jędrzejewski-Szmek [Thu, 7 Jun 2018 18:47:45 +0000 (20:47 +0200)] 
Merge pull request #9218 from systemd/finalize-coverity

coverity.sh: check that coverity responds with 200

5 years agoREADME.md: embed the Travis CI badge 9218/head
Evegeny Vereshchagin [Thu, 7 Jun 2018 17:53:43 +0000 (17:53 +0000)] 
README.md: embed the Travis CI badge

It should make it easier to keep track of the status
of daily cron jobs uploading data to Coverity Scan.

5 years agotravis: stop sending notifications to the authors of randomly chosen commits
Evegeny Vereshchagin [Thu, 7 Jun 2018 17:51:01 +0000 (17:51 +0000)] 
travis: stop sending notifications to the authors of randomly chosen commits

5 years agocoverity.sh: check that coverity responds with 200
Evegeny Vereshchagin [Tue, 5 Jun 2018 06:31:41 +0000 (06:31 +0000)] 
coverity.sh: check that coverity responds with 200

This is mostly inspired by https://github.com/pmem/pmdk/commit/7b103fd2dd54b2e5974f71fb65c81ab3713c12c5

Closes https://github.com/systemd/systemd/issues/9186.

5 years agoupdate TODO
Lennart Poettering [Thu, 7 Jun 2018 16:20:04 +0000 (18:20 +0200)] 
update TODO

5 years agoupdate TODO
Lennart Poettering [Thu, 7 Jun 2018 15:35:58 +0000 (17:35 +0200)] 
update TODO

The three ancient entries marked "bugfixes" are already fixed (in two
cases), or are not really bugs (in the other case). Let's clean this up
a bit.

5 years agoMerge pull request #9200 from poettering/device-state-fix
Lennart Poettering [Thu, 7 Jun 2018 15:04:57 +0000 (17:04 +0200)] 
Merge pull request #9200 from poettering/device-state-fix

core: rework device state serialization/enumeration

5 years agoMerge pull request #9165 from ssahani/networkd-netdevsim
Lennart Poettering [Thu, 7 Jun 2018 14:56:32 +0000 (16:56 +0200)] 
Merge pull request #9165 from ssahani/networkd-netdevsim

networkd: introduce netdev "Netdevsim" Driver

5 years agoCODING_STYLE: allow c99-style mixed code and declarations
Zbigniew Jędrzejewski-Szmek [Thu, 7 Jun 2018 13:08:02 +0000 (15:08 +0200)] 
CODING_STYLE: allow c99-style mixed code and declarations

We already allowed variables to be declared in the middle of a function
(whenever a new scope was opened), so this isn't such a big change. Sometimes
we would open a scope just to work around this prohibition.

But sometimes the code can be much clearer if the variable is declared
somewhere in the middle of a scope, in particular if the declaration is
combined with initialization or acquisition of some resources. So let's allow
this, but keep things in the old style, unless there's a good reason to move
the variable declaration to a different place.

5 years agoMerge pull request #9222 from poettering/code-quality-docs
Zbigniew Jędrzejewski-Szmek [Thu, 7 Jun 2018 14:30:56 +0000 (16:30 +0200)] 
Merge pull request #9222 from poettering/code-quality-docs

let's document the code quality tools we have set up

5 years agoHACKING: link up CODE_QUALITY.md 9222/head
Lennart Poettering [Thu, 7 Jun 2018 14:26:00 +0000 (16:26 +0200)] 
HACKING: link up CODE_QUALITY.md

5 years agodoc: add a list of code quality tools we have set up
Lennart Poettering [Thu, 7 Jun 2018 13:07:23 +0000 (15:07 +0200)] 
doc: add a list of code quality tools we have set up

Also, as a reminder all of these exist to myself.

5 years agotools: make various scripts find the top-levle git dir automatically
Lennart Poettering [Thu, 7 Jun 2018 13:07:14 +0000 (15:07 +0200)] 
tools: make various scripts find the top-levle git dir automatically

5 years agoupdate TODO 9200/head
Lennart Poettering [Mon, 4 Jun 2018 19:00:44 +0000 (21:00 +0200)] 
update TODO

5 years agoswap: trivial log message improvements
Lennart Poettering [Tue, 5 Jun 2018 18:57:08 +0000 (20:57 +0200)] 
swap: trivial log message improvements

5 years agocore: be a bit stricter when validating SYSTEMD_ALIAS udev props
Lennart Poettering [Tue, 5 Jun 2018 18:47:26 +0000 (20:47 +0200)] 
core: be a bit stricter when validating SYSTEMD_ALIAS udev props

5 years agotree-wide: fix a number of log calls that use %m but have no errno set
Lennart Poettering [Tue, 5 Jun 2018 18:18:47 +0000 (20:18 +0200)] 
tree-wide: fix a number of log calls that use %m but have no errno set

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.

5 years agocore: enumerate perpetual units in a separate per-unit-type method
Lennart Poettering [Tue, 5 Jun 2018 16:26:45 +0000 (18:26 +0200)] 
core: enumerate perpetual units in a separate per-unit-type method

Previously the enumerate() callback defined for each unit type would do
two things:

1. It would create perpetual units (i.e. -.slice, system.slice, -.mount and
   init.scope)

2. It would enumerate units from /proc/self/mountinfo, /proc/swaps and
   the udev database

With this change these two parts are split into two seperate methods:
enumerate() now only does #2, while enumerate_perpetual() is responsible
for #1. Why make this change? Well, perpetual units should have a
slightly different effect that those found through enumeration: as
perpetual units should be up unconditionally, perpetually and thus never
change state, they should also not pull in deps by their state changing,
not even when the state is first set to active. Thus, their state is
generally initialized through the per-device coldplug() method in
similar  fashion to the deserialized state from a previous run would be
put into place. OTOH units found through regular enumeration should
result in state changes (and thus pull in deps due to state changes),
hence their state should be put in effect in the catchup() method
instead. Hence, given this difference, let's also separate the
functions, so that the rule is:

1. What is created in enumerate_perpetual() should be started in
   coldplug()

2. What is created in enumerate() should be started in catchup().

5 years agocore: tighten when we unset the sysfs path of device units
Lennart Poettering [Tue, 5 Jun 2018 16:09:27 +0000 (18:09 +0200)] 
core: tighten when we unset the sysfs path of device units

Make sure that whenever we enter "dead" state we unset the sysfs path,
not just when we are changing to it due to "found" mask changes.

5 years agocore: rework how device units get set up
Lennart Poettering [Tue, 5 Jun 2018 15:28:32 +0000 (17:28 +0200)] 
core: rework how device units get set up

This reworks how device units are "powered on".

This makes sure that any device changes that might have happened while
we were restarting/reloading will be noticed properly. For that we'll
now properly serialize/deserialize both the device unit state and the
device "found" flags, and restore these initially in the "coldplug"
phase of the manager deserialization. While enumerating the udev devices
during startup we'll put together a new "found" flags mask, which we'll
the switch to in the "catchup" phase of the manager deserialization,
which follows the "coldplug" phase.

Note that during the "coldplug" phase no unit state change events are
generated, which is different for the "catchall" phase which will do
that. Thus we correctly make sure that the deserialized state won't pull
in new deps, but any device's change while we were reloading would.

Fixes: #8832
Replaces: #8675

5 years agodevice: simplify device_found_to_string_many() a tiny bit
Lennart Poettering [Tue, 5 Jun 2018 15:22:11 +0000 (17:22 +0200)] 
device: simplify device_found_to_string_many() a tiny bit

No need to maintain a NULL marker at the end of the table if we know the
size of the array anyway.

5 years agocore: add a new unit method "catchup()"
Lennart Poettering [Tue, 5 Jun 2018 14:53:22 +0000 (16:53 +0200)] 
core: add a new unit method "catchup()"

This is very similar to the existing unit method coldplug() but is
called a bit later. The idea is that that coldplug() restores the unit
state from before any prior reload/restart, i.e. puts the deserialized
state in effect. The catchup() call is then called a bit later, to
catch up with the system state for which we missed notifications while
we were reloading. This is only really useful for mount, swap and device
mount points were we should be careful to generate all missing unit
state change events (i.e. call unit_notify() appropriately) for
everything that happened while we were reloading.

5 years agocore: use safe_fclose() where appropriate
Lennart Poettering [Mon, 4 Jun 2018 21:05:39 +0000 (23:05 +0200)] 
core: use safe_fclose() where appropriate

5 years agocore: split out early-boot preset logic into a function of its own
Lennart Poettering [Mon, 4 Jun 2018 21:05:20 +0000 (23:05 +0200)] 
core: split out early-boot preset logic into a function of its own

5 years agoudev: add helper udev_device_new_from_stat_rdev()
Lennart Poettering [Mon, 4 Jun 2018 20:52:02 +0000 (22:52 +0200)] 
udev: add helper udev_device_new_from_stat_rdev()

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.

5 years agocore: split out device validation from device_found_node()
Lennart Poettering [Mon, 4 Jun 2018 19:35:30 +0000 (21:35 +0200)] 
core: split out device validation from device_found_node()

Let's separate the validate step out. Also, let's update some comments
which have long ceased to be true.

No change in behaviour.

5 years agocore: rework device_found_node() prototype
Lennart Poettering [Mon, 4 Jun 2018 16:06:05 +0000 (18:06 +0200)] 
core: rework device_found_node() prototype

let's drop the "now" argument, it's exactly what MANAGER_IS_RUNNING()
returns, hence let's use that instead to simplify things.

Moreover, let's change the add/found argument pair to become found/mask,
which allows us to change multiple flags at the same time into opposing
directions, which will be useful later on.

Also, let's change the return type to void. It's a notifier call where
callers will ignore the return value anyway as it is nothing actionable.

Should not change behaviour.

5 years agocore: split out reload propagation into its own function
Lennart Poettering [Mon, 4 Jun 2018 19:16:50 +0000 (21:16 +0200)] 
core: split out reload propagation into its own function

5 years agocore: improve error logging a bit
Lennart Poettering [Mon, 4 Jun 2018 18:29:04 +0000 (20:29 +0200)] 
core: improve error logging a bit

5 years agocore: split out bus initialization from manager_setup()
Lennart Poettering [Mon, 4 Jun 2018 18:02:59 +0000 (20:02 +0200)] 
core: split out bus initialization from manager_setup()

5 years agocore: log when unit_add_dependency() fails for some reason
Lennart Poettering [Mon, 4 Jun 2018 16:05:09 +0000 (18:05 +0200)] 
core: log when unit_add_dependency() fails for some reason

Also, proceed, as there's little we can do in this case.

5 years agocore: modernize device_update_description() a bit
Lennart Poettering [Mon, 4 Jun 2018 16:04:33 +0000 (18:04 +0200)] 
core: modernize device_update_description() a bit

5 years agocore: use device_found_to_string_many() result only on success
Lennart Poettering [Mon, 4 Jun 2018 16:03:57 +0000 (18:03 +0200)] 
core: use device_found_to_string_many() result only on success

5 years agocore: use FLAGS_SET() macro at one more place
Lennart Poettering [Mon, 4 Jun 2018 16:03:30 +0000 (18:03 +0200)] 
core: use FLAGS_SET() macro at one more place

5 years agocore: modernize device_set_sysfs() a bit
Lennart Poettering [Mon, 4 Jun 2018 16:03:02 +0000 (18:03 +0200)] 
core: modernize device_set_sysfs() a bit

5 years agocopy: put a depth limit on copying file system trees recursively 9213/head
Lennart Poettering [Thu, 7 Jun 2018 11:24:03 +0000 (13:24 +0200)] 
copy: put a depth limit on copying file system trees recursively

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

5 years agocopy: extend check for mount point crossing
Lennart Poettering [Wed, 6 Jun 2018 15:33:28 +0000 (17:33 +0200)] 
copy: extend check for mount point crossing

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.

5 years agocopy: only check for traversing mount points on directories
Filipe Brandenburger [Mon, 4 Jun 2018 21:23:14 +0000 (14:23 -0700)] 
copy: only check for traversing mount points on directories

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
5 years agohwdb: HP ZBook Studio G4 wireless switch
Alessandro Casale [Thu, 7 Jun 2018 09:43:59 +0000 (11:43 +0200)] 
hwdb: HP ZBook Studio G4 wireless switch

5 years agosd-event: document sd_event_source_set_io_fd_own() 9221/head
Lennart Poettering [Thu, 7 Jun 2018 11:07:52 +0000 (13:07 +0200)] 
sd-event: document sd_event_source_set_io_fd_own()

With this we have 100% of the sd-event symbols documented again. Yay!

5 years agosd-event: add destroy callback logic to sd-event too
Lennart Poettering [Thu, 7 Jun 2018 10:40:35 +0000 (12:40 +0200)] 
sd-event: add destroy callback logic to sd-event too

This adds what has been added to sd_bus_slot and sd_bus_track to
sd_event too.

5 years agosd-bus: also add destroy callbacks to sd_bus_track objects
Lennart Poettering [Thu, 7 Jun 2018 10:29:52 +0000 (12:29 +0200)] 
sd-bus: also add destroy callbacks to sd_bus_track objects

This augments previous work for this for sd_bus_slot objects, and adds
the same concept to sd_bus_track objects, too.

5 years agoman: update url to latest 802.1AB (2016) standard
Stefan Schweter [Wed, 6 Jun 2018 21:24:33 +0000 (23:24 +0200)] 
man: update url to latest 802.1AB (2016) standard

5 years agoMerge pull request #9208 from keszybz/async-callback-memleak
Lennart Poettering [Thu, 7 Jun 2018 08:29:05 +0000 (10:29 +0200)] 
Merge pull request #9208 from keszybz/async-callback-memleak

Async callback memleak fix and documentation cleanups

5 years agoMerge pull request #9214 from poettering/systemctl-get-processes-fix
Lennart Poettering [Thu, 7 Jun 2018 07:17:01 +0000 (09:17 +0200)] 
Merge pull request #9214 from poettering/systemctl-get-processes-fix

two small fixes for systemctl's process tree display

5 years agohwdb: Logitech Anywhere MX wheel data (#9203)
Ivan Shapovalov [Wed, 6 Jun 2018 22:51:42 +0000 (01:51 +0300)] 
hwdb: Logitech Anywhere MX wheel data (#9203)

5 years agotest-bus-util: add a test for destroy callbacks 9208/head
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 20:58:03 +0000 (22:58 +0200)] 
test-bus-util: add a test for destroy callbacks

5 years agoshared/bus-util: use the new cleanup functionality to avoid a memleak
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 09:12:25 +0000 (11:12 +0200)] 
shared/bus-util: use the new cleanup functionality to avoid a memleak

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

5 years agobus: optionally call a callbacks for cleanup
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 09:07:02 +0000 (11:07 +0200)] 
bus: optionally call a callbacks for cleanup

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.

5 years agoman: also mention EINVAL in sd_bus_slot_set_floating(3)
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 08:57:30 +0000 (10:57 +0200)] 
man: also mention EINVAL in sd_bus_slot_set_floating(3)

5 years agotest-bus-util: add a simple test for bus_request_name_async_may_reload_dbus()
Zbigniew Jędrzejewski-Szmek [Mon, 4 Jun 2018 13:15:17 +0000 (15:15 +0200)] 
test-bus-util: add a simple test for bus_request_name_async_may_reload_dbus()

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

5 years agobus-util: avoid unneeded initalization to zero
Zbigniew Jędrzejewski-Szmek [Mon, 4 Jun 2018 11:04:40 +0000 (13:04 +0200)] 
bus-util: avoid unneeded initalization to zero

5 years agoman: xinclude the generic text to talk about libsystemd pkgconfig
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 09:59:04 +0000 (11:59 +0200)] 
man: xinclude the generic text to talk about libsystemd pkgconfig

The only difference is that functions are not individually listed by name,
but that seems completely pointless, since all functions that are documented
are always exported, so the generic text tells the user all she or he needs
to know.

5 years agoMerge pull request #9201 from poettering/integration-test-unfuck
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 19:02:13 +0000 (21:02 +0200)] 
Merge pull request #9201 from poettering/integration-test-unfuck

make the integration tests great again

5 years agopid: fix ENOENT error check 9214/head
Lennart Poettering [Wed, 6 Jun 2018 18:22:41 +0000 (20:22 +0200)] 
pid: fix ENOENT error check

5 years agosystemctl: when GetProcesses() doesn't work, say for which unit
Lennart Poettering [Wed, 6 Jun 2018 17:46:23 +0000 (19:46 +0200)] 
systemctl: when GetProcesses() doesn't work, say for which unit

5 years agoMerge pull request #9212 from keszybz/null-removal-part-two
Lennart Poettering [Wed, 6 Jun 2018 15:18:19 +0000 (17:18 +0200)] 
Merge pull request #9212 from keszybz/null-removal-part-two

Small follow-up to log_struct NULL removal

5 years agoMerge pull request #9197 from poettering/make-main-shorter
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 14:05:41 +0000 (16:05 +0200)] 
Merge pull request #9197 from poettering/make-main-shorter

some smaller changes to make PID1's main() a bit shorter

5 years agoresolved: reformat message about a revoked trust anchor 9212/head
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 12:55:31 +0000 (14:55 +0200)] 
resolved: reformat message about a revoked trust anchor

LOG_MESSAGE is just a wrapper, but it keeps the arguments indented together
with the format string, so put the argument inside of the macro invocation.
(No functional change.)

Also use lowercase for "trust anchor" — it should either be all capitaled or not
at all, and it's not a proper name, so let's make it all lowercase.
Also, add a newline, to make the string more readable. "%s" can expand to
something that is quite long.

5 years agoRemove NULL terminator from two log_struct calls
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 12:44:34 +0000 (14:44 +0200)] 
Remove NULL terminator from two log_struct calls

Fixup for a1230ff972. I forgot to press "save" ;(

5 years agomain: combine a some if checks 9197/head
Lennart Poettering [Tue, 5 Jun 2018 14:07:49 +0000 (16:07 +0200)] 
main: combine a some if checks

Let's merge a few if blocks that are conditioned out the same way.

No change in behaviour.

5 years agomain: use rlimit_free_all() at one more place
Lennart Poettering [Tue, 5 Jun 2018 14:06:57 +0000 (16:06 +0200)] 
main: use rlimit_free_all() at one more place

5 years agocore: comment verbosely what the difference betweem set_manager_settings() and set_ma...
Lennart Poettering [Tue, 5 Jun 2018 14:06:19 +0000 (16:06 +0200)] 
core: comment verbosely what the difference betweem set_manager_settings() and set_manager_defaults() is

5 years agoutil: add new write_string_filef() helper
Lennart Poettering [Tue, 5 Jun 2018 14:02:32 +0000 (16:02 +0200)] 
util: add new write_string_filef() helper

This new helper combines asprintf() and write_string_file() in one,
which is useful at various places to shorten the code a bit.

5 years agomain: split out reading of /proc/sys/fs/nr_open into its own function
Lennart Poettering [Tue, 5 Jun 2018 13:21:47 +0000 (15:21 +0200)] 
main: split out reading of /proc/sys/fs/nr_open into its own function

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.

5 years agoman: add example for sd_event_add_inotify
Zbigniew Jędrzejewski-Szmek [Tue, 5 Jun 2018 10:52:21 +0000 (12:52 +0200)] 
man: add example for sd_event_add_inotify

5 years agoMerge pull request #9210 from poettering/use-delete-trailing-chars
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 10:43:47 +0000 (12:43 +0200)] 
Merge pull request #9210 from poettering/use-delete-trailing-chars

make use of delete_trailing_chars() more

5 years agoMerge pull request #9121 from poettering/sd-event-inotify
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 10:38:55 +0000 (12:38 +0200)] 
Merge pull request #9121 from poettering/sd-event-inotify

add "sd_event_add_inotify()" and use it for making PID 1 rescheduler .timer units properly on timezone change

5 years agoNEWS: add note about --runtime
Zbigniew Jędrzejewski-Szmek [Tue, 5 Jun 2018 12:25:43 +0000 (14:25 +0200)] 
NEWS: add note about --runtime

5 years agolocale: add _unused_ attribute for dummy variable
Yu Watanabe [Wed, 6 Jun 2018 08:13:12 +0000 (17:13 +0900)] 
locale: add _unused_ attribute for dummy variable

This suppresses the following warning by clang:
```
[588/1179] Compiling C object 'systemd-localed@exe/src_locale_localed.c.o'.
../src/locale/localed.c:271:39: warning: unused variable 'dummy' [-Wunused-variable]
        _cleanup_(locale_free) char **dummy = new_locale;
                                      ^
```

5 years agohwdb: add accel mount settings for Cube i7 Stylus I8L Model (#9207)
rubensa [Wed, 6 Jun 2018 10:02:35 +0000 (12:02 +0200)] 
hwdb: add accel mount settings for Cube i7 Stylus I8L Model (#9207)

There are different Cube i7 Stylus generations.

Those are identified with the printed serial code sticker on motherboard (Printed serial code on casing is not always true)

Order of Model (Old - New):

    W
    WA
    WWA
    WN(I8WN)
    I8L(With W on casing)

I own a I8L generation so the hw identification for my model does not work.

# cat /sys/class/dmi/id/sys_vendor
Cube
# сat /sys/class/dmi/id/product_name
i8-L

5 years agostring-util: put together strstrip() from skip_leading_chars() and delete_trailing_ch... 9210/head
Lennart Poettering [Wed, 6 Jun 2018 09:58:38 +0000 (11:58 +0200)] 
string-util: put together strstrip() from skip_leading_chars() and delete_trailing_chars()

5 years agoprocess-util: make use of delete_trailing_chars() in get_process_cmdline()
Lennart Poettering [Wed, 6 Jun 2018 09:58:18 +0000 (11:58 +0200)] 
process-util: make use of delete_trailing_chars() in get_process_cmdline()

5 years agoupdate TODO
Lennart Poettering [Wed, 6 Jun 2018 09:44:58 +0000 (11:44 +0200)] 
update TODO

5 years agotest: turn off the kernel's passive agressive /dev/kmsg ratelimit for our tests 9201/head
Lennart Poettering [Wed, 6 Jun 2018 08:17:01 +0000 (10:17 +0200)] 
test: turn off the kernel's passive agressive /dev/kmsg ratelimit for our tests

5 years agotest: make sure output of test TEST-03 test service ends up on console
Lennart Poettering [Wed, 6 Jun 2018 08:16:42 +0000 (10:16 +0200)] 
test: make sure output of test TEST-03 test service ends up on console

5 years agotest: disable QEMU based testing for TEST-16-EXTEND-TIMEOUT
Lennart Poettering [Tue, 5 Jun 2018 19:30:19 +0000 (21:30 +0200)] 
test: disable QEMU based testing for TEST-16-EXTEND-TIMEOUT

The test is heavily dependent on timeouts, and if we are run in
potentially very slow QEMU instances there's a good chance we'll miss
some which we normally wouldn't miss. Hence, let's test this one in
nspawn only. Given that the test is purely in service management it
shouldn't matter whether it runs in nspawn or qemu, hence keep running
it in nspawn, but don't bother with qemu.

Similar, do this for TEST-03-JOBS, too, which operates with relatively
short sleep times internally.

Fixes: #9123
5 years agoupdate TODO 9121/head
Lennart Poettering [Tue, 29 May 2018 14:20:46 +0000 (16:20 +0200)] 
update TODO

5 years agosd-event: use structure initialization instead of new0() where possible
Lennart Poettering [Wed, 6 Jun 2018 08:49:27 +0000 (10:49 +0200)] 
sd-event: use structure initialization instead of new0() where possible

5 years agocore: schedule time and timezone change events a bit before .timer elapsation events
Lennart Poettering [Tue, 29 May 2018 14:26:24 +0000 (16:26 +0200)] 
core: schedule time and timezone change events a bit before .timer elapsation events

We really should make sure that .timer units are dispatched while taking
the newest time/timezone data into account.

5 years agotime-util: introduce common implementation of TFD_TIMER_CANCEL_ON_SET client code
Lennart Poettering [Tue, 29 May 2018 10:55:33 +0000 (12:55 +0200)] 
time-util: introduce common implementation of TFD_TIMER_CANCEL_ON_SET client code

We now use pretty much the same code at three places, let's unify that.

5 years agocore: subscribe to /etc/localtime timezone changes and update timer elapsation accord...
Lennart Poettering [Mon, 28 May 2018 19:33:10 +0000 (21:33 +0200)] 
core: subscribe to /etc/localtime timezone changes and update timer elapsation accordingly

Fixes: #8233
This is our first real-life usecase for the new sd_event_add_inotify()
calls we just added.

5 years agocore: move destruction of old time event sources to manager_setup_time_change()
Lennart Poettering [Mon, 28 May 2018 19:32:03 +0000 (21:32 +0200)] 
core: move destruction of old time event sources to manager_setup_time_change()

It's a bit prettier that day as the function won't silently overwrite
any possibly pre-initialized field, and destroy it right before we
allocate a new event source.

5 years agoman: document the new sd_event_add_inotify() call
Lennart Poettering [Tue, 29 May 2018 13:59:26 +0000 (15:59 +0200)] 
man: document the new sd_event_add_inotify() call

5 years agosd-event: add test for the new sd_event_add_inotify() API
Lennart Poettering [Mon, 28 May 2018 15:25:14 +0000 (17:25 +0200)] 
sd-event: add test for the new sd_event_add_inotify() API

This tests a couple of corner cases of the sd-event API including
changing priorities of existing event sources, as well as overflow
conditions of the inotify queue.

5 years agosd-event: add new API for subscribing to inotify events
Lennart Poettering [Mon, 28 May 2018 14:26:50 +0000 (16:26 +0200)] 
sd-event: add new API for subscribing to inotify events

This adds a new call sd_event_add_inotify() which allows watching for
inotify events on specified paths.

sd-event will try to minimize the number of inotify fds allocated, and
will try to add file watches to the same inotify fd objects as far as
that's possible. Doing this kind of inotify object should optimize
behaviour in programs that watch a limited set of mostly independent
files as in most cases a single inotify object will suffice for watching
all files.

Traditionally, this kind of coalescing logic (i.e. that multiple event
sources are implemented on top of a single inotify object) was very hard
to do, as the inotify API had serious limitations: it only allowed
adding watches by path, and would implicitly merge watches installed on
the same node via different path, without letting the caller know about
whether such merging took place or not.

With the advent of O_PATH this issue can be dealt with to some point:
instead of adding a path to watch to an inotify object with
inotify_add_watch() right away, we can open the path with O_PATH first,
call fstat() on the fd, and check the .st_dev/.st_ino fields of that
against a list of watches we already have in place. If we find one we
know that the inotify_add_watch() will update the watch mask of the
existing watch, otherwise it will create a new watch. To make this
race-free we use inotify_add_watch() on the /proc/self/fd/ path of the
O_PATH fd, instead of the original path, so that we do the checking and
watch updating with guaranteed the same inode.

This approach let's us deal safely with inodes that may appear under
various different paths (due to symlinks, hardlinks, bind mounts, fs
namespaces). However it's not a perfect solution: currently the kernel
has no API for changing the watch mask of an existing watch -- unless
you have a path or fd to the original inode. This means we can "merge"
the watches of the same inode of multiple event sources correctly, but
we cannot "unmerge" it again correctly in many cases, as access to the
original inode might have been lost, due to renames, mount/unmount, or
deletions. We could in theory always keep open an O_PATH fd of the inode
to watch so that we can change the mask anytime we want, but this is
highly problematics, as it would consume too many fds (and in fact the
scarcity of fds is the reason why watch descriptors are a separate
concepts from fds) and would keep the backing mounts busy (wds do not
keep mounts busy, fds do). The current implemented approach to all this:
filter in userspace and accept that the watch mask on some inode might
be higher than necessary due to earlier installed event sources that
might have ceased to exist. This approach while ugly shouldn't be too
bad for most cases as the same inodes are probably wacthed for the same
masks in most implementations.

In order to implement priorities correctly a seperate inotify object is
allocated for each priority that is used. This way we get separate
per-priority event queues, of which we never dequeue more than a few
events at a time.

Fixes: #3982