Re: Cannot bind an AF_UNIX socket with large filenames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Kerrisk writes:

Hi Sam,

(Always worth CCing me as well as the list, if you want my attention
on a bug report.)
On Sat, Nov 29, 2008 at 9:34 AM, Sam Varshavchik <mrsam@xxxxxxxxxxxxxxx> wrote:
It looks like the kernel -- at least 2.6.27.5 -- rejects with EINVAL a
bind() of an AF_UNIX socket whose given size exceeds sizeof(struct
sockaddr_un).

Even if I make arrangements for a larger structure to accomodate a path that
exceeds sockaddr_un's 107 bytes + \0, and I specify the actual size of the
structure, bind() fails for me.

I don't have the details, but I'm pretty sure other unixes accept domain
sockets with larger filenames.

Are you sure of that?  Offhand, I don't know of such implementations,
but it's been a while since I tested this.  Which systems have you
seen this on?

Well, by process of elimination it has to be either Solaris or AIX, since those are the only ones I've worked with, in the last couple of decades. However, I don't remember which specific versions.

There, the sockaddr_un structure exists for
historical reasons, and you can pretty much roll your own.

This is perhaps worth mentioning in the description of EINVAL in unix(7).

I'm not (yet) convinced.

Well, various pathnames on various distros are getting longer, as times go by. That's how this one came up on my radar screen.

It might be interesting to track down where the magical 108 byte limitation came from, but I don't really know where to look. Presuming four bytes for the address family, that leaves the total structure of 112 bytes. Can't think of a reason to use precisely that size, nothing more, and nothing less.

Attachment: pgpPQrVej1ZDW.pgp
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux