Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Unix domain sockets in abstract namespace

Maxim Dounin
September 25, 2012 01:20AM
Hello!

On Fri, Sep 21, 2012 at 09:28:16AM +0200, Dirk Feytons wrote:

> On Wed, Sep 19, 2012 at 3:56 PM, Maxim Dounin <mdounin@mdounin.ru> wrote:
> > Hello!
> >
> > On Wed, Sep 12, 2012 at 11:46:52AM +0200, Dirk Feytons wrote:
> >
> >> Hi,
> >>
> >> I was playing around with ngx_lua and its socket API, which is built
> >> on top of nginx functionality. The API supports unix domain sockets
> >> but not in the abstract namespace, at least not officially. When I
> >> tried specifying an abstract address I found it didn't work. I tracked
> >> it down to two calls to ngx_cpystrn() in
> >> core/ngx_inet.c:ngx_parse_unix_domain_url(). That function gets
> >> confused by the leading '\0' in an abstract namespace address.
> >
> > This is because the abstract namespace is actually linux extension
> > to unix domain sockets, "The abstract socket namespace is a
> > nonportable Linux extension" (from [1]).
> >
> > Strictly speaking, it's not something even permitted by POSIX as
> > socket path ends with first null byte as per POSIX.
>
> Yeah; I know it's Linux specific. Too bad in my opinion; I find it
> easier to work with than the regular namespace.
>
> >> Changing it to ngx_memcpy() fixes this and then everything works.
> >>
> >> I attached a patch agains nginx 1.2.3. The fix seems trivial but this
> >> is my first look into the nginx internals so I don't know whether
> >> there are unwanted side effects from this change. Feedback welcome.
> >
> > I suspect there may be some, in particular during logging of
> > errors and probably while parsing untrusted urls.
>
> Okay, I'll have a look at the code again.
> Are you willing to accept a patch to support the abstract namespace?
> Or does the fact that it's a nonportable Linux extension make it a
> no-go for inclusion in nginx?

It would be fine to add support, though I would like to make sure
various possible side effects are checked/addressed.

Maxim Dounin

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Unix domain sockets in abstract namespace Attachments

Dirk Feytons 1896 September 12, 2012 05:48AM

Re: [PATCH] Unix domain sockets in abstract namespace

Maxim Dounin 622 September 19, 2012 09:58AM

Re: [PATCH] Unix domain sockets in abstract namespace

Dirk Feytons 699 September 21, 2012 03:30AM

Re: [PATCH] Unix domain sockets in abstract namespace

Maxim Dounin 890 September 25, 2012 01:20AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 156
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready