connection: fix error rewind exit path in kdbus_conn_msg_install()
handle: Return POLLOUT | POLLWRNORM mask when no messages are pending

To facility the feature of doing an asynchronous sending of messages
when the bus is idle, make sure to return POLLOUT | POLLWRNORM from
kdbus_handle_poll.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
metadata: rename kdbus_meta_offset_of() to kdbus_meta_find_item()

Return a pointer to the item itself, so we can as well use its size.
util: introduce KDBUS_ITEM_PAYLOAD_SIZE

Add a simple macro to determine an item's payload size, and use it in
message.c.
connection: address possible auxgrp count mismatch

The number of auxgrps could theoretically change between the preparation of
the the meta data item and the scan in kdbus_conn_queue_alloc().

Solve this by clamping the number of group elements we look at.
connection: drop unused paramenter to kdbus_conn_*_install

The connection parameter is not used, so drop it from the function's
parameters.
metadata: remove kdbus_meta_find_item()

Remove kdbus_meta_find_item(), and store offsets of items inside the
metadata in the metadata itself. This is nicer than walking the list again
in order to find a specific element.
metadata: set item->size in kdbus_meta_append_item()

This saves us some logic on the call sites.
Kconfig: depend on TMPFS
handle: return POLLOUT | POLLWRNORM from kdbus_handle_poll()

Also return POLLOUT | POLLWRNORM from kdbus_handle_poll() when a message
arrived. IOW: in all non-error conditions.
metadata: document creds_item_off and auxgrps_item_off fields

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection: move the install creds into the slice to its own function

Move the install creds into the receiver's slice to its own function
kdbus_conn_creds_install().

Use from_kuid_munged(), so the uid mapping never fails.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
test: add helpers for user namespace mapping

Will be used by other tests.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
test: move shared definitions to kdbus-util.h to use them in other tests

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
test: add conn_recv() that use poll() and msg_recv()

Will be used by tests.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
test: add the metadata tests inside new namespaces

Currently this only handles user namespace. Use it to inspect the
dumped metadata/credentials.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Makefile: export KERNELDIR for tests

We include linux/memfd.h now, make sure it's searched for in $KERNELDIR.
Makefile: deal with realtive paths in test/

Invoke realpath to convert a possible relative path into an absolute one.