Bug 23978 - dlmopen(): increasing the number of name spaces
Summary: dlmopen(): increasing the number of name spaces
Status: UNCONFIRMED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-12 07:56 UTC by Atsushi Hori
Modified: 2020-01-02 07:44 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Atsushi Hori 2018-12-12 07:56:34 UTC
Is there any chance to increase the number of name spaces created by calling dlmopen()?

I am working on new parallel execution model (named Process-in-Process (PiP), detailes: https://dl.acm.org/citation.cfm?id=3208045) and I want to create name spaces much more than 16 which is the current upper limit.

I already have a patch to do this. It is very simple. Just increase the number of DL_NNS found in sysdeps/generic/ldsodefs.h.  I would like to have around 300 which is mlarger than the number of cores available on Xeon Phi (KNL).
Comment 1 Florian Weimer 2019-07-08 10:04:41 UTC
I'm not sure that it's a good idea to retrofit such execution models onto an existing dynamic loader.

libc.so needs around 144 bytes of TLS space.  Supporting 300 name spaces would need a static TLS reserve of at least 43 KiB, and this reserve could not be used for anything else.  For such large numbers of name spaces, we would have to find a way to deal with initial-exec TLS memory used by the implementation itself.
Comment 2 Atsushi Hori 2019-07-09 00:43:51 UTC
It's been a long time since I posted and I almost forget about this issue. At last I got a comment, this is great!

I understand your concern.  Although I have only little knowledge about glibc including ld.so, I wonder if it is possible to dynamically allocate the 'TLS' regions.

I also found that the recent audit implementation using a uint32_t as the audit flags for name spaces is not a good idea.

Anyhow, I am very happy to have this feedback.

P.S.
If some of you might be interested in the PiP model, you can try it by downloading from;
https://github.com/RIKEN-SysSoft/PiP

I also uploaded some presentation slides which are much easier to read than reading the HPDC paper.
Comment 3 Florian Weimer 2019-07-09 05:52:07 UTC
(In reply to Atsushi Hori from comment #2)
> It's been a long time since I posted and I almost forget about this issue.
> At last I got a comment, this is great!
> 
> I understand your concern.  Although I have only little knowledge about
> glibc including ld.so, I wonder if it is possible to dynamically allocate
> the 'TLS' regions.

No, because the implementation is free to store pointers to TLS variables, so the allocation cannot be moved (and we might have to move it if its size changes).
Comment 4 Atsushi Hori 2019-07-09 07:03:28 UTC
Thank you, Florian,

I think I know what TLS is, but what I wanted yo to do is expanding the size of name space table, or dynamically allocating name space entriesI  believe this is independent from TLS variables. Just correct me, if I am wrong.
Comment 5 Florian Weimer 2019-07-09 07:23:38 UTC
These two are related.  Each namespace must load libc.so, and libc.so contains some TLS variables.  The number of usable namespaces is therefore limited by the size of the static TLS reserve divided by the amount of initial-exec TLS memory that libc.so uses.
Comment 6 Atsushi Hori 2020-01-02 07:44:56 UTC
I discussed with the PiP (Process-in-Process) users on this issue.  One idea, I hope you can accept this, was brought up.  Could you make the DL_NNS (defined in sysdeps/generic/ldsodefs.h) a configure option?