mailing list of musl libc
 help / color / mirror / code / Atom feed
From: u-igbb@aetey.se
To: musl@lists.openwall.com
Subject: Re: musl 1.0.x branch
Date: Wed, 11 Jun 2014 12:24:19 +0200	[thread overview]
Message-ID: <20140611102314.GI20596@example.net> (raw)
In-Reply-To: <20140610215156.GO179@brightrain.aerifal.cx>

On Tue, Jun 10, 2014 at 05:51:56PM -0400, Rich Felker wrote:
> >  --I-really-know-what-I-am-doing-and-why=env-db-redirection-never-ever-suid
> > makes a feature quite hard to choose without thinking at least a second :)
> 
> Sadly, I really doubt it does; it comes across as patronizing, which
> annoys users with an "I know what I'm doing!" attitude.

:(

> In any case, it's also a matter of maintenance cost. Supporting
> environment variables to override these things is not always trivial.
> Some (most?) of these interfaces are required to be thread-safe and
> accessing the environment is not thread-safe with respect to other
> threads modifying it. There may also be storage/allocation burdens

Do you mean that getenv("SOMETHING") can be screwed if a different
thread is doing setenv("SOMETHINGELSE",...) at a wrong time?

(This "SOMETHING"'s value is _not_ to be modified under the lifetime of
the process.)

> when allowing a custom runtime path requires concatenating it with
> another string. Even if none of this were difficult, it's extra

An unmodified program can be impossible to compile against the
modified libc as we do it, as certain macros become no longer constants
but expressions to evaluate at run time. This is of course expected.

Luckily these applications needing both the functionality and specific
fixes are a minority.

> combinatorics for testing, and that issue was basically uclibc's
> demise.

Yes, I appreciate how much easier it is to build musl than uclibc,
without choosing among the myriads of options. Wonder which subset of
the combinations in uclibc actually was ever tested :)

> In the long term there may be ways we could change things upstream to
> make it easier to maintain your changes -- for instance, replacing the
> inline string literals with references to symbols. You could then
> replace the const arrays the symbols refer to with non-const arrays
> that get filled in at program startup (this is probably a lot safer
> than calling getenv on demand, albeit slightly more bloated).

I readily trade off runtime efficiency for least possible complexity
and bloating. Thread safety is not to be traded though.

Filling the strings array at startup would be certainly acceptable here
both regarding the cpu and storage penalty. If the overhead for the
"standard" compile can be made negligible it would be certainly a very
nice way to allow us to "plug in" our indirections.

This would also remove any dependency between the details of the
implementation of get/setenv() and the correctness of applications
built here.

> *nod* It's a shame this option isn't available in mainline kernels
> though. It would be really nice if any user could do bind mounts with
> a local fs/mount namespace and if doing so just precluded the suid bit
> from taking effect in affected processes.

Agreed, given some redesign we might have a much more convenient/sane
architecture. On the other side I am unsure the changes would not expose
new issues which might happen to be hard to solve, possibly "as hard as
safe setuid"?.. And then it would no longer be Posix-compatible
and would probably need a corresponding standardization effort (sigh).

> > We solve this pretty straightforwardly by using environment variables,
> > pointing to a relevant "shadow" file and/or pam configurations.
> 
> Note that the "tcb shadow" support in musl already provides this
> functionality. For your purposes, of course, you already have path
> override so it makes sense just to use the same tool you're using for
> everything else. But for other uses outside yours, tcb shadow is a
> really nice solution to this problem.

Yes I looked at it - it is unfortunately also a solution for goals
"other than ours". AFAICS it still assumes a hardcoded database
placement (/etc/tcb). In this sence it is orthogonal to what we do, we
may choose to use it for its nice virtues but we still need to be able
to point out the necessary tcb shadow database instance per process,
not per compiled binary.

Thanks for the positive discussion Rich.

Regards,
Rune



  reply	other threads:[~2014-06-11 10:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06 17:56 Rich Felker
2014-06-06 19:39 ` u-igbb
2014-06-07  6:23   ` Kevin Bortis
2014-06-07 13:16 ` Anthony G. Basile
2014-06-07 18:26 ` Gustavo Zacarias
2014-06-09  9:23 ` Natanael Copa
2014-06-09 20:08   ` Rich Felker
2014-06-10  9:43     ` u-igbb
2014-06-10 16:03       ` Rich Felker
2014-06-10 16:50         ` Laurent Bercot
2014-06-10 17:37           ` Rich Felker
2014-06-10 19:19             ` Laurent Bercot
2014-06-10 21:01               ` Rich Felker
2014-06-11  1:27                 ` Laurent Bercot
2014-06-10 20:32         ` u-igbb
2014-06-10 21:51           ` Rich Felker
2014-06-11 10:24             ` u-igbb [this message]
2014-06-11 13:09               ` Rich Felker
2014-06-11 14:37                 ` u-igbb
2014-06-10 21:25         ` Natanael Copa
2014-06-10 21:13           ` musl 1.0.x branch -- OT u-igbb
2014-06-10 21:55           ` musl 1.0.x branch Rich Felker
2014-06-11 10:41 ` Oliver Schneider
2014-06-11 13:16   ` Rich Felker
2014-06-12 18:46     ` Oliver Schneider
2014-06-13  1:23       ` 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=20140611102314.GI20596@example.net \
    --to=u-igbb@aetey.se \
    --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).