[18/20] Fix elf/tst-dlmopen-twice to support enough link namespaces

Message ID 1adc193aeb267bdb147428b747e66c77cfd447d0.1666877952.git.szabolcs.nagy@arm.com
State Superseded
Headers
Series patches from the morello port |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Szabolcs Nagy Oct. 27, 2022, 3:33 p.m. UTC
  The test dlmopens 10 namespaces recursively, which requires a glibc
tunable setting, otherwise it may run out of static TLS.
---
 elf/Makefile            | 1 +
 elf/tst-dlmopen-twice.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
  

Comments

Florian Weimer Oct. 27, 2022, 4:24 p.m. UTC | #1
* Szabolcs Nagy via Libc-alpha:

> The test dlmopens 10 namespaces recursively, which requires a glibc
> tunable setting, otherwise it may run out of static TLS.
> ---
>  elf/Makefile            | 1 +
>  elf/tst-dlmopen-twice.c | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/elf/Makefile b/elf/Makefile
> index 7b50ccc07a..ace15dc11b 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -2969,6 +2969,7 @@ tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
>  $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
>  tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
>  
> +tst-dlmopen-twice-ENV = GLIBC_TUNABLES=glibc.rtld.nns=10
>  $(objpfx)tst-dlmopen-twice.out: \
>    $(objpfx)tst-dlmopen-twice-mod1.so \
>    $(objpfx)tst-dlmopen-twice-mod2.so
> diff --git a/elf/tst-dlmopen-twice.c b/elf/tst-dlmopen-twice.c
> index 70c71fe19c..dfa58b1505 100644
> --- a/elf/tst-dlmopen-twice.c
> +++ b/elf/tst-dlmopen-twice.c
> @@ -46,7 +46,7 @@ do_test (void)
>    recurse (1);
>  
>    /* Then with nesting.  The constant needs to be less than the
> -     internal DL_NNS namespace constant.  */
> +     glibc.rtld.nns tunable (which is between 1 and DL_NNS).  */
>    recurse (10);
>    return 0;
>  }

This doesn't work if configured with --disable-tunables.

I suspect this is merely a symptom.  The static TLS sizing defaults
should allow creating DL_NNS namespaces?

Thanks,
Florian
  
Szabolcs Nagy Oct. 27, 2022, 4:45 p.m. UTC | #2
The 10/27/2022 18:24, Florian Weimer wrote:
> * Szabolcs Nagy via Libc-alpha:
> 
> > The test dlmopens 10 namespaces recursively, which requires a glibc
> > tunable setting, otherwise it may run out of static TLS.
> > ---
> >  elf/Makefile            | 1 +
> >  elf/tst-dlmopen-twice.c | 2 +-
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/elf/Makefile b/elf/Makefile
> > index 7b50ccc07a..ace15dc11b 100644
> > --- a/elf/Makefile
> > +++ b/elf/Makefile
> > @@ -2969,6 +2969,7 @@ tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
> >  $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
> >  tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
> >  
> > +tst-dlmopen-twice-ENV = GLIBC_TUNABLES=glibc.rtld.nns=10
> >  $(objpfx)tst-dlmopen-twice.out: \
> >    $(objpfx)tst-dlmopen-twice-mod1.so \
> >    $(objpfx)tst-dlmopen-twice-mod2.so
> > diff --git a/elf/tst-dlmopen-twice.c b/elf/tst-dlmopen-twice.c
> > index 70c71fe19c..dfa58b1505 100644
> > --- a/elf/tst-dlmopen-twice.c
> > +++ b/elf/tst-dlmopen-twice.c
> > @@ -46,7 +46,7 @@ do_test (void)
> >    recurse (1);
> >  
> >    /* Then with nesting.  The constant needs to be less than the
> > -     internal DL_NNS namespace constant.  */
> > +     glibc.rtld.nns tunable (which is between 1 and DL_NNS).  */
> >    recurse (10);
> >    return 0;
> >  }
> 
> This doesn't work if configured with --disable-tunables.
> 
> I suspect this is merely a symptom.  The static TLS sizing defaults
> should allow creating DL_NNS namespaces?

