mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Josiah Worcester <josiahw@gmail.com>
To: musl@lists.openwall.com
Subject: Re: AS-safe change for multithreaded setxid breaks chroot() along with set*id()
Date: Fri, 01 Apr 2016 20:28:48 +0000	[thread overview]
Message-ID: <CAMAJcuDd26qMfYYyZ2NbpOghGYMtTN4r+JGZ1Jghxm5TmnAwYA@mail.gmail.com> (raw)
In-Reply-To: <20160401202249.GB961@lalala>

[-- Attachment #1: Type: text/plain, Size: 1179 bytes --]

On Fri, Apr 1, 2016 at 1:23 PM Lance Chen <cyen0312@gmail.com> wrote:

> Hello there,
>
> I have been trying to run powerdns on Alpine Linux, which features musl,
> without success. It turns out that the AS-safe strategy introduced in
> the patch
>
> http://git.musl-libc.org/cgit/musl/commit/?id=78a8ef47c4d92b7680c52a85f80a81e29da86bb9
> ,
> especially the use of reading /proc/self/task, causes the failure. The
> failure condition is a combination of three features, pthread, chroot,
> and set*id. After chroot()'ing to some directory, calling set*id() will
> try to access /proc/self/task, and fail to find the directory in the new
> root. I've created a minimal POC at
> https://gist.github.com/Lance0312/c7a82793e35b322bfbdfe96b79dd3152.
>

>

A fairly simple fix for this would be to create and mount /proc in the
chroot. This is likely to be needed for some other interfaces in libc as
well as other libraries and utilities, because there's functionality of
Linux which is only really exposed in that filesystem. I don't know of
anything in particular that would fail on glibc, but I am confident that
you'll have issues, just like if you don't have /dev in the chroot.

[-- Attachment #2: Type: text/html, Size: 1861 bytes --]

  reply	other threads:[~2016-04-01 20:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 20:22 Lance Chen
2016-04-01 20:28 ` Josiah Worcester [this message]
2016-04-02  1:03   ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMAJcuDd26qMfYYyZ2NbpOghGYMtTN4r+JGZ1Jghxm5TmnAwYA@mail.gmail.com \
    --to=josiahw@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).