[PATCH] nss: Add ERANGE testing to tst-nss-test4 (bug 33361)

DJ Delorie dj@redhat.com
Sat Nov 8 00:41:53 GMT 2025


"Carlos O'Donell" <carlos@redhat.com> writes:
>>> -  __nss_configure_lookup ("group", "test1 [SUCCESS=merge] test2");
>>> +  /* At least 3 service modules are needed to reproduce BZ#33361. */
>>> +  __nss_configure_lookup ("group", "test1 [SUCCESS=merge] test2 files");
>> 
>> I'll note that the content of the "files" service is not controlled
>> here, but given we use "test names" for the groups instead of
>> likely-to-conflict realistic names, this is probably not an issue.
>
> For the test to pass falsely we would need files to contain the data the
> test was expecting, which is highly unlikely?

Oh right, because we don't have a [] between test2 and files, as long as
test1 or test2 match the group name, files won't be used at all.

> Only in the scenario where an implementation defect occurs again would we
> get data from files.

Agreed then.  Concern retracted.

> @@ -136,7 +137,8 @@ do_test (void)
>          }
>         merge_1[array_length(group_1) - 1 + member_cnt]= NULL;
>   
> -      align_mask = __alignof__ (struct group *) - 1;
> +      align_mask = __alignof__ (struct group) - 1;
> +      align_mem_mask = __alignof__ (char *) - 1;
>   
>         setgrent ();
>   
> @@ -151,7 +153,7 @@ do_test (void)
>                    printf ("FAIL: [%d] unaligned group %p\n", i, g);
>                    ++retval;
>                  }
> -             if ((uintptr_t)(g->gr_mem) & align_mask)
> +             if ((uintptr_t)(g->gr_mem) & align_mem_mask)

Yup.

With those changes, LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>



More information about the Libc-alpha mailing list