← Back to team overview

kernel-packages team mailing list archive

[Bug 1540731] Re: SocketMessenger::update_session_creds() fails to get client PID, causing "[ FAILED ] PromptSessionClientAPI.client_pid_is_associated_with_session" on kernel 4.4 (but kernel 4.3 works)

 

This is the commit that introduced this regression in V4.4-rc6:


commit 3822b5c2fc62e3de8a0f33806ff279fb7df92432
Author: Rainer Weikusat <rweikusat@xxxxxxxxxxxxxxxxxxxxxxx>
Date:   Wed Dec 16 20:09:25 2015 +0000

    af_unix: Revert 'lock_interruptible' in stream receive code

    With b3ca9b02b00704053a38bfe4c31dbbb9c13595d0, the AF_UNIX SOCK_STREAM
    receive code was changed from using mutex_lock(&u->readlock) to
    mutex_lock_interruptible(&u->readlock) to prevent signals from being
    delayed for an indefinite time if a thread sleeping on the mutex
    happened to be selected for handling the signal. But this was never a
    problem with the stream receive code (as opposed to its datagram
    counterpart) as that never went to sleep waiting for new messages with the
    mutex held and thus, wouldn't cause secondary readers to block on the
    mutex waiting for the sleeping primary reader. As the interruptible
    locking makes the code more complicated in exchange for no benefit,
    change it back to using mutex_lock.

    Signed-off-by: Rainer Weikusat <rweikusat@xxxxxxxxxxxxxxxxxxxxxxx>
    Acked-by: Hannes Frederic Sowa <hannes@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1540731

Title:
  SocketMessenger::update_session_creds() fails to get client PID,
  causing "[ FAILED ]
  PromptSessionClientAPI.client_pid_is_associated_with_session" on
  kernel 4.4 (but kernel 4.3 works)

Status in GLibC:
  New
Status in Mir:
  Confirmed
Status in linux package in Ubuntu:
  In Progress

Bug description:
  Since updating to the 4.4.0-2 kernel recvmsg() fails SCM_CREDENTIALS
  request with EOPNOTSUPP.

  This manifests as a test failure in Mir:

      [ RUN      ] PromptSessionClientAPI.client_pid_is_associated_with_session
      unknown file: Failure

  Test case:

  #include <stdlib.h>
  #include <stdio.h>
  #include <sys/socket.h>
  #include <sys/stat.h>
  #include <assert.h>
  #include <errno.h>
  #include <string.h>

  int main()
  {
      enum { server, client, size };
      int socket_fd[size];
      int const opt = 1;

      assert(socketpair(AF_LOCAL, SOCK_STREAM, 0, socket_fd) == 0);

      char const msg[] = "A random message";
      send(socket_fd[client], msg, sizeof msg, MSG_DONTWAIT | MSG_NOSIGNAL);

      assert(setsockopt(socket_fd[server], SOL_SOCKET, SO_PASSCRED,
  &opt, sizeof(opt)) != -1);

      union {
          struct cmsghdr cmh;
          char control[CMSG_SPACE(sizeof(ucred))];
      } control_un;

      control_un.cmh.cmsg_len = CMSG_LEN(sizeof(ucred));
      control_un.cmh.cmsg_level = SOL_SOCKET;
      control_un.cmh.cmsg_type = SCM_CREDENTIALS;

      msghdr msgh;
      msgh.msg_name = NULL;
      msgh.msg_namelen = 0;
      msgh.msg_iov = NULL;
      msgh.msg_iovlen = 0;
      msgh.msg_control = control_un.control;
      msgh.msg_controllen = sizeof(control_un.control);

      errno = 0;

      if (recvmsg(socket_fd[server], &msgh, MSG_PEEK) == -1)
      {
          printf("Error: %s\n", strerror(errno));
          exit(EXIT_FAILURE);
      }
      else
      {
          printf("Success!\n");
          exit(EXIT_SUCCESS);
      }
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/glibc/+bug/1540731/+subscriptions