Re: git: aba79b0f4a3f - main - mbuf: provide mc_uiotomc() a function to copy from uio(9) to mchain

From: Emmanuel Vadot <manu_at_bidouilliste.com>
Date: Fri, 12 Apr 2024 07:39:39 UTC
 Hi Gleb,

On Mon, 8 Apr 2024 20:29:47 GMT
Gleb Smirnoff <glebius@FreeBSD.org> wrote:

> The branch main has been updated by glebius:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=aba79b0f4a3f69f070ace6effd5700d65226bd20
> 
> commit aba79b0f4a3f69f070ace6effd5700d65226bd20
> Author:     Gleb Smirnoff <glebius@FreeBSD.org>
> AuthorDate: 2024-04-08 20:16:51 +0000
> Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
> CommitDate: 2024-04-08 20:16:51 +0000
> 
>     mbuf: provide mc_uiotomc() a function to copy from uio(9) to mchain
>     
>     Implement m_uiotombuf() as a wrapper around mc_uiotomc().  The M_EXTPG is
>     left untouched.  The m_uiotombuf() is left as a compat KPI.  New code
>     should use either mc_uiotomc() or m_uiotombuf_nomap().
>     
>     Reviewed by:            markj, tuexen
>     Differential Revision:  https://reviews.freebsd.org/D44150
> ---
>  sys/kern/uipc_mbuf.c | 126 +++++++++++++++++++++++++++++++++------------------
>  sys/sys/mbuf.h       |   1 +
>  2 files changed, 83 insertions(+), 44 deletions(-)
> 

 As discussed on irc yesterday this is the commit that broke something
wrt unix socket.
 This was fixed by d80a97def9a1db6f07f5d2e68f7ad62b27918947 but since
this commit was later reverted we still have the problem.
 I now see problems with sway and swaymsg, it's unable to write to the
socket setup by sway itself. Other unix socket seems to work fine (I
can nc -U /var/run/devd.pipe correctly). 

  1590 swaymsg  CALL  socket(PF_LOCAL,0x1<SOCK_STREAM>,0)
  1590 swaymsg  RET   socket 3
  1590 swaymsg  CALL  connect(0x3,0x821170006,0x6a)
  1590 swaymsg  CAP   system call not allowed: connect
  1590 swaymsg  STRU  struct sockaddr
{ AF_LOCAL, /var/run/xdg/manu/sway-ipc.1001.1561.sock } 1590 swaymsg
NAMI  "/var/run/xdg/manu/sway-ipc.1001.1561.sock" 1590 swaymsg  RET
connect 0 1590 swaymsg  CALL  setsockopt(0x3,SOL_SOCKET,SO_RCVTIMEO,
0x821170068,0x10) 1590 swaymsg  RET   setsockopt 0
  1590 swaymsg  CALL  write(0x3,0x821170058,0xe)
  1590 swaymsg  GIO   fd 3 wrote 14 bytes
       "i3-ipc\0\0\0\0\0\0\0\0"
  1590 swaymsg  RET   write 14/0xe
  1590 swaymsg  CALL  write(0x3,0x1fbe1da08008,0)
  1590 swaymsg  RET   write -1 errno 14 Bad address

What swaymsg do differently from nc -U is :
  1590 swaymsg  CALL  setsockopt(0x3,SOL_SOCKET,SO_RCVTIMEO,
0x821170068,0x10) 1590 swaymsg  RET   setsockopt 0
 There is probably more difference but that's the main one I can see.

 Cheers,

-- 
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>