the tunable defaults to 4, DL_NNS is 16 and that's the max value
of the tunable (since that's the static namespace array size)
  
Adhemerval Zanella Netto Oct. 27, 2022, 4:47 p.m. UTC | #3
On 27/10/22 13:24, Florian Weimer via Libc-alpha wrote:
> * Szabolcs Nagy via Libc-alpha:
> 
>> The test dlmopens 10 namespaces recursively, which requires a glibc
>> tunable setting, otherwise it may run out of static TLS.
>> ---
>>  elf/Makefile            | 1 +
>>  elf/tst-dlmopen-twice.c | 2 +-
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/elf/Makefile b/elf/Makefile
>> index 7b50ccc07a..ace15dc11b 100644
>> --- a/elf/Makefile
>> +++ b/elf/Makefile
>> @@ -2969,6 +2969,7 @@ tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
>>  $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
>>  tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
>>  
>> +tst-dlmopen-twice-ENV = GLIBC_TUNABLES=glibc.rtld.nns=10
>>  $(objpfx)tst-dlmopen-twice.out: \
>>    $(objpfx)tst-dlmopen-twice-mod1.so \
>>    $(objpfx)tst-dlmopen-twice-mod2.so
>> diff --git a/elf/tst-dlmopen-twice.c b/elf/tst-dlmopen-twice.c
>> index 70c71fe19c..dfa58b1505 100644
>> --- a/elf/tst-dlmopen-twice.c
>> +++ b/elf/tst-dlmopen-twice.c
>> @@ -46,7 +46,7 @@ do_test (void)
>>    recurse (1);
>>  
>>    /* Then with nesting.  The constant needs to be less than the
>> -     internal DL_NNS namespace constant.  */
>> +     glibc.rtld.nns tunable (which is between 1 and DL_NNS).  */
>>    recurse (10);
>>    return 0;
>>  }
> 
> This doesn't work if configured with --disable-tunables.
> 
> I suspect this is merely a symptom.  The static TLS sizing defaults
> should allow creating DL_NNS namespaces?

Another question would be whether if we should keep --disable-tunables option.
  
Florian Weimer Oct. 27, 2022, 4:51 p.m. UTC | #4
* Szabolcs Nagy:

> The 10/27/2022 18:24, Florian Weimer wrote:
>> * Szabolcs Nagy via Libc-alpha:
>> 
>> > The test dlmopens 10 namespaces recursively, which requires a glibc
>> > tunable setting, otherwise it may run out of static TLS.
>> > ---
>> >  elf/Makefile            | 1 +
>> >  elf/tst-dlmopen-twice.c | 2 +-
>> >  2 files changed, 2 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/elf/Makefile b/elf/Makefile
>> > index 7b50ccc07a..ace15dc11b 100644
>> > --- a/elf/Makefile
>> > +++ b/elf/Makefile
>> > @@ -2969,6 +2969,7 @@ tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
>> >  $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
>> >  tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
>> >  
>> > +tst-dlmopen-twice-ENV = GLIBC_TUNABLES=glibc.rtld.nns=10
>> >  $(objpfx)tst-dlmopen-twice.out: \
>> >    $(objpfx)tst-dlmopen-twice-mod1.so \
>> >    $(objpfx)tst-dlmopen-twice-mod2.so
>> > diff --git a/elf/tst-dlmopen-twice.c b/elf/tst-dlmopen-twice.c
>> > index 70c71fe19c..dfa58b1505 100644
>> > --- a/elf/tst-dlmopen-twice.c
>> > +++ b/elf/tst-dlmopen-twice.c
>> > @@ -46,7 +46,7 @@ do_test (void)
>> >    recurse (1);
>> >  
>> >    /* Then with nesting.  The constant needs to be less than the
>> > -     internal DL_NNS namespace constant.  */
>> > +     glibc.rtld.nns tunable (which is between 1 and DL_NNS).  */
>> >    recurse (10);
>> >    return 0;
>> >  }
>> 
>> This doesn't work if configured with --disable-tunables.
>> 
>> I suspect this is merely a symptom.  The static TLS sizing defaults
>> should allow creating DL_NNS namespaces?
>
> the tunable defaults to 4, DL_NNS is 16 and that's the max value
> of the tunable (since that's the static namespace array size)

Maybe we should lower the constant from 10 to 3 then?  I mistakenly
assumed the namespace count was higher than it actually is.  3 should
not yet invalidate the test.

Thanks,
Florian
  

Patch

diff --git a/elf/Makefile b/elf/Makefile
index 7b50ccc07a..ace15dc11b 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -2969,6 +2969,7 @@  tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
 $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
 tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
 
+tst-dlmopen-twice-ENV = GLIBC_TUNABLES=glibc.rtld.nns=10
 $(objpfx)tst-dlmopen-twice.out: \
   $(objpfx)tst-dlmopen-twice-mod1.so \
   $(objpfx)tst-dlmopen-twice-mod2.so
diff --git a/elf/tst-dlmopen-twice.c b/elf/tst-dlmopen-twice.c
index 70c71fe19c..dfa58b1505 100644
--- a/elf/tst-dlmopen-twice.c
+++ b/elf/tst-dlmopen-twice.c
@@ -46,7 +46,7 @@  do_test (void)
   recurse (1);
 
   /* Then with nesting.  The constant needs to be less than the
-     internal DL_NNS namespace constant.  */
+     glibc.rtld.nns tunable (which is between 1 and DL_NNS).  */
   recurse (10);
   return 0;
 }