Age | Commit message (Collapse) | Author | Files | Lines |
|
No need to create the kdbus msg every time, and if we are sending a
memfd, then just store its item offset, patch it later with the right
memfd fd+data, seal it, then send it.
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Tweak the test case accordingly.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Move capabilites to its own struct inside kdbus_item. This also gives
us the ability to inform userspace of the highest caps bit the kernel
knows about.
Hence, if the capabilites grow in either the number of sets or the
number of rows, we can now detect and handle both from userspace.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
If a SYNC-SEND is interrupted by a signal, there is no way we can restart
the syscall. If we returned ERESTARTSYS, we'd queue the message again on
restart. This is very irritating, therefore, we never support restarting
syscalls. Instead, we return EINPROGRESS if the message was queued but no
reply was received, yet.
Internally, we turn the 'sync' reply_wait into an 'async' reply. This way,
it will be treated the same way as any other asynchronous reply.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
As we now use kdbus_cmd_conn_info and kdbus_conn_info for bus creator
information as well, rename the structs to a more generic term.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Add a call to return metadata on the task that created a bus, at the
moment it did so. The call behaves similar to KDBUS_CMD_CONN_INFO, and
shares the same dispatcher code in handle.c.
While at it, factor out bus-related test functions to their own file,
and also add some code test the new ioctl.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Satisfy a kernel check so we can be sure we really bail out due
to the check we're actually enforcing.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
The test was working for all cases, but fix it to only check for the
SA_RESTART case.
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Make kdbus_msg_dump() return an error in case there's anything wrong
with the message. Return such errors from kdbus_msg_recv(). We currently
fail with notifications.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Make the timeouts in struct kdbus_msg.timeout_ns absolute.
This is necessary in order to support blocking sync calls with
SA_RESTART behavior.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Implement a new helper function to reply to pending messages.
Formerly, the test abused the timeout parameter to respond, knowing
that its value will eventually end up in the kdbus message in the
same union as the cookie_reply field.
In the process of switching to absolute timeouts, however, this bites
us, so move this hack out of the way first.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Instead of negotating kernel flags via the same field for input and
output, use two different bitfields for that, and call the returned
flags 'kernel_flags'.
The approach implemented before didn't turn out to work too well for
more complex userspace programs that retain the same ioctl buffers
for multiple calls, and which had to manually save and restore the
flags before.
While at it, rename conn_flags → flags in kdbus_cmd_hello to ease
the internal helper functions and unify the API a bit more.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Introduce struct kdbus_name_info and report information on name lists
with it, instead of (ab)using struct kdbus_cmd_name for it.
That way, we can get rid of two fields in the latter.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
We are obliged to reject all bits in flags fields that are not known
to the kernel. In order to let userspace know which flags the kernel
knowns about, we agreed to always write back to the flags field in the
ioctl buffer, even if the call succeeded. The kernel will, however,
will always set the KDBUS_FLAG_KERNEL bit, which consequently is always
invalid when submitted by userspace.
Move some checks from other place to handle.c, and update the testsuite
and documentation accordingly.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Memfds are a basic exchange mechanism not supposed to be
optional per connection. A per-bus flag, instead of a
per-connection one, would probably be acceptable,
but its usefulness is questionable at this point.
Broadcasts can contain memfds and we would silently messages
for such connections, which is not the expected behavior.
Receivers just need to make sure to be able to receive messages
with memfd payload, otherwise they are just not fully supporting
the common kdbus interface.
Contracts of not supporting memfds on private buses are fine,
but the general purpose communication will always require
memfds to be supported by all clients.
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Will be used by other tests
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Add another flags to the connection's flags to denote whether it
want to receive memfds. Reject messages with -ECOMM if it contains
a memfd if the receiver can't cope with it.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Use the correct maximum size with strncpy(), even though we're using
small static strings as sources.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
We still need to decide how we wanna handle this.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
|
|
test: fix typo
|
|
Add more broadcast tests that will run after a policy holder is uploaded
on the bus.
Each test is documented. Currently we fail at these tests, next patches
will fix this.
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
Add broadcast tests, and modify RUN_UNPRIVILEGED() so we can specify
the uid/gid of the user to drop in and run tests.
Move all the tests that check the default behaviour of the bus and
before a policy holder is uploaded to their function:
test_priv_before_policy_upload().
Each test is documented.
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
|
|
fix typo in bybye test description
|
|
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Avoid abbr. and rename EP → ENDPOINT.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Add a new field called 'features' to struct kdbus_cmd_make and
kdbus_cmd_hello. In these bitmasks, userspace can request features from
the kernel, and the kernel can itself request features from userspace.
For now, we check that this field is set to 0, and bail with
-EOPNOTSUPP otherwise.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
|
|
Found by coverity.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Rather than passing a pointer to a u64 with these ioctls, use a struct.
That also allows us to pass (currently unused) flags around.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
When the cookie specified in the command struct was not found in the
match database, return -ENOENT.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
Instead of directly attaching the string to kdbus_cmd_conn_info, use
items as we do in all other commands. That allows for more flexibility
later.
Signed-off-by: Daniel Mack <daniel@zonque.org>
|
|
We should not reset stats before retying a test, otherwise, the test will
file in batch mode as stats.count is 0.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|