[PATCH v4 2/5] string: Improve coverage in test-strcmp.c and test-strncmp.c
Noah Goldstein
goldstein.w.n@gmail.com
Mon Feb 7 19:03:13 GMT 2022
On Mon, Feb 7, 2022 at 8:08 AM Matheus Castanho <msc@linux.ibm.com> wrote:
>
>
> Hi Noah,
>
> Noah Goldstein via Libc-alpha <libc-alpha@sourceware.org> writes:
>
> > Add additional test cases for small / medium sizes.
> >
> > Add tests in test-strncmp.c where `n` is near ULONG_MAX or LONG_MIN to
> > test for overflow bugs in length handling.
> >
> > Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
> > ---
> > string/test-strcmp.c | 70 ++++++++++--
> > string/test-strncmp.c | 257 +++++++++++++++++++++++++++++++++++++++---
> > 2 files changed, 306 insertions(+), 21 deletions(-)
> >
> > diff --git a/string/test-strcmp.c b/string/test-strcmp.c
> > index 97d7bf5043..eacbdc8857 100644
> > --- a/string/test-strcmp.c
> > +++ b/string/test-strcmp.c
> > @@ -16,6 +16,9 @@
> > License along with the GNU C Library; if not, see
> > <https://www.gnu.org/licenses/>. */
> >
> > +#define TEST_LEN (4096 * 3)
> > +#define MIN_PAGE_SIZE (TEST_LEN + 2 * getpagesize ())
>
> Is this change really necessary? It broke the tests on ppc64le because
> the default page size is 64kB, which this new value is not a multiple
> of, causing mprotect to fail with EINVAL in test_init.
We can make MIN_PAGE_SIZE (8 * getpagesize ())?
>
> --
> Matheus Castanho
More information about the Libc-alpha
mailing list