12 #include <sys/types.h>
14 #include <sys/socket.h>
17 #include "kdbus-api.h"
18 #include "kdbus-test.h"
19 #include "kdbus-util.h"
20 #include "kdbus-enum.h"
22 #define KDBUS_MSG_MAX_ITEMS 128
23 #define KDBUS_USER_MAX_CONN 256
25 /* maximum number of inflight fds in a target queue per user */
26 #define KDBUS_CONN_MAX_FDS_PER_USER 16
28 /* maximum number of memfd items per message */
29 #define KDBUS_MSG_MAX_MEMFD_ITEMS 16
31 static int make_msg_payload_dbus(uint64_t src_id, uint64_t dst_id,
33 struct kdbus_msg **msg_dbus)
35 struct kdbus_msg *msg;
37 msg = malloc(msg_size);
38 ASSERT_RETURN_VAL(msg, -ENOMEM);
40 memset(msg, 0, msg_size);
44 msg->payload_type = KDBUS_PAYLOAD_DBUS;
51 static void make_item_memfds(struct kdbus_item *item,
52 int *memfds, size_t memfd_size)
56 for (i = 0; i < memfd_size; i++) {
57 item->type = KDBUS_ITEM_PAYLOAD_MEMFD;
58 item->size = KDBUS_ITEM_HEADER_SIZE +
59 sizeof(struct kdbus_memfd);
60 item->memfd.fd = memfds[i];
61 item->memfd.size = sizeof(uint64_t); /* const size */
62 item = KDBUS_ITEM_NEXT(item);
66 static void make_item_fds(struct kdbus_item *item,
67 int *fd_array, size_t fd_size)
70 item->type = KDBUS_ITEM_FDS;
71 item->size = KDBUS_ITEM_HEADER_SIZE + (sizeof(int) * fd_size);
73 for (i = 0; i < fd_size; i++)
74 item->fds[i] = fd_array[i];
77 static int memfd_write(const char *name, void *buf, size_t bufsize)
82 memfd = sys_memfd_create(name, 0);
83 ASSERT_RETURN_VAL(memfd >= 0, memfd);
85 ret = write(memfd, buf, bufsize);
86 ASSERT_RETURN_VAL(ret == (ssize_t)bufsize, -EAGAIN);
88 ret = sys_memfd_seal_set(memfd);
89 ASSERT_RETURN_VAL(ret == 0, -errno);
94 static int send_memfds(struct kdbus_conn *conn, uint64_t dst_id,
95 int *memfds_array, size_t memfd_count)
97 struct kdbus_cmd_send cmd = {};
98 struct kdbus_item *item;
99 struct kdbus_msg *msg;
103 size = sizeof(struct kdbus_msg);
104 size += memfd_count * KDBUS_ITEM_SIZE(sizeof(struct kdbus_memfd));
106 if (dst_id == KDBUS_DST_ID_BROADCAST)
107 size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_bloom_filter)) + 64;
109 ret = make_msg_payload_dbus(conn->id, dst_id, size, &msg);
110 ASSERT_RETURN_VAL(ret == 0, ret);
114 if (dst_id == KDBUS_DST_ID_BROADCAST) {
115 item->type = KDBUS_ITEM_BLOOM_FILTER;
116 item->size = KDBUS_ITEM_SIZE(sizeof(struct kdbus_bloom_filter)) + 64;
117 item = KDBUS_ITEM_NEXT(item);
119 msg->flags |= KDBUS_MSG_SIGNAL;
122 make_item_memfds(item, memfds_array, memfd_count);
124 cmd.size = sizeof(cmd);
125 cmd.msg_address = (uintptr_t)msg;
127 ret = kdbus_cmd_send(conn->fd, &cmd);
129 kdbus_printf("error sending message: %d (%m)\n", ret);
137 static int send_fds(struct kdbus_conn *conn, uint64_t dst_id,
138 int *fd_array, size_t fd_count)
140 struct kdbus_cmd_send cmd = {};
141 struct kdbus_item *item;
142 struct kdbus_msg *msg;
146 size = sizeof(struct kdbus_msg);
147 size += KDBUS_ITEM_SIZE(sizeof(int) * fd_count);
149 if (dst_id == KDBUS_DST_ID_BROADCAST)
150 size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_bloom_filter)) + 64;
152 ret = make_msg_payload_dbus(conn->id, dst_id, size, &msg);
153 ASSERT_RETURN_VAL(ret == 0, ret);
157 if (dst_id == KDBUS_DST_ID_BROADCAST) {
158 item->type = KDBUS_ITEM_BLOOM_FILTER;
159 item->size = KDBUS_ITEM_SIZE(sizeof(struct kdbus_bloom_filter)) + 64;
160 item = KDBUS_ITEM_NEXT(item);
162 msg->flags |= KDBUS_MSG_SIGNAL;
165 make_item_fds(item, fd_array, fd_count);
167 cmd.size = sizeof(cmd);
168 cmd.msg_address = (uintptr_t)msg;
170 ret = kdbus_cmd_send(conn->fd, &cmd);
172 kdbus_printf("error sending message: %d (%m)\n", ret);
180 static int send_fds_memfds(struct kdbus_conn *conn, uint64_t dst_id,
181 int *fds_array, size_t fd_count,
182 int *memfds_array, size_t memfd_count)
184 struct kdbus_cmd_send cmd = {};
185 struct kdbus_item *item;
186 struct kdbus_msg *msg;
190 size = sizeof(struct kdbus_msg);
191 size += memfd_count * KDBUS_ITEM_SIZE(sizeof(struct kdbus_memfd));
192 size += KDBUS_ITEM_SIZE(sizeof(int) * fd_count);
194 ret = make_msg_payload_dbus(conn->id, dst_id, size, &msg);
195 ASSERT_RETURN_VAL(ret == 0, ret);
199 make_item_fds(item, fds_array, fd_count);
200 item = KDBUS_ITEM_NEXT(item);
201 make_item_memfds(item, memfds_array, memfd_count);
203 cmd.size = sizeof(cmd);
204 cmd.msg_address = (uintptr_t)msg;
206 ret = kdbus_cmd_send(conn->fd, &cmd);
208 kdbus_printf("error sending message: %d (%m)\n", ret);
216 /* Return the number of received fds */
217 static unsigned int kdbus_item_get_nfds(struct kdbus_msg *msg)
219 unsigned int fds = 0;
220 const struct kdbus_item *item;
222 KDBUS_ITEM_FOREACH(item, msg, items) {
223 switch (item->type) {
224 case KDBUS_ITEM_FDS: {
225 fds += (item->size - KDBUS_ITEM_HEADER_SIZE) /
230 case KDBUS_ITEM_PAYLOAD_MEMFD:
242 static struct kdbus_msg *
243 get_kdbus_msg_with_fd(struct kdbus_conn *conn_src,
244 uint64_t dst_id, uint64_t cookie, int fd)
248 struct kdbus_item *item;
249 struct kdbus_msg *msg;
251 size = sizeof(struct kdbus_msg);
253 size += KDBUS_ITEM_SIZE(sizeof(int));
255 ret = make_msg_payload_dbus(conn_src->id, dst_id, size, &msg);
256 ASSERT_RETURN_VAL(ret == 0, NULL);
258 msg->cookie = cookie;
263 make_item_fds(item, (int *)&fd, 1);
269 static int kdbus_test_no_fds(struct kdbus_test_env *env,
270 int *fds, int *memfd)
275 int connfd1, connfd2;
276 struct kdbus_msg *msg, *msg_sync_reply;
277 struct kdbus_cmd_hello hello;
278 struct kdbus_conn *conn_src, *conn_dst, *conn_dummy;
279 struct kdbus_cmd_send cmd = {};
280 struct kdbus_cmd_free cmd_free = {};
282 conn_src = kdbus_hello(env->buspath, 0, NULL, 0);
283 ASSERT_RETURN(conn_src);
285 connfd1 = open(env->buspath, O_RDWR|O_CLOEXEC);
286 ASSERT_RETURN(connfd1 >= 0);
288 connfd2 = open(env->buspath, O_RDWR|O_CLOEXEC);
289 ASSERT_RETURN(connfd2 >= 0);
292 * Create connections without KDBUS_HELLO_ACCEPT_FD
293 * to test if send fd operations are blocked
295 conn_dst = malloc(sizeof(*conn_dst));
296 ASSERT_RETURN(conn_dst);
298 conn_dummy = malloc(sizeof(*conn_dummy));
299 ASSERT_RETURN(conn_dummy);
301 memset(&hello, 0, sizeof(hello));
302 hello.size = sizeof(struct kdbus_cmd_hello);
303 hello.pool_size = POOL_SIZE;
304 hello.attach_flags_send = _KDBUS_ATTACH_ALL;
306 ret = kdbus_cmd_hello(connfd1, &hello);
307 ASSERT_RETURN(ret == 0);
309 cmd_free.size = sizeof(cmd_free);
310 cmd_free.offset = hello.offset;
311 ret = kdbus_cmd_free(connfd1, &cmd_free);
312 ASSERT_RETURN(ret >= 0);
314 conn_dst->fd = connfd1;
315 conn_dst->id = hello.id;
317 memset(&hello, 0, sizeof(hello));
318 hello.size = sizeof(struct kdbus_cmd_hello);
319 hello.pool_size = POOL_SIZE;
320 hello.attach_flags_send = _KDBUS_ATTACH_ALL;
322 ret = kdbus_cmd_hello(connfd2, &hello);
323 ASSERT_RETURN(ret == 0);
325 cmd_free.size = sizeof(cmd_free);
326 cmd_free.offset = hello.offset;
327 ret = kdbus_cmd_free(connfd2, &cmd_free);
328 ASSERT_RETURN(ret >= 0);
330 conn_dummy->fd = connfd2;
331 conn_dummy->id = hello.id;
333 conn_dst->buf = mmap(NULL, POOL_SIZE, PROT_READ,
334 MAP_SHARED, connfd1, 0);
335 ASSERT_RETURN(conn_dst->buf != MAP_FAILED);
337 conn_dummy->buf = mmap(NULL, POOL_SIZE, PROT_READ,
338 MAP_SHARED, connfd2, 0);
339 ASSERT_RETURN(conn_dummy->buf != MAP_FAILED);
342 * Send fds to connection that do not accept fd passing
344 ret = send_fds(conn_src, conn_dst->id, fds, 1);
345 ASSERT_RETURN(ret == -ECOMM);
348 * memfd are kdbus payload
350 ret = send_memfds(conn_src, conn_dst->id, memfd, 1);
351 ASSERT_RETURN(ret == 0);
353 ret = kdbus_msg_recv_poll(conn_dst, 100, NULL, NULL);
354 ASSERT_RETURN(ret == 0);
359 ASSERT_RETURN_VAL(pid >= 0, pid);
365 * A sync send/reply to a connection that do not
366 * accept fds should fail if it contains an fd
368 msg_sync_reply = get_kdbus_msg_with_fd(conn_dst,
371 ASSERT_EXIT(msg_sync_reply);
373 ret = clock_gettime(CLOCK_MONOTONIC_COARSE, &now);
374 ASSERT_EXIT(ret == 0);
376 msg_sync_reply->timeout_ns = now.tv_sec * 1000000000ULL +
377 now.tv_nsec + 100000000ULL;
378 msg_sync_reply->flags = KDBUS_MSG_EXPECT_REPLY;
380 memset(&cmd, 0, sizeof(cmd));
381 cmd.size = sizeof(cmd);
382 cmd.msg_address = (uintptr_t)msg_sync_reply;
383 cmd.flags = KDBUS_SEND_SYNC_REPLY;
385 ret = kdbus_cmd_send(conn_dst->fd, &cmd);
386 ASSERT_EXIT(ret == -ECOMM);
389 * Now send a normal message, but the sync reply
390 * will fail since it contains an fd that the
391 * original sender do not want.
393 * The original sender will fail with -ETIMEDOUT
396 ret = kdbus_msg_send_sync(conn_dst, NULL, cookie,
397 KDBUS_MSG_EXPECT_REPLY,
398 5000000000ULL, 0, conn_src->id, -1);
399 ASSERT_EXIT(ret == -EREMOTEIO);
402 ret = kdbus_msg_recv_poll(conn_dst, 100, &msg, NULL);
403 ASSERT_EXIT(ret == 0);
404 ASSERT_EXIT(msg->cookie == cookie);
406 free(msg_sync_reply);
412 ret = kdbus_msg_recv_poll(conn_dummy, 100, NULL, NULL);
413 ASSERT_RETURN(ret == -ETIMEDOUT);
416 ret = kdbus_msg_recv_poll(conn_src, 100, &msg, NULL);
417 ASSERT_RETURN(ret == 0 && msg->cookie == cookie);
422 * Try to reply with a kdbus connection handle, this should
423 * fail with -EOPNOTSUPP
425 msg_sync_reply = get_kdbus_msg_with_fd(conn_src,
427 cookie, conn_dst->fd);
428 ASSERT_RETURN(msg_sync_reply);
430 msg_sync_reply->cookie_reply = cookie;
432 memset(&cmd, 0, sizeof(cmd));
433 cmd.size = sizeof(cmd);
434 cmd.msg_address = (uintptr_t)msg_sync_reply;
436 ret = kdbus_cmd_send(conn_src->fd, &cmd);
437 ASSERT_RETURN(ret == -EOPNOTSUPP);
439 free(msg_sync_reply);
442 * Try to reply with a normal fd, this should fail even
443 * if the response is a sync reply
445 * From the sender view we fail with -ECOMM
447 msg_sync_reply = get_kdbus_msg_with_fd(conn_src,
450 ASSERT_RETURN(msg_sync_reply);
452 msg_sync_reply->cookie_reply = cookie;
454 memset(&cmd, 0, sizeof(cmd));
455 cmd.size = sizeof(cmd);
456 cmd.msg_address = (uintptr_t)msg_sync_reply;
458 ret = kdbus_cmd_send(conn_src->fd, &cmd);
459 ASSERT_RETURN(ret == -ECOMM);
461 free(msg_sync_reply);
464 * Resend another normal message and check if the queue
468 ret = kdbus_msg_send(conn_src, NULL, cookie, 0, 0, 0,
469 conn_dst->id, 0, NULL);
470 ASSERT_RETURN(ret == 0);
472 ret = waitpid(pid, &status, 0);
473 ASSERT_RETURN_VAL(ret >= 0, ret);
475 kdbus_conn_free(conn_dummy);
476 kdbus_conn_free(conn_dst);
477 kdbus_conn_free(conn_src);
479 return (status == EXIT_SUCCESS) ? TEST_OK : TEST_ERR;
482 static int kdbus_send_multiple_fds(struct kdbus_conn *conn_src,
483 struct kdbus_conn *conn_dst)
487 int fds[KDBUS_CONN_MAX_FDS_PER_USER + 1];
488 int memfds[KDBUS_MSG_MAX_ITEMS + 1];
489 struct kdbus_msg *msg;
490 uint64_t dummy_value;
492 dummy_value = time(NULL);
494 for (i = 0; i < KDBUS_CONN_MAX_FDS_PER_USER + 1; i++) {
495 fds[i] = open("/dev/null", O_RDWR|O_CLOEXEC);
496 ASSERT_RETURN_VAL(fds[i] >= 0, -errno);
499 /* Send KDBUS_CONN_MAX_FDS_PER_USER with one more fd */
500 ret = send_fds(conn_src, conn_dst->id, fds,
501 KDBUS_CONN_MAX_FDS_PER_USER + 1);
502 ASSERT_RETURN(ret == -EMFILE);
504 /* Retry with the correct KDBUS_CONN_MAX_FDS_PER_USER */
505 ret = send_fds(conn_src, conn_dst->id, fds,
506 KDBUS_CONN_MAX_FDS_PER_USER);
507 ASSERT_RETURN(ret == 0);
509 ret = kdbus_msg_recv(conn_dst, &msg, NULL);
510 ASSERT_RETURN(ret == 0);
512 /* Check we got the right number of fds */
513 nfds = kdbus_item_get_nfds(msg);
514 ASSERT_RETURN(nfds == KDBUS_CONN_MAX_FDS_PER_USER);
518 for (i = 0; i < KDBUS_MSG_MAX_ITEMS + 1; i++, dummy_value++) {
519 memfds[i] = memfd_write("memfd-name",
521 sizeof(dummy_value));
522 ASSERT_RETURN_VAL(memfds[i] >= 0, memfds[i]);
525 /* Send KDBUS_MSG_MAX_ITEMS with one more memfd */
526 ret = send_memfds(conn_src, conn_dst->id,
527 memfds, KDBUS_MSG_MAX_ITEMS + 1);
528 ASSERT_RETURN(ret == -E2BIG);
530 ret = send_memfds(conn_src, conn_dst->id,
531 memfds, KDBUS_MSG_MAX_MEMFD_ITEMS + 1);
532 ASSERT_RETURN(ret == -E2BIG);
534 /* Retry with the correct KDBUS_MSG_MAX_ITEMS */
535 ret = send_memfds(conn_src, conn_dst->id,
536 memfds, KDBUS_MSG_MAX_MEMFD_ITEMS);
537 ASSERT_RETURN(ret == 0);
539 ret = kdbus_msg_recv(conn_dst, &msg, NULL);
540 ASSERT_RETURN(ret == 0);
542 /* Check we got the right number of fds */
543 nfds = kdbus_item_get_nfds(msg);
544 ASSERT_RETURN(nfds == KDBUS_MSG_MAX_MEMFD_ITEMS);
550 * Combine multiple KDBUS_CONN_MAX_FDS_PER_USER+1 fds and
553 ret = send_fds_memfds(conn_src, conn_dst->id,
554 fds, KDBUS_CONN_MAX_FDS_PER_USER + 1,
556 ASSERT_RETURN(ret == -EMFILE);
558 ret = kdbus_msg_recv(conn_dst, NULL, NULL);
559 ASSERT_RETURN(ret == -EAGAIN);
562 * Combine multiple KDBUS_CONN_MAX_FDS_PER_USER fds and
563 * (128 - 1) + 1 memfds, all fds take one item, while each
564 * memfd takes one item
566 ret = send_fds_memfds(conn_src, conn_dst->id,
567 fds, KDBUS_CONN_MAX_FDS_PER_USER,
568 memfds, (KDBUS_MSG_MAX_ITEMS - 1) + 1);
569 ASSERT_RETURN(ret == -E2BIG);
571 ret = send_fds_memfds(conn_src, conn_dst->id,
572 fds, KDBUS_CONN_MAX_FDS_PER_USER,
573 memfds, KDBUS_MSG_MAX_MEMFD_ITEMS + 1);
574 ASSERT_RETURN(ret == -E2BIG);
576 ret = kdbus_msg_recv(conn_dst, NULL, NULL);
577 ASSERT_RETURN(ret == -EAGAIN);
580 * Send KDBUS_CONN_MAX_FDS_PER_USER fds +
581 * KDBUS_MSG_MAX_MEMFD_ITEMS memfds
583 ret = send_fds_memfds(conn_src, conn_dst->id,
584 fds, KDBUS_CONN_MAX_FDS_PER_USER,
585 memfds, KDBUS_MSG_MAX_MEMFD_ITEMS);
586 ASSERT_RETURN(ret == 0);
588 ret = kdbus_msg_recv(conn_dst, &msg, NULL);
589 ASSERT_RETURN(ret == 0);
591 /* Check we got the right number of fds */
592 nfds = kdbus_item_get_nfds(msg);
593 ASSERT_RETURN(nfds == KDBUS_CONN_MAX_FDS_PER_USER +
594 KDBUS_MSG_MAX_MEMFD_ITEMS);
600 * Re-send fds + memfds, close them, but do not receive them
601 * and try to queue more
603 ret = send_fds_memfds(conn_src, conn_dst->id,
604 fds, KDBUS_CONN_MAX_FDS_PER_USER,
605 memfds, KDBUS_MSG_MAX_MEMFD_ITEMS);
606 ASSERT_RETURN(ret == 0);
608 /* close old references and get a new ones */
609 for (i = 0; i < KDBUS_CONN_MAX_FDS_PER_USER + 1; i++) {
611 fds[i] = open("/dev/null", O_RDWR|O_CLOEXEC);
612 ASSERT_RETURN_VAL(fds[i] >= 0, -errno);
615 /* should fail since we have already fds in the queue */
616 ret = send_fds(conn_src, conn_dst->id, fds,
617 KDBUS_CONN_MAX_FDS_PER_USER);
618 ASSERT_RETURN(ret == -EMFILE);
620 /* This should succeed */
621 ret = send_memfds(conn_src, conn_dst->id,
622 memfds, KDBUS_MSG_MAX_MEMFD_ITEMS);
623 ASSERT_RETURN(ret == 0);
625 ret = kdbus_msg_recv(conn_dst, &msg, NULL);
626 ASSERT_RETURN(ret == 0);
628 nfds = kdbus_item_get_nfds(msg);
629 ASSERT_RETURN(nfds == KDBUS_CONN_MAX_FDS_PER_USER +
630 KDBUS_MSG_MAX_MEMFD_ITEMS);
634 ret = kdbus_msg_recv(conn_dst, &msg, NULL);
635 ASSERT_RETURN(ret == 0);
637 nfds = kdbus_item_get_nfds(msg);
638 ASSERT_RETURN(nfds == KDBUS_MSG_MAX_MEMFD_ITEMS);
642 ret = kdbus_msg_recv(conn_dst, NULL, NULL);
643 ASSERT_RETURN(ret == -EAGAIN);
645 for (i = 0; i < KDBUS_CONN_MAX_FDS_PER_USER + 1; i++)
648 for (i = 0; i < KDBUS_MSG_MAX_ITEMS + 1; i++)
654 int kdbus_test_fd_passing(struct kdbus_test_env *env)
656 struct kdbus_conn *conn_src, *conn_dst;
657 const char *str = "stackenblocken";
658 const struct kdbus_item *item;
659 struct kdbus_msg *msg;
668 now = (uint64_t) time(NULL);
670 /* create two connections */
671 conn_src = kdbus_hello(env->buspath, 0, NULL, 0);
672 conn_dst = kdbus_hello(env->buspath, 0, NULL, 0);
673 ASSERT_RETURN(conn_src && conn_dst);
675 fds_conn[0] = conn_src->fd;
676 fds_conn[1] = conn_dst->fd;
678 ret = socketpair(AF_UNIX, SOCK_STREAM, 0, sock_pair);
679 ASSERT_RETURN(ret == 0);
682 memfd = memfd_write("memfd-name", &now, sizeof(now));
683 ASSERT_RETURN(memfd >= 0);
687 ASSERT_RETURN(ret == 0);
689 i = write(fds[1], str, strlen(str));
690 ASSERT_RETURN(i == strlen(str));
693 * Try to ass the handle of a connection as message payload.
696 ret = send_fds(conn_src, conn_dst->id, fds_conn, 2);
697 ASSERT_RETURN(ret == -ENOTSUP);
699 ret = send_fds(conn_dst, conn_src->id, fds_conn, 2);
700 ASSERT_RETURN(ret == -ENOTSUP);
702 ret = send_fds(conn_src, conn_dst->id, sock_pair, 2);
703 ASSERT_RETURN(ret == -ENOTSUP);
706 * Send fds and memfds to connection that do not accept fds
708 ret = kdbus_test_no_fds(env, fds, (int *)&memfd);
709 ASSERT_RETURN(ret == 0);
711 /* Try to broadcast file descriptors. This must fail. */
712 ret = send_fds(conn_src, KDBUS_DST_ID_BROADCAST, fds, 1);
713 ASSERT_RETURN(ret == -ENOTUNIQ);
715 /* Try to broadcast memfd. This must succeed. */
716 ret = send_memfds(conn_src, KDBUS_DST_ID_BROADCAST, (int *)&memfd, 1);
717 ASSERT_RETURN(ret == 0);
719 /* Open code this loop */
723 * Send the read end of the pipe and close it.
725 ret = send_fds(conn_src, conn_dst->id, fds, 1);
726 ASSERT_RETURN(ret == 0);
729 ret = kdbus_msg_recv(conn_dst, &msg, NULL);
730 ASSERT_RETURN(ret == 0);
732 KDBUS_ITEM_FOREACH(item, msg, items) {
733 if (item->type == KDBUS_ITEM_FDS) {
735 int nfds = (item->size - KDBUS_ITEM_HEADER_SIZE) /
737 ASSERT_RETURN(nfds == 1);
739 i = read(item->fds[0], tmp, sizeof(tmp));
741 ASSERT_RETURN(i == sizeof(tmp));
742 ASSERT_RETURN(memcmp(tmp, str, sizeof(tmp)) == 0);
748 * Resend the read end of the pipe,
749 * the receiver still holds a reference
758 * Close the last reference to the read end
759 * of the pipe, other references are
760 * automatically closed just after send.
767 * Try to resend the read end of the pipe. Must fail with
768 * -EBADF since both the sender and receiver closed their
769 * references to it. We assume the above since sender and
770 * receiver are on the same process.
772 ret = send_fds(conn_src, conn_dst->id, fds, 1);
773 ASSERT_RETURN(ret == -EBADF);
775 /* Then we clear out received any data... */
778 ret = kdbus_send_multiple_fds(conn_src, conn_dst);
779 ASSERT_RETURN(ret == 0);
785 kdbus_conn_free(conn_src);
786 kdbus_conn_free(conn_dst);