Revert "test/Makefile: only look at $(KERNELDIR)/usr/include for files with quotes"

This reverts commit baeb2d8bbf2360524d4104ea851407a14085cef9.

Turns out this confuses cpp even more.

For now, people have to to 'make headers_install' in the kernel dir before
building kdbus.
metadata: add back code to fill creds data

It was overlooked that metadata is also used for connection info calls.
Until we find a nicer way, just do the creds assigment in this item twice:
once at metadata creation time, and again when we deliver the message.
kdbus: do the audit loginuid translation as late as possible

Do the namespace translation just before pushing into the receiver's
slice, so we map to the receiver's user namespace.

Patch tested.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
test: use audit.loginuid and audit.sessionid when dumping the audit item

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
metadata: kdbus_meta_append_auxgroups(): actually set the group ids

As we need metadata in other context than queue items, we don't want
to rely on the queue item logic to clean up after us and fix up the
values. For now, add back the code to actually fill the payload. We
might add code to make the queue patching conditional later.
connection: drop unused argument of kdbus_conn_payload_add()
connection: check policy for reply-awaiting messages as well

The current logic in bogus. We need to call kdbus_conn_check_access()
for messages that require a message as well. Also, teach
kdbus_conn_check_access() a mode in which not to look up expected
replies of a connection.
policy: indent
test: update policy tests to handle user namespaces

Upstream kernels allow unprivileged users to create user namespaces
and change their uid/gid.

These patches update kdbus policy logic to handle this case and
improve our current checks across user namespaces.

So this patch adds:

* kdbus_test_waitpid() to get exit code of childs.
* kdbus_clone_userns_test() that performs the test inside a new
  user namespace.
* Converts all the other tests to return CHECK_OK, CHECK_SKIP or
  CHECK_ERR so we are consistent.

Currently we fail at kdbus_clone_userns_test() test #8. The next patch
will fix this issue.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection: rename 'entry' variable in kdbus_conn_kmsg_send()
connection: factor out queue management code to queue.c

Move code that deals with the message queue and its items into queue.c.
This way, we can work towards a cleaner structure and cut down connection.c
which has grown too big.

The sepearation is not really strict at this point, and might see some
more cleanups in the future.
policy: make policy checks work across user namespaces

Use the global kuid_t and kgid_t to store uid/gid values, this way we
our policy checks will work across user namespaces.

Note that currently we ignore that the user is privileged in its own
namespaces and the policy access kuid_t and kgid_t were mapped into that
namespace. If this is requested we can add it later a la:
fs/inode.c:inode_owner_or_capable()

Add kdbus_policy_make_access() to convert the user provided info to the
current user namespace. Userspace struct is not changed, only the kernel
one.

This patch fixes test #8 of test-kdbus-policy

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
[daniel: group kdbus_policy_db_entry_access->{uid,gid} in a union]
kdbus.txt: kill reference to sd-memfd.h
notify: explictly set payload_type = KDBUS_PAYLOAD_KERNEL
match: don't fail on invalid item types
kdbus.txt: add more documentation
connection: return -EOPNOTSUPP if the connection has already died
connection: check return value of kdbus_meta_append()
endpoint: cosmetics
connection: reformat