Daniel Mack [Mon, 22 Sep 2014 16:20:14 +0000 (18:20 +0200)]
sd-bus: sync kdbus.h (API+ABI break)
The kdbus logic name registry logic was changed to transport the actual
name to acquire, release or report in a kdbus item.
This brings the name API a little more in line with other calls, and allows
for later augmentation.
Follow that change on the systemd side.
Emil Renner Berthing [Fri, 19 Sep 2014 18:26:53 +0000 (20:26 +0200)]
util: avoid non-portable __WORDSIZE
Lets not unnecessarily rely on __WORDSIZE, which is not clearly specified
by any spec. Use explicit size comparisons if we're not interested in the
WORDSIZE, anyway.
(David: adjust commit message to explain why we do this)
David Herrmann [Mon, 22 Sep 2014 16:05:19 +0000 (18:05 +0200)]
terminal: signal object removal during sysview_context_stop()
Now that we no longer propagate callback return values, we can safely call
into user-callbacks during sysview_context_stop(). This way, users can
rely on all objects to be removed via callbacks (except if they failed
during object creation). This avoids duplicating any object hashtables on
the users' side and reduces memory consumption.
David Herrmann [Mon, 22 Sep 2014 15:55:31 +0000 (17:55 +0200)]
terminal: handle callback errors in sysview instead of propagating them
We cannot sanely propagate error codes if we call into user-callbacks
multiple times for multiple objects. There is no way to merge those errors
or somehow propagate them.
However, we can just act similar to sd-event and print a log-message while
discarding the values. This way, we allow error-returns, but can properly
continue working on our objects.
David Herrmann [Mon, 22 Sep 2014 15:37:21 +0000 (17:37 +0200)]
terminal: allow user-context to be retrieved/stored
Add "userdata" storage to a bunch of external objects, namely displays and
sessions. Furthermore, add some property retrieval helpers.
This is required if we want external API users to not duplicate our own
object hashtables, but retrieve context from the objects themselves.
David Herrmann [Mon, 22 Sep 2014 15:34:13 +0000 (17:34 +0200)]
terminal: make evdev logind-matches per session
Instead of adding matches per device, we now add logind matches per
session. This reduces the number of matches considerably and saves
resources.
Zbigniew Jędrzejewski-Szmek [Mon, 22 Sep 2014 13:15:49 +0000 (09:15 -0400)]
exit-status.c: bring EXIT_BUS_ENDPOINT label in line with others
Zbigniew Jędrzejewski-Szmek [Mon, 22 Sep 2014 13:13:38 +0000 (09:13 -0400)]
man: fix typo and add link
David Herrmann [Sat, 20 Sep 2014 16:42:29 +0000 (18:42 +0200)]
login: add public sd_session_get_desktop() API
The desktop brand is stored as DESKTOP variable for sessions. It can be
set arbitrarily by the session owner and identifies the desktop
environment that is running on that session.
David Herrmann [Mon, 22 Sep 2014 10:49:47 +0000 (12:49 +0200)]
bus: align kdbus ioctl parameters to 8byte
All kdbus ioctl arguments must be 8byte aligned. Make sure we use
alloca_align() and _alignas_(8) in all situations where gcc doesn't
guarantee 8-byte alignment.
Note that objects on the stack are always 8byte aligned as we put
_alignas_(8) into the structure definition in kdbus.h.
David Herrmann [Mon, 22 Sep 2014 10:05:16 +0000 (12:05 +0200)]
util: add alloca_align()
The alloca_align() helper is the alloca() equivalent of posix_memalign().
As there is no such function provided by glibc, we simply account for
additional memory and return a pointer offset into the allocated memory to
grant the alignment.
Furthermore, alloca0_align() is added, which simply clears the allocated
memory.
David Herrmann [Mon, 22 Sep 2014 09:27:22 +0000 (11:27 +0200)]
test-util: make valgrind happy
Properly free all temporary resources to make valgrind not complain about
lost records.
David Herrmann [Sat, 20 Sep 2014 15:47:56 +0000 (17:47 +0200)]
terminal: raise sysview DEVICE_CHANGE events per attachment
Instead of raising DEVICE_CHANGE only per device, we now raise it per
device-session attachment. This is what we want for all sysview users,
anyway, as sessions are meant to be independent of each other. Lets avoid
any external session iterators and just do that in sysview itself.
David Herrmann [Sat, 20 Sep 2014 10:39:59 +0000 (12:39 +0200)]
terminal: forward evdev RESYNC events to linked devices
Whenever we resync an evdev device (or disable it), we should send RESYNC
events to the linked upper layers. This allows to disable key-repeat and
assume some events got dropped.
David Herrmann [Sat, 20 Sep 2014 10:34:43 +0000 (12:34 +0200)]
terminal: always call _enable/_disable on evdev devices
The current pause/resume logic kinda intertwines the resume/pause and
enable/disable functions. Lets avoid that non-obvious behavior and always
make resume call into enable, and pause call into disable, if appropriate.
David Herrmann [Sat, 20 Sep 2014 10:33:18 +0000 (12:33 +0200)]
terminal: print RESYNC state in evcat
Whenever a key-event is part of a RESYNC, we should print that verbosely
as those events are out-of-order.
Daniel Mack [Fri, 19 Sep 2014 12:50:53 +0000 (14:50 +0200)]
bus-policy: add test utility
Add some test files and routines for dbus policy checking.
Daniel Mack [Fri, 19 Sep 2014 12:38:52 +0000 (14:38 +0200)]
bus-policy: add policy check function
Add policy_check() to actually check whether an incoming message is allowed
by the policy. The code is not yet used from the proxy daemon, though.
Daniel Mack [Sat, 20 Sep 2014 16:09:00 +0000 (18:09 +0200)]
bus-policy: print numeric [gu]id in dump_items()
Daniel Mack [Sat, 20 Sep 2014 13:59:40 +0000 (15:59 +0200)]
bus-policy: do not exit() from policy_dump()
This function is quite useful for debugging. Exiting from it seems
unnecessary.
Daniel Mack [Fri, 19 Sep 2014 12:05:18 +0000 (14:05 +0200)]
bus-policy: implement dump_items() with LIST_FOREACH
Instead of making the function call itself recursively.
Daniel Mack [Sat, 20 Sep 2014 02:34:30 +0000 (04:34 +0200)]
bus-policy: resolve [ug]id of POLICY_ITEM_{USER,GROUP}
Do the lookup during parsing already, and set i->uid, or i->gid to the
numerical values.
Daniel Mack [Sat, 20 Sep 2014 14:34:31 +0000 (16:34 +0200)]
bus_policy: set i->[ug]id_valid
Daniel Mack [Fri, 19 Sep 2014 20:05:01 +0000 (22:05 +0200)]
bus-policy: append items rather than prepending them
In the D-Bus policy, the order of items matters, so make sure to store them
in the same order as they are parsed by the sax parser.
Daniel Mack [Fri, 19 Sep 2014 15:50:41 +0000 (17:50 +0200)]
bus-policy: story mandatory items in right list
Tom Gundersen [Sat, 20 Sep 2014 16:12:53 +0000 (18:12 +0200)]
test: udev - restrict nemuric uid's to existing ones
We now verify the existence of uid's before applying them to devicenodes, so change the
test accordingly. We assume that both uid/gid 1 and 2 exist on the test system.
David Herrmann [Sat, 20 Sep 2014 09:43:32 +0000 (11:43 +0200)]
terminal: fix mode sync for connectors
The GETXY ioctls of DRM are usually called twice by libdrm: Once to
retrieve the number of objects, a second time with suitably sized buffers
to actually retrieve all objects. In grdrm, we avoid these excessive calls
and instead just call ioctls with cached buffers and resize them if they
were too small.
However, connectors need to read the mode list via EDID, which is horribly
slow. As the kernel still cannot do that asynchronously (seriously, we
need to fix this!), it has a hack to only do it if count_modes==0. This is
fine with libdrm, as it calls every ioctl twice, anyway. However, we fail
horribly with this as we usually never pass 0.
Fix this by calling into GETCONNECTOR ioctls twice in case we received an
hotplug event. Only in those cases, we need to re-read modes, so this
should be totally fine.
David Herrmann [Sat, 20 Sep 2014 09:41:34 +0000 (11:41 +0200)]
terminal: restructure some logging calls in grdrm
Multiple issues here:
1) Don't print excessive card dumps on each resync. Disable it and make
developers add it themselves.
2) Ignore EINVAL on page-flips. Some cards don't support page-flips, so
we'd print it on each frame. Maybe, at some point, the kernel will add
support to retrieve capabilities for that. Until then, simply ignore
it.
3) Replace the now dropped card-dump with a short message about resyncing
the card.
David Herrmann [Sat, 20 Sep 2014 09:12:44 +0000 (11:12 +0200)]
terminal: grdev: schedule virtual frame events if hw doesn't support it
Whenever we cannot use hardware frame events, we now schedule a virtual
frame event to make sure applications don't have to do this. Usually,
applications render only on data changes, but we can further reduce
render-time by also limiting rendering to vsyncs.
David Herrmann [Sat, 20 Sep 2014 09:11:07 +0000 (11:11 +0200)]
terminal: grdev: raise frame event after DISPLAY_ADD/CHANGE
Whenever a display is added or changed, we suppressed any frame events.
Make sure to raise them manually so we can avoid rendering when handling
anything but FRAME events.
David Herrmann [Sat, 20 Sep 2014 09:10:04 +0000 (11:10 +0200)]
terminal: split grdrm_crtc_commit() apart
This helper is quite huge, split it apart to make it easier to follow.
David Herrmann [Sat, 20 Sep 2014 07:50:10 +0000 (09:50 +0200)]
terminal: grdev: refresh device state on hotplug events
Whenever we get udev hotplug events, re-read the device state so we
properly detect any changed in the display setups.
David Herrmann [Sat, 20 Sep 2014 07:48:22 +0000 (09:48 +0200)]
terminal: grdev: treat udev-devices without devnum as hotplug
If we get udev-device events via sysview, but they lack devnum
annotations, we know it cannot be a DRM card. Look through it's parents
and treat it as hotplug event in case we find such a card.
This will treat any new/removed connectors as sub-devices of the real
card, instead of as devices on its own.
David Herrmann [Sat, 20 Sep 2014 07:46:13 +0000 (09:46 +0200)]
terminal: modeset: forward DEVICE_CHANGE events into grdev
Properly forward DEVICE_CHANGE events into grdev so we can react to
changing display setups.
David Herrmann [Sat, 20 Sep 2014 07:45:26 +0000 (09:45 +0200)]
terminal: reduce speed of morphing colors in modeset test
The high frequency of the color-morphing is kinda irritating. Reduce it
to a much lower frequency so you can actually look at it longer than few
seconds.
David Herrmann [Sat, 20 Sep 2014 07:44:14 +0000 (09:44 +0200)]
terminal: make drm-connectors first-level devices
So far, we only forward DRM cards via sysview APIs. However, with MST,
connectors can be hotplugged, too. Forward the connectors as first-level
devices via sysview so API users can react to changing DRM connectors.
David Herrmann [Sat, 20 Sep 2014 07:43:16 +0000 (09:43 +0200)]
terminal: forward DEVICE_CHANGE events via sysview
Whe need to react to "change" events on devices, but we want to avoid
duplicating udev-monitors everywhere. Therefore, make sysview forward
change events to the sysview controllers, which can then properly react
to it.
David Herrmann [Sat, 20 Sep 2014 07:29:11 +0000 (09:29 +0200)]
terminal: parse ID_SEAT not only for parents but the device itself
When deciding what seat a device is on, we have to traverse all parents
to find one with an ID_SEAT tag, otherwise, input devices plugged on a
seated USB-hub are not automatically attached to the right seat. But any
tags on the main device still overwrite the tags of the childs, so fix our
logic to check the device itself first, before traversing the parents.
Tom Gundersen [Fri, 19 Sep 2014 21:02:00 +0000 (23:02 +0200)]
nspawn: don't try to create veth link with too long ifname
Reported by: James Lott <james@lottspot.com>
David Herrmann [Fri, 19 Sep 2014 12:48:54 +0000 (14:48 +0200)]
terminal: add systemd-modeset debugging tool
The systemd-modeset tool is meant to debug grdev issues. It simply
displays morphing colors on any found display. This is pretty handy to
look for tearing in the backends and debug hotplug issues.
Note that this tool requires systemd-logind to be compiled from git
(there're important fixes that haven't been released, yet).
David Herrmann [Fri, 19 Sep 2014 12:13:06 +0000 (14:13 +0200)]
terminal: add grdev DRM backend
The grdev-drm backend manages DRM cards for grdev. Any DRM card with
DUMB_BUFFER support can be used. So far, our policy is to configure all
available connectors, but keep pipes inactive as long as users don't
enable the displays on top.
We hard-code double-buffering so far, but can easily support
single-buffering or n-buffering. We also require XRGB8888 as format as
this is required to be supported by all DRM drivers and it is what VTs
use. This allows us to switch from VTs to grdev via page-flips instead of
deep modesets.
There is still a lot room for improvements in this backend, but it works
smoothly so far so more enhanced features can be added later.
David Herrmann [Fri, 19 Sep 2014 12:05:52 +0000 (14:05 +0200)]
terminal: add graphics interface
The grdev layer provides graphics-device access via the
libsystemd-terminal library. It will be used by all terminal helpers to
actually access display hardware.
Like idev, the grdev layer is built around session objects. On each
session object you add/remove graphics devices as they appear and vanish.
Any device type can be supported via specific card-backends. The exported
grdev API hides any device details.
Graphics devices are represented by "cards". Those are hidden in the
session and any pipe-configuration is automatically applied. Out of those,
we configure displays which are then exported to the API user. Displays
are meant as lowest hardware entity available outside of grdev. The
underlying pipe configuration is fully hidden and not accessible from the
outside. The grdev tiling layer allows almost arbitrary setups out of
multiple pipes, but so far we only use a small subset of this. More will
follow.
A grdev-display is meant to represent real connected displays/monitors.
The upper level screen arrangements are user policy and not controlled by
grdev. Applications are free to apply any policy they want.
Real card-backends will follow in later patches.
David Herrmann [Fri, 19 Sep 2014 11:26:39 +0000 (13:26 +0200)]
login: pause devices before acknowledging VT switches
If a session controller does not need synchronous VT switches, we allow
them to pass VT control to logind, which acknowledges all VT switches
unconditionally. This works fine with all sessions using the dbus API,
but causes out-of-sync device use if we switch to legacy sessions that
are notified via VT signals. Those are processed before logind notices
the session-switch via sysfs. Therefore, leaving the old session still
active for a short amount of time.
This, in fact, may cause the legacy session to prepare graphics devices
before the old session was deactivated, and thus, maybe causing the old
session to interfer with graphics device usage.
Fix this by releasing devices immediately before acknowledging VT
switches. This way, sessions without VT handlers are required to support
async session switching (which they do in that case, anyway).
Michal Sekletar [Thu, 24 Jul 2014 08:40:28 +0000 (10:40 +0200)]
socket: introduce SELinuxContextFromNet option
This makes possible to spawn service instances triggered by socket with
MLS/MCS SELinux labels which are created based on information provided by
connected peer.
Implementation of label_get_child_mls_label derived from xinetd.
Reviewed-by: Paul Moore <pmoore@redhat.com>
Tom Gundersen [Fri, 19 Sep 2014 06:03:31 +0000 (08:03 +0200)]
shared: wtmp-utmp - don't clear store_wtmp in utmp_put_dead_process()
Also modernize a few other things and add comments to explain CID #
1237503
and CID #
1237504.
Thomas Hindoe Paaboel Andersen [Thu, 18 Sep 2014 23:43:04 +0000 (01:43 +0200)]
test: warn if we could not parse the loop count argument
Found by coverity. Fixes: CID#
1237512
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:43 +0000 (15:24 +0200)]
shared/sparse-endian.h: add missing byteswap.h include
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:42 +0000 (15:24 +0200)]
shared/label.h: add missing stdio.h include
David Herrmann [Thu, 18 Sep 2014 22:23:42 +0000 (00:23 +0200)]
pty: include linux/ioctl.h for TIOCSIG
TIOCSIG is linux specific, so include the linux ioctl header to make sure
it's defined. We currently rely on some rather non-obvious recursive
includes. Make sure its always defined regardless of the system headers.
Thomas Hindoe Paaboel Andersen [Thu, 18 Sep 2014 21:55:46 +0000 (23:55 +0200)]
nss: remove dead code
c > 0 is already guaranteed from earlier checks.
We go from
ms = ALIGN(l+1) +
sizeof(char*) +
(c > 0 ? c : 1) * ALIGN(alen) +
(c > 0 ? c+1 : 2) * sizeof(char*);
to
ms = ALIGN(l+1) +
sizeof(char*) +
c * ALIGN(alen) +
(c+1) * sizeof(char*);
to
ms = ALIGN(l+1) + c * ALIGN(alen) + (c+2) * sizeof(char*);
Found by coverity. Fixes: CID#
1237570 and CID#
1237610
Tom Gundersen [Thu, 18 Sep 2014 21:37:07 +0000 (23:37 +0200)]
timesyncd: check return of setting IP_TOS
Fonud by Coverity. Fixes CID #
1237534.
Tom Gundersen [Thu, 18 Sep 2014 19:57:49 +0000 (21:57 +0200)]
udevd: don't fail if /run/udev exists
Tom Gundersen [Thu, 18 Sep 2014 18:25:33 +0000 (20:25 +0200)]
udev: fix typos
Spotted by Andreas Henriksson.
Tom Gundersen [Thu, 18 Sep 2014 17:26:11 +0000 (19:26 +0200)]
udev: ctrl - log if setting SO_PASSCRED fails
No functional change.
Found by Coverity. Fixes CID #
1237533.
Tom Gundersen [Thu, 18 Sep 2014 17:22:09 +0000 (19:22 +0200)]
udev: node - warn if chmod/chown fails
No functional change, just log the warning.
Fonud by Coverity. Fixes CID #
1237544.
Tom Gundersen [Thu, 18 Sep 2014 17:16:54 +0000 (19:16 +0200)]
udevadm: hwdb - check return value of fseeko()
Fonud by Coverity. Fixes CID #996255.
Tom Gundersen [Thu, 18 Sep 2014 17:07:02 +0000 (19:07 +0200)]
udevd: check return of various functions
One reported by Coverity. Fixes CID #996252.
Tom Gundersen [Thu, 18 Sep 2014 17:02:03 +0000 (19:02 +0200)]
udevd: parse_argv - warn if argumens are invalid
Found by Coverity. Fixes CID #
1238780.
Andreas Henriksson [Thu, 18 Sep 2014 15:52:54 +0000 (17:52 +0200)]
journal-remote: check return code of sd_event_default
Handle sd_event_default returning error and bail out properly
as done in every other caller of this function.
Found by coverity. Fixes: CID#
1238957
Philippe De Swert [Thu, 18 Sep 2014 15:56:57 +0000 (18:56 +0300)]
sysusers: Remove some gcc warnings about uninitialized variables
Gcc is spewing some warnings about uninitialized variables.
Let's get rid of the noise.
Philippe De Swert [Thu, 18 Sep 2014 15:56:56 +0000 (18:56 +0300)]
core: Remove uninitialized warnings from bus-endpoint.c
Gcc is spewing some warnings about uninitialized variables.
Let's get rid of the noise.
Philippe De Swert [Thu, 18 Sep 2014 15:56:55 +0000 (18:56 +0300)]
journal-upload: Remove compilation warning
When compiling we see this curl warning popping up:
src/journal-remote/journal-upload.c:194:17: warning: call to
‘_curl_easy_setopt_err_error_buffer’ declared with attribute
warning: curl_easy_setopt expects a char buffer of CURL_ERROR_SIZE
as argument for this option [enabled by default]
This patch removes the warning (which occurs twice).
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:59 +0000 (15:24 +0200)]
mount: order options before other arguments to mount
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:38 +0000 (15:24 +0200)]
include fcntl.h rather than sys/fcntl.h
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:40 +0000 (15:24 +0200)]
sd-rtnl: rtnl-message: remove unneeded linux includes
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:39 +0000 (15:24 +0200)]
udev: link-config: remove unneded linux/netdevice.h include
Philippe De Swert [Tue, 16 Sep 2014 21:27:16 +0000 (00:27 +0300)]
journal: Do not count on the compiler initializing found_last to false
There is a very unlikely case where this can happen since gcc usually
does the sane thing. But let's make sure found_last is initialized anyway.
Fixes: CID#996386
Michael Marineau [Mon, 15 Sep 2014 21:07:39 +0000 (14:07 -0700)]
man: use the escape for "-" in example instead of space.
This sentence can be misread to mean that "\x20" is the escape code for
"-" which is the only character explicitly mentioned. This lead to at
least one user loosing hair over why a mount unit for "/foo/bar-baz"
didn't work. The example escape is arbitrary so lets prevent hair loss.
Robert Milasan [Sat, 13 Sep 2014 13:18:37 +0000 (15:18 +0200)]
udev: fix path for database names on 'change' event
If a device does not have a major/minor number attached, we use different
database names than if it does. On "change" events, we didn't copy the
devnum over, therefore, we used different paths than on 'add' or 'remove'
events (where devnum was properly copied).
Fix this by always copying the devnum into the udev-device.
(David: added commit-log from email)
David Herrmann [Thu, 18 Sep 2014 11:28:28 +0000 (13:28 +0200)]
bus: fix bus_print_property() to use "int" for booleans
We always use "int" if we retrieve boolean values from sd-bus, as "bool"
is only a single byte, but full int on va-args.
Thanks to Werner Fink for the report!
Tom Gundersen [Thu, 18 Sep 2014 11:47:00 +0000 (13:47 +0200)]
shared: conf-parser - don't leak memory on error in DEFINE_CONFIG_PARSE_ENUMV
Found by Coverity. Fixes CID #
1237746.
Tom Gundersen [Thu, 18 Sep 2014 07:20:46 +0000 (09:20 +0200)]
libudev: monitor - warn if we fail to request SO_PASSCRED
The function still succeeds, so there is no functional change. This fixes CID #996288.
Ronny Chevalier [Thu, 18 Sep 2014 10:09:10 +0000 (12:09 +0200)]
tests: fix resource & mem leaks
Daniel Mack [Thu, 18 Sep 2014 08:25:35 +0000 (10:25 +0200)]
sd-bus: sync kdbus.h
(no API/ABI break this time)
Cristian Rodríguez [Thu, 18 Sep 2014 00:56:25 +0000 (21:56 -0300)]
systemctl: fix resource leak CID #
1237747
..by simply moving the declaration of "unit" into the STRV_FOREACH
loop as suggested by Andreas.
Cristian Rodríguez [Wed, 17 Sep 2014 21:10:21 +0000 (18:10 -0300)]
Fix resource leak (coverity CID
1237760)
Thomas Hindoe Paaboel Andersen [Wed, 17 Sep 2014 21:03:27 +0000 (23:03 +0200)]
sysv-generator: don't check first if hashmap contains the service name
Just test if hashmap_get returns null. hashmap_contains does exactly
same thing internally so this is slightly more efficient for the true
case.
Silences a coverity warning too. CID#
1237648
Ronny Chevalier [Wed, 17 Sep 2014 18:10:44 +0000 (20:10 +0200)]
logind: fix typo
Tom Gundersen [Wed, 17 Sep 2014 20:17:53 +0000 (22:17 +0200)]
shared: conf-parser
Check memory allocation. Found by Coverity.
Fixes CID #
1237644.
Tom Gundersen [Wed, 17 Sep 2014 19:53:20 +0000 (21:53 +0200)]
udev: event - modernize spawn_exec()
Tom Gundersen [Wed, 17 Sep 2014 19:44:56 +0000 (21:44 +0200)]
udev: event - explicitly don't read() from invalid fd
This fixes CID #
1237641.
Tom Gundersen [Wed, 17 Sep 2014 19:43:57 +0000 (21:43 +0200)]
udev: event - modernize spawn_read()
Thomas Hindoe Paaboel Andersen [Wed, 17 Sep 2014 18:48:39 +0000 (20:48 +0200)]
nss-resolve: remove dead code
ifindex < 0 was already checked before entering the loop
Found by coverity. Fixes: CID#
1237609
Tom Gundersen [Wed, 17 Sep 2014 17:53:01 +0000 (19:53 +0200)]
udev: rules - close empty file
If the file is found to be empty, we exit early without closing the file first.
Found by coverity. Fixes CID #
1237759.
Tom Gundersen [Wed, 17 Sep 2014 17:07:56 +0000 (19:07 +0200)]
libsystemd-network: dhcp-test - assert that malloc0 succeeds
Otherwise we would get a nullptr dereference later on.
Found by coverity. Fixes CID #
1237655.
Tom Gundersen [Wed, 17 Sep 2014 17:00:55 +0000 (19:00 +0200)]
networkd: dhcp4 - fix unchecked return value
Found by coverity. CID #
1237529 and #
1237528.
David Herrmann [Wed, 17 Sep 2014 08:32:49 +0000 (10:32 +0200)]
bus: fix error leak in bus_node_exists()
If we call into user callbacks, we must always propagate possible errors.
Fix bus_node_exists() to do that and adjust the callers (which already
partially propagated the error).
Also speed up that function by first checking for registered enumerators
and/or object-managers.
David Herrmann [Wed, 17 Sep 2014 07:28:09 +0000 (09:28 +0200)]
bus: never respond to GetManagedObjects() on sub-paths
The dbus-spec clearly specifies that GetManagedObjects() should only work
on the root-path of an object-tree. But on that path, it works regardless
whether there are any objects available or not.
We could, technically, define all sub-paths as a root-path of its own
sub-tree. However, if we do that, we enter undefined territory:
Imagine only a fallback vtable is registered. We want
GetManagedObjects() to *NOT* fail with UNKNOWN_METHOD if it is called
on a valid sub-tree of the fallback. On the other hand, we don't want
it to work on arbitrary sub-tree. Something like:
/path/to/fallback/foobar/foobar/foobar/invalid/foobar
should not work.
However, there is no way to know which paths on a fallback are valid
without looking at there registered objects. If no objects are
registered, we have no way to figure it out.
Therefore, we now try to follow the dbus spec by only returning valid data
on registered root-paths. We treat each path as root which was registered
an object-manager on via add_object_manager(). So applications can now
directly control which paths to place an object-manager on.
We also fix the introspection to not return object-manager interfaces on
non-root paths.
Also fixes some dead-code paths initially reported by Philippe De Swert.
David Herrmann [Wed, 17 Sep 2014 07:06:49 +0000 (09:06 +0200)]
sysctl: make --prefix allow all kinds of sysctl paths
Currently, we save arguments passed as --prefix directly and compare them
later to absolute sysctl file-system paths. That is, you are required to
specify arguments to --prefix with leading /proc/sys/. This is kinda
uselesss. Furthermore, we replace dots by slashes in the name, which makes
it impossible to match on specific sysfs paths that have dots in their
name (like netdev names). The intention of this argument is clear, but it
never worked as expected.
This patch modifies --prefix to accept any kind of sysctl paths. It
supports paths prefixed with /proc/sys for compatibility (but drops the
erroneous dot->slash conversion), but instead applies normalize_sysctl()
which turns any name or path into a proper path. It then appends
/proc/sys/ so we can properly use it in matches.
Thanks to Jan Synacek <jsynacek@redhat.com> for catching this!
Thomas Hindoe Paaboel Andersen [Tue, 16 Sep 2014 20:58:35 +0000 (22:58 +0200)]
util: remove a unnecessary check
We only break out of the previous loop if fd >= 0 so there is no
use in checking it again.
Found by coverity. Fixes: CID#
1237577
David Herrmann [Tue, 16 Sep 2014 21:00:26 +0000 (23:00 +0200)]
terminal: remove dead code checking O_WRONLY
We only reject evdev FDs that are O_WRONLY as they're currently pretty
useless. The following check for O_WRONLY is thus never excercised so drop
it.
Thanks to Thomas Andersen (via coverity)!
Thomas Hindoe Paaboel Andersen [Tue, 16 Sep 2014 19:59:50 +0000 (21:59 +0200)]
test: silence a coverity report
We check the actual contents of the file on the line after but we
might as well also check the number of bytes read here.
Found by coverity. Fixes: CID#
1237521
Andreas Henriksson [Tue, 16 Sep 2014 19:36:26 +0000 (21:36 +0200)]
shared: fix resource leak in config_parse_default_instance
The recently allocated "printed" is not freed on error path.
Found by coverity. Fixes: CID#
1237745
Andreas Henriksson [Tue, 16 Sep 2014 19:22:59 +0000 (21:22 +0200)]
sysv-generator: fix resource leak
The "unit" string allocation is not freed on either error or success path.
Found by coverity. Fixes: CID#
1237755
Andreas Henriksson [Tue, 16 Sep 2014 19:11:02 +0000 (21:11 +0200)]
core: fix resource leak in manager_environment_add
Second error path must free the (potentially) allocated memory in the
first code chunk before returning.
Found by coverity. Fixes: CID#
1237750
Cristian Rodríguez [Tue, 16 Sep 2014 17:17:01 +0000 (14:17 -0300)]
missing: memfd_create takes unsigned int flags in final version
Thomas Hindoe Paaboel Andersen [Mon, 15 Sep 2014 20:55:36 +0000 (22:55 +0200)]
terminal: sd_bus_error_get_errno returns positive errno
The 3 calls to sd_bus_error_get_errno appear to expect a negative
return value.
This patch negates the returned value so it matches the other error
cases in the 3 functions where sd_bus_error_get_errno is used.
Thomas Hindoe Paaboel Andersen [Mon, 15 Sep 2014 20:36:43 +0000 (22:36 +0200)]
sd-bus: sd_bus_message_get_errno should only return positive errno
sd_bus_message_get_errno can currently return either a number of
different poitive errno values (from bus-error-mapping), or a negative
EINVAL if passed null as parameter.
The check for null parameter was introduced in
40ca29a1370379d43e44c0ed425eecc7218dcbca
at the same as the function was renamed from bus_message_to_errno and
made public API. Before becoming public the function used to return
only negative values.
It is weird to have a function return both positive and negative errno
and it generally looks like a mistake. The function is guarded by the
--enable-kdbus flags so I wonder if we still have time to fix it up?
It does not have any documentation yet. However, except for a few details
it is just a convenient way to call sd_bus_error_get_errno which is documented
to return only positive errno.
This patch makes it return only positive errno and fixes up the two
calls to the function that tried to cope with both positive and negative
values.
Andreas Henriksson [Tue, 16 Sep 2014 17:40:25 +0000 (19:40 +0200)]
bootchart: oom-check correct variable
Coverity warned that we have already dereferenced ps->sample before
null-checking it. I suspect that's not really the issue and that
the check is checking the wrong variable.
Likely the oom-check should be on the just allocated ps->sample->next.
Found by coverity. Fixes: CID#
1237765
Tom Gundersen [Tue, 16 Sep 2014 16:42:22 +0000 (18:42 +0200)]
bootchart: use safe_atod() rather than strtod